Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
626 มุมมอง


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.

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
พ.ย. 22
2807
0
พ.ย. 15
4138
2
ก.ย. 25
305
2
ก.ย. 25
345
4
ก.ย. 25
428