Hi Everyone,
I am trying to update supplier_taxes_id, taxes_id depeding. upon a particular custom filed.
But I am not able to update it, I read in issues of onchange that it cannot update m2m fileds. If this is the case then can any one suggest how to implement it.
Note for a particular product I have single tax.
@api.onchange('budget_batch')
def set_default_taxes_of_product(self):
print('hello world')
print('hello world>>>>>>>', self.env.company.account_purchase_tax_id)
for record in self:
record.supplier_taxes_id = self.env.company.account_purchase_tax_id.ids
# record.taxes_id = lambda self: self.env.company.account_sale_tax_id
if record.budget_batch:
formatted_buget_batch = record.budget_batch.strip()
if(formatted_buget_batch.startswith('03')):
tax = self.env['account.tax'].search([('name', '=ilike', 'TAX_ NAME'), ('type_tax_use', '=', 'sale')], limit=1)
# record.supplier_taxes_id=tax.id
# record.taxes_id='qwerw'
print(tax)