[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
This commit is contained in:
Nicolas Martinelli
2016-12-21 15:38:42 +01:00
parent daa90edc8a
commit 806989b7b0
+1 -1
View File
@@ -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!"))