Skip to content
Snippets Groups Projects
Commit 2c9a86c5 authored by alt-odoo's avatar alt-odoo
Browse files

[FIX] mrp_account: correctly retrieve rounding factor of currency


The company is not mandatory on the analytic account, and the currency on it
is a related field to the currency of that company, if set. In case it is not
set, we should add a default fallback on the currency of the company of the
manufacturing order.

closes odoo/odoo#72456

X-original-commit: 4fc2ec31
Signed-off-by: default avatarArnold Moyaux <amoyaux@users.noreply.github.com>
Signed-off-by: default avatarAlex Tuyls <alt-odoo@users.noreply.github.com>
parent 72fea2fe
No related branches found
No related tags found
No related merge requests found
......@@ -63,7 +63,7 @@ class MrpProduction(models.Model):
AccountAnalyticLine = self.env['account.analytic.line'].sudo()
for wc_line in self.workorder_ids.filtered('workcenter_id.costs_hour_account_id'):
vals = self._prepare_wc_analytic_line(wc_line)
precision_rounding = wc_line.workcenter_id.costs_hour_account_id.currency_id.rounding
precision_rounding = (wc_line.workcenter_id.costs_hour_account_id.currency_id or self.company_id.currency_id).rounding
if not float_is_zero(vals.get('amount', 0.0), precision_rounding=precision_rounding):
# we use SUPERUSER_ID as we do not guarantee an mrp user
# has access to account analytic lines but still should be
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment