Hello, I wish for transient model to appear once field changes, however I cannot figure out what should I do so it would appear once code is triggered. I manage to make it appear on menu option so I suppose xml and wizard class are working fine.
splitting_wizard.py:
class SplittingWizard(models.TransientModel):
_name = "splitting.wizard"
_description = "This wizards show splitting selection"
options = fields.Selection([('x4','x4 (4,5 mm)'), ('x5', 'x5 (3,8 mm)'), ('x6', "x6 (2.5 mm)")], string = "Kalibruotas lentos vienetas skaldomas")
def action_send(self):
logging.info(f"veik")```
splitting_wizard_view.xml:
<recordid="splitting_wizard_action"model="ir.actions.act_window">
<fieldname="name">Splitting Wizardddfield>
<fieldname="type">ir.actions.act_windowfield>
<fieldname="res_model">splitting.wizardfield>
<fieldname="view_mode">formfield>
<fieldname="target">newfield>
record>
code attempting to call window in stock_picking.py:
@api.onchange('picking_type_id')
def_get_splitting_popup(self):
operation_type_transfer_to_splitting = self.env.ref("ecowood_splitting.operation_type_transfer_to_splitting")
ifself.picking_type_id == operation_type_transfer_to_splitting:
action = self.env.ref('ecowood_splitting.splitting_wizard_action')
result = action.sudo().read()[0]
result['context'] = {'default_options' : "", }
return {
"name" : "Skaldymo langas",
"type": "splitting_wizard_action",
"res_model": "splitting.wizard",
"view_mode": "form",
"target": "new",
}