2
votes

I have problem with my code.

 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'

And error is:

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

As you see my problem. I need act using the value passed in wizard. Then i have some action I'm try this solution :

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,
            }

the solution can't run return after code.

I don't passed value in wizard.

Please, help me.

1

1 Answers

2
votes

It appears to be the error is due to the l10n_mn_consume_order's button_done method, where you are trying to return a action.

Here is the possible solution to overcome the error.

@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

Make sure in the wizard view file ir.actions.act_window record exists.

Hope this helps.