Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
4169 Zobrazení

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šit
Related Posts Odpovědi Zobrazení Aktivita
0
úno 25
1074
2
pro 24
1410
0
čvc 24
1165
0
srp 23
1618
0
kvě 23
2966