更新odoo10中一对多字段的功能

时间:2017-09-22 13:03:54

标签: xml python-2.7 openerp odoo-10

我必须有两种类型的字段,一种是many2one,另一种是one2many字段。在许多2字段中,我选择了工作流程(全流程,半流程和简化流程),并在one2many字段相关的阶段和状态“char”类型字段中。我在“按钮字段”上应用了一个功能,我希望在选择特定工作流程时,然后在按钮字段上显示相关的“阶段”,在状态栏中显示“状态”。所以,任何人都可以解决这个问题。

我的Python和XML代码在这里:

Python代码:

work_flow_stage = fields.Many2one('stage.workflow',column ='workflow',string =“工作流程类型”) stages_workflow_flow = fields.One2many('stages.workflow','order_id',string =“Stages Workflow”) state = fields.Char(“Stage”) status = fields.Char(“状态”)

Col2

Xml代码:

@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

0 个答案:

没有答案