İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
381 Görünümler


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.

Avatar
Vazgeç
En İyi Yanı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.

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Kas 22
2433
0
Kas 15
3892
2
Ağu 25
583
0
Tem 25
481
1
Tem 25
913