我试图用pos.order.line模型中调用的以下函数更新一个2many字段,因为“tax\u ids\u after\u fiscal\u position”字段没有保存问题。这是我的代码:
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)]})
我得到以下错误:
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'
请问怎么了?有什么帮助吗?谢谢。
暂无答案!
目前还没有任何答案,快来回答吧!