コンテンツへスキップ
メニュー
この質問にフラグが付けられました
5 返信
18126 ビュー

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
3207
3
11月 23
32007
4
7月 25
4781
2
12月 23
17543
6
4月 18
21181