trytond-edocument-ubl 8.0.4__tar.gz → 8.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/PKG-INFO +1 -1
  2. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/edocument.py +32 -23
  3. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/template/2/CreditNote.xml +13 -13
  4. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/template/2/Invoice.xml +13 -13
  5. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/scenario_ubl_2_credit_note_parse.rst +1 -1
  6. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/scenario_ubl_2_invoice_parse.rst +1 -1
  7. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tryton.cfg +1 -1
  8. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/.hgignore +0 -0
  9. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/COPYRIGHT +0 -0
  10. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/LICENSE +0 -0
  11. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/__init__.py +0 -0
  12. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/account.py +0 -0
  13. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/account.xml +0 -0
  14. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/document.py +0 -0
  15. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/exceptions.py +0 -0
  16. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/icons/LICENSE +0 -0
  17. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/bg.po +0 -0
  18. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/ca.po +0 -0
  19. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/cs.po +0 -0
  20. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/de.po +0 -0
  21. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/es.po +0 -0
  22. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/es_419.po +0 -0
  23. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/et.po +0 -0
  24. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/fa.po +0 -0
  25. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/fi.po +0 -0
  26. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/fr.po +0 -0
  27. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/hu.po +0 -0
  28. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/id.po +0 -0
  29. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/it.po +0 -0
  30. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/lo.po +0 -0
  31. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/lt.po +0 -0
  32. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/nl.po +0 -0
  33. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/pl.po +0 -0
  34. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/pt.po +0 -0
  35. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/ro.po +0 -0
  36. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/ru.po +0 -0
  37. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/sl.po +0 -0
  38. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/tr.po +0 -0
  39. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/uk.po +0 -0
  40. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/locale/zh_CN.po +0 -0
  41. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/message.xml +0 -0
  42. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/party.py +0 -0
  43. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/pyproject.toml +0 -0
  44. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/template/2/base.xml +0 -0
  45. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/BDNDR-CCTS_CCT_SchemaModule-1.1.xsd +0 -0
  46. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/BDNDR-UnqualifiedDataTypes-1.1.xsd +0 -0
  47. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/UBL-CommonAggregateComponents-2.4.xsd +0 -0
  48. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/UBL-CommonBasicComponents-2.4.xsd +0 -0
  49. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/UBL-CommonExtensionComponents-2.4.xsd +0 -0
  50. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/UBL-CommonSignatureComponents-2.4.xsd +0 -0
  51. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/UBL-ExtensionContentDataType-2.4.xsd +0 -0
  52. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/UBL-QualifiedDataTypes-2.4.xsd +0 -0
  53. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/UBL-SignatureAggregateComponents-2.4.xsd +0 -0
  54. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/UBL-SignatureBasicComponents-2.4.xsd +0 -0
  55. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/UBL-XAdES01903v132-201601-2.4.xsd +0 -0
  56. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/UBL-XAdES01903v141-201601-2.4.xsd +0 -0
  57. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/UBL-xmldsig-core-schema-2.4.xsd +0 -0
  58. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/UBL-xmldsig1-schema-2.4.xsd +0 -0
  59. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/common/UBL-xmldsig11-schema-2.4.xsd +0 -0
  60. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/maindoc/UBL-CreditNote-2.4.xsd +0 -0
  61. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/2.4/maindoc/UBL-Invoice-2.4.xsd +0 -0
  62. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/UBL-CreditNote-2.1-Example.xml +0 -0
  63. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/UBL-Invoice-2.1-Example-Trivial.xml +0 -0
  64. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/UBL-Invoice-2.1-Example.xml +0 -0
  65. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/__init__.py +0 -0
  66. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/scenario_ubl_2_credit_note_parse.json +0 -0
  67. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/scenario_ubl_2_invoice_parse.json +0 -0
  68. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/scenario_ubl_2_invoice_parse_trivial.rst +0 -0
  69. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/test_module.py +0 -0
  70. {trytond_edocument_ubl-8.0.4 → trytond_edocument_ubl-8.0.6}/tests/test_scenario.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: trytond_edocument_ubl
3
- Version: 8.0.4
3
+ Version: 8.0.6
4
4
  Summary: UBL electronic document for Tryton
5
5
  Project-URL: homepage, https://www.tryton.org/
6
6
  Project-URL: documentation, https://docs.tryton.org/modules-edocument-ubl/
@@ -321,11 +321,24 @@ class Invoice(Model):
321
321
  type_code=type_code))
322
322
 
323
323
  invoice = Invoice(type='in')
