콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
651 화면


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
2858
0
11월 15
4154
1
9월 25
751
2
9월 25
355
2
9월 25
385