From 1db656da065b0ead328601cfbcefda871707954f Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Fri, 20 Nov 2020 14:31:42 +0000 Subject: [PATCH] [FIX] purchase_stock: fix price difference 1. Create a storable product 2. Set the category: Costing - Method: First In First Out (FIFO) - Inventory Valuation: Automated - Price Difference Account: Price different accounts. 3. Create a vendor bill with the product and the quantity set as 0, and set a tax 4. Post the vendor Bill A ZeroDivision error is raised. opw-2375464 closes odoo/odoo#62120 X-original-commit: beeb83ca53c52dc189faaff4d76711bbcf24a08c Signed-off-by: Nicolas Martinelli (nim) --- addons/purchase_stock/models/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase_stock/models/account_invoice.py b/addons/purchase_stock/models/account_invoice.py index 02935d55a16..6731c3c05b0 100644 --- a/addons/purchase_stock/models/account_invoice.py +++ b/addons/purchase_stock/models/account_invoice.py @@ -116,7 +116,7 @@ class AccountMove(models.Model): price_unit = line.price_unit * (1 - (line.discount or 0.0) / 100.0) - if line.tax_ids: + if line.tax_ids and line.quantity: # We do not want to round the price unit since : # - It does not follow the currency precision # - It may include a discount