|
@ -1,4 +1,3 @@ |
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# Copyright 2017 Tecnativa - Jairo Llopis |
|
|
# Copyright 2017 Tecnativa - Jairo Llopis |
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
@ -45,7 +44,7 @@ class DynamicListCase(common.SavepointCase): |
|
|
self.list.dynamic = False |
|
|
self.list.dynamic = False |
|
|
# Create contact for partner 0 in unsynced list |
|
|
# Create contact for partner 0 in unsynced list |
|
|
contact0 = Contact.create({ |
|
|
contact0 = Contact.create({ |
|
|
"list_id": self.list.id, |
|
|
|
|
|
|
|
|
"list_ids": [(4, self.list.id, False)], |
|
|
"partner_id": self.partners[0].id, |
|
|
"partner_id": self.partners[0].id, |
|
|
}) |
|
|
}) |
|
|
self.assertEqual(self.list.contact_nbr, 1) |
|
|
self.assertEqual(self.list.contact_nbr, 1) |
|
@ -57,7 +56,7 @@ class DynamicListCase(common.SavepointCase): |
|
|
# Set list as full-synced |
|
|
# Set list as full-synced |
|
|
self.list.sync_method = "full" |
|
|
self.list.sync_method = "full" |
|
|
Contact.search([ |
|
|
Contact.search([ |
|
|
("list_id", "=", self.list.id), |
|
|
|
|
|
|
|
|
("list_ids", "in", [self.list.id]), |
|
|
("partner_id", "=", self.partners[2].id), |
|
|
("partner_id", "=", self.partners[2].id), |
|
|
]).unlink() |
|
|
]).unlink() |
|
|
self.list.action_sync() |
|
|
self.list.action_sync() |
|
@ -66,11 +65,11 @@ class DynamicListCase(common.SavepointCase): |
|
|
# Cannot add or edit contacts in fully synced lists |
|
|
# Cannot add or edit contacts in fully synced lists |
|
|
with self.assertRaises(ValidationError): |
|
|
with self.assertRaises(ValidationError): |
|
|
Contact.create({ |
|
|
Contact.create({ |
|
|
"list_id": self.list.id, |
|
|
|
|
|
|
|
|
"list_ids": [(4, self.list.id, False)], |
|
|
"partner_id": self.partners[0].id, |
|
|
"partner_id": self.partners[0].id, |
|
|
}) |
|
|
}) |
|
|
contact1 = Contact.search([ |
|
|
contact1 = Contact.search([ |
|
|
("list_id", "=", self.list.id), |
|
|
|
|
|
|
|
|
("list_ids", "in", [self.list.id]), |
|
|
], limit=1) |
|
|
], limit=1) |
|
|
with self.assertRaises(ValidationError): |
|
|
with self.assertRaises(ValidationError): |
|
|
contact1.name = "other" |
|
|
contact1.name = "other" |
|
@ -82,7 +81,7 @@ class DynamicListCase(common.SavepointCase): |
|
|
self.list.dynamic = False |
|
|
self.list.dynamic = False |
|
|
# Now the contact is created without exception |
|
|
# Now the contact is created without exception |
|
|
Contact.create({ |
|
|
Contact.create({ |
|
|
"list_id": self.list.id, |
|
|
|
|
|
|
|
|
"list_ids": [(4, self.list.id, False)], |
|
|
"email": "test@example.com", |
|
|
"email": "test@example.com", |
|
|
}) |
|
|
}) |
|
|
# Contacts can now be changed |
|
|
# Contacts can now be changed |
|
|