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.

23 lines
958 B

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