Skip to Content
Menu
This question has been flagged
4126 Zobrazenia

Hello All,

I have two types of fields in odoo10. One is 'Many2one' type field and other is 'One2many' type field. In 'Many2one' field we selected type of "Workflow". Recently i have three type of workflows(full-flow, semi-flow and simplified-flow). And in One2many type field, i have two field 'stage' and 'status'. And, when i select "full-flow" from workflow field then in another field "stage" and "status" automatically selected. Now i require that when i select any workflow from workflow field then related "stage" visible in button and "status" appear in statusbar. So, anyone can help me for this problem.

My Python and XML code is below:

Python code:

work_flow_stage = fields.Many2one('stage.workflow', column='workflow', string="Type of Workflow")
work_stage = fields.One2many(related="work_flow_stage.stages_workflow_flow", string="Work Stage")
body_pro_stage = fields.Many2one('partner.state', string="Stages")
body_pro_status = fields.Char(related='body_pro_stage.status', string="Status")

@api.multi
def case_start(self, uid, context=None):
workflow_obj = self.env['body.processing'].default_get(['work_flow_stage'])
print "workflow_obj: ", workflow_obj
stage_obj = self.env['stages.workflow'].default_get(['work_stage'])
workflow_ids = []
stage_workflow_ids = workflow_obj.search(cr, uid, [('workflow_ids', '=', 'work_stage')])
if workflow_ids:
stages = stage_obj.browse(cr, uid)
return stages

XML code:

<header>
<button name="case_start" string="Start" type="object" class="btn-primary"/>
<field name="body_pro_stage" nolabel="1" widget="statusbar" statusbar_visible="body_pro_status"/>
 </header>
Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
0
feb 25
1026
2
dec 24
1363
0
júl 24
1133
0
aug 23
1597
0
máj 23
2923