324
+
325
+ if (customer_party := root.find('./{*}AccountingCustomerParty')
326
+ ) is not None:
327
+ invoice.company = cls._parse_2_company(customer_party)
328
+ else:
329
+ invoice.company = Invoice.default_company()
330
+ if not invoice.company:
331
+ raise InvoiceError(gettext(
332
+ 'edocument_ubl.msg_company_not_found',
333
+ company=etree.tostring(
334
+ customer_party, pretty_print=True).decode()
335
+ if customer_party else ''))
336
+
324
337
  invoice.reference = root.findtext('./{*}ID')
325
338
  invoice.invoice_date = dt.date.fromisoformat(
326
339
  root.findtext('./{*}IssueDate'))
327
340
  invoice.party = cls._parse_2_supplier(
328
- root.find('./{*}AccountingSupplierParty'), create=True)
341
+ root.find('./{*}AccountingSupplierParty'), create=True).id
329
342
  payees = [invoice.party]
330
343
  invoice.set_journal()
331
344
  invoice.on_change_party()
@@ -341,17 +354,6 @@ class Invoice(Model):
341
354
  supplier = cls._parse_2_supplier(seller)
342
355
  else:
343
356
  supplier = invoice.party
344
- if (customer_party := root.find('./{*}AccountingCustomerParty')
345
- ) is not None:
346
- invoice.company = cls._parse_2_company(customer_party)
347
- else:
348
- invoice.company = Invoice.default_company()
349
- if not invoice.company:
350
- raise InvoiceError(gettext(
351
- 'edocument_ubl.msg_company_not_found',
352
- company=etree.tostring(
353
- customer_party, pretty_print=True).decode()
354
- if customer_party else ''))
355
357
 
356
358
  if (payee_party := root.find('./{*}PayeeParty')) is not None:
357
359
  party = cls._parse_2_party(payee_party)
@@ -659,11 +661,24 @@ class Invoice(Model):
659
661
  type_code=type_code))
660
662
 
661
663
  invoice = Invoice(type='in')
664
+
665
+ if (customer_party := root.find('./{*}AccountingCustomerParty')
666
+ ) is not None:
667
+ invoice.company = cls._parse_2_company(customer_party)
668
+ else:
669
+ invoice.company = Invoice.default_company()
670
+ if not invoice.company:
671
+ raise InvoiceError(gettext(
672
+ 'edocument_ubl.msg_company_not_found',
673
+ company=etree.tostring(
674
+ customer_party, pretty_print=True).decode()
675
+ if customer_party else ''))
676
+
662
677
  invoice.reference = root.findtext('./{*}ID')
663
678
  invoice.invoice_date = dt.date.fromisoformat(
664
679
  root.findtext('./{*}IssueDate'))
665
680
  invoice.party = cls._parse_2_supplier(
666
- root.find('./{*}AccountingSupplierParty'), create=True)
681
+ root.find('./{*}AccountingSupplierParty'), create=True).id
667
682
  payees = [invoice.party]
668
683
  invoice.set_journal()
669
684
  invoice.on_change_party()
@@ -671,11 +686,7 @@ class Invoice(Model):
671
686
  supplier = cls._parse_2_supplier(seller)
672
687
  else:
673
688
  supplier = invoice.party
674
- if (customer_party := root.find('./{*}AccountingCustomerParty')
675
- ) is not None:
676
- invoice.company = cls._parse_2_company(customer_party)
677
- else:
678
- invoice.company = Invoice.default_company()
689
+
679
690
  if (payee_party := root.find('./{*}PayeeParty')) is not None:
680
691
  party = cls._parse_2_party(payee_party)
681
692
  if not party:
@@ -1080,9 +1091,8 @@ class Invoice(Model):
1080
1091
  address.building_number = address_el.findtext('./{*}BuildingNumber')
1081
1092
  address.city = address_el.findtext('./{*}CityName')
1082
1093
  address.postal_code = address_el.findtext('./{*}PostalZone')
1083
- if (country_code := address_el.findtext(
1084
- './{*}Country/{*}IdentificationCode[@listId="ISO3166-1"]')
1085
- ) is not None:
1094
+ if country_code := address_el.findtext(
1095
+ './{*}Country/{*}IdentificationCode[@listId="ISO3166-1"]'):
1086
1096
  try:
