跳至内容
菜单
此问题已终结
1 回复
437 查看


On Manufacturing Orders I added a new Char field (New Field) whose value I want to pass on all the child MO it is associated with.

形象
丢弃
最佳答案

Hi,

Please refer to the code below:


from odoo import fields, models

class MrpProduction(models.Model):
_inherit = 'mrp.production'

new_field = fields.Char(string="New Field")

@api.constrains("new_field")
def _constraint_new_field(self):
child_mo = self.self._get_children()
for child in child_mo:
child.new_field = self.new_field


Hope it helps.

形象
丢弃
相关帖文 回复 查看 活动
2
11月 22
2471
0
11月 15
3927
0
8月 25
192
0
8月 25
165
2
8月 25
691