跳至内容
菜单
此问题已终结
5 回复
18109 查看

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


形象
丢弃

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

编写者

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

编写者

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.

最佳答案

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',
}
形象
丢弃
相关帖文 回复 查看 活动
1
12月 22
3202
3
11月 23
31976
4
7月 25
4773
2
12月 23
17536
6
4月 18
21169