depency edocument_unece, fix quantity-unit
This commit is contained in:
parent
c5843caf00
commit
7b0ca66b42
4 changed files with 212 additions and 18 deletions
29
document.py
29
document.py
|
@ -25,14 +25,14 @@ from trytond.protocols.jsonrpc import JSONEncoder
|
|||
xml_types = [
|
||||
(['xsd', 'Factur-X_1.07.2_MINIMUM', 'Factur-X_1.07.2_MINIMUM.xsd'],
|
||||
'Factur-X minimum', 'facturx_minimal'),
|
||||
(['xsd', 'Factur-X_1.07.2_EXTENDED', 'Factur-X_1.07.2_EXTENDED.xsd'],
|
||||
'Factur-X extended', 'facturx_extended'),
|
||||
(['xsd', 'Factur-X_1.07.2_EN16931', 'Factur-X_1.07.2_EN16931.xsd'],
|
||||
'Factur-X EN16931', ''),
|
||||
(['xsd', 'Factur-X_1.07.2_BASIC', 'Factur-X_1.07.2_BASIC.xsd'],
|
||||
'Factur-X basic', ''),
|
||||
'Factur-X basic', 'facturx_basic'),
|
||||
(['xsd', 'Factur-X_1.07.2_BASICWL', 'Factur-X_1.07.2_BASICWL.xsd'],
|
||||
'Factur-X basic-wl', ''),
|
||||
(['xsd', 'Factur-X_1.07.2_EN16931', 'Factur-X_1.07.2_EN16931.xsd'],
|
||||
'Factur-X EN16931', ''),
|
||||
(['xsd', 'Factur-X_1.07.2_EXTENDED', 'Factur-X_1.07.2_EXTENDED.xsd'],
|
||||
'Factur-X extended', 'facturx_extended'),
|
||||
(['xsd', 'CII D22B XSD', 'CrossIndustryInvoice_100pD22B.xsd'],
|
||||
'CrossIndustryInvoice D22', ''),
|
||||
(['xsd', 'os-UBL-2.1', 'xsd/maindoc', 'UBL-Invoice-2.1.xsd'],
|
||||
|
@ -416,11 +416,13 @@ class Incoming(metaclass=PoolMeta):
|
|||
'document_incoming_invoice_xml.msg_convert_error',
|
||||
msg='factur-x minimal not supported'))
|
||||
|
||||
def _readxml_facturx_basic(self, xmltree):
|
||||
""" read facturx - basic
|
||||
"""
|
||||
self._readxml_facturx_extended(xmltree)
|
||||
|
||||
def _readxml_facturx_extended(self, xmltree):
|
||||
""" read factur-x extended
|
||||
|
||||
Returns:
|
||||
record: model account.invoice
|
||||
"""
|
||||
Configuration = Pool().get('document.incoming.configuration')
|
||||
|
||||
|
@ -501,7 +503,6 @@ class Incoming(metaclass=PoolMeta):
|
|||
create_party=False)
|
||||
if buyer_party:
|
||||
self.parsed_data['buyer_party'] = buyer_party
|
||||
print('\n# buyer_party-read:', buyer_party)
|
||||
|
||||
# invoice - lines
|
||||
# rsm:CrossIndustryInvoice/
|
||||
|
@ -690,11 +691,9 @@ class Incoming(metaclass=PoolMeta):
|
|||
|
||||
# uom
|
||||
xml_uom = Uom(ModelData.get_id('product', 'uom_unit'))
|
||||
for x_attr in line_data.get('attributes', []):
|
||||
x_uom = x_attr.get('uom', None)
|
||||
if not x_uom:
|
||||
continue
|
||||
units = Uom.search([('symbol', '=', x_uom)])
|
||||
unit_code = line_data.get('quantity', {}).pop('unit_code', None)
|
||||
if unit_code:
|
||||
units = Uom.search([('unece_code', '=', unit_code)])
|
||||
if units:
|
||||
xml_uom = units[0]
|
||||
|
||||
|
@ -940,6 +939,8 @@ class Incoming(metaclass=PoolMeta):
|
|||
('ram:ChargeFreeQuantity', 'chargefree', Decimal),
|
||||
('ram:PackageQuantity', 'package', Decimal),
|
||||
])[0]
|
||||
result['quantity']['unit_code'] = self._readxml_getattrib(
|
||||
xmldata, xpath_quantity + ['ram:BilledQuantity'], 'unitCode')
|
||||
# notice ignored fields
|
||||
for x in [
|
||||
'ShipToTradeParty', 'UltimateShipToTradeParty',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue