I tried to update One2many field with the following function called in pos.order.line model because of problem of not saving the field 'tax_ids_after_fiscal_position' Here is my code :
class PosOrderLine(models.Model):
_inherit = "pos.order.line"
@api.onchange('product_id')
def _onchange_product_id(self):
self.tax_ids_after_fiscal_position = self.product_id.taxes_id
self.write({'tax_ids_after_fiscal_position': [(4, self.product_id.taxes_id)]})
I got the following error :
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 639, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 315, in _handle_exception
raise exception.with_traceback(None) from new_cause
AttributeError: 'account.tax' object has no attribute 'ref'
What's wrong please? Any help? Thanks.