trytond-edocument-ubl 8.0.2__tar.gz → 8.0.4__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.2 → trytond_edocument_ubl-8.0.4}/PKG-INFO +2 -2
  2. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/edocument.py +19 -7
  3. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/template/2/CreditNote.xml +13 -13
  4. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/template/2/Invoice.xml +13 -13
  5. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tryton.cfg +1 -1
  6. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/.hgignore +0 -0
  7. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/COPYRIGHT +0 -0
  8. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/LICENSE +0 -0
  9. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/__init__.py +0 -0
  10. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/account.py +0 -0
  11. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/account.xml +0 -0
  12. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/document.py +0 -0
  13. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/exceptions.py +0 -0
  14. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/icons/LICENSE +0 -0
  15. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/bg.po +0 -0
  16. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/ca.po +0 -0
  17. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/cs.po +0 -0
  18. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/de.po +0 -0
  19. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/es.po +0 -0
  20. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/es_419.po +0 -0
  21. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/et.po +0 -0
  22. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/fa.po +0 -0
  23. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/fi.po +0 -0
  24. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/fr.po +0 -0
  25. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/hu.po +0 -0
  26. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/id.po +0 -0
  27. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/it.po +0 -0
  28. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/lo.po +0 -0
  29. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/lt.po +0 -0
  30. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/nl.po +0 -0
  31. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/pl.po +0 -0
  32. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/pt.po +0 -0
  33. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/ro.po +0 -0
  34. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/ru.po +0 -0
  35. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/sl.po +0 -0
  36. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/tr.po +0 -0
  37. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/uk.po +0 -0
  38. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/locale/zh_CN.po +0 -0
  39. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/message.xml +0 -0
  40. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/party.py +0 -0
  41. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/pyproject.toml +0 -0
  42. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/template/2/base.xml +0 -0
  43. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/BDNDR-CCTS_CCT_SchemaModule-1.1.xsd +0 -0
  44. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/BDNDR-UnqualifiedDataTypes-1.1.xsd +0 -0
  45. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/UBL-CommonAggregateComponents-2.4.xsd +0 -0
  46. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/UBL-CommonBasicComponents-2.4.xsd +0 -0
  47. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/UBL-CommonExtensionComponents-2.4.xsd +0 -0
  48. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/UBL-CommonSignatureComponents-2.4.xsd +0 -0
  49. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/UBL-ExtensionContentDataType-2.4.xsd +0 -0
  50. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/UBL-QualifiedDataTypes-2.4.xsd +0 -0
  51. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/UBL-SignatureAggregateComponents-2.4.xsd +0 -0
  52. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/UBL-SignatureBasicComponents-2.4.xsd +0 -0
  53. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/UBL-XAdES01903v132-201601-2.4.xsd +0 -0
  54. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/UBL-XAdES01903v141-201601-2.4.xsd +0 -0
  55. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/UBL-xmldsig-core-schema-2.4.xsd +0 -0
  56. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/UBL-xmldsig1-schema-2.4.xsd +0 -0
  57. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/common/UBL-xmldsig11-schema-2.4.xsd +0 -0
  58. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/maindoc/UBL-CreditNote-2.4.xsd +0 -0
  59. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/2.4/maindoc/UBL-Invoice-2.4.xsd +0 -0
  60. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/UBL-CreditNote-2.1-Example.xml +0 -0
  61. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/UBL-Invoice-2.1-Example-Trivial.xml +0 -0
  62. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/UBL-Invoice-2.1-Example.xml +0 -0
  63. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/__init__.py +0 -0
  64. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/scenario_ubl_2_credit_note_parse.json +0 -0
  65. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/scenario_ubl_2_credit_note_parse.rst +0 -0
  66. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/scenario_ubl_2_invoice_parse.json +0 -0
  67. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/scenario_ubl_2_invoice_parse.rst +0 -0
  68. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/scenario_ubl_2_invoice_parse_trivial.rst +0 -0
  69. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/test_module.py +0 -0
  70. {trytond_edocument_ubl-8.0.2 → trytond_edocument_ubl-8.0.4}/tests/test_scenario.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: trytond_edocument_ubl
3
- Version: 8.0.2
3
+ Version: 8.0.4
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/
@@ -279,7 +279,7 @@ class Invoice(Model):
279
279
  elif self.invoice.currency == self.invoice.company.currency:
280
280
  return line.debit - line.credit
281
281
  else:
282
- return 0
282
+ return Decimal(0)
283
283
  return sum(map(balance, self.invoice.lines_to_pay))
