TypeError: 'int' object is not iterable in wizard

TypeError: 'int' object is not iterable in wizard

我的代码有问题。

 if not context.get('account_id', False):
     wizard_id = self.env.get('ir.model.data').get_object_reference('l10n_mn_consume_order', 'action_consumable_material_in_use_wizard')[1]
     result = **self.env.get('ir.actions.act_window').read(wizard_id)**
     result['context'] = dict(self.context.items(), active_id=asset.id, active_ids=[asset.id])
     return result
     print 'some action'

错误是:

File "/home/delgertsetseg/workspace/odoo/addons/web/controllers/main.py", line 877, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/delgertsetseg/workspace/odoo/odoo/api.py", line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "/home/delgertsetseg/workspace/odoo/odoo/api.py", line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/delgertsetseg/workspace/oderp10/addons/l10n_mn_consume_order /models/consume_material_in_use.py", line 113, in button_done
result = self.env.get('ir.actions.act_window').read(wizard_id)
File "/home/delgertsetseg/workspace/odoo/odoo/addons/base/ir/ir_actions.py", line 317, in read
result = super(IrActionsActWindow, self).read(fields, load=load)
File "/home/delgertsetseg/workspace/odoo/odoo/models.py", line 2993, in readfor name in fields: TypeError: 'int' object is not iterable

如你所见我的问题。 我需要使用向导中传递的值进行操作。那我有一些行动 我正在尝试这个解决方案:

return {
                'name': _('Account?'),
                'type': 'ir.actions.act_window',
                'view_type': 'form',
                'view_mode': 'form',
                'res_model': 'consumable.material.in.use.wizard',
                'views': [(view.id, 'form')],
                'view_id': view.id,
                'target': 'new',
#                 'res_id': wiz.id,
                'context': self.env.context,
            }

解法不能运行return代码后

我没有在向导中传递值。

请帮帮我。

错误似乎是由 l10n_mn_consume_orderbutton_done 方法引起的,其中您正在尝试 return 一项操作。

这是克服错误的可能解决方案。

@api.multi
def button_done(self):
    self.ensure_one()
    # your code here
    action = self.env.ref('l10n_mn_consume_order.wizard_action_id').read()[0] 
    # replace the wizard_action_id with your wizard's action
    action['context'] = dict(self.context.items(), active_id=asset.id, active_ids=[asset.id])
    return action

确保在向导视图文件中存在 ir.actions.act_window 记录。

希望对您有所帮助。