
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.
Це запитання позначене
1
Відповісти
1767
Переглядів
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.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Реєстрація| Related Posts | Відповіді | Переглядів | Дія | |
|---|---|---|---|---|
|
|
2
лист. 22
|
4371 | ||
|
|
0
лист. 15
|
5536 | ||
|
|
2
черв. 26
|
22 | ||
|
|
1
черв. 26
|
1944 | ||
|
|
1
трав. 26
|
3053 |