Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
5 Ответы
18142 Представления

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',
}
Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
дек. 22
3222
What is wizard ? Решено
3
нояб. 23
32051
4
июл. 25
4796
2
дек. 23
17559
6
апр. 18
21210