[FIX] account_facturx: fix upload of pdf using facturx
There seems to be an issue with the import of factur-x pdf. The unit price is being divided by the quantity resulting in wrong values. This commit will correct that by dividing the unit price by the amount of products in one unit, instead of the amount of unit. Task id #2341111 X-original-commit: d3116ba7266270cb5ef8e018f65131003d0331ed
This commit is contained in:
@@ -256,12 +256,19 @@ class AccountEdiFormat(models.Model):
|
||||
# Price Unit.
|
||||
line_elements = element.xpath('.//ram:GrossPriceProductTradePrice/ram:ChargeAmount', namespaces=tree.nsmap)
|
||||
if line_elements:
|
||||
invoice_line_form.price_unit = float(line_elements[0].text) / invoice_line_form.quantity
|
||||
quantity_elements = element.xpath('.//ram:GrossPriceProductTradePrice/ram:BasisQuantity', namespaces=tree.nsmap)
|
||||
if quantity_elements:
|
||||
invoice_line_form.price_unit = float(line_elements[0].text) / float(quantity_elements[0].text)
|
||||
else:
|
||||
invoice_line_form.price_unit = float(line_elements[0].text)
|
||||
else:
|
||||
line_elements = element.xpath('.//ram:NetPriceProductTradePrice/ram:ChargeAmount', namespaces=tree.nsmap)
|
||||
if line_elements:
|
||||
invoice_line_form.price_unit = float(line_elements[0].text) / invoice_line_form.quantity
|
||||
|
||||
quantity_elements = element.xpath('.//ram:NetPriceProductTradePrice/ram:BasisQuantity', namespaces=tree.nsmap)
|
||||
if quantity_elements:
|
||||
invoice_line_form.price_unit = float(line_elements[0].text) / float(quantity_elements[0].text)
|
||||
else:
|
||||
invoice_line_form.price_unit = float(line_elements[0].text)
|
||||
# Discount.
|
||||
line_elements = element.xpath('.//ram:AppliedTradeAllowanceCharge/ram:CalculationPercent', namespaces=tree.nsmap)
|
||||
if line_elements:
|
||||
|
||||
Reference in New Issue
Block a user