【发布时间】:2022-01-08 14:51:32
【问题描述】:
我正在尝试在我的 one2many 字段 onchange 中添加值。
我尝试使用[(0,0, {values})],但什么也没发生。关于如何实现它的任何想法?
custom_line_ids = fields.One2many('mrp.production', 'product_id', 'Custom Line')
@api.onchange('product_id')
def add_custom_line_ids(self):
mrp = self.env['mrp.productions'].search([])
result = []
vals = {
'sequence': self.sequence,
'name': self.name,
'product_id': self.product_id,
'date_planned_start': self.date_planned_start,
'state': self.state,
}
self.update({'custom_line_ids':[(0, 0, vals)]})
【问题讨论】:
标签: odoo onchange odoo-13 one2many