【发布时间】:2017-10-25 09:49:48
【问题描述】:
我有一个 One2many 字段。在这个字段中,我有复选框字段。而且,我已经为复选框选择应用了验证。并且功能工作得很好。现在,当我选择检查时,值将返回,如果未选择,则没有问题。但是,现在我希望如果选中 One2many 字段中的任何行复选框,则返回值,否则显示警告。意味着,整体 One2many 中的单行复选框足以返回值。
我的代码在这里:
@api.multi
def action_salepack_add(self):
rec = self._context.get('active_ids', [])
wiz = [q.id for q in self.wizard]
res_wiz= []
#here is check box condition#
for s in self.wizard:
if s.check_box==True:
res_wiz.append(s.id)
#check-box condition over#
if rec:
line_values = {'product_id': self.product_id.id,
'wizards': [(6, 0, res_wiz)],
}
sale_order_line = self.env['sale.order.line'].create(line_values)
提前致谢
【问题讨论】:
标签: python-2.7 for-loop if-statement openerp odoo-10