diff --git a/partner_multi_relation/README.rst b/partner_multi_relation/README.rst index b0fe9e0b9c7..8a9e48849a9 100644 --- a/partner_multi_relation/README.rst +++ b/partner_multi_relation/README.rst @@ -17,13 +17,13 @@ Partner Relations :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpartner--contact-lightgray.png?logo=github - :target: https://github.com/OCA/partner-contact/tree/17.0/partner_multi_relation + :target: https://github.com/OCA/partner-contact/tree/18.0/partner_multi_relation :alt: OCA/partner-contact .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/partner-contact-17-0/partner-contact-17-0-partner_multi_relation + :target: https://translation.odoo-community.org/projects/partner-contact-18-0/partner-contact-18-0-partner_multi_relation :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/partner-contact&target_branch=17.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/partner-contact&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -179,7 +179,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -208,6 +208,8 @@ Contributors - Raf Ven +- Marcin Chechłacz + Maintainers ----------- @@ -221,6 +223,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -This module is part of the `OCA/partner-contact `_ project on GitHub. +This module is part of the `OCA/partner-contact `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/partner_multi_relation/__manifest__.py b/partner_multi_relation/__manifest__.py index 01637766f7f..6e8e3d491ec 100644 --- a/partner_multi_relation/__manifest__.py +++ b/partner_multi_relation/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Partner Relations", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "author": "Therp BV,Camptocamp,Odoo Community Association (OCA)", "website": "https://github.com/OCA/partner-contact", "complexity": "normal", diff --git a/partner_multi_relation/i18n/am.po b/partner_multi_relation/i18n/am.po index 2d3f41c0c16..8f0ffbb9a01 100644 --- a/partner_multi_relation/i18n/am.po +++ b/partner_multi_relation/i18n/am.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/ar.po b/partner_multi_relation/i18n/ar.po index 1382f78d4c0..0c419a4ff9d 100644 --- a/partner_multi_relation/i18n/ar.po +++ b/partner_multi_relation/i18n/ar.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/bg.po b/partner_multi_relation/i18n/bg.po index d5115f54c63..62fa0f54b02 100644 --- a/partner_multi_relation/i18n/bg.po +++ b/partner_multi_relation/i18n/bg.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/bs.po b/partner_multi_relation/i18n/bs.po index 8ecac953f16..8e6e4fd56ef 100644 --- a/partner_multi_relation/i18n/bs.po +++ b/partner_multi_relation/i18n/bs.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/ca.po b/partner_multi_relation/i18n/ca.po index e1a30f613e1..2692f6ddccf 100644 --- a/partner_multi_relation/i18n/ca.po +++ b/partner_multi_relation/i18n/ca.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/cs.po b/partner_multi_relation/i18n/cs.po index 5aa93a22041..1f5e0d4a9c8 100644 --- a/partner_multi_relation/i18n/cs.po +++ b/partner_multi_relation/i18n/cs.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/da.po b/partner_multi_relation/i18n/da.po index da65caeeb07..8fcbb00f417 100644 --- a/partner_multi_relation/i18n/da.po +++ b/partner_multi_relation/i18n/da.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/el_GR.po b/partner_multi_relation/i18n/el_GR.po index bd0f2bc1612..2d4d4a7a805 100644 --- a/partner_multi_relation/i18n/el_GR.po +++ b/partner_multi_relation/i18n/el_GR.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/en_GB.po b/partner_multi_relation/i18n/en_GB.po index 2d1817f9655..34598600265 100644 --- a/partner_multi_relation/i18n/en_GB.po +++ b/partner_multi_relation/i18n/en_GB.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/es.po b/partner_multi_relation/i18n/es.po index 03700a279df..844b5e26306 100644 --- a/partner_multi_relation/i18n/es.po +++ b/partner_multi_relation/i18n/es.po @@ -477,8 +477,8 @@ msgstr "Simétrica" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." -msgstr "El socio %s no es aplicable para este tipo de relación." +msgid "The {side} partner is not applicable for this relation type" +msgstr "El socio {side} no es aplicable para este tipo de relación." #. module: partner_multi_relation #: model:ir.model.fields,help:partner_multi_relation.field_res_partner_relation_all__res_model diff --git a/partner_multi_relation/i18n/es_AR.po b/partner_multi_relation/i18n/es_AR.po index def6ccdc4be..7a892ba9589 100644 --- a/partner_multi_relation/i18n/es_AR.po +++ b/partner_multi_relation/i18n/es_AR.po @@ -480,8 +480,8 @@ msgstr "Simétrico" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." -msgstr "El socio %s no es aplicable para este tipo de relación." +msgid "The {side} partner is not applicable for this relation type" +msgstr "El socio {side} no es aplicable para este tipo de relación." #. module: partner_multi_relation #: model:ir.model.fields,help:partner_multi_relation.field_res_partner_relation_all__res_model diff --git a/partner_multi_relation/i18n/es_CL.po b/partner_multi_relation/i18n/es_CL.po index 7c8d3dab8ba..c7fba262d64 100644 --- a/partner_multi_relation/i18n/es_CL.po +++ b/partner_multi_relation/i18n/es_CL.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/es_CO.po b/partner_multi_relation/i18n/es_CO.po index d6e3208cf64..c809f2562f5 100644 --- a/partner_multi_relation/i18n/es_CO.po +++ b/partner_multi_relation/i18n/es_CO.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/es_CR.po b/partner_multi_relation/i18n/es_CR.po index 9a07513fa93..7c9f2c8eff2 100644 --- a/partner_multi_relation/i18n/es_CR.po +++ b/partner_multi_relation/i18n/es_CR.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/es_DO.po b/partner_multi_relation/i18n/es_DO.po index b0b652edb1b..f11d9d9707d 100644 --- a/partner_multi_relation/i18n/es_DO.po +++ b/partner_multi_relation/i18n/es_DO.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/es_EC.po b/partner_multi_relation/i18n/es_EC.po index 42d966dd5b4..38f398860cf 100644 --- a/partner_multi_relation/i18n/es_EC.po +++ b/partner_multi_relation/i18n/es_EC.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/es_ES.po b/partner_multi_relation/i18n/es_ES.po index 5e433792b6f..95753e78fed 100644 --- a/partner_multi_relation/i18n/es_ES.po +++ b/partner_multi_relation/i18n/es_ES.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/es_MX.po b/partner_multi_relation/i18n/es_MX.po index 8576a17c392..6fb13713dfb 100644 --- a/partner_multi_relation/i18n/es_MX.po +++ b/partner_multi_relation/i18n/es_MX.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/es_PE.po b/partner_multi_relation/i18n/es_PE.po index 0383e024fb8..835928bca2d 100644 --- a/partner_multi_relation/i18n/es_PE.po +++ b/partner_multi_relation/i18n/es_PE.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/es_PY.po b/partner_multi_relation/i18n/es_PY.po index fe6ff8f2710..ed544ae965f 100644 --- a/partner_multi_relation/i18n/es_PY.po +++ b/partner_multi_relation/i18n/es_PY.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/es_VE.po b/partner_multi_relation/i18n/es_VE.po index 33d729f86ad..124f3459ff0 100644 --- a/partner_multi_relation/i18n/es_VE.po +++ b/partner_multi_relation/i18n/es_VE.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/et.po b/partner_multi_relation/i18n/et.po index f6447087612..beb9e1928c2 100644 --- a/partner_multi_relation/i18n/et.po +++ b/partner_multi_relation/i18n/et.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/eu.po b/partner_multi_relation/i18n/eu.po index 96e51815de3..088355a0eb9 100644 --- a/partner_multi_relation/i18n/eu.po +++ b/partner_multi_relation/i18n/eu.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/fa.po b/partner_multi_relation/i18n/fa.po index 370c1bd1152..e9ad5f36b3b 100644 --- a/partner_multi_relation/i18n/fa.po +++ b/partner_multi_relation/i18n/fa.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/fi.po b/partner_multi_relation/i18n/fi.po index b77800be17e..f75f18f3d22 100644 --- a/partner_multi_relation/i18n/fi.po +++ b/partner_multi_relation/i18n/fi.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/fr.po b/partner_multi_relation/i18n/fr.po index 1ea36c35d2e..b4ff575dbad 100644 --- a/partner_multi_relation/i18n/fr.po +++ b/partner_multi_relation/i18n/fr.po @@ -483,8 +483,8 @@ msgstr "Symétrique" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." -msgstr "Le partenaire %s n'est pas applicable pour ce type de relation." +msgid "The {side} partner is not applicable for this relation type" +msgstr "Le partenaire {side} n'est pas applicable pour ce type de relation." #. module: partner_multi_relation #: model:ir.model.fields,help:partner_multi_relation.field_res_partner_relation_all__res_model diff --git a/partner_multi_relation/i18n/fr_CA.po b/partner_multi_relation/i18n/fr_CA.po index 090aae1156c..47d43c4d89a 100644 --- a/partner_multi_relation/i18n/fr_CA.po +++ b/partner_multi_relation/i18n/fr_CA.po @@ -469,7 +469,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/fr_CH.po b/partner_multi_relation/i18n/fr_CH.po index 32a1c3938cf..67bcdd4bbfc 100644 --- a/partner_multi_relation/i18n/fr_CH.po +++ b/partner_multi_relation/i18n/fr_CH.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/fr_FR.po b/partner_multi_relation/i18n/fr_FR.po index 806036736da..a8416569993 100644 --- a/partner_multi_relation/i18n/fr_FR.po +++ b/partner_multi_relation/i18n/fr_FR.po @@ -469,7 +469,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/gl.po b/partner_multi_relation/i18n/gl.po index 6e841c93066..3696dcde032 100644 --- a/partner_multi_relation/i18n/gl.po +++ b/partner_multi_relation/i18n/gl.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/gl_ES.po b/partner_multi_relation/i18n/gl_ES.po index f9149a82ab2..831864dd1fe 100644 --- a/partner_multi_relation/i18n/gl_ES.po +++ b/partner_multi_relation/i18n/gl_ES.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/he.po b/partner_multi_relation/i18n/he.po index 1f3b40ec4d1..fd209786a30 100644 --- a/partner_multi_relation/i18n/he.po +++ b/partner_multi_relation/i18n/he.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/hr.po b/partner_multi_relation/i18n/hr.po index 99690f406be..611bc1e76e1 100644 --- a/partner_multi_relation/i18n/hr.po +++ b/partner_multi_relation/i18n/hr.po @@ -469,7 +469,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/hr_HR.po b/partner_multi_relation/i18n/hr_HR.po index 488b806892a..0c937bbe8cd 100644 --- a/partner_multi_relation/i18n/hr_HR.po +++ b/partner_multi_relation/i18n/hr_HR.po @@ -469,7 +469,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/hu.po b/partner_multi_relation/i18n/hu.po index f75be1b3180..1676e240f2e 100644 --- a/partner_multi_relation/i18n/hu.po +++ b/partner_multi_relation/i18n/hu.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/id.po b/partner_multi_relation/i18n/id.po index 97058a64817..1f79010bc50 100644 --- a/partner_multi_relation/i18n/id.po +++ b/partner_multi_relation/i18n/id.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/it.po b/partner_multi_relation/i18n/it.po index c7c3c5e64eb..75a6f719c1f 100644 --- a/partner_multi_relation/i18n/it.po +++ b/partner_multi_relation/i18n/it.po @@ -478,8 +478,8 @@ msgstr "Simmetrico" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." -msgstr "Il partner %s non è applicabile per questo tipo di relazione." +msgid "The {side} partner is not applicable for this relation type" +msgstr "Il partner {side} non è applicabile per questo tipo di relazione." #. module: partner_multi_relation #: model:ir.model.fields,help:partner_multi_relation.field_res_partner_relation_all__res_model diff --git a/partner_multi_relation/i18n/ja.po b/partner_multi_relation/i18n/ja.po index 48f2c8340ca..fcfe2639ddd 100644 --- a/partner_multi_relation/i18n/ja.po +++ b/partner_multi_relation/i18n/ja.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/ko.po b/partner_multi_relation/i18n/ko.po index 1f7f18c7333..831b409887b 100644 --- a/partner_multi_relation/i18n/ko.po +++ b/partner_multi_relation/i18n/ko.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/lt.po b/partner_multi_relation/i18n/lt.po index 2c4ef217229..d5edd82ee03 100644 --- a/partner_multi_relation/i18n/lt.po +++ b/partner_multi_relation/i18n/lt.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/lt_LT.po b/partner_multi_relation/i18n/lt_LT.po index 8819cf22484..9fd68e5915a 100644 --- a/partner_multi_relation/i18n/lt_LT.po +++ b/partner_multi_relation/i18n/lt_LT.po @@ -469,7 +469,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/lv.po b/partner_multi_relation/i18n/lv.po index af1fb831801..6c0279785c8 100644 --- a/partner_multi_relation/i18n/lv.po +++ b/partner_multi_relation/i18n/lv.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/mk.po b/partner_multi_relation/i18n/mk.po index 212b7188dc7..d54d6b6e665 100644 --- a/partner_multi_relation/i18n/mk.po +++ b/partner_multi_relation/i18n/mk.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/mn.po b/partner_multi_relation/i18n/mn.po index 1add3108599..e53038776bb 100644 --- a/partner_multi_relation/i18n/mn.po +++ b/partner_multi_relation/i18n/mn.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/nb.po b/partner_multi_relation/i18n/nb.po index 75e16852587..1c0eaffe1b9 100644 --- a/partner_multi_relation/i18n/nb.po +++ b/partner_multi_relation/i18n/nb.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/nb_NO.po b/partner_multi_relation/i18n/nb_NO.po index 3cf9922c47a..7b6921832d6 100644 --- a/partner_multi_relation/i18n/nb_NO.po +++ b/partner_multi_relation/i18n/nb_NO.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/nl.po b/partner_multi_relation/i18n/nl.po index a88e0f054f4..478e6ec338a 100644 --- a/partner_multi_relation/i18n/nl.po +++ b/partner_multi_relation/i18n/nl.po @@ -471,8 +471,8 @@ msgstr "Symmetrisch" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." -msgstr "De %s relatie is niet geldig voor dit type connectie." +msgid "The {side} partner is not applicable for this relation type" +msgstr "De {side} relatie is niet geldig voor dit type connectie." #. module: partner_multi_relation #: model:ir.model.fields,help:partner_multi_relation.field_res_partner_relation_all__res_model diff --git a/partner_multi_relation/i18n/nl_BE.po b/partner_multi_relation/i18n/nl_BE.po index bb0a7e4490e..f4fd4b0d56c 100644 --- a/partner_multi_relation/i18n/nl_BE.po +++ b/partner_multi_relation/i18n/nl_BE.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/nl_NL.po b/partner_multi_relation/i18n/nl_NL.po index bfa95c1a604..f886ce2ffac 100644 --- a/partner_multi_relation/i18n/nl_NL.po +++ b/partner_multi_relation/i18n/nl_NL.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/partner_multi_relation.pot b/partner_multi_relation/i18n/partner_multi_relation.pot index b3e256e63a7..8e974d6ae79 100644 --- a/partner_multi_relation/i18n/partner_multi_relation.pot +++ b/partner_multi_relation/i18n/partner_multi_relation.pot @@ -463,7 +463,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/pl.po b/partner_multi_relation/i18n/pl.po index 3a412afab25..86cce7393ab 100644 --- a/partner_multi_relation/i18n/pl.po +++ b/partner_multi_relation/i18n/pl.po @@ -469,7 +469,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/pt.po b/partner_multi_relation/i18n/pt.po index 0116ec63468..340106aea3f 100644 --- a/partner_multi_relation/i18n/pt.po +++ b/partner_multi_relation/i18n/pt.po @@ -476,8 +476,8 @@ msgstr "Simétrica" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." -msgstr "O parceiro %s não é aplicável para este tipo de relação." +msgid "The {side} partner is not applicable for this relation type" +msgstr "O parceiro {side} não é aplicável para este tipo de relação." #. module: partner_multi_relation #: model:ir.model.fields,help:partner_multi_relation.field_res_partner_relation_all__res_model diff --git a/partner_multi_relation/i18n/pt_BR.po b/partner_multi_relation/i18n/pt_BR.po index 15225474249..6227cdf30cb 100644 --- a/partner_multi_relation/i18n/pt_BR.po +++ b/partner_multi_relation/i18n/pt_BR.po @@ -470,8 +470,8 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." -msgstr "O parceiro %s não é aplicavel a este tipo de relação." +msgid "The {side} partner is not applicable for this relation type" +msgstr "O parceiro {side} não é aplicavel a este tipo de relação." #. module: partner_multi_relation #: model:ir.model.fields,help:partner_multi_relation.field_res_partner_relation_all__res_model diff --git a/partner_multi_relation/i18n/pt_PT.po b/partner_multi_relation/i18n/pt_PT.po index 16d7f878c5d..3eeded4f2e0 100644 --- a/partner_multi_relation/i18n/pt_PT.po +++ b/partner_multi_relation/i18n/pt_PT.po @@ -469,7 +469,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/ro.po b/partner_multi_relation/i18n/ro.po index 3a57e9173c3..86945b87300 100644 --- a/partner_multi_relation/i18n/ro.po +++ b/partner_multi_relation/i18n/ro.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/ru.po b/partner_multi_relation/i18n/ru.po index ae9be7fb47f..7dd0b448186 100644 --- a/partner_multi_relation/i18n/ru.po +++ b/partner_multi_relation/i18n/ru.po @@ -469,7 +469,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/sk.po b/partner_multi_relation/i18n/sk.po index cff489e58f1..81fc9a4b096 100644 --- a/partner_multi_relation/i18n/sk.po +++ b/partner_multi_relation/i18n/sk.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/sl.po b/partner_multi_relation/i18n/sl.po index bb523ce8bb3..a1de2df8b87 100644 --- a/partner_multi_relation/i18n/sl.po +++ b/partner_multi_relation/i18n/sl.po @@ -470,8 +470,8 @@ msgstr "Simetrični" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." -msgstr "Partner %s ni ustrezen za ta tip odnosa." +msgid "The {side} partner is not applicable for this relation type" +msgstr "Partner {side} ni ustrezen za ta tip odnosa." #. module: partner_multi_relation #: model:ir.model.fields,help:partner_multi_relation.field_res_partner_relation_all__res_model diff --git a/partner_multi_relation/i18n/sr.po b/partner_multi_relation/i18n/sr.po index 1c4bf9d280c..97aaa66d4ec 100644 --- a/partner_multi_relation/i18n/sr.po +++ b/partner_multi_relation/i18n/sr.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/sr@latin.po b/partner_multi_relation/i18n/sr@latin.po index 253100e99fd..51e13a1c28c 100644 --- a/partner_multi_relation/i18n/sr@latin.po +++ b/partner_multi_relation/i18n/sr@latin.po @@ -469,7 +469,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/sv.po b/partner_multi_relation/i18n/sv.po index e275ca603f6..2b8c6ceda77 100644 --- a/partner_multi_relation/i18n/sv.po +++ b/partner_multi_relation/i18n/sv.po @@ -474,8 +474,8 @@ msgstr "Symmetrisk" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." -msgstr "Partnern %s är inte tillämplig för den här relationstypen." +msgid "The {side} partner is not applicable for this relation type" +msgstr "Partnern {side} är inte tillämplig för den här relationstypen." #. module: partner_multi_relation #: model:ir.model.fields,help:partner_multi_relation.field_res_partner_relation_all__res_model diff --git a/partner_multi_relation/i18n/th.po b/partner_multi_relation/i18n/th.po index 0858775964d..350ed9284f8 100644 --- a/partner_multi_relation/i18n/th.po +++ b/partner_multi_relation/i18n/th.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/tr.po b/partner_multi_relation/i18n/tr.po index 89123192701..3d84a722f52 100644 --- a/partner_multi_relation/i18n/tr.po +++ b/partner_multi_relation/i18n/tr.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/tr_TR.po b/partner_multi_relation/i18n/tr_TR.po index 23b3b6d1e1f..4f715c88dc4 100644 --- a/partner_multi_relation/i18n/tr_TR.po +++ b/partner_multi_relation/i18n/tr_TR.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/uk.po b/partner_multi_relation/i18n/uk.po index 63bb2de5c6f..81a1ce3b012 100644 --- a/partner_multi_relation/i18n/uk.po +++ b/partner_multi_relation/i18n/uk.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/vi.po b/partner_multi_relation/i18n/vi.po index e7ac7f5e193..6ece4809e62 100644 --- a/partner_multi_relation/i18n/vi.po +++ b/partner_multi_relation/i18n/vi.po @@ -467,7 +467,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/vi_VN.po b/partner_multi_relation/i18n/vi_VN.po index 633db6cce95..151e97216fa 100644 --- a/partner_multi_relation/i18n/vi_VN.po +++ b/partner_multi_relation/i18n/vi_VN.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/zh_CN.po b/partner_multi_relation/i18n/zh_CN.po index 30d001882d9..e5149c995d3 100644 --- a/partner_multi_relation/i18n/zh_CN.po +++ b/partner_multi_relation/i18n/zh_CN.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/i18n/zh_TW.po b/partner_multi_relation/i18n/zh_TW.po index 9938465d2c0..6283cc4ee01 100644 --- a/partner_multi_relation/i18n/zh_TW.po +++ b/partner_multi_relation/i18n/zh_TW.po @@ -468,7 +468,7 @@ msgstr "" #. odoo-python #: code:addons/partner_multi_relation/models/res_partner_relation.py:0 #, python-format -msgid "The %s partner is not applicable for this relation type." +msgid "The {side} partner is not applicable for this relation type" msgstr "" #. module: partner_multi_relation diff --git a/partner_multi_relation/models/res_partner.py b/partner_multi_relation/models/res_partner.py index e723804e502..d70bd6cb981 100644 --- a/partner_multi_relation/models/res_partner.py +++ b/partner_multi_relation/models/res_partner.py @@ -4,8 +4,9 @@ import numbers -from odoo import _, api, exceptions, fields, models +from odoo import api, exceptions, fields, models from odoo.osv.expression import FALSE_LEAF, OR, is_leaf +from odoo.tools.safe_eval import safe_eval class ResPartner(models.Model): @@ -13,8 +14,6 @@ class ResPartner(models.Model): in various ways. """ - # pylint: disable=invalid-name - # pylint: disable=no-member _inherit = "res.partner" relation_count = fields.Integer(compute="_compute_relation_count") @@ -75,7 +74,7 @@ def _search_relation_type_id(self, operator, value): ) if operator not in SUPPORTED_OPERATORS: raise exceptions.ValidationError( - _('Unsupported search operator "%s"') % operator + self.env._('Unsupported search operator "%s"', operator) ) type_selection_model = self.env["res.partner.relation.type.selection"] relation_type_selection = [] @@ -177,28 +176,24 @@ def get_partner_type(self): def action_view_relations(self): for contact in self: - relation_model = self.env["res.partner.relation.all"] - relation_ids = relation_model.search( - [ - "|", - ("this_partner_id", "=", contact.id), - ("other_partner_id", "=", contact.id), - ] - ) action = self.env["ir.actions.act_window"]._for_xml_id( "partner_multi_relation.action_res_partner_relation_all" ) - action["domain"] = [("id", "in", relation_ids.ids)] - context = action.get("context", "{}").strip()[1:-1] - elements = context.split(",") if context else [] - to_add = [ - f"""'search_default_this_partner_id': {contact.id}, - 'default_this_partner_id': {contact.id}, - 'active_model': 'res.partner', - 'active_id': {contact.id}, - 'active_ids': [{contact.id}], - 'active_test': False""" + action["domain"] = [ + "|", + ("this_partner_id", "=", contact.id), + ("other_partner_id", "=", contact.id), ] - context = "{" + ", ".join(elements + to_add) + "}" - action["context"] = context + context = safe_eval(action.get("context", "{}")) + context.update( + { + "search_default_this_partner_id": contact.id, + "default_this_partner_id": contact.id, + "active_model": "res.partner", + "active_id": contact.id, + "active_ids": contact.ids, + "active_test": False, + } + ) + action["context"] = str(context) return action diff --git a/partner_multi_relation/models/res_partner_relation.py b/partner_multi_relation/models/res_partner_relation.py index 5548292f393..fd7a31b66e5 100644 --- a/partner_multi_relation/models/res_partner_relation.py +++ b/partner_multi_relation/models/res_partner_relation.py @@ -3,7 +3,7 @@ # pylint: disable=api-one-deprecated """Store relations (connections) between partners.""" -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import ValidationError @@ -46,10 +46,10 @@ class ResPartnerRelation(models.Model): @api.model_create_multi def create(self, vals_list): """Override create to correct values, before being stored.""" - context = self.env.context + active_id = self.env.context.get("active_id") for vals in vals_list: - if "left_partner_id" not in vals and context.get("active_id"): - vals["left_partner_id"] = context.get("active_id") + if "left_partner_id" not in vals and active_id: + vals["left_partner_id"] = active_id return super().create(vals_list) @api.constrains("date_start", "date_end") @@ -65,7 +65,7 @@ def _check_dates(self): and record.date_start > record.date_end ): raise ValidationError( - _("The starting date cannot be after the ending date.") + self.env._("The starting date cannot be after the ending date.") ) @api.constrains("left_partner_id", "type_id") @@ -91,22 +91,31 @@ def _check_partner(self, side): :raises ValidationError: When constraint is violated """ for record in self: - assert side in ["left", "right"] - ptype = getattr(record.type_id, "contact_type_%s" % side) - partner = getattr(record, "%s_partner_id" % side) + if side not in ["left", "right"]: + raise ValidationError( + self.env._( + 'Programming error: Argument "side" of method "_check_partner"' + ' can just be called with a value of "left" or "right".', + ), + ) + ptype = getattr(record.type_id, f"contact_type_{side}") + partner = getattr(record, f"{side}_partner_id") if (ptype == "c" and not partner.is_company) or ( ptype == "p" and partner.is_company ): raise ValidationError( - _("The %s partner is not applicable for this " "relation type.") - % side + self.env._( + "The %s partner is not applicable for this relation type.", side + ) ) - category = getattr(record.type_id, "partner_category_%s" % side) + category = getattr(record.type_id, f"partner_category_{side}") if category and category.id not in partner.category_id.ids: raise ValidationError( - _( - "The {partner} partner does not have category {category}." - ).format(partner=side, category=category.name) + self.env._( + "The %s partner does not have category %s.", + side, + category.name, + ) ) @api.constrains("left_partner_id", "right_partner_id") @@ -119,7 +128,7 @@ def _check_not_with_self(self): if record.left_partner_id == record.right_partner_id: if not (record.type_id and record.type_id.allow_self): raise ValidationError( - _("Partners cannot have a relation with themselves.") + self.env._("Partners cannot have a relation with themselves.") ) @api.constrains( @@ -131,8 +140,6 @@ def _check_relation_uniqueness(self): :raises ValidationError: When constraint is violated """ - # pylint: disable=no-member - # pylint: disable=no-value-for-parameter for record in self: domain = [ ("type_id", "=", record.type_id.id), @@ -154,5 +161,7 @@ def _check_relation_uniqueness(self): ] if record.search(domain): raise ValidationError( - _("There is already a similar relation with overlapping dates") + self.env._( + "There is already a similar relation with overlapping dates" + ) ) diff --git a/partner_multi_relation/models/res_partner_relation_all.py b/partner_multi_relation/models/res_partner_relation_all.py index 4a2e0394207..05e1b89a78f 100644 --- a/partner_multi_relation/models/res_partner_relation_all.py +++ b/partner_multi_relation/models/res_partner_relation_all.py @@ -6,7 +6,7 @@ from psycopg2.extensions import AsIs -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import MissingError, ValidationError from odoo.tools import drop_view_if_exists @@ -216,7 +216,10 @@ def _search_any_partner_id(self, operator, value): ) def _compute_display_name(self): for record in self: - record.display_name = f"{record.this_partner_id.name} {record.type_selection_id.display_name} {record.other_partner_id.name}" + record.display_name = ( + f"{record.this_partner_id.name} {record.type_selection_id.display_name}" + f" {record.other_partner_id.name}" + ) @api.onchange("type_selection_id") def onchange_type_selection_id(self): @@ -234,14 +237,14 @@ def check_partner_domain(partner, partner_domain, side): partner_model = self.env["res.partner"] partners_found = partner_model.search(test_domain, limit=1) if not partners_found: - warning["title"] = _("Error!") + warning["title"] = self.env._("Error!") if partner: - warning["message"] = ( - _("%s partner incompatible with relation type.") % side.title() + warning["message"] = self.env._( + "%s partner incompatible with relation type.", side.title() ) else: - warning["message"] = ( - _("No %s partner available for relation type.") % side + warning["message"] = self.env._( + "No %s partner available for relation type.", side ) return warning @@ -286,10 +289,12 @@ def check_partner_domain(partner, partner_domain, side): ) if this_partner_id: this_partner = partner_model.browse(this_partner_id) - warning = check_partner_domain(this_partner, this_partner_domain, _("this")) + warning = check_partner_domain( + this_partner, this_partner_domain, self.env._("this") + ) if not warning and other_partner_domain: warning = check_partner_domain( - self.other_partner_id, other_partner_domain, _("other") + self.other_partner_id, other_partner_domain, self.env._("other") ) if warning: result["warning"] = warning @@ -314,8 +319,8 @@ def check_type_selection_domain(type_selection_domain): type_model = self.env["res.partner.relation.type.selection"] types_found = type_model.search(test_domain, limit=1) if not types_found: - warning["title"] = _("Error!") - warning["message"] = _( + warning["title"] = self.env._("Error!") + warning["message"] = self.env._( "Relation type incompatible with selected partner(s)." ) return warning @@ -444,7 +449,7 @@ def create(self, vals_list): type_selection = self._get_type_selection_from_vals(vals) if not type_selection: # Should not happen raise ValidationError( - _("No relation type specified in vals: %s.") % vals + self.env._("No relation type specified in vals: %s.", vals) ) corrected_vals.append(self._correct_vals(vals, type_selection)) type_selections.append(type_selection) diff --git a/partner_multi_relation/models/res_partner_relation_type.py b/partner_multi_relation/models/res_partner_relation_type.py index 9035da451dd..07e590663a6 100644 --- a/partner_multi_relation/models/res_partner_relation_type.py +++ b/partner_multi_relation/models/res_partner_relation_type.py @@ -2,15 +2,24 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). """Define the type of relations that can exist between partners.""" -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import ValidationError from odoo.osv.expression import AND, OR HANDLE_INVALID_ONCHANGE = [ - ("restrict", _("Do not allow change that will result in invalid relations")), - ("ignore", _("Allow existing relations that do not fit changed conditions")), - ("end", _("End relations per today, if they do not fit changed conditions")), - ("delete", _("Delete relations that do not fit changed conditions")), + ( + "restrict", + "Do not allow change that will result in invalid relations", + ), + ( + "ignore", + "Allow existing relations that do not fit changed conditions", + ), + ( + "end", + "End relations per today, if they do not fit changed conditions", + ), + ("delete", "Delete relations that do not fit changed conditions"), ] @@ -61,7 +70,7 @@ class ResPartnerRelationType(models.Model): def get_partner_types(self): """A partner can be an organisation or an individual.""" # pylint: disable=no-self-use - return [("c", _("Organisation")), ("p", _("Person"))] + return [("c", self.env._("Organisation")), ("p", self.env._("Person"))] @api.model def _end_active_relations(self, relations): @@ -77,12 +86,16 @@ def _end_active_relations(self, relations): :param relations: a recordset of relations (not necessarily all active) """ today = fields.Date.today() + relations_to_delete = self.env["res.partner.relation"] + relations_to_update = self.env["res.partner.relation"] for relation in relations: if relation.date_start and relation.date_start >= today: - relation.unlink() - + relations_to_delete += relation elif not relation.date_end or relation.date_end > today: - relation.write({"date_end": today}) + relations_to_update += relation + relations_to_delete.unlink() + relations_to_update.write({"date_end": today}) + self.env.flush_all() def check_existing(self, vals): """Check wether records exist that do not fit new criteria.""" @@ -90,8 +103,8 @@ def check_existing(self, vals): def get_type_condition(vals, side): """Add if needed check for contact type.""" - fieldname1 = "contact_type_%s" % side - fieldname2 = "%s_partner_id.is_company" % side + fieldname1 = f"contact_type_{side}" + fieldname2 = f"{side}_partner_id.is_company" contact_type = fieldname1 in vals and vals[fieldname1] or False if contact_type == "c": # Records that are not companies are invalid: @@ -99,17 +112,17 @@ def get_type_condition(vals, side): if contact_type == "p": # Records that are companies are invalid: return [(fieldname2, "=", True)] - return [] + return [(0, "=", 1)] def get_category_condition(vals, side): """Add if needed check for partner category.""" - fieldname1 = "partner_category_%s" % side - fieldname2 = "%s_partner_id.category_id" % side + fieldname1 = f"partner_category_{side}" + fieldname2 = f"{side}_partner_id.category_id" category_id = fieldname1 in vals and vals[fieldname1] or False if category_id: # Records that do not have the specified category are invalid: return [(fieldname2, "not in", [category_id])] - return [] + return [(0, "=", 1)] for this in self: handling = ( @@ -119,7 +132,7 @@ def get_category_condition(vals, side): ) if handling == "ignore": continue - invalid_conditions = [] + invalid_conditions = [(0, "=", 1)] for side in ["left", "right"]: invalid_conditions = OR( [invalid_conditions, get_type_condition(vals, side)] @@ -128,7 +141,7 @@ def get_category_condition(vals, side): [invalid_conditions, get_category_condition(vals, side)] ) if not invalid_conditions: - return + continue # only look at relations for this type invalid_domain = AND([[("type_id", "=", this.id)], invalid_conditions]) invalid_relations = relation_model.with_context(active_test=False).search( @@ -137,7 +150,7 @@ def get_category_condition(vals, side): if invalid_relations: if handling == "restrict": raise ValidationError( - _( + self.env._( "There are already relations not satisfying the" " conditions for partner type or category." ) @@ -169,22 +182,23 @@ def _check_no_existing_reflexive_relations(self): relations = relation_type._get_reflexive_relations() if relations: raise ValidationError( - _( + self.env._( "Reflexivity could not be disabled for the relation " - "type {relation_type}. There are existing reflexive " + "type %s. There are existing reflexive " "relations defined for the following partners: " - "{partners}" - ).format( - relation_type=relation_type.display_name, - partners=relations.mapped("left_partner_id.display_name"), + "%s", + relation_type.display_name, + relations.mapped("left_partner_id.display_name"), ) ) def _delete_existing_reflexive_relations(self): """Delete existing reflexive relations for these relation types.""" + relations_to_delete = self.env["res.partner.relation"] for relation_type in self: relations = relation_type._get_reflexive_relations() - relations.unlink() + relations_to_delete += relations + relations_to_delete.unlink() def _end_active_reflexive_relations(self): """End active reflexive relations for these relation types.""" @@ -247,13 +261,18 @@ def write(self, vals): def unlink(self): """Allow delete of relation type, even when connections exist. - Relations can be deleted if relation type allows it. + Relations can be deleted if relation type allows it, so existing relations do + not prevent unlink of relation type. """ - relation_model = self.env["res.partner.relation"] - for rec in self: - if rec.handle_invalid_onchange == "delete": - # Automatically delete relations, so existing relations - # do not prevent unlink of relation type: - relations = relation_model.search([("type_id", "=", rec.id)]) - relations.unlink() + self.env["res.partner.relation"].search( + [ + ( + "type_id", + "in", + self.filtered( + lambda rel_type: rel_type.handle_invalid_onchange == "delete" + ).ids, + ) + ], + ).unlink() return super().unlink() diff --git a/partner_multi_relation/readme/CONTRIBUTORS.md b/partner_multi_relation/readme/CONTRIBUTORS.md index c24cc729f4c..ae86280a72b 100644 --- a/partner_multi_relation/readme/CONTRIBUTORS.md +++ b/partner_multi_relation/readme/CONTRIBUTORS.md @@ -9,3 +9,4 @@ () - [DynApps NV](https://www.dynapps.be): - Raf Ven +- Marcin Chechłacz \<\> diff --git a/partner_multi_relation/security/ir.model.access.csv b/partner_multi_relation/security/ir.model.access.csv index 3fd6af48fbd..89c32238ecb 100644 --- a/partner_multi_relation/security/ir.model.access.csv +++ b/partner_multi_relation/security/ir.model.access.csv @@ -1,8 +1,8 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -read_res_partner_relation,access_res_partner_relation,model_res_partner_relation,,1,0,0,0 -read_res_partner_relation_all,access_res_partner_relation,model_res_partner_relation_all,,1,0,0,0 -read_res_partner_relation_type,access_res_partner_relation_type,model_res_partner_relation_type,,1,0,0,0 -read_res_partner_relation_type_selection,access_res_partner_relation_type,model_res_partner_relation_type_selection,,1,0,0,0 +read_res_partner_relation,access_res_partner_relation,model_res_partner_relation,base.group_user,1,0,0,0 +read_res_partner_relation_all,access_res_partner_relation,model_res_partner_relation_all,base.group_user,1,0,0,0 +read_res_partner_relation_type,access_res_partner_relation_type,model_res_partner_relation_type,base.group_user,1,0,0,0 +read_res_partner_relation_type_selection,access_res_partner_relation_type,model_res_partner_relation_type_selection,base.group_user,1,0,0,0 crud_res_partner_relation,access_res_partner_relation,model_res_partner_relation,base.group_partner_manager,1,1,1,1 crud_res_partner_relation_all,access_res_partner_relation,model_res_partner_relation_all,base.group_partner_manager,1,1,1,1 crud_res_partner_relation_type,access_res_partner_relation_type,model_res_partner_relation_type,sales_team.group_sale_manager,1,1,1,1 diff --git a/partner_multi_relation/static/description/index.html b/partner_multi_relation/static/description/index.html index dfe6c51fcd4..ea6874b642d 100644 --- a/partner_multi_relation/static/description/index.html +++ b/partner_multi_relation/static/description/index.html @@ -369,7 +369,7 @@

