我的任务中有可用的“审阅者”字段,当任务从“进行中”阶段移到“审阅”阶段时,我希望自动将审阅者与任务指派者切换。我的服务器操作中有以下Python代码: picture of the code in context
def assignrev(self):
for record in self:
if record['project.task.type.stage_id.name']=='Review':
a=self.res.users.reviewer_id.name
b=self.res.users.user_id.name
record['res.users.user_id.name']=a
record['res.users.reviewer_id.name']=b
下面是指向我的自动操作设置图片的链接: Server action to run
不幸的是,将任务阶段更改为“审阅”并不能获得预期的结果。有什么建议吗?在
卡祖
好吧,我终于找到答案了。以下是Odoo 10上下文中的代码图片:
不需要“for record”的“def”:代码将不运行。在
我只希望这对其他人有帮助。。。在
卡祖
我猜你是在错误地调用你想要得到的字段。在
此外,为什么不试着用^{} method 代替呢?在
^{pr2}$如果仍然有问题,可以使用ipdb在方法中触发
set_trace
,从而更容易地调试代码。在相关问题 更多 >
编程相关推荐