Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
5 Vastaukset
17704 Näkymät

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
Hylkää

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

Tekijä

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 :)

Tekijä

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.

Paras vastaus

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
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
jouluk. 22
2555
3
marrask. 23
30515
4
jouluk. 18
4160
2
jouluk. 23
17062
6
huhtik. 18
20406