Reputation: 3897
I'm creating a wizard with steps on Odoov8, this is my original form 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="date_production"/>
<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')]}"/>
</group>
<group>
<field name="type_prod"/>
<field name="print_order2" attrs="{'invisible': [('type_prod', '!=', 'direct')]}" />
<field name="print_order2" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order2" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order2" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order2" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order2" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
</group>
<group string="Book Block">
<field name="name_block"/>
<field name="category"/>
<field name="language"/>
<field name="edition"/>
<field name="size"/>
<field name="book_block_textp"/>
<field name="n_pages_one_color"/>
<field name="two_color"/>
<field name="four_color"/>
<field name="total"/>
<field name="text_print_code"/>
<field name="book_block_adpaper"/>
<field name="adnl_n_pages_one_color"/>
<field name="adnl_two_color"/>
<field name="adnl_third_color"/>
<field name="adnl_four_color"/>
<field name="adnl_total"/>
<field name="adnl_text_print_code"/>
<field name="book_block_txtep"/>
<field name="n_of_end_pages"/>
</group>
<group string="Book Size">
<field name="name_size"/>
<field name="description_size"/>
<field name="forme_size"/>
<field name="plate_size"/>
</group>
<group string="Book Edition">
<field name="name_edition"/>
</group>
<group string="Book Binding">
<field name="name_binding"/>
</group>
<group string="Cut Off">
<field name="name_cut"/>
<field name="description_cut"/>
<field name="cutoff_size"/>
</group>
<group string="Paper Master">
<field name="name_papermaster"/>
<field name="description_papermaster"/>
<field name="paper_type"/>
<field name="uom_papermaster"/>
<field name="gsm_papermaster"/>
<field name="std_cost_rate"/>
<field name="qty_in_kgs"/>
<field name="size_width"/>
<field name="size_height"/>
</group>
<group string="End Paper">
<field name="name_end_paper"/>
<field name="category_end_paper"/>
<field name="size_end_paper"/>
</group>
<group string="Printing Code">
<field name="description_code"/>
<field name="size_code"/>
</group>
<group string="Book Edge">
<field name="name_book_edge"/>
</group>
<group string="Job Rate">
<field name="name_jobrate"/>
<field name="binding"/>
<field name="size_binding_job_rate"/>
<field name="bind_variety"/>
<field name="rates"/>
<field name="addl_rate"/>
<field name="uptoforme"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
What I want is t call this view from a wizard, with steps, so every 'x' field quantity can be filled on every step, this is my wizard code:
def action_next1(self, cr, uid, ids, context=None):
#your treatment to click button next
#...
# update state to step2
self.write(cr, uid, ids, {'state': 'step2',}, context=context)
#return view
return {
'type': 'ir.actions.act_window',
'res_model': 'bsi_production_order',
'view_mode': 'form',
'view_type': 'form',
'res_id': this.id,
'views': [(False, 'form')],
'target': 'new',
}
def action_next2(self, cr, uid, ids, context=None):
#your treatment to click button next
#...
# update state to step2
self.write(cr, uid, ids, {'state': 'step3',}, context=context)
#return view
return {
'type': 'ir.actions.act_window',
'res_model': 'bsi_production_order',
'view_mode': 'form',
'view_type': 'form',
'res_id': this.id,
'views': [(False, 'form')],
'target': 'new',
}
def action_next3(self, cr, uid, ids, context=None):
#your treatment to click button next
#...
# update state to step2
self.write(cr, uid, ids, {'state': 'step4',}, context=context)
#return view
return {
'type': 'ir.actions.act_window',
'res_model': 'bsi_production_order',
'view_mode': 'form',
'view_type': 'form',
'res_id': this.id,
'views': [(False, 'form')],
'target': 'new',
}
def action_previous1(self, cr, uid, ids, context=None):
#your treatment to click button previous
#...
# update state to step1
self.write(cr, uid, ids, {'state': 'step1',}, context=context)
#return view
return {
'type': 'ir.actions.act_window',
'res_model': 'bsi_production_order',
'view_mode': 'form',
'view_type': 'form',
'res_id': this.id,
'views': [(False, 'form')],
'target': 'new',
}
def action_previous2(self, cr, uid, ids, context=None):
#your treatment to click button previous
#...
# update state to step1
self.write(cr, uid, ids, {'state': 'step2',}, context=context)
#return view
return {
'type': 'ir.actions.act_window',
'res_model': 'bsi_production_order',
'view_mode': 'form',
'view_type': 'form',
'res_id': this.id,
'views': [(False, 'form')],
'target': 'new',
}
def action_previous3(self, cr, uid, ids, context=None):
#your treatment to click button previous
#...
# update state to step1
self.write(cr, uid, ids, {'state': 'step3',}, context=context)
#return view
return {
'type': 'ir.actions.act_window',
'res_model': 'bsi_production_order',
'view_mode': 'form',
'view_type': 'form',
'res_id': this.id,
'views': [(False, 'form')],
'target': 'new',
}
And this is the respective view:
<record id="view_wizard_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">
<field invisible="1" name="state" />
<group states="step1">
<group>
<group>
<field name="date_production"/>
<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')]}"/>
</group>
<group>
<field name="type_prod"/>
<field name="print_order2" attrs="{'invisible': [('type_prod', '!=', 'direct')]}" />
<field name="print_order2" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order2" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order2" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order2" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
<field name="print_order2" attrs="{'invisible': [('type_prod', '!=', 'direct')]}"/>
</group>
</group>
</group>
<group states="step2">
<group string="Book Block">
<field name="name_block"/>
<!--<field name="description"/>-->
<field name="category"/>
<field name="language"/>
<field name="edition"/>
<field name="size"/>
<field name="book_block_textp"/>
<field name="n_pages_one_color"/>
<field name="two_color"/>
<field name="four_color"/>
<field name="total"/>
<field name="text_print_code"/>
<field name="book_block_adpaper"/>
<field name="adnl_n_pages_one_color"/>
<field name="adnl_two_color"/>
<field name="adnl_third_color"/>
<field name="adnl_four_color"/>
<field name="adnl_total"/>
<field name="adnl_text_print_code"/>
<field name="book_block_txtep"/>
<field name="n_of_end_pages"/>
</group>
<group string="Book Size">
<field name="name_size"/>
<field name="description_size"/>
<field name="forme_size"/>
<field name="plate_size"/>
</group>
</group>
<group states="step3">
<group string="Book Edition">
<field name="name_edition"/>
</group>
<group string="Book Binding">
<field name="name_binding"/>
</group>
<group string="Cut Off">
<field name="name_cut"/>
<field name="description_cut"/>
<field name="cutoff_size"/>
</group>
<group string="Paper Master">
<field name="name_papermaster"/>
<field name="description_papermaster"/>
<field name="paper_type"/>
<field name="uom_papermaster"/>
<field name="gsm_papermaster"/>
<field name="std_cost_rate"/>
<field name="qty_in_kgs"/>
<field name="size_width"/>
<field name="size_height"/>
</group>
</group>
<group states="step4">
<group string="End Paper">
<field name="name_end_paper"/>
<field name="category_end_paper"/>
<field name="size_end_paper"/>
</group>
<group string="Printing Code">
<field name="description_code"/>
<field name="size_code"/>
</group>
<group string="Book Edge">
<field name="name_book_edge"/>
</group>
<group string="Job Rate">
<field name="name_jobrate"/>
<field name="binding"/>
<field name="size_binding_job_rate"/>
<field name="bind_variety"/>
<field name="rates"/>
<field name="addl_rate"/>
<field name="uptoforme"/>
</group>
</group>
<footer states="step1">
<button name="action_next1" string="Next" type="object" />
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
<footer states="step2">
<button name="action_previous1" string="Previous" type="object" />
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
<footer states="step2">
<button name="action_next2" string="Next" type="object" />
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
<footer states="step3">
<button name="action_previous2" string="Previous" type="object" />
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
<footer states="step3">
<button name="action_next3" string="Next" type="object" />
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
<footer states="step4">
<button name="action_previous3" string="Previous" type="object" />
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
Now, if I want to open this wizard view, it just shows an empty white form, also, the vey same thing is happening with the non-wizard view, this are the menuitems and actions
For wizard:
<record id="action_prod_order" model="ir.actions.act_window">
<field name="name">Production Order (Wizard)</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">bsi.production.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_wizard_prod_order_form"/>
<field name="target">new</field>
</record>
<menuitem action="action_prod_order" id="menu_mrp_production_order_action_1"
parent="mrp.menu_mrp_manufacturing" />
And for form view:
<record id="mrp_production_order_action_2" model="ir.actions.act_window">
<field name="name">Production Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">bsi.production.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph,gantt</field>
<field name="view_id" eval="False"/>
<field name="context">{}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a production order.
</p><p>
A production order...
</p><p>
Production orders are usually proposed automatically based
on customer requirements or automated rules like the minimum
stock rule.
</p>
</field>
</record>
<menuitem action="mrp_production_order_action_2" id="menu_mrp_production_order_action_2"
parent="mrp.menu_mrp_manufacturing" />
Any ideas?
Upvotes: 0
Views: 335
Reputation: 14721
I think the problem is in your action
<field name="view_mode">tree,form</field>
You are showing your record In tree view in a popup this not allowed in odoo. Generally the tree will be just a simple bare and when you click on it than the record are loaded this is in odoo 10.
Just use form mode
And make sure you status field has a default value too.
Upvotes: 1