Do not divide LineExtensionAmount by a quantity of zero from UBL invoice
The unit price of such line can be the LineExtensionAmount. Closes #14673
This commit is contained in:
@@ -493,7 +493,7 @@ class Invoice(Model):
|
||||
|
||||
line.unit_price = round_price(
|
||||
Decimal(invoice_line.findtext('./{*}LineExtensionAmount'))
|
||||
/ Decimal(str(line.quantity)))
|
||||
/ Decimal(str(line.quantity or 1)))
|
||||
|
||||
if invoice_line.find('./{*}Item/{*}ClassifiedTaxCategory') is not None:
|
||||
tax_categories = invoice_line.iterfind(
|
||||
@@ -765,7 +765,7 @@ class Invoice(Model):
|
||||
|
||||
line.unit_price = round_price(
|
||||
-Decimal(credit_note_line.findtext('./{*}LineExtensionAmount'))
|
||||
/ Decimal(str(line.quantity)))
|
||||
/ Decimal(str(line.quantity or -1)))
|
||||
|
||||
if (credit_note_line.find('./{*}Item/{*}ClassifiedTaxCategory')
|
||||
is not None):
|
||||
|
||||
Reference in New Issue
Block a user