|
|
@ -20,16 +20,21 @@ class TestPartnerIdentificationBase(common.TransactionCase): |
|
|
|
|
|
|
|
partner_1 = self.env.ref('base.res_partner_1') |
|
|
|
self.assertEquals(len(partner_1.id_numbers), 0) |
|
|
|
# create without required category |
|
|
|
with self.assertRaises(IntegrityError), self.cr.savepoint(): |
|
|
|
partner_1.write({'id_numbers': [(0, 0, { |
|
|
|
partner_1.write({'id_numbers': [(0, 0, { |
|
|
|
'name': '1234', |
|
|
|
})]}) |
|
|
|
partner_1.write({'id_numbers': [(0, 0, { |
|
|
|
# successful creation |
|
|
|
partner_1.write({'id_numbers': [(0, 0, { |
|
|
|
'name': '1234', |
|
|
|
'category_id': partner_id_category.id |
|
|
|
})]}) |
|
|
|
self.assertEquals(len(partner_1.id_numbers), 1) |
|
|
|
self.assertEquals(partner_1.id_numbers.name, '1234') |
|
|
|
# delete |
|
|
|
partner_1.write({'id_numbers': [(5, 0, 0)]}) |
|
|
|
self.assertEquals(len(partner_1.id_numbers), 0) |
|
|
|
|
|
|
|
|
|
|
|
class TestPartnerCategoryValidation(common.TransactionCase): |
|
|
|