1087
1097
  country, = Country.search([
1088
1098
  ('code', '=', country_code),
@@ -1221,8 +1231,7 @@ class Invoice(Model):
1221
1231
  pass
1222
1232
  else:
1223
1233
  return product
1224
- if (code := item.findtext('./{*}BuyersItemIdentification/{*}ID')
1225
- ) is not None:
1234
+ if code := item.findtext('./{*}BuyersItemIdentification/{*}ID'):
1226
1235
  try:
1227
1236
  product, = Product.search([
1228
1237
  ('code', '=', code),
@@ -90,7 +90,7 @@ this repository contains the full copyright notices and license terms. -->
90
90
  <py:otherwise>
91
91
  <cac:PaymentTerms py:for="line in this.invoice.lines_to_pay">
92
92
  <cbc:Note py:if="this.invoice.payment_term and this.invoice.payment_term.description">${this.invoice.payment_term.description}</cbc:Note>
93
- <cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.amount.normalize(), 'f')}</cbc:Amount>
93
+ <cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.amount, 'f')}</cbc:Amount>
94
94
  <cbc:PaymentDueDate>${line.maturity_date}</cbc:PaymentDueDate>
95
95
  </cac:PaymentTerms>
96
96
  </py:otherwise>
@@ -101,16 +101,16 @@ this repository contains the full copyright notices and license terms. -->
101
101
  <cbc:AllowanceChargeReasonCode py:if="reason_code">${reason_code}</cbc:AllowanceChargeReasonCode>
102
102
  </py:with>
103
103
  <cbc:AllowanceChargeReason>${allowance_charge.product.name}</cbc:AllowanceChargeReason>
104
- <cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${format(abs(allowance_charge.amount).normalize(), 'f')}</cbc:Amount>
104
+ <cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${format(abs(allowance_charge.amount), 'f')}</cbc:Amount>
105
105
  <cac:TaxCategory py:for="tax_line in allowance_charge.invoice_taxes">
106
106
  ${TaxCategory(tax_line.tax)}
107
107
  </cac:TaxCategory>
108
108
  </cac:AllowanceCharge>
109
109
  <cac:TaxTotal py:for="group, lines, amount in this.taxes">
110
- <cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((-amount).normalize(), 'f')}</cbc:TaxAmount>
110
+ <cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(-amount, 'f')}</cbc:TaxAmount>
111
111
  <cac:TaxSubtotal py:for="line in lines">
112
- <cbc:TaxableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((-line.base).normalize(), 'f')}</cbc:TaxableAmount>
113
- <cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((-line.amount).normalize(), 'f')}</cbc:TaxAmount>
112
+ <cbc:TaxableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(-line.base, 'f')}</cbc:TaxableAmount>
113
+ <cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(-line.amount, 'f')}</cbc:TaxAmount>
114
114
  <cbc:Percent py:if="line.tax.type == 'percentage' and not (specification or '').startswith('peppol')">${format((line.tax.rate * 100).normalize(), 'f')}</cbc:Percent>
115
115
  <cac:TaxCategory>
116
116
  ${TaxCategory(line.tax)}
@@ -118,19 +118,19 @@ this repository contains the full copyright notices and license terms. -->
118
118
  </cac:TaxSubtotal>
119
119
  </cac:TaxTotal>
120
120
  <cac:LegalMonetaryTotal>
121
- <cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((-this.invoice.untaxed_amount).normalize(), 'f')}</cbc:LineExtensionAmount>
122
- <cbc:TaxExclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((-this.invoice.untaxed_amount).normalize(), 'f')}</cbc:TaxExclusiveAmount>
123
- <cbc:TaxInclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((-(this.invoice.untaxed_amount + this.invoice.tax_amount)).normalize(), 'f')}</cbc:TaxInclusiveAmount>
121
+ <cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(-this.invoice.untaxed_amount, 'f')}</cbc:LineExtensionAmount>
122
+ <cbc:TaxExclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(-this.invoice.untaxed_amount, 'f')}</cbc:TaxExclusiveAmount>
123
+ <cbc:TaxInclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(-(this.invoice.untaxed_amount + this.invoice.tax_amount), 'f')}</cbc:TaxInclusiveAmount>
124
124
  <py:if test="this.invoice.total_amount != (this.invoice.untaxed_amount + this.invoice.tax_amount)">
125
- <cbc:PayableRoundingAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((-(this.invoice.total_amount - this.invoice.untaxed_amount - this.invoice.tax_amount)).normalize(), 'f')}</cbc:PayableRoundingAmount>
125
+ <cbc:PayableRoundingAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(-(this.invoice.total_amount - this.invoice.untaxed_amount - this.invoice.tax_amount), 'f')}</cbc:PayableRoundingAmount>
126
126
  </py:if>
