diff --git a/partner_multi_relation/README.rst b/partner_multi_relation/README.rst index 5b891c692..f73d5aaa6 100644 --- a/partner_multi_relation/README.rst +++ b/partner_multi_relation/README.rst @@ -1,6 +1,8 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License +.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 +================= Partner Relations ================= @@ -57,9 +59,22 @@ For further information, please visit: * https://www.odoo.com/forum/help-1 + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/134/11.0 + Known issues / Roadmap ====================== +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 smash it by providing detailed and welcomed feedback. + Credits ======= @@ -76,9 +91,9 @@ Contributors Maintainer ---------- -.. image:: http://odoo-community.org/logo.png +.. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association - :target: http://odoo-community.org + :target: https://odoo-community.org This module is maintained by the OCA. @@ -86,4 +101,4 @@ 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. -To contribute to this module, please visit http://odoo-community.org. +To contribute to this module, please visit https://odoo-community.org. diff --git a/partner_multi_relation/__init__.py b/partner_multi_relation/__init__.py index c3e6b003f..197516703 100644 --- a/partner_multi_relation/__init__.py +++ b/partner_multi_relation/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2013-2017 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import models diff --git a/partner_multi_relation/__manifest__.py b/partner_multi_relation/__manifest__.py index 1ed334d82..33fa9d4db 100644 --- a/partner_multi_relation/__manifest__.py +++ b/partner_multi_relation/__manifest__.py @@ -1,15 +1,14 @@ -# -*- coding: utf-8 -*- # Copyright 2013-2017 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { - "name": "Partner relations", - "version": "10.0.1.0.1", + "name": "Partner Relations", + "version": "1.0.0", "author": "Therp BV,Camptocamp,Odoo Community Association (OCA)", "complexity": "normal", "category": "Customer Relationship Management", "license": "AGPL-3", "depends": [ - 'base', + 'contacts', 'sales_team', ], "demo": [ diff --git a/partner_multi_relation/models/__init__.py b/partner_multi_relation/models/__init__.py index 5890ea7e0..2ec0ea3a2 100644 --- a/partner_multi_relation/models/__init__.py +++ b/partner_multi_relation/models/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2013-2017 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import res_partner_relation_type diff --git a/partner_multi_relation/models/res_partner.py b/partner_multi_relation/models/res_partner.py index bfaabdea9..e37ce4157 100644 --- a/partner_multi_relation/models/res_partner.py +++ b/partner_multi_relation/models/res_partner.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2013-2017 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). """Support connections between partners.""" @@ -143,7 +142,7 @@ class ResPartner(models.Model): # pylint: disable=no-value-for-parameter date_args = [] for arg in args: - if (is_leaf(arg) and isinstance(arg[0], basestring) and + if (is_leaf(arg) and isinstance(arg[0], str) and arg[0].startswith('search_relation')): if arg[0] == 'search_relation_date': date_args = [] @@ -156,7 +155,7 @@ class ResPartner(models.Model): active_args = [] if self.env.context.get('active_test', True): for arg in args: - if (is_leaf(arg) and isinstance(arg[0], basestring) and + if (is_leaf(arg) and isinstance(arg[0], str) and arg[0].startswith('search_relation')): active_args = [('relation_all_ids.active', '=', True)] break diff --git a/partner_multi_relation/models/res_partner_relation.py b/partner_multi_relation/models/res_partner_relation.py index e19b9aaf6..01972214a 100644 --- a/partner_multi_relation/models/res_partner_relation.py +++ b/partner_multi_relation/models/res_partner_relation.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2013-2017 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # pylint: disable=api-one-deprecated diff --git a/partner_multi_relation/models/res_partner_relation_all.py b/partner_multi_relation/models/res_partner_relation_all.py index 84525d4e8..8d1ba15bb 100644 --- a/partner_multi_relation/models/res_partner_relation_all.py +++ b/partner_multi_relation/models/res_partner_relation_all.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2014-2017 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # pylint: disable=method-required-super @@ -430,7 +429,7 @@ CREATE OR REPLACE VIEW %%(table)s AS rec.write_resource(base_resource, vals) # Invalidate cache to make res.partner.relation.all reflect changes # in underlying res.partner.relation: - self.env.invalidate_all() + self.env.clear() return True @api.model diff --git a/partner_multi_relation/models/res_partner_relation_type.py b/partner_multi_relation/models/res_partner_relation_type.py index ad8eec3f5..1a6aa2fa2 100644 --- a/partner_multi_relation/models/res_partner_relation_type.py +++ b/partner_multi_relation/models/res_partner_relation_type.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2013-2018 Therp BV . # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). """Define the type of relations that can exist between partners.""" @@ -152,7 +151,8 @@ class ResPartnerRelationType(models.Model): # already ended: cutoff_date = fields.Date.today() for relation in invalid_relations: - if relation.date_start >= cutoff_date: + if (relation.date_start and + relation.date_start >= cutoff_date): relation.unlink() elif (not relation.date_end or relation.date_end > cutoff_date): 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 bb01c38d3..7a00b044d 100644 --- a/partner_multi_relation/models/res_partner_relation_type_selection.py +++ b/partner_multi_relation/models/res_partner_relation_type_selection.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2013-2017 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). """ diff --git a/partner_multi_relation/tests/__init__.py b/partner_multi_relation/tests/__init__.py index 272f6d49f..70329c08d 100644 --- a/partner_multi_relation/tests/__init__.py +++ b/partner_multi_relation/tests/__init__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from . import test_partner_relation_common diff --git a/partner_multi_relation/tests/test_partner_relation.py b/partner_multi_relation/tests/test_partner_relation.py index 8768c95d5..dfb64b449 100644 --- a/partner_multi_relation/tests/test_partner_relation.py +++ b/partner_multi_relation/tests/test_partner_relation.py @@ -1,9 +1,7 @@ -# -*- coding: utf-8 -*- # Copyright 2016-2017 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from datetime import date from dateutil.relativedelta import relativedelta -from psycopg2 import IntegrityError from openerp import fields from openerp.exceptions import ValidationError @@ -235,38 +233,6 @@ class TestPartnerRelation(TestPartnerRelationCommon): 'contact_type_right': 'p'}) self.assertFalse(relation_bart2lisa.exists()) - def test_relation_type_unlink_dberror(self): - """Test deleting relation type when not possible. - - This test will catch a DB Integrity error. Because of that the - cursor will be invalidated, and further tests using the objects - will not be possible. - """ - # First create a relation type having restrict particular conditions. - type_model = self.env['res.partner.relation.type'] - relation_model = self.env['res.partner.relation'] - partner_model = self.env['res.partner'] - type_school2student = type_model.create({ - 'name': 'school has student', - 'name_inverse': 'studies at school', - 'handle_invalid_onchange': 'restrict'}) - # Second create relation based on those conditions. - partner_school = partner_model.create({ - 'name': 'Test School', - 'is_company': True, - 'ref': 'TS'}) - partner_bart = partner_model.create({ - 'name': 'Bart Simpson', - 'is_company': False, - 'ref': 'BS'}) - relation_model.create({ - 'left_partner_id': partner_school.id, - 'type_id': type_school2student.id, - 'right_partner_id': partner_bart.id}) - # Unlink should for the moment lead to error because of restrict: - with self.assertRaises(IntegrityError): - type_school2student.unlink() - def test_relation_type_unlink(self): """Test delete of relation type, including deleting relations.""" # First create a relation type having restrict particular conditions. diff --git a/partner_multi_relation/tests/test_partner_relation_all.py b/partner_multi_relation/tests/test_partner_relation_all.py index 8da567e61..e00f814d6 100644 --- a/partner_multi_relation/tests/test_partner_relation_all.py +++ b/partner_multi_relation/tests/test_partner_relation_all.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016-2017 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp.exceptions import ValidationError diff --git a/partner_multi_relation/tests/test_partner_relation_common.py b/partner_multi_relation/tests/test_partner_relation_common.py index fde3d5385..10d830082 100644 --- a/partner_multi_relation/tests/test_partner_relation_common.py +++ b/partner_multi_relation/tests/test_partner_relation_common.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp.tests import common diff --git a/partner_multi_relation/tests/test_partner_search.py b/partner_multi_relation/tests/test_partner_search.py index 153b35b78..aa1f0e11e 100644 --- a/partner_multi_relation/tests/test_partner_search.py +++ b/partner_multi_relation/tests/test_partner_search.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2015 Camptocamp SA # Copyright 2016 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). diff --git a/partner_multi_relation/views/menu.xml b/partner_multi_relation/views/menu.xml index 05cb81d4b..ad3c75bda 100644 --- a/partner_multi_relation/views/menu.xml +++ b/partner_multi_relation/views/menu.xml @@ -2,9 +2,16 @@ + + @@ -17,7 +24,8 @@ diff --git a/partner_multi_relation/views/res_partner_relation_all.xml b/partner_multi_relation/views/res_partner_relation_all.xml index 76d3a0ea0..827d48cfd 100644 --- a/partner_multi_relation/views/res_partner_relation_all.xml +++ b/partner_multi_relation/views/res_partner_relation_all.xml @@ -82,6 +82,7 @@ name="search_view_id" ref="search_res_partner_relation_all" /> + {'active_test': 0}

Record and track your partners' relations. Relations may