I want to update the 'price_unit' of the 'recurring_invoice_line_ids' when a field in sale.subscription changes
It works when you run whit a button, but doesn't trigger the depens
Here is my code:
class SubscriptionPlanes(models.Model):
_inherit = 'sale.subscription'
pagadas_count = fields.Integer()
@api.depends('pagadas_count')
def update_sub_line(self):
subline_aporte = self.env['sale.subscription.line'].search(['&', ('analytic_account_id', '=', self.id), ('product_id.default_code', '=', 'APORTE')])
subline_cmac = self.env['sale.subscription.line'].search(['&', ('analytic_account_id', '=', self.id), ('product_id.default_code', '=', 'CMAC')])
subline_aporte.write({'price_unit': 1000})
subline_cmac.write({'price_unit': 500})