Browse Source

[FIX] add index on contact_type

pull/347/head
Nicolas JEUDY 8 years ago
parent
commit
9902dc15a5
  1. 1
      partner_contact_in_several_companies/models/res_partner.py
  2. 4
      partner_contact_in_several_companies/tests/test_partner_contact_in_several_companies.py

1
partner_contact_in_several_companies/models/res_partner.py

@ -15,6 +15,7 @@ class ResPartner(models.Model):
compute='_get_contact_type',
store=True,
required=True,
index=True,
default='standalone')
contact_id = fields.Many2one('res.partner', string='Main Contact',
domain=[('is_company', '=', False),

4
partner_contact_in_several_companies/tests/test_partner_contact_in_several_companies.py

@ -115,7 +115,7 @@ class PartnerContactInSeveralCompaniesCase(common.TransactionCase):
# should contain Bob position.
partner_ids = self.partner.search(
[('parent_id', 'ilike', 'YourCompany')])
self.assertTrue(len(self.bob_job1 & partner_ids) != 0)
self.assertTrue(self.bob_job1 in partner_ids)
# but when searching without 'all positions',
# we should get the position standalone contact instead.
@ -124,7 +124,7 @@ class PartnerContactInSeveralCompaniesCase(common.TransactionCase):
}}
partner_ids = self.partner.with_context(ctx).search(
[('parent_id', 'ilike', 'YourCompany')])
self.assertTrue(len(self.bob_contact & partner_ids) == 0)
self.assertTrue(self.bob_contact not in partner_ids)
def test_04_contact_creation(self):
"""Check that we're begin to create a contact"""

Loading…
Cancel
Save