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

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2019 ACSONE SA/NV
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from odoo import api, fields, models
  5. class TestOnchangeHelperMulti(models.Model):
  6. _name = "test_onchange_helper.multi"
  7. _description = "Test Onchange Helper Multi"
  8. name = fields.Char(related="partner.name", readonly=True)
  9. partner = fields.Many2one("res.partner")
  10. lines = fields.One2many("test_onchange_helper.multi.line", "multi")
  11. @api.onchange("name")
  12. def _onchange_name(self):
  13. for line in self.lines:
  14. line.name = self.name
  15. @api.onchange("partner")
  16. def _onchange_partner(self):
  17. for line in self.lines:
  18. line.partner = self.partner