Cédric Pigeon
5 years ago
committed by
Kevin Khao
7 changed files with 104 additions and 48 deletions
-
1partner_address_version/__init__.py
-
4partner_address_version/__manifest__.py
-
95partner_address_version/models/res_partner.py
-
1partner_address_version/readme/CONTRIBUTORS.rst
-
26partner_address_version/tests/test_address_version.py
-
1partner_address_version/wizards/__init__.py
-
24partner_address_version/wizards/base_partner_merge.py
@ -1,2 +1,3 @@ |
|||||
* Benoît Guillot <benoit.guillot@akretion.com> |
* Benoît Guillot <benoit.guillot@akretion.com> |
||||
* Kevin Khao <kevin.khao@akretion.com> |
* Kevin Khao <kevin.khao@akretion.com> |
||||
|
* Cédric Pigeon |
@ -0,0 +1 @@ |
|||||
|
from . import base_partner_merge |
@ -0,0 +1,24 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2020 ACSONE SA/NV (<http://acsone.eu>) |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
from odoo import models |
||||
|
|
||||
|
|
||||
|
class MergePartnerAutomatic(models.TransientModel): |
||||
|
_inherit = "base.partner.merge.automatic.wizard" |
||||
|
|
||||
|
def _get_fk_on(self, table): |
||||
|
foreign_keys = super(MergePartnerAutomatic, self)._get_fk_on(table) |
||||
|
if table == "res_partner" and self.env.context.get("address_version"): |
||||
|
models = self.env["res.partner"]._version_impacted_tables() |
||||
|
limited_fk = [] |
||||
|
for fk in foreign_keys: |
||||
|
if fk[0] in models: |
||||
|
ignore_col_dict = self.env["res.partner"]._version_exclude_keys() |
||||
|
ignore_col = ignore_col_dict.get(fk[0], False) |
||||
|
if ignore_col and fk[1] in ignore_col: |
||||
|
continue |
||||
|
limited_fk.append(fk) |
||||
|
return limited_fk |
||||
|
return foreign_keys |
Write
Preview
Loading…
Cancel
Save
Reference in new issue