284
284
 
285
285
  @classmethod
@@ -382,6 +382,9 @@ class Invoice(Model):
382
382
  root.findall('./{*}PaymentMeans'), payees=payees)
383
383
  invoice.payment_term_date = cls._parse_2_payment_term_date(
384
384
  root.findall('./{*}PaymentTerms'))
385
+ if not invoice.payment_term_date:
386
+ if due_date := root.findtext('./{*}DueDate'):
387
+ invoice.payment_term_date = dt.date.fromisoformat(due_date)
385
388
  lines = [
386
389
  cls._parse_invoice_2_line(
387
390
  line,
@@ -460,7 +463,9 @@ class Invoice(Model):
460
463
  if (invoiced_quantity := invoice_line.find('./{*}InvoicedQuantity')
461
464
  ) is not None:
462
465
  line.quantity = float(invoiced_quantity.text)
463
- digits = -Decimal(invoiced_quantity.text).as_tuple().exponent
466
+ digits = (
467
+ -Decimal(invoiced_quantity.text)
468
+ .normalize().as_tuple().exponent)
464
469
  if (unit_code := invoiced_quantity.get('unitCode')) not in {
465
470
  None, 'ZZ', 'XZZ'}:
466
471
  try:
@@ -695,6 +700,9 @@ class Invoice(Model):
695
700
  root.findall('./{*}PaymentMeans'), payees=payees)
696
701
  invoice.payment_term_date = cls._parse_2_payment_term_date(
697
702
  root.findall('./{*}PaymentTerms'))
703
+ if not invoice.payment_term_date:
704
+ if due_date := root.findtext('./{*}DueDate'):
705
+ invoice.payment_term_date = dt.date.fromisoformat(due_date)
698
706
  lines = [
699
707
  cls._parse_credit_note_2_line(
700
708
  line, company=invoice.company, currency=invoice.currency,
@@ -771,7 +779,9 @@ class Invoice(Model):
771
779
  if (credited_quantity := credit_note_line.find('./{*}CreditedQuantity')
772
780
  ) is not None:
773
781
  line.quantity = -float(credited_quantity.text)
774
- digits = -Decimal(credited_quantity.text).as_tuple().exponent
782
+ digits = (
783
+ -Decimal(credited_quantity.text)
784
+ .normalize().as_tuple().exponent)
775
785
  if (unit_code := credited_quantity.get('unitCode')) not in {
776
786
  None, 'ZZ', 'XZZ'}:
777
787
  try:
@@ -1188,8 +1198,7 @@ class Invoice(Model):
1188
1198
  def _parse_2_payment_term_date(cls, payment_terms):
1189
1199
  dates = []
1190
1200
  for payment_term in payment_terms:
1191
- if (date := payment_term.findtext('./{*}PaymentDueDate')
1192
- ) is not None:
1201
+ if date := payment_term.findtext('./{*}PaymentDueDate'):
1193
1202
  dates.append(dt.date.fromisoformat(date))
1194
1203
  return min(dates, default=None)
1195
1204
 
@@ -1314,13 +1323,16 @@ class Invoice(Model):
1314
1323
  ) is not None:
1315
1324
  mime_code = (
1316
1325
  data.get('mimeCode') or 'application/octet-stream')
1317
- name += mimetypes.guess_extension(mime_code) or ''
1326
+ if extension := mimetypes.guess_extension(mime_code):
1327
+ if not name.lower().endswith(extension):
1328
+ name += extension
1318
1329
  attachment.type = 'data'
1319
1330
  data = b64decode(data.text)
1320
1331
  attachment.data = data
1321
1332
  elif data := document.findtext(
1322
1333
  './{*}Attachment/{*}EmbeddedDocument'):
1323
- name += '.txt'
1334
+ if not name.lower().endswith('.txt'):
1335
+ name += '.txt'
1324
1336
  attachment.type = 'data'
1325
1337
  attachment.data = data
1326
1338
  elif url := document.findtext(
@@ -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}">${line.amount}</cbc:Amount>
93
+ <cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.amount.normalize(), '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}">${abs(allowance_charge.amount)}</cbc:Amount>
104
+ <cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${format(abs(allowance_charge.amount).normalize(), '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}">${-amount}</cbc:TaxAmount>
110
+ <cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((-amount).normalize(), 'f')}</cbc:TaxAmount>
111
111
  <cac:TaxSubtotal py:for="line in lines">
112
- <cbc:TaxableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-line.base}</cbc:TaxableAmount>
113
- <cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-line.amount}</cbc:TaxAmount>
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>
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}">${-this.invoice.untaxed_amount}</cbc:LineExtensionAmount>
122
- <cbc:TaxExclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-this.invoice.untaxed_amount}</cbc:TaxExclusiveAmount>
123
- <cbc:TaxInclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-(this.invoice.untaxed_amount + this.invoice.tax_amount)}</cbc:TaxInclusiveAmount>
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>
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}">${-(this.invoice.total_amount - this.invoice.untaxed_amount - this.invoice.tax_amount)}</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)).normalize(), 'f')}</cbc:PayableRoundingAmount>
126
126
  </py:if>
