store parsed data
This commit is contained in:
parent
174887f87e
commit
2f67ae4425
1 changed files with 9 additions and 2 deletions
11
document.py
11
document.py
|
@ -71,7 +71,7 @@ class Incoming(metaclass=PoolMeta):
|
|||
'document_incoming_invoice_xml.msg_not_implemented',
|
||||
xmltype=xsd_type))
|
||||
# read xml data
|
||||
invoice = xml_read_func(invoice, xmltree)
|
||||
(self.parsed_data, invoice) = xml_read_func(invoice, xmltree)
|
||||
return invoice
|
||||
|
||||
def _readxml_xpath(self, tags):
|
||||
|
@ -303,6 +303,7 @@ class Incoming(metaclass=PoolMeta):
|
|||
Configuration = Pool().get('document.incoming.configuration')
|
||||
|
||||
config = Configuration.get_singleton()
|
||||
parsed_data = {}
|
||||
|
||||
# rsm:CrossIndustryInvoice
|
||||
xpath_cross_ind = ['rsm:CrossIndustryInvoice']
|
||||
|
@ -325,6 +326,7 @@ class Incoming(metaclass=PoolMeta):
|
|||
invoice.number = invoice_number
|
||||
else:
|
||||
invoice.reference = invoice_number
|
||||
parsed_data['invoice_number'] = invoice_number
|
||||
|
||||
# invoice-date
|
||||
date_path = xpath_exchg_doc + [
|
||||
|
@ -337,6 +339,7 @@ class Incoming(metaclass=PoolMeta):
|
|||
'code': str(date_format)}))
|
||||
invoice.invoice_date = self._readxml_convertdate(
|
||||
self._readxml_getvalue(xmltree, date_path))
|
||||
parsed_data['invoice_date'] = invoice.invoice_date
|
||||
|
||||
# IncludedNote, 1st line --> 'description', 2nd ff. --> 'comment'
|
||||
xpath_notes = xpath_exchg_doc + ['ram:IncludedNote']
|
||||
|
@ -353,6 +356,7 @@ class Incoming(metaclass=PoolMeta):
|
|||
for y in ['Content', 'ContentCode', 'SubjectCode']
|
||||
})
|
||||
|
||||
parsed_data['note_list'] = note_list
|
||||
if note_list:
|
||||
invoice.description = note_list[0].get('Content', None)
|
||||
invoice.comment = '\n'.join([
|
||||
|
@ -378,6 +382,7 @@ class Incoming(metaclass=PoolMeta):
|
|||
seller_party = self._readxml_party_data(
|
||||
xmltree, xpath_appl_head_agree + ['ram:SellerTradeParty'],
|
||||
create_party=add_party)
|
||||
parsed_data['seller_party'] = seller_party
|
||||
if seller_party:
|
||||
if 'party' in seller_party.keys():
|
||||
invoice.party = seller_party['party']
|
||||
|
@ -393,6 +398,7 @@ class Incoming(metaclass=PoolMeta):
|
|||
buyer_party = self._readxml_party_data(
|
||||
xmltree, xpath_appl_head_agree + ['ram:BuyerTradeParty'],
|
||||
create_party=False)
|
||||
parsed_data['buyer_party'] = buyer_party
|
||||
# check if we found our company
|
||||
if config and not config.accept_other_company:
|
||||
company_party_id = self._readxml_find_party(buyer_party)
|
||||
|
@ -417,6 +423,7 @@ class Incoming(metaclass=PoolMeta):
|
|||
for x in range(1, num_lines + 1):
|
||||
lines_data.append(
|
||||
self._readxml_invoice_line(xmltree, xpath_line_item, x))
|
||||
parsed_data['lines_data'] = lines_data
|
||||
lines = [
|
||||
self._readxml_getinvoiceline(invoice, x)
|
||||
for x in lines_data]
|
||||
|
@ -425,7 +432,7 @@ class Incoming(metaclass=PoolMeta):
|
|||
invoice.lines = lines
|
||||
|
||||
invoice.on_change_lines()
|
||||
return invoice
|
||||
return (parsed_data, invoice)
|
||||
|
||||
def _readxml_getinvoiceline(self, invoice, line_data):
|
||||
""" create invoice line in memory
|
||||
|
|
Loading…
Reference in a new issue