i'm new in odoo dev and i'm trying to make the field value 'recommanded_price' (from marketplace.marketplaceinfo model) change when 'formula' field changes (which is in the marketplace.marketplace model)
I used the @api.depends decorator but it doesn't trigger the function when the specific
Here's the essential of my code
class marketplace(models.Model):
_name = 'marketplace.marketplace'
_description = 'Marketplace'
_sql_constraints = [
('mkp_name_uniq',
'UNIQUE (name)',
'Marketplace name must be unique')
]
formula = fields.Char('Formula')
product_ids = fields.One2many('marketplace.marketplaceinfo', 'mkp', 'Products')
class marketplace_info(models.Model):
_name = 'marketplace.marketplaceinfo'
_description = 'Information about a product marketplace'
mkp = fields.Many2one('marketplace.marketplace','Marketplace',ondelete = 'cascade',required = True,
help='Marketplace of this product'
)
product_tmpl_id = fields.Many2one(
'product.template', 'Product Template',
index=True, ondelete='cascade')
price = fields.Float('Price', default=0.0, digits=dp.get_precision('Product Price'),
help="The selling price for a product within the marketplace")
recommonded_price = fields.Float('Recommended Price', compute='_compute_recommonded_price' ,default=0.0, digits=dp.get_precision('Product Price'),
readonly = True, help="The recommended selling price for a product within the marketplace")
@api.depends('mkp.formula')
def _compute_recommonded_price(self):
#do something