Odoo8:ValueERROR:字典更新序列元素#0的长度为1; 2是必需的

时间:2022-06-05 02:25:36

I'm Inheriting Function in Account Voucher (def voucher_move_line_create) using new api style odoo8.

我使用新的api样式odoo8在帐户凭证(def voucher_move_line_create)中继承功能。

Here's my Code:

这是我的代码:

@api.model
def voucher_move_line_create(self, line_total, move_id, company_currency, current_currency):
    res =  super(AccountVoucher, self).voucher_move_line_create(line_total, move_id, company_currency, current_currency)
    _logger.info('\n\n\n Return: %s \n\n\n'%(str(res)))
    for i in res[1]:
        _logger.info('\n\n\nRes Return: %s \n\n\n'%(str(i)))
    return res

and I Got this Error:

我有这个错误:

File "/opt/odoo8/odoo8-server/openerp/api.py", line 769, in new self.cr, self.uid, self.context = self.args = (cr, uid, frozendict(context)) ValueError: dictionary update sequence element #0 has length 1; 2 is required.

在新的self.cr文件“/opt/odoo8/odoo8-server/openerp/api.py”,第769行,self.uid,self.context = self.args =(cr,uid,frozendict(context))ValueError :字典更新序列元素#0的长度为1; 2是必需的。

Thank you!

谢谢!

1 个解决方案

#1


0  



It's seems that you forgot an argument while you're inheriting this function.
You missed voucher_id argument so the inherited function should be like :

在你继承这个函数的时候,你似乎忘记了一个参数。你错过了voucher_id参数,所以继承的函数应该是这样的:

@api.model
def voucher_move_line_create(self, voucher_id, line_total, move_id, company_currency, current_currency):
        res =  super(account_voucher, self).voucher_move_line_create(voucher_id, line_total, move_id, company_currency, current_currency) 

I hope this helps, and thank you for your question.

我希望这会有所帮助,并感谢您的提问。

#1


0  



It's seems that you forgot an argument while you're inheriting this function.
You missed voucher_id argument so the inherited function should be like :

在你继承这个函数的时候,你似乎忘记了一个参数。你错过了voucher_id参数,所以继承的函数应该是这样的:

@api.model
def voucher_move_line_create(self, voucher_id, line_total, move_id, company_currency, current_currency):
        res =  super(account_voucher, self).voucher_move_line_create(voucher_id, line_total, move_id, company_currency, current_currency) 

I hope this helps, and thank you for your question.

我希望这会有所帮助,并感谢您的提问。