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.

24 lines
982 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2020 ACSONE SA/NV (<http://acsone.eu>)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo import models
  5. class MergePartnerAutomatic(models.TransientModel):
  6. _inherit = "base.partner.merge.automatic.wizard"
  7. def _get_fk_on(self, table):
  8. foreign_keys = super(MergePartnerAutomatic, self)._get_fk_on(table)
  9. if table == "res_partner" and self.env.context.get("address_version"):
  10. models = self.env["res.partner"]._version_impacted_tables()
  11. limited_fk = []
  12. for fk in foreign_keys:
  13. if fk[0] in models:
  14. ignore_col_dict = self.env["res.partner"]._version_exclude_keys()
  15. ignore_col = ignore_col_dict.get(fk[0], False)
  16. if ignore_col and fk[1] in ignore_col:
  17. continue
  18. limited_fk.append(fk)
  19. return limited_fk
  20. return foreign_keys