[FIX] account: analytic cost

- Set a cost of 12.34 for product P
- Create manually a new analytic entry
- Choose product P
- Set desired quantity

The analytic amount is set to 12.00.

This is because `move_id` is empty, therefore `currency_id` is empty as
well and `decimal_places` is zero

opw-1924184

closes odoo/odoo#30869
This commit is contained in:
Nicolas Martinelli
2019-02-06 10:27:59 +00:00
parent d89f4d6ec2
commit c7c938996f
@@ -44,7 +44,7 @@ class AccountAnalyticLine(models.Model):
# Compute based on pricetype
amount_unit = self.product_id.price_compute('standard_price', uom=unit)[self.product_id.id]
amount = amount_unit * self.unit_amount or 0.0
result = round(amount, self.currency_id.decimal_places) * -1
result = round(amount, self.currency_id.decimal_places if self.currency_id else 2) * -1
self.amount = result
self.general_account_id = account
self.product_uom_id = unit