I have this code on my Odoo v8 module:
@api.multi
def button_generate_wh_doc(self):
context = self._context
partner = self.env['res.partner']
res = {}
for inv in self:
view_id = self.env['ir.ui.view'].search([
('name', '=', 'account.invoice.wh.iva.customer')])
context.update({
'invoice_id': inv.id,
'type': inv.type,
'default_partner_id': partner._find_accounting_partner(
inv.partner_id).id,
'default_name': inv.name or inv.number,
'view_id': view_id,
})
res = {
'name': _('Withholding vat customer'),
'type': 'ir.actions.act_window',
'res_model': 'account.wh.iva',
'view_type': 'form',
'view_id': False,
'view_mode': 'form',
'nodestroy': True,
'target': 'current',
'domain': "[('type', '=', '" + inv.type + "')]",
'context': context
}
return res
This is a button action, but when I click it it throws me:
File "/home/user/odoov8/odoo-venezuela/l10n_ve_withholding_iva/model/invoice.py", line 427, in button_generate_wh_doc
'view_id': view_id,
File "/home/user/odoov8/odoo-8.0-20161017/openerp/tools/misc.py", line 1280, in update
raise NotImplementedError("'update' not supported on frozendict")
NotImplementedError: 'update' not supported on frozendict
Has anybody encounter this kind of error implementing this?
I think it has to do with the order in which the context is called, but Im not really sure.