From 806989b7b052ab0760f683de6f4e264d939079a7 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 21 Dec 2016 13:27:44 +0100 Subject: [PATCH] [FIX] stock_account: change standard price When MRP and Product Extended are installed: - Define a manufactured product with valuation as 'Periodic (manual)' - On the product form, click on "Compute from BOM" Several issues: - The field "Counter-Part Account" is mandatory - Account moves are posted although the product valuation is 'Periodic (manual)' The problem is that the wizard is originally used for products with valuation 'Perpetual (automated)', where this behavior makes sense. In this use case, however, it's an issue. Making the field not mandatory is not possible without an upgrade of the module, so this will have to be fixed in master branch. Regarding the creation of account moves, however, this commit solves it. opw-697867 --- addons/stock_account/models/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock_account/models/product.py b/addons/stock_account/models/product.py index 6f0c4e7a351..1e4ac7ffbe1 100644 --- a/addons/stock_account/models/product.py +++ b/addons/stock_account/models/product.py @@ -102,7 +102,7 @@ class ProductProduct(models.Model): product_accounts = {product.id: product.product_tmpl_id.get_product_accounts() for product in self} for location in locations: - for product in self.with_context(location=location.id, compute_child=False): + for product in self.with_context(location=location.id, compute_child=False).filtered(lambda r: r.valuation == 'real_time'): diff = product.standard_price - new_price if float_is_zero(diff, precision_rounding=product.currency_id.rounding): raise UserError(_("No difference between standard price and new price!"))