diff --git a/partner_multi_relation/__init__.py b/partner_multi_relation/__init__.py index cb45f2710..c32fd62b7 100644 --- a/partner_multi_relation/__init__.py +++ b/partner_multi_relation/__init__.py @@ -1,2 +1,2 @@ -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from . import models diff --git a/partner_multi_relation/__manifest__.py b/partner_multi_relation/__manifest__.py index 15bc574c9..1465635c8 100644 --- a/partner_multi_relation/__manifest__.py +++ b/partner_multi_relation/__manifest__.py @@ -1,5 +1,5 @@ -# Copyright 2013-2017 Therp BV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# Copyright 2013-2020 Therp BV . +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "Partner Relations", "version": "13.0.1.0.0", diff --git a/partner_multi_relation/data/demo.xml b/partner_multi_relation/data/demo.xml index ed48b2dd5..c47c023f3 100644 --- a/partner_multi_relation/data/demo.xml +++ b/partner_multi_relation/data/demo.xml @@ -1,10 +1,10 @@ + turned out to be a bad idea to rely on demo data in base module, + that can change from release to release. Only dependency on + countries remain. They are less likely to change/disappear. + --> Is assistant of @@ -48,8 +48,6 @@ name="category_id" eval="[(6, 0, [ref('res_partner_category_pmr_11'), ref('res_partner_category_pmr_4')])]" /> - 1 - 1 1 Le Bourget du Lac 73377 @@ -65,7 +63,6 @@ name="category_id" eval="[(6, 0, [ref('res_partner_category_pmr_4'), ref('res_partner_category_pmr_11')])]" /> - 1 1 Champs sur Marne 77420 @@ -78,8 +75,6 @@ Super Washing Powder Company - 1 - 1 3rd Floor, Room 3-C, today: relation.write({"date_end": today}) - @api.multi def check_existing(self, vals): """Check wether records exist that do not fit new criteria.""" relation_model = self.env["res.partner.relation"] @@ -207,7 +206,6 @@ class ResPartnerRelationType(models.Model): end_relation_types = self.filtered(lambda t: t.handle_invalid_onchange == "end") end_relation_types._end_active_reflexive_relations() - @api.multi def _update_right_vals(self, vals): """Make sure that on symmetric relations, right vals follow left vals. @@ -231,7 +229,6 @@ class ResPartnerRelationType(models.Model): self._update_right_vals(vals) return super(ResPartnerRelationType, self).create(vals) - @api.multi def write(self, vals): """Handle existing relations if conditions change.""" self.check_existing(vals) @@ -248,7 +245,6 @@ class ResPartnerRelationType(models.Model): return True - @api.multi def unlink(self): """Allow delete of relation type, even when connections exist. diff --git a/partner_multi_relation/models/res_partner_relation_type_selection.py b/partner_multi_relation/models/res_partner_relation_type_selection.py index c6b54e786..e0fadd03d 100644 --- a/partner_multi_relation/models/res_partner_relation_type_selection.py +++ b/partner_multi_relation/models/res_partner_relation_type_selection.py @@ -73,7 +73,6 @@ class ResPartnerRelationTypeSelection(models.Model): """ return "" - @api.model_cr_context def _auto_init(self): cr = self._cr drop_view_if_exists(cr, self._table) @@ -121,7 +120,6 @@ CREATE OR REPLACE VIEW %(table)s AS ) return super(ResPartnerRelationTypeSelection, self)._auto_init() - @api.multi def name_get(self): """Get name or name_inverse from underlying model.""" return [ diff --git a/partner_multi_relation/readme/CONTRIBUTORS.rst b/partner_multi_relation/readme/CONTRIBUTORS.rst index 7d766f045..b5cede3b0 100644 --- a/partner_multi_relation/readme/CONTRIBUTORS.rst +++ b/partner_multi_relation/readme/CONTRIBUTORS.rst @@ -5,3 +5,4 @@ * Bruno Joliveau * Adriana Ierfino * Numigi (tm) and all its contributors (https://bit.ly/numigiens) +* Radovan Skolnik , KEMA SK s.r.o. (https://www.kema.sk) diff --git a/partner_multi_relation/tests/__init__.py b/partner_multi_relation/tests/__init__.py index e14c3bebc..a28c111cc 100644 --- a/partner_multi_relation/tests/__init__.py +++ b/partner_multi_relation/tests/__init__.py @@ -1,4 +1,4 @@ -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from . import test_partner_relation_common from . import test_partner_relation from . import test_partner_relation_all diff --git a/partner_multi_relation/tests/test_partner_relation.py b/partner_multi_relation/tests/test_partner_relation.py index 3b98d8e6f..c7d8ff64e 100644 --- a/partner_multi_relation/tests/test_partner_relation.py +++ b/partner_multi_relation/tests/test_partner_relation.py @@ -1,5 +1,5 @@ # Copyright 2016-2017 Therp BV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from datetime import date, datetime, timedelta from dateutil.relativedelta import relativedelta @@ -271,8 +271,7 @@ class TestPartnerRelation(TestPartnerRelationCommon): ) self.assertEqual(len(selection_symmetric), 2) # Now change to symmetric and test name and inverse name: - with self.env.do_in_draft(): - type_symmetric.write({"name": "sym", "is_symmetric": True}) + type_symmetric.write({"name": "sym", "is_symmetric": True}) self.assertEqual(type_symmetric.is_symmetric, True) self.assertEqual(type_symmetric.name_inverse, type_symmetric.name) self.assertEqual( @@ -287,6 +286,7 @@ class TestPartnerRelation(TestPartnerRelationCommon): "contact_type_right": type_symmetric.contact_type_right, } ) + type_symmetric.flush() # symmetric relation should result in only one record in # selection: selection_symmetric = self.selection_model.search( diff --git a/partner_multi_relation/tests/test_partner_relation_all.py b/partner_multi_relation/tests/test_partner_relation_all.py index 96125c9ce..94d9a1f9e 100644 --- a/partner_multi_relation/tests/test_partner_relation_all.py +++ b/partner_multi_relation/tests/test_partner_relation_all.py @@ -1,5 +1,5 @@ # Copyright 2016-2017 Therp BV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from datetime import date @@ -56,6 +56,8 @@ class TestPartnerRelation(TestPartnerRelationCommon): self.assertTrue(relation) self.assertEqual(relation.this_partner_id, self.partner_02_company) # Partner should have one relation now: + relation.invalidate_cache(None, relation.ids) + self.partner_01_person.flush() self.assertEqual(self.partner_01_person.relation_count, 1) # Test create without type_selection_id: with self.assertRaises(ValidationError): @@ -79,11 +81,10 @@ class TestPartnerRelation(TestPartnerRelationCommon): ), ) - def test__regular_write(self): + def test_regular_write(self): """Test write with valid data.""" relation = self._create_company2person_relation() relation.write({"date_start": "2014-09-01"}) - relation.invalidate_cache(ids=relation.ids) self.assertEqual(relation.date_start, date(2014, 9, 1)) def test_write_incompatible_dates(self): @@ -252,18 +253,17 @@ class TestPartnerRelation(TestPartnerRelationCommon): ) # 4. Test with invalid or impossible combinations relation_nobody = self._get_empty_relation() - with self.env.do_in_draft(): - relation_nobody.type_selection_id = self.selection_nobody + relation_nobody.type_selection_id = self.selection_nobody warning = relation_nobody.onchange_type_selection_id()["warning"] self.assertTrue("message" in warning) self.assertTrue("No this partner available" in warning["message"]) - with self.env.do_in_draft(): - relation_nobody.this_partner_id = self.partner_02_company + relation_nobody.this_partner_id = self.partner_02_company warning = relation_nobody.onchange_type_selection_id()["warning"] self.assertTrue("message" in warning) self.assertTrue("incompatible" in warning["message"]) # Allow left partner and check message for other partner: self.type_nobody.write({"partner_category_left": False}) + self.type_nobody.flush() self.selection_nobody.invalidate_cache(ids=self.selection_nobody.ids) warning = relation_nobody.onchange_type_selection_id()["warning"] self.assertTrue("message" in warning) @@ -284,9 +284,8 @@ class TestPartnerRelation(TestPartnerRelationCommon): self.assertTrue(("contact_type_this", "=", "c") in domain["type_selection_id"]) # 3. Test with invalid or impossible combinations relation_nobody = self._get_empty_relation() - with self.env.do_in_draft(): - relation_nobody.this_partner_id = self.partner_02_company - relation_nobody.type_selection_id = self.selection_nobody + relation_nobody.this_partner_id = self.partner_02_company + relation_nobody.type_selection_id = self.selection_nobody warning = relation_nobody.onchange_partner_id()["warning"] self.assertTrue("message" in warning) self.assertTrue("incompatible" in warning["message"]) diff --git a/partner_multi_relation/tests/test_partner_relation_common.py b/partner_multi_relation/tests/test_partner_relation_common.py index 05d472926..30b932ec2 100644 --- a/partner_multi_relation/tests/test_partner_relation_common.py +++ b/partner_multi_relation/tests/test_partner_relation_common.py @@ -1,5 +1,5 @@ # Copyright 2016 Therp BV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo.tests import common diff --git a/partner_multi_relation/tests/test_partner_search.py b/partner_multi_relation/tests/test_partner_search.py index 71451dc51..c200e045e 100644 --- a/partner_multi_relation/tests/test_partner_search.py +++ b/partner_multi_relation/tests/test_partner_search.py @@ -1,6 +1,6 @@ # Copyright 2015 Camptocamp SA # Copyright 2016 Therp BV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import fields from odoo.exceptions import ValidationError diff --git a/partner_multi_relation/views/res_partner.xml b/partner_multi_relation/views/res_partner.xml index d9a13a0b5..cd2aebf56 100644 --- a/partner_multi_relation/views/res_partner.xml +++ b/partner_multi_relation/views/res_partner.xml @@ -33,9 +33,8 @@ diff --git a/partner_multi_relation/views/res_partner_relation_all.xml b/partner_multi_relation/views/res_partner_relation_all.xml index 9c1614f12..23feee789 100644 --- a/partner_multi_relation/views/res_partner_relation_all.xml +++ b/partner_multi_relation/views/res_partner_relation_all.xml @@ -3,11 +3,7 @@ res.partner.relation.all - + Relations res.partner.relation.all - form tree {'active_test': 0}

- Record and track your partners' relations. Relations may - be linked to other partners with a type either directly - or inversely. -

+ Record and track your partners' relations. Relations may + be linked to other partners with a type either directly + or inversely. +