127
- <cbc:PrepaidAmount py:if="this.prepaid_amount" py:attrs="{'currencyID': this.invoice.currency.code}">${-this.prepaid_amount}</cbc:PrepaidAmount>
128
- <cbc:PayableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${-this.invoice.total_amount + this.prepaid_amount}</cbc:PayableAmount>
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>
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
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}">${-line.amount}</cbc:LineExtensionAmount>
133
+ <cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format((-line.amount).normalize(), '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>
@@ -152,7 +152,7 @@ this repository contains the full copyright notices and license terms. -->
152
152
  </cac:ClassifiedTaxCategory>
153
153
  </cac:Item>
154
154
  <cac:Price>
155
- <cbc:PriceAmount py:attrs="{'currencyID': this.invoice.currency.code}">${line.unit_price}</cbc:PriceAmount>
155
+ <cbc:PriceAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.unit_price.normalize(), 'f')}</cbc:PriceAmount>
156
156
  </cac:Price>
157
157
  </cac:CreditNoteLine>
158
158
  </CreditNote>
@@ -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}">${line.amount}</cbc:Amount>
93
+ <cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.amount.normalize(), '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}">${abs(allowance_charge.amount)}</cbc:Amount>
104
+ <cbc:Amount py:attrs="{'currencyID': this.invoice.currency.code}">${format(abs(allowance_charge.amount).normalize(), '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}">${amount}</cbc:TaxAmount>
110
+ <cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(amount.normalize(), 'f')}</cbc:TaxAmount>
111
111
  <cac:TaxSubtotal py:for="line in lines">
112
- <cbc:TaxableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${line.base}</cbc:TaxableAmount>
113
- <cbc:TaxAmount py:attrs="{'currencyID': this.invoice.currency.code}">${line.amount}</cbc:TaxAmount>
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>
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}">${this.invoice.untaxed_amount}</cbc:LineExtensionAmount>
122
- <cbc:TaxExclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.untaxed_amount}</cbc:TaxExclusiveAmount>
123
- <cbc:TaxInclusiveAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.untaxed_amount + this.invoice.tax_amount}</cbc:TaxInclusiveAmount>
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>
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}">${this.invoice.total_amount - this.invoice.untaxed_amount - this.invoice.tax_amount}</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).normalize(), 'f')}</cbc:PayableRoundingAmount>
126
126
  </py:if>
127
- <cbc:PrepaidAmount py:if="this.prepaid_amount" py:attrs="{'currencyID': this.invoice.currency.code}">${this.prepaid_amount}</cbc:PrepaidAmount>
128
- <cbc:PayableAmount py:attrs="{'currencyID': this.invoice.currency.code}">${this.invoice.total_amount - this.prepaid_amount}</cbc:PayableAmount>
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>
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
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}">${line.amount}</cbc:LineExtensionAmount>
133
+ <cbc:LineExtensionAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.amount.normalize(), '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>
@@ -152,7 +152,7 @@ this repository contains the full copyright notices and license terms. -->
152
152
  </cac:ClassifiedTaxCategory>
153
153
  </cac:Item>
154
154
  <cac:Price>
155
- <cbc:PriceAmount py:attrs="{'currencyID': this.invoice.currency.code}">${line.unit_price}</cbc:PriceAmount>
155
+ <cbc:PriceAmount py:attrs="{'currencyID': this.invoice.currency.code}">${format(line.unit_price.normalize(), 'f')}</cbc:PriceAmount>
156
156
  </cac:Price>
157
157
  </cac:InvoiceLine>
158
158
  </Invoice>
@@ -1,5 +1,5 @@
1
1
  [tryton]
2
- version=8.0.2
2
+ version=8.0.4
3
3
  depends:
4
4
  edocument_unece
5
5
  ir