Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
6902 Widoki

I am not able to call wizard on sales order onchange method

Here is my View.xml:

<record model="ir.ui.view" id="wizard_form_view">

    <field name="name">Wizard Form</field>

    <field name="model">stages.wizard</field>

    <field name="arch" type="xml">

        <form string="Email Confirmation">

                <field name="message"/>

        </form>

    </field>

  </record>

Here is my wizard.py:

class wizard(models.TransientModel):

    _name = 'stages.wizard'

    message = fields.Text("Message")

Here I am calling wizard in onchange method:

@api.constrains ('so_stage')

    @api.onchange ('so_stage')

    def _onchange_so_stage_name(self):


        string_error = ""

        so_order = self.name

        return {

            'type': 'ir.actions.act_window',

            'res_model': 'stages.wizard',

            'view_id' : 'wizard_form_view',

            'view_ref' : 'wizard_form_view',

            'view_type': 'form',

            'view_mode': 'form',

            'target': 'new',

        }


After onchange method triggered the wizard does not pop up.


Awatar
Odrzuć
Najlepsza odpowiedź

Hello,

     As per my understanding onchange functions can return only values, warnings or domain.

Also why are you using constrains with onchange? Please go through this file new api guide line

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
paź 23
1726
4
paź 18
8516
3
cze 18
7032
0
cze 17
3209
2
gru 21
26361