fix check of invoice, fix read of trade_country

This commit is contained in:
Frederik Jaeckel 2025-01-22 12:16:04 +01:00
parent 7b0ca66b42
commit 0d31e60772

View file

@ -109,8 +109,9 @@ class Incoming(metaclass=PoolMeta):
('taxbase', 'untaxed_amount'), ('taxbase', 'untaxed_amount'),
('taxtotal', 'tax_amount'), ('taxtotal', 'tax_amount'),
('grand', 'total_amount')]: ('grand', 'total_amount')]:
xml_val = totals.get('taxbase', Decimal('0.0')) xml_val = totals.get(xfield, Decimal('0.0'))
inv_val = getattr(invoice, inv_field) inv_val = getattr(invoice, inv_field)
if xml_val != inv_val: if xml_val != inv_val:
raise UserError(gettext( raise UserError(gettext(
'document_incoming_invoice_xml.msg_convert_error', 'document_incoming_invoice_xml.msg_convert_error',
@ -853,7 +854,8 @@ class Incoming(metaclass=PoolMeta):
(['ram:OriginTradeCountry', 'ram:ID'], 'trade_country') (['ram:OriginTradeCountry', 'ram:ID'], 'trade_country')
]: ]:
result[key] = self._readxml_getvalue(xmldata, xpath_line + [ result[key] = self._readxml_getvalue(xmldata, xpath_line + [
'ram:SpecifiedTradeProduct', xkey]) 'ram:SpecifiedTradeProduct'] +
(xkey if isinstance(xkey, list) else [xkey]))
# attributes of product # attributes of product
result['attributes'] = self._readxml_read_listdata( result['attributes'] = self._readxml_read_listdata(