Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
510 Lượt xem


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.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 11 22
2571
0
thg 11 15
3984
3
thg 9 25
267
1
thg 9 25
307
0
thg 8 25
379