I want to assign the tax_id from the product in the sale.order to my new field.
Here I have the screenshots:
Like in the screenshots I want to add the +8.0 UST directly in the tax field .
my code looks like this:
tax_line_ids = fields.Many2many('account.tax', string='Taxes', domain=['|', ('active', '=', False), ('active', '=', True)])
@api.onchange('order_line')
def _onchange_order_line(self):
for line in self.order_line:
if self.tax_line_ids.id == line.tax_id.id:
return 0
else:
self.tax_line_ids.id = line.tax_id.id
But I get an error when I try to do this: self.tax_line_ids.id = line.tax_id.id
It should add the new TAX to the new field "tax_line_ids"
I get this error:
line 22, in _onchange_order_line self.tax_line_ids.id = line.tax_id.id File "/odoo10/odoo10-server/odoo/fields.py", line 2439, in __set__ raise TypeError("field 'id' cannot be assigned") TypeError: field 'id' cannot be assigned
I want to thank you for the incoming help.
Thank you