You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
731 B

# -*- coding: utf-8 -*-
# Copyright 2019 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class TestOnchangeHelperMulti(models.Model):
_name = "test_onchange_helper.multi"
_description = "Test Onchange Helper Multi"
name = fields.Char(related="partner.name", readonly=True)
partner = fields.Many2one("res.partner")
lines = fields.One2many("test_onchange_helper.multi.line", "multi")
@api.onchange("name")
def _onchange_name(self):
for line in self.lines:
line.name = self.name
@api.onchange("partner")
def _onchange_partner(self):
for line in self.lines:
line.partner = self.partner