Render allowance and charge in UBL invoice

This commit is contained in:
Cédric Krier committed 2026-01-26 15:38:06 +01:00
1 parent 8f08fcf6bf
commit 19d4b91df2
6 files changed
+82 -28

No files matched your search

+21 -7
View File
@@ -79,16 +79,22 @@ def get_invoice():
type='percentage',
rate=Decimal('.1'),
),
base=Decimal('100.00'),
amount=Decimal('10.00'),
base=Decimal('105.00'),
amount=Decimal('10.50'),
legal_notice="Legal Notice",
)]
product = Mock(spec=Product,
code="12345",
type='service',
unece_special_service_code=None,
)
product.name = "Product"
product.identifier_get.return_value = '98412345678908'
charge = Mock(spec=Product,
type='service',
unece_special_service_code='ZZZ',
)
charge.name = "Charge"
lines = [Mock(spec=InvoiceLine,
type='line',
product=product,
@@ -99,6 +105,12 @@ def get_invoice():
amount=Decimal('100.00'),
description="Description",
taxes=[t.tax for t in taxes],
), Mock(spec=Invoice,
type='line',
product=charge,
quantity=1,
amount=Decimal('5.00'),
taxes=[t.tax for t in taxes],
)]
invoice = MagicMock(spec=Invoice,
id=-1,
@@ -120,17 +132,19 @@ def get_invoice():
lines=lines,
line_lines=lines,
taxes=taxes,
untaxed_amount=Decimal('100.00'),
tax_amount=Decimal('10.00'),
total_amount=Decimal('110.00'),
amount_to_pay=Decimal('110.00'),
untaxed_amount=Decimal('105.00'),
tax_amount=Decimal('10.50'),
total_amount=Decimal('110.50'),
amount_to_pay=Decimal('110.50'),
lines_to_pay=[Mock(spec=MoveLine,
maturity_date=datetime.date.today(),
amount=Decimal('110.00'),
amount=Decimal('110.50'),
)],
sales=[],
state='posted',
)
for line in invoice.lines:
line.invoice = invoice
return invoice