[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) <nim@odoo.com>
This commit is contained in:
Nicolas Martinelli
2020-11-20 16:57:20 +00:00
parent 12b612d798
commit 1db656da06
@@ -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