Hello All,
I have to two types of fields one is many2one and another is one2many field. And in many2one field i selected workflow(full-flow, semi-flow and simplified-flow) and in one2many field related stage and status "char" types field. And i applied a function on "button field", in which i want that when i select particular workflow then related "stage" available on button field and "status" in status bar. So, anyone can solve this problem.
My Python and XML Code is here:
Python Code:
work_flow_stage = fields.Many2one('stage.workflow', column='workflow', string="Type of Workflow")
stages_workflow_flow = fields.One2many('stages.workflow', 'order_id', string="Stages Workflow")
state = fields.Char("Stage")
status = fields.Char("Status")
@api.multi
def case_start(self, work_flow_stage, context=None):
vals = {}
workflow_obj = self.work_flow_stage.workflow
print "workflow_obj: ", workflow_obj
stage_obj = self.work_flow_stage.stages_workflow_flow
print "workflow_obj: ", stage_obj
for vals in stage_obj:
print "valsssss", vals
print "vals: stage ", vals.stage_id.state
print "vals: status", vals.status_id
stages_workflow_flow = [(0, 0, {
'work_flow_stage': vals.stage_id.state
})]
print "vals: stages_workflow_flow", stages_workflow_flow
Xml Code:
<header>
<button name="case_start" string="Start" type="object" class="btn-primary"/>
<field name="work_flow_stage " nolabel="1" widget="statusbar" statusbar_visible="none"
statusbar_colors='{"pending":"blue"}'/>
</header>
The workflow you want implement it will work globally (For all the records)? or bases on individual records you want to have option?
Want workflow globally...