Skip to Content
Menu
This question has been flagged
5 Replies
17055 Views

actually i want , when i click on save button then one wizard will pop up with same form data so i created wizard view for same table,like form table is assets.creation and wizard table is also same. and wizard view i called on python method and that python method i called in create method before super method. but after clicking on save button pop up is not coming.

..................................................................................

---------------wizard view-----------


<record id="view_asset_data_confirmation" model="ir.ui.view">
            <field name="name">Data Confirmation</field>
            <field name="model">assets.creation</field>
            <field name="arch" type="xml">
                <form string="Assets Confirmation">
                      
                        <group>
                            <group>
                                <field name="name"/>
                                <field name="category_id"/>
                            </group>
                            <group>
                                <field name="maintenance_team_id"/>
           
                            </group>
                        </group>
                     
                        <footer>
                        <button name="confirm" string="Confirm" type="object" class="oe_highlight"/>
                        or
                        <button string="Cancel" class="oe_link" special="cancel" />
                    </footer>
                </form>
            </field>
        </record>

.....................................................................................................................................................

-----------------python wizard method-----------

@api.multi
    def _call_wizard(self,vals):
        view = self.env.ref('wms.view_asset_data_confirmation')
        new_id = self.env['assets.creation']
   
            vals = {
                'name'   : self.name,
                   'category_id' : self.category_id,
                   'maintenance_team_id' : self.maintenance_team_id.id,
                   'partner_id' : self.partner_id,
                  
                 }
        view_id = new_id.create(vals)
        return {
            'name': _("Asset Data Confirmation"),
            'view_mode': 'form',
            'view_id': view.id,
            'res_id': view_id.id,
            'view_type': 'form',
            'res_model': 'assets.creation',
            'type': 'ir.actions.act_window',
            'target': 'new',
           
        }

.............................................................................


-----------Create method.........

@api.model
    def create(self, vals):
      self._call_wizard(vals)
    res = super(EquipmentCreation, self).create(vals)
    return res

where i m doing wrong please help me


Avatar
Discard

it's not a logical way to call an outside wizard on create method, and here only one return should work.

Author

Then can u suggest me other way Hilar ,if u know other way

You can pass all the values to wizard. Once you save wizard values call create method for parent object and values you passed to wizard along with a temp key and value.Validate that in parent create method.

EX:-

@api.model

def create(self, vals):

if not vals.get('tempkey', False):

self._call_wizard(vals)

return super(EquipmentCreation, self).create(vals)

Hope this will solve your problem :)

Author

Thanks George Vincent....But wizard value is not returning in create method and pop up is not opening ...please suggest what to do ...i get stuck in this prblm...is it possible or not.

Best Answer

you have to change your model name here.


return {
      'type': 'ir.actions.act_window',
      'view_type': 'form',
     'view_mode': 'form',
     'res_model': 'res.user.wizard',
     'target': 'new',
}
Avatar
Discard
Related Posts Replies Views Activity
1
Dec 22
1809
3
Nov 23
28090
4
Dec 18
3582
2
Dec 23
16311
6
Apr 18
19415