在发票中扩展更改方法时出错

2024-03-29 06:22:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试从模型中扩展方法product\u id\u changeaccount.invoice.line行地址:

分类科目发票行(模型。模型)地址:

\u继承='account.invoice.line行'

  @api.multi

  def product_id_change(self, product, uom_id, qty=0, name='', type_x='out_invoice',

                                      partner_id=False, fposition_id=False, price_unit=False, currency_id=False,

                                      company_id=None):

        res = super(account_invoice_line, self).product_id_change(self,product, uom_id, qty, name, type_x, partner_id,                                                                                                         fposition_id, price_unit, currency_id, company_id)

        return res.

但是当我用super:TypeError:product\u id\u change()调用product\u id\u change()时,我有一个错误:最多使用11个参数(给定12个)。你知道吗

你有主意吗?你知道吗


Tags: name模型selfidfalsepartner地址type
1条回答
网友
1楼 · 发布于 2024-03-29 06:22:44

从超级方法调用行中删除self。你知道吗

res = super(account_invoice_line, self).product_id_change(product, uom_id, qty=0, name='', type_x='out_invoice',partner_id=False, fposition_id=False, price_unit=False, currency_id=False,
company_id=None)

无需将self显式传递给任何方法,自动调用此参数中的对象集。你知道吗

相关问题 更多 >