From 696645934c3a723e10a2556497ce490b76483913 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Thu, 18 Jan 2018 15:31:52 +0100 Subject: [PATCH] Adapt tests to play nicely with other module tests --- partner_changeset/__manifest__.py | 2 +- partner_changeset/models/res_partner.py | 4 +++- partner_changeset/tests/test_changeset_origin.py | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/partner_changeset/__manifest__.py b/partner_changeset/__manifest__.py index 91ee56e31..99b9c5d0c 100644 --- a/partner_changeset/__manifest__.py +++ b/partner_changeset/__manifest__.py @@ -3,7 +3,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). {'name': 'Partner Changesets', - 'version': '10.0.1.0.0', + 'version': '10.0.1.0.1', 'author': 'Camptocamp, Odoo Community Association (OCA)', 'license': 'AGPL-3', 'category': 'Sales Management', diff --git a/partner_changeset/models/res_partner.py b/partner_changeset/models/res_partner.py index c29488a4a..fb5ff454b 100644 --- a/partner_changeset/models/res_partner.py +++ b/partner_changeset/models/res_partner.py @@ -27,7 +27,9 @@ class ResPartner(models.Model): @api.multi def write(self, values): - if self.env.context.get('__no_changeset'): + if (self.env.context.get('__no_changeset') or + self.env.context.get('test_enable') and + not self.env.context.get('test_partner_changeset')): return super(ResPartner, self).write(values) else: changeset_model = self.env['res.partner.changeset'] diff --git a/partner_changeset/tests/test_changeset_origin.py b/partner_changeset/tests/test_changeset_origin.py index bac7baabf..7b022f230 100644 --- a/partner_changeset/tests/test_changeset_origin.py +++ b/partner_changeset/tests/test_changeset_origin.py @@ -30,6 +30,8 @@ class TestChangesetOrigin(ChangesetMixin, common.TransactionCase): self.partner = self.env['res.partner'].create({ 'name': 'X', }) + # Add context for this test for compatibility with other modules' tests + self.partner = self.partner.with_context(test_partner_changeset=True) def test_origin_value_of_change_with_apply(self): """ Origin field is read from the parter or 'old' - with apply