Partner Relations

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:f4895f23ab68ab38eb0f9d9d1e2cd942e4a663a44835bb25431aab75ff3152c9 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/partner-contact Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/partner-contact Translate me on Weblate Try me on Runboat

This module aims to provide generic means to model relations between partners.

Examples would be ‘is sibling of’ or ‘is friend of’, but also ‘has @@ -493,7 +493,7 @@

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -521,6 +521,7 @@

Contributors

  • Raf Ven
  • +
  • Marcin Chechłacz <marcin.chechlacz@braintec.com>
  • @@ -532,7 +533,7 @@

    Maintainers

    OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

    -

    This module is part of the OCA/partner-contact project on GitHub.

    +

    This module is part of the OCA/partner-contact project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/partner_multi_relation/tests/test_partner_relation_all.py b/partner_multi_relation/tests/test_partner_relation_all.py index 9a7005fe347..e814e2b53b6 100644 --- a/partner_multi_relation/tests/test_partner_relation_all.py +++ b/partner_multi_relation/tests/test_partner_relation_all.py @@ -73,7 +73,8 @@ def test_display_name(self): relation = self._create_company2person_relation() self.assertEqual( relation.display_name, - f"{relation.this_partner_id.name} {relation.type_selection_id.name} {relation.other_partner_id.name}", + f"{relation.this_partner_id.name} {relation.type_selection_id.name} " + f"{relation.other_partner_id.name}", ) def test_regular_write(self): @@ -172,7 +173,8 @@ def test_inverse_creation(self): # Check wether display name is what we should expect: self.assertEqual( relation.display_name, - f"{self.partner_01_person.name} {self.selection_person2company.name} {self.partner_02_company.name}", + f"{self.partner_01_person.name} {self.selection_person2company.name} " + f"{self.partner_02_company.name}", ) def test_inverse_creation_type_id(self): @@ -188,7 +190,8 @@ def test_inverse_creation_type_id(self): # Check wether display name is what we should expect: self.assertEqual( relation.display_name, - f"{self.partner_01_person.name} {self.selection_person2company.name} {self.partner_02_company.name}", + f"{self.partner_01_person.name} {self.selection_person2company.name} " + f"{self.partner_02_company.name}", ) def test_unlink(self): diff --git a/partner_multi_relation/tests/test_partner_relation_common.py b/partner_multi_relation/tests/test_partner_relation_common.py index 4fb9cfd9171..09896260bf2 100644 --- a/partner_multi_relation/tests/test_partner_relation_common.py +++ b/partner_multi_relation/tests/test_partner_relation_common.py @@ -4,46 +4,47 @@ class TestPartnerRelationCommon(common.TransactionCase): - def setUp(self): - super().setUp() - - self.partner_model = self.env["res.partner"] - self.category_model = self.env["res.partner.category"] - self.type_model = self.env["res.partner.relation.type"] - self.selection_model = self.env["res.partner.relation.type.selection"] - self.relation_model = self.env["res.partner.relation"] - self.relation_all_model = self.env["res.partner.relation.all"] - self.partner_01_person = self.partner_model.create( + @classmethod + def setUpClass(cls): + """Main Set Up Class.""" + super().setUpClass() + cls.partner_model = cls.env["res.partner"] + cls.category_model = cls.env["res.partner.category"] + cls.type_model = cls.env["res.partner.relation.type"] + cls.selection_model = cls.env["res.partner.relation.type.selection"] + cls.relation_model = cls.env["res.partner.relation"] + cls.relation_all_model = cls.env["res.partner.relation.all"] + cls.partner_01_person = cls.partner_model.create( {"name": "Test User 1", "is_company": False, "ref": "PR01"} ) - self.partner_02_company = self.partner_model.create( + cls.partner_02_company = cls.partner_model.create( {"name": "Test Company", "is_company": True, "ref": "PR02"} ) # Create partners with specific categories: - self.category_01_ngo = self.category_model.create({"name": "NGO"}) - self.partner_03_ngo = self.partner_model.create( + cls.category_01_ngo = cls.category_model.create({"name": "NGO"}) + cls.partner_03_ngo = cls.partner_model.create( { "name": "Test NGO", "is_company": True, "ref": "PR03", - "category_id": [(4, self.category_01_ngo.id)], + "category_id": [(4, cls.category_01_ngo.id)], } ) - self.category_02_volunteer = self.category_model.create({"name": "Volunteer"}) - self.partner_04_volunteer = self.partner_model.create( + cls.category_02_volunteer = cls.category_model.create({"name": "Volunteer"}) + cls.partner_04_volunteer = cls.partner_model.create( { "name": "Test Volunteer", "is_company": False, "ref": "PR04", - "category_id": [(4, self.category_02_volunteer.id)], + "category_id": [(4, cls.category_02_volunteer.id)], } ) # Create a new relation type withouth categories: ( - self.type_company2person, - self.selection_company2person, - self.selection_person2company, - ) = self._create_relation_type_selection( + cls.type_company2person, + cls.selection_company2person, + cls.selection_person2company, + ) = cls._create_relation_type_selection( { "name": "mixed", "name_inverse": "mixed_inverse", @@ -53,55 +54,40 @@ def setUp(self): ) # Create a new relation type with categories: ( - self.type_ngo2volunteer, - self.selection_ngo2volunteer, - self.selection_volunteer2ngo, - ) = self._create_relation_type_selection( + cls.type_ngo2volunteer, + cls.selection_ngo2volunteer, + cls.selection_volunteer2ngo, + ) = cls._create_relation_type_selection( { "name": "NGO has volunteer", "name_inverse": "volunteer works for NGO", "contact_type_left": "c", "contact_type_right": "p", - "partner_category_left": self.category_01_ngo.id, - "partner_category_right": self.category_02_volunteer.id, + "partner_category_left": cls.category_01_ngo.id, + "partner_category_right": cls.category_02_volunteer.id, } ) - def _create_relation_type_selection(self, vals): + @classmethod + def _create_relation_type_selection(cls, vals): """Create relation type and return this with selection types.""" - assert "name" in vals, ( - "Name missing in vals to create relation type. Vals: %s." % vals - ) - assert "name" in vals, ( - "Name_inverse missing in vals to create relation type. Vals: %s." % vals - ) vals_list = [vals] - new_type = self.type_model.create(vals_list) - self.assertTrue(new_type, msg="No relation type created with vals %s." % vals) - selection_types = self.selection_model.search([("type_id", "=", new_type.id)]) + new_type = cls.type_model.create(vals_list) + selection_types = cls.selection_model.search([("type_id", "=", new_type.id)]) for st in selection_types: if st.is_inverse: inverse_type_selection = st else: type_selection = st - self.assertTrue( - inverse_type_selection, - msg="Failed to find inverse type selection based on" - " relation type created with vals %s." % vals, - ) - self.assertTrue( - type_selection, - msg="Failed to find type selection based on" - " relation type created with vals %s." % vals, - ) return (new_type, type_selection, inverse_type_selection) - def _create_company2person_relation(self): + @classmethod + def _create_company2person_relation(cls): """Utility function to get a relation from company 2 partner.""" - return self.relation_all_model.create( + return cls.relation_all_model.create( { - "type_selection_id": self.selection_company2person.id, - "this_partner_id": self.partner_02_company.id, - "other_partner_id": self.partner_01_person.id, + "type_selection_id": cls.selection_company2person.id, + "this_partner_id": cls.partner_02_company.id, + "other_partner_id": cls.partner_01_person.id, } ) diff --git a/partner_multi_relation/views/menu.xml b/partner_multi_relation/views/menu.xml index 189bfbeacd1..2972b449672 100644 --- a/partner_multi_relation/views/menu.xml +++ b/partner_multi_relation/views/menu.xml @@ -15,7 +15,7 @@ Partner Relations Types res.partner.relation.type - tree,form + list,form Show partner's relations res.partner.relation.all - tree,form + list,form [('this_partner_id', 'in', active_ids)] diff --git a/partner_multi_relation/views/res_partner_relation_all.xml b/partner_multi_relation/views/res_partner_relation_all.xml index b9409434c10..f49f9ba521a 100644 --- a/partner_multi_relation/views/res_partner_relation_all.xml +++ b/partner_multi_relation/views/res_partner_relation_all.xml @@ -3,7 +3,7 @@ res.partner.relation.all - + - + @@ -71,7 +71,7 @@ Relations res.partner.relation.all - tree + list {'active_test': 0} diff --git a/partner_multi_relation/views/res_partner_relation_type.xml b/partner_multi_relation/views/res_partner_relation_type.xml index ce41ca84baa..ceef3dbf11f 100644 --- a/partner_multi_relation/views/res_partner_relation_type.xml +++ b/partner_multi_relation/views/res_partner_relation_type.xml @@ -3,14 +3,14 @@ res.partner.relation.type - + - +