Hii All,
I have two fields in odoo10, add i want to add onchange function for it. In one field i added three workflows, In first workflow(work1) i added two stages(create, new) similarly for second(work2) and third(work3) added two stages(draft, escalate) & (assign, pending). i want that when i select work1 from workflow field then related stages show in the stage field. So, anyone can solve this problem. my python code for that is below:
python code:
work_flow_stage = fields.Many2one('stage.workflow', string="Work Flow", change_default=True, default=_work_flow_status)
work_stage = fields.Many2one('partner.state', string="Stage")
@api.onchange('work_flow_stage', 'work_stage')
@api.multi
def _work_flow_status(self):
stage = self.env['stage.workflow'].search([('work_stage', 'in', 'work_flow_stage')], limit=1)
print "stage", stage
return stage