127
- <cbc:PrepaidAmount py:if="this.prepaid_amount" py:attrs="{'currencyID': this.invoice.currency.code}">${format((-this.prepaid_amount).normalize(), 'f')}</cbc:PrepaidAmount>
128
- <cbc:PayableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((-this.invoice.total_amount + this.prepaid_amount).normalize(), 'f')}</cbc:PayableAmount>
127
+ <cbc:PrepaidAmount py:if="this.prepaid_amount" py:attrs="{'currencyID': this.invoice.currency.code}">${format(-this.prepaid_amount, 'f')}</cbc:PrepaidAmount>
128
+ <cbc:PayableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(-this.invoice.total_amount + this.prepaid_amount, 'f')}</cbc:PayableAmount>
129
129
  </cac:LegalMonetaryTotal>
130
130
  <cac:CreditNoteLine py:for="line_id, line in enumerate(this.lines, 1)">
131
131
  <cbc:ID>${line_id}</cbc:ID>
132
- <cbc:CreditedQuantity py:attrs="{'unitCode': line.unit.unece_code if line.unit and line.unit.unece_code else 'ZZ'}">${format(-Decimal(str(line.quantity)), 'f')}</cbc:CreditedQuantity>
133
- <cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((-line.amount).normalize(), 'f')}</cbc:LineExtensionAmount>
132
+ <cbc:CreditedQuantity py:attrs="{'unitCode': line.unit.unece_code if line.unit and line.unit.unece_code else 'ZZ'}">${format(-Decimal(str(line.quantity)).normalize(), 'f')}</cbc:CreditedQuantity>
133
+ <cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(-line.amount, 'f')}</cbc:LineExtensionAmount>
134
134
  <cac:Item>
135
135
  <cbc:Description py:if="line.description">${line.description}</cbc:Description>
136
136
  <cbc:Name>${line.product.name if line.product else line.summary}</cbc:Name>
@@ -90,7 +90,7 @@ this repository contains the full copyright notices and license terms. -->
90
90
  <py:otherwise>
91
91
  <cac:PaymentTerms py:for="line in this.invoice.lines_to_pay">
92
92
  <cbc:Note py:if="this.invoice.payment_term and this.invoice.payment_term.description">${this.invoice.payment_term.description}</cbc:Note>
93
- <cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.amount.normalize(), 'f')}</cbc:Amount>
93
+ <cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.amount, 'f')}</cbc:Amount>
94
94
  <cbc:PaymentDueDate>${line.maturity_date}</cbc:PaymentDueDate>
95
95
  </cac:PaymentTerms>
96
96
  </py:otherwise>
@@ -101,16 +101,16 @@ this repository contains the full copyright notices and license terms. -->
101
101
  <cbc:AllowanceChargeReasonCode py:if="reason_code">${reason_code}</cbc:AllowanceChargeReasonCode>
102
102
  </py:with>
103
103
  <cbc:AllowanceChargeReason>${allowance_charge.product.name}</cbc:AllowanceChargeReason>
104
- <cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${format(abs(allowance_charge.amount).normalize(), 'f')}</cbc:Amount>
104
+ <cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${format(abs(allowance_charge.amount), 'f')}</cbc:Amount>
105
105
  <cac:TaxCategory py:for="tax_line in allowance_charge.invoice_taxes">
106
106
  ${TaxCategory(tax_line.tax)}
107
107
  </cac:TaxCategory>
108
108
  </cac:AllowanceCharge>
109
109
  <cac:TaxTotal py:for="group, lines, amount in this.taxes">
110
- <cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(amount.normalize(), 'f')}</cbc:TaxAmount>
110
+ <cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(amount, 'f')}</cbc:TaxAmount>
111
111
  <cac:TaxSubtotal py:for="line in lines">
112
- <cbc:TaxableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.base.normalize(), 'f')}</cbc:TaxableAmount>
113
- <cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.amount.normalize(), 'f')}</cbc:TaxAmount>
112
+ <cbc:TaxableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.base, 'f')}</cbc:TaxableAmount>
113
+ <cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.amount, 'f')}</cbc:TaxAmount>
114
114
  <cbc:Percent py:if="line.tax.type == 'percentage' and not (specification or '').startswith('peppol')">${format((line.tax.rate * 100).normalize(), 'f')}</cbc:Percent>
115
115
  <cac:TaxCategory>
116
116
  ${TaxCategory(line.tax)}
@@ -118,19 +118,19 @@ this repository contains the full copyright notices and license terms. -->
118
118
  </cac:TaxSubtotal>
119
119
  </cac:TaxTotal>
120
120
  <cac:LegalMonetaryTotal>
