Skip to content

Commit b143c2c

Browse files
committed
[FIX]stock_currency_valuation: Revert of commit 850ad67
closes #823 Signed-off-by: Filoquin adhoc <maq@adhoc.com.ar>
1 parent 850ad67 commit b143c2c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

stock_currency_valuation/models/product_template.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class productTemplate(models.Model):
88
valuation_currency_id = fields.Many2one(related="categ_id.valuation_currency_id",)
99
standard_price_in_currency = fields.Float(
1010
'Cost', compute='_compute_standard_price_in_currency',
11+
inverse='_set_standard_price_in_currency',
1112
search='_search_standard_price_in_currency',
1213
digits='Product Price', groups="base.group_user",
1314
readonly=True,
@@ -50,6 +51,11 @@ def _compute_standard_price_in_currency(self):
5051
for template in (self - unique_variants):
5152
template.standard_price_in_currency = template.product_variant_ids[:1].standard_price_in_currency
5253

54+
def _set_standard_price_in_currency(self):
55+
for template in self:
56+
if len(template.product_variant_ids) == 1:
57+
template.product_variant_ids.standard_price_in_currency = template.standard_price_in_currency
58+
5359
def _search_standard_price_in_currency(self, operator, value):
5460
products = self.env['product.product'].search([('standard_price_in_currency', operator, value)], limit=None)
5561
return [('id', 'in', products.mapped('product_tmpl_id').ids)]

0 commit comments

Comments
 (0)