I have this view
<record id="view_prod_order_form" model="ir.ui.view">
<field name="name">bsi.production.order.form</field>
<field name="model">bsi.production.order</field>
<field name="arch" type="xml">
<form string="Production Order">
<div class="oe_title">
<label for="name" class="oe_edit_only" />
<h1>
<field name="name" />
</h1>
</div>
<sheet>
<h1>
<field name="name" class="oe_inline" readonly="1"/>
</h1>
<group>
<group>
<field name="product_id"/>
<field name="qty_available"/>
<field name="isbn1" attrs="{'invisible': [('type_prod', '!=', 'direct')]}" />
<field name="isbn2" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="isbn3" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="isbn4" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="isbn5" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="isbn6" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="isbn7" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="isbn8" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
</group>
<group>
<field name="type_prod"/>
<field name="print_order" attrs="{'invisible': [('type_prod', '!=', 'direct')]}" />
<field name="print_order" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
Which I'm trying to call from a wizard/button, like this:
@api.multi
def action_open_prod(self):
self.ensure_one()
assert len(self) == 1, 'This option should only be used for a single id at a time.'
id = self.id
return {
'name': self.name,
'res_model': 'bsi.production.order',
'res_id': id,
'type': 'ir.actions.act_window',
'context': {},
'view_mode': 'form',
'view_type': 'form',
'view_id': self.env.ref('mrp_worksheet_contract.view_prod_order_form'),
'target': 'current',
}
But now it throws me this:
Traceback (most recent call last): File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 546, in _handle_exception File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 597, in dispatch File "C:\Program Files\Odoo 8.0-20170809\server\.\openerp\http.py", line 535, in _json_response File "simplejson\__init__.pyc", line 354, in dumps File "simplejson\encoder.pyc", line 264, in encode File "simplejson\encoder.pyc", line 612, in _iterencode File "simplejson\encoder.pyc", line 568, in _iterencode_dict File "simplejson\encoder.pyc", line 568, in _iterencode_dict File "simplejson\encoder.pyc", line 622, in _iterencode File "simplejson\encoder.pyc", line 239, in default TypeError: ir.ui.view(998,) is not JSON serializable
I know this is probably because of view id, I mean, I'm passing the entire view, so it's not serializable, but how can I just open this view as a new one from this button?
Like, creating a new record on it?