121
- <cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(this.invoice.untaxed_amount.normalize(), 'f')}</cbc:LineExtensionAmount>
122
- <cbc:TaxExclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(this.invoice.untaxed_amount.normalize(), 'f')}</cbc:TaxExclusiveAmount>
123
- <cbc:TaxInclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((this.invoice.untaxed_amount + this.invoice.tax_amount).normalize(), 'f')}</cbc:TaxInclusiveAmount>
121
+ <cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(this.invoice.untaxed_amount, 'f')}</cbc:LineExtensionAmount>
122
+ <cbc:TaxExclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(this.invoice.untaxed_amount, 'f')}</cbc:TaxExclusiveAmount>
123
+ <cbc:TaxInclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((this.invoice.untaxed_amount + this.invoice.tax_amount), 'f')}</cbc:TaxInclusiveAmount>
124
124
  <py:if test="this.invoice.total_amount != (this.invoice.untaxed_amount + this.invoice.tax_amount)">
125
- <cbc:PayableRoundingAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((this.invoice.total_amount - this.invoice.untaxed_amount - this.invoice.tax_amount).normalize(), 'f')}</cbc:PayableRoundingAmount>
125
+ <cbc:PayableRoundingAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((this.invoice.total_amount - this.invoice.untaxed_amount - this.invoice.tax_amount), 'f')}</cbc:PayableRoundingAmount>
126
126
  </py:if>
127
- <cbc:PrepaidAmount py:if="this.prepaid_amount" py:attrs="{'currencyID': this.invoice.currency.code}">${format(this.prepaid_amount.normalize(), 'f')}</cbc:PrepaidAmount>
128
- <cbc:PayableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((this.invoice.total_amount - this.prepaid_amount).normalize(), 'f')}</cbc:PayableAmount>
127
+ <cbc:PrepaidAmount py:if="this.prepaid_amount" py:attrs="{'currencyID': this.invoice.currency.code}">${format(this.prepaid_amount, 'f')}</cbc:PrepaidAmount>
128
+ <cbc:PayableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(this.invoice.total_amount - this.prepaid_amount, 'f')}</cbc:PayableAmount>
129
129
  </cac:LegalMonetaryTotal>
130
130
  <cac:InvoiceLine py:for="line_id, line in enumerate(this.lines, 1)">
131
131
  <cbc:ID>${line_id}</cbc:ID>
132
- <cbc:InvoicedQuantity py:attrs="{'unitCode': line.unit.unece_code if line.unit and line.unit.unece_code else 'ZZ'}">${format(Decimal(str(line.quantity)), 'f')}</cbc:InvoicedQuantity>
133
- <cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.amount.normalize(), 'f')}</cbc:LineExtensionAmount>
132
+ <cbc:InvoicedQuantity py:attrs="{'unitCode': line.unit.unece_code if line.unit and line.unit.unece_code else 'ZZ'}">${format(Decimal(str(line.quantity)).normalize(), 'f')}</cbc:InvoicedQuantity>
133
+ <cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.amount, 'f')}</cbc:LineExtensionAmount>
134
134
  <cac:Item>
135
135
  <cbc:Description py:if="line.description">${line.description}</cbc:Description>
136
136
  <cbc:Name>${line.product.name if line.product else line.summary}</cbc:Name>
@@ -62,7 +62,7 @@ Parse the UBL invoice::
62
62
  >>> with file_open(
63
63
  ... 'edocument_ubl/tests/UBL-CreditNote-2.1-Example.xml',
64
64
  ... mode='rb') as fp:
65
- ... invoice_id = EInvoice.parse(fp.read(), config.context)
65
+ ... invoice_id = EInvoice.parse(fp.read(), {**config.context, 'company': None})
66
66
 
67
67
  >>> invoice = Invoice(invoice_id)
68
68
 
@@ -62,7 +62,7 @@ Parse the UBL invoice::
62
62
  >>> with file_open(
63
63
  ... 'edocument_ubl/tests/UBL-Invoice-2.1-Example.xml',
64
64
  ... mode='rb') as fp:
65
- ... invoice_id = EInvoice.parse(fp.read(), config.context)
65
+ ... invoice_id = EInvoice.parse(fp.read(), {**config.context, 'company': None})
66
66
 
67
67
  >>> invoice = Invoice(invoice_id)
68
68
 
@@ -1,5 +1,5 @@
1
1
  [tryton]
2
- version=8.0.4
2
+ version=8.0.6
3
3
  depends:
4
4
  edocument_unece
5
5
  ir