Browse Source
Merge pull request #551 from yvaucher/fix-changeset-test-to-avoid-breaking-others
[10.0] partner_changeset - Adapt tests to play nicely with other module tests
pull/550/head
Pedro M. Baeza
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
6 additions and
2 deletions
-
partner_changeset/__manifest__.py
-
partner_changeset/models/res_partner.py
-
partner_changeset/tests/test_changeset_origin.py
|
@ -3,7 +3,7 @@ |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
|
{'name': 'Partner Changesets', |
|
|
{'name': 'Partner Changesets', |
|
|
'version': '10.0.1.0.0', |
|
|
|
|
|
|
|
|
'version': '10.0.1.0.1', |
|
|
'author': 'Camptocamp, Odoo Community Association (OCA)', |
|
|
'author': 'Camptocamp, Odoo Community Association (OCA)', |
|
|
'license': 'AGPL-3', |
|
|
'license': 'AGPL-3', |
|
|
'category': 'Sales Management', |
|
|
'category': 'Sales Management', |
|
|
|
@ -27,7 +27,9 @@ class ResPartner(models.Model): |
|
|
|
|
|
|
|
|
@api.multi |
|
|
@api.multi |
|
|
def write(self, values): |
|
|
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) |
|
|
return super(ResPartner, self).write(values) |
|
|
else: |
|
|
else: |
|
|
changeset_model = self.env['res.partner.changeset'] |
|
|
changeset_model = self.env['res.partner.changeset'] |
|
|
|
@ -30,6 +30,8 @@ class TestChangesetOrigin(ChangesetMixin, common.TransactionCase): |
|
|
self.partner = self.env['res.partner'].create({ |
|
|
self.partner = self.env['res.partner'].create({ |
|
|
'name': 'X', |
|
|
'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): |
|
|
def test_origin_value_of_change_with_apply(self): |
|
|
""" Origin field is read from the parter or 'old' - with apply |
|
|
""" Origin field is read from the parter or 'old' - with apply |
|
|