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.

16 lines
520 B

  1. # Copyright 2019-2020 Onestein (<https://www.onestein.eu>)
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  3. from odoo import models
  4. class ResPartner(models.Model):
  5. _inherit = "res.partner"
  6. def toggle_active(self):
  7. res = super().toggle_active()
  8. if self.env.context.get("skip_child_toggle_active"):
  9. return res
  10. for partner in self.filtered(lambda x: not x.active):
  11. partner.child_ids.filtered(lambda x: x.active).toggle_active()
  12. return res