Skip to Content
Menu
This question has been flagged
1 Reply
4700 Views

the compute Method will not be called when opening a custom wizard:


class x_dummy_createwizardClose(models.TransientModel):
_name = 'x_dummy.createbeleg_close_wizard'
description = fields.Char(string="Beschreibung", required=True)
betrag_ist = fields.Float(string="IST-Stand", required=True)
betrag_soll = fields.Float(string="Soll-Stand", compute='_compute_betrag_soll', required=True)

@api.one
def _compute_betrag_soll(self):
        #some logic here....
self.betrag_soll = 20    # TESTING


but the Method _compute_betrag_soll will never be called
The Action vor opening the wizard looks as follows:


   <act_window id="launch_session_wizard_closer"
name="create Close-Entry"
src_model="x_dummy.dummy"
view_type="form"
res_model="x_dummy.createbeleg_close_wizard"
view_mode="form"
target="new"
key2="client_action_multi"/>



Avatar
Discard
Best Answer

Use @api.depends('your_field_name')

    @api.one    
    @api.depends('your_field_name')
def _compute_betrag_soll(self):
        #some logic here....
self.betrag_soll = 20    # TESTING

Avatar
Discard
Author

still will not be triggered while opening the Wizard.

Author

now it works: problem was an attribute readonly=1 which was set for this field.