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
parent
commit
e063d6b9fd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      partner_changeset/__manifest__.py
  2. 4
      partner_changeset/models/res_partner.py
  3. 2
      partner_changeset/tests/test_changeset_origin.py

2
partner_changeset/__manifest__.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',

4
partner_changeset/models/res_partner.py

@ -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']

2
partner_changeset/tests/test_changeset_origin.py

@ -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

Loading…
Cancel
Save