Browse Source
[IMP] partner_ref_unique: Take into account contact merging
[IMP] partner_ref_unique: Take into account contact merging
If merging 2 contacts, one with reference, and another without, and being the target one the contact without reference, the constraint is raised as the reference value is copied before unlinking the other contact. We avoid it disabling the constraint when merging.14.0
Pedro M. Baeza
4 years ago
63 changed files with 548 additions and 347 deletions
-
6partner_ref_unique/README.rst
-
1partner_ref_unique/__init__.py
-
15partner_ref_unique/i18n/am.po
-
15partner_ref_unique/i18n/ar.po
-
15partner_ref_unique/i18n/bg.po
-
15partner_ref_unique/i18n/bs.po
-
15partner_ref_unique/i18n/ca.po
-
15partner_ref_unique/i18n/cs.po
-
15partner_ref_unique/i18n/da.po
-
15partner_ref_unique/i18n/de.po
-
15partner_ref_unique/i18n/el_GR.po
-
15partner_ref_unique/i18n/en_GB.po
-
15partner_ref_unique/i18n/es.po
-
15partner_ref_unique/i18n/es_CR.po
-
15partner_ref_unique/i18n/es_EC.po
-
15partner_ref_unique/i18n/es_ES.po
-
15partner_ref_unique/i18n/es_MX.po
-
15partner_ref_unique/i18n/es_VE.po
-
15partner_ref_unique/i18n/et.po
-
15partner_ref_unique/i18n/eu.po
-
15partner_ref_unique/i18n/fi.po
-
15partner_ref_unique/i18n/fr.po
-
15partner_ref_unique/i18n/fr_CA.po
-
15partner_ref_unique/i18n/fr_CH.po
-
15partner_ref_unique/i18n/fr_FR.po
-
15partner_ref_unique/i18n/gl.po
-
15partner_ref_unique/i18n/hr.po
-
15partner_ref_unique/i18n/hr_HR.po
-
15partner_ref_unique/i18n/hu.po
-
15partner_ref_unique/i18n/it.po
-
15partner_ref_unique/i18n/ja.po
-
15partner_ref_unique/i18n/lt.po
-
15partner_ref_unique/i18n/lv.po
-
15partner_ref_unique/i18n/mk.po
-
15partner_ref_unique/i18n/mn.po
-
15partner_ref_unique/i18n/nb.po
-
15partner_ref_unique/i18n/nb_NO.po
-
15partner_ref_unique/i18n/nl.po
-
15partner_ref_unique/i18n/nl_BE.po
-
15partner_ref_unique/i18n/nl_NL.po
-
22partner_ref_unique/i18n/partner_ref_unique.pot
-
15partner_ref_unique/i18n/pl.po
-
15partner_ref_unique/i18n/pt.po
-
15partner_ref_unique/i18n/pt_BR.po
-
15partner_ref_unique/i18n/pt_PT.po
-
15partner_ref_unique/i18n/ro.po
-
15partner_ref_unique/i18n/ru.po
-
15partner_ref_unique/i18n/sk.po
-
15partner_ref_unique/i18n/sl.po
-
15partner_ref_unique/i18n/sr@latin.po
-
15partner_ref_unique/i18n/sv.po
-
15partner_ref_unique/i18n/th.po
-
15partner_ref_unique/i18n/tr.po
-
15partner_ref_unique/i18n/tr_TR.po
-
15partner_ref_unique/i18n/vi.po
-
15partner_ref_unique/i18n/zh_CN.po
-
15partner_ref_unique/i18n/zh_TW.po
-
3partner_ref_unique/models/res_partner.py
-
6partner_ref_unique/readme/USAGE.rst
-
12partner_ref_unique/static/description/index.html
-
14partner_ref_unique/tests/test_res_partner_ref.py
-
3partner_ref_unique/wizards/__init__.py
-
18partner_ref_unique/wizards/base_partner_merge_automatic_wizard.py
@ -1,3 +1,4 @@ |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from . import models |
|||
from . import wizards |
@ -1,6 +1,6 @@ |
|||
#. Go to any partner in **Contacts > Contacts** |
|||
#. Try to create two partners with the same ref. |
|||
|
|||
* If you selected the option 'All partners' you can't create two partners with the same ref. |
|||
* If you selected the option 'Only companies' you can't create two companies with the same ref. |
|||
* If you selected the option 'None' you can create two partners with the same ref. |
|||
* If you selected the option 'All partners', you can't create two partners with the same ref. |
|||
* If you selected the option 'Only companies', you can't create two companies with the same ref. |
|||
* If you selected the option 'None', you can create two partners with the same ref. |
@ -0,0 +1,3 @@ |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from . import base_partner_merge_automatic_wizard |
@ -0,0 +1,18 @@ |
|||
# Copyright 2020 Tecnativa - Pedro M. Baeza |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from odoo import models |
|||
|
|||
|
|||
class BasePartnerMergeAutomaticWizard(models.TransientModel): |
|||
_inherit = "base.partner.merge.automatic.wizard" |
|||
|
|||
def action_merge(self): |
|||
"""Inject context for avoiding the duplicate reference constraint that |
|||
happens when merging one contact with reference in another without |
|||
reference. |
|||
""" |
|||
return super( |
|||
BasePartnerMergeAutomaticWizard, |
|||
self.with_context(partner_ref_unique_merging=True), |
|||
).action_merge() |
Write
Preview
Loading…
Cancel
Save
Reference in new issue