From 87f0222aee9d49b0165c31e50d575dee808f60a6 Mon Sep 17 00:00:00 2001 From: Saurabh Mishra Date: Wed, 5 Jul 2023 13:07:59 +0000 Subject: [PATCH] [FIX] mrp_account: produce mo when production account given This issue occurs when the user has not provided production account and is trying to produce the manufacturing order. steps to produce: - Install `mrp_production`, `account_accountant`. - From Settings > Users > Manage Users select a user (eg: Mitchell Admin) and under `Technical` select `Stock Accounting Automatic group`. - Inventry > Configuration > Products > Product Categories open a category and change it's `Inventry Valuation` (property_valuation) to Automated. - Through Accounting > Configuaration > Settings > Stock Valuation check `Automatic Accounting` and remove Production Account and save it. (You will see that production account got removed from the product category). - Now create a manufacturing order by Manufacturing > Operations > Manufacturing Orders - While creating manufacturing order select the product which comes under product category you have modified, then confirm the manufacturing order. - Once it is confirmed click on `Produce All`. video: https://encr.pw/09a2c Error: `AttributeError: 'bool' object has no attribute 'id'` Through our commit if the user does not specify a `Production Account` then the user will face the UserError. The error is specified in `_get_accounting_data_for_valuation` function while checking for `account_src` or `account_dest`. sentry-4271608065 closes odoo/odoo#128594 X-original-commit: 9265e785dedd8943296573fc6e5218925a33c522 Signed-off-by: William Henrotin (whe) --- addons/mrp_account/models/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp_account/models/product.py b/addons/mrp_account/models/product.py index e6078b3fb11..d3e7258fab3 100644 --- a/addons/mrp_account/models/product.py +++ b/addons/mrp_account/models/product.py @@ -12,7 +12,7 @@ class ProductTemplate(models.Model): def _get_product_accounts(self): accounts = super()._get_product_accounts() accounts.update({ - 'production': self.categ_id.property_stock_account_production_cost_id or False, + 'production': self.categ_id.property_stock_account_production_cost_id, }) return accounts