-
-
Notifications
You must be signed in to change notification settings - Fork 862
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[10.0][CHG] partner_address_version: refactor the way versionning is …
…managed
- Loading branch information
Cédric Pigeon
committed
May 13, 2020
1 parent
61f27bb
commit 3ee4689
Showing
6 changed files
with
97 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from . import models | ||
from . import wizards |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,6 @@ | |
'installable': True, | ||
'depends': [ | ||
'base', | ||
'base_partner_merge', | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import base_partner_merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- 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 |