2
I create empty theoretical composition list 01 - this test file is not used, was an attempt to test
3
exceptions integrity, but does not work because of rollback of data OEB-107
5
!record {model: composition.kit, id: kit_compo_01}:
6
composition_type: 'theoretical'
7
composition_product_id: kit_product_A
8
composition_version_txt: 'ITC'
9
composition_creation_date: '2010-01-20'
11
I create empty theoretical composition list 02
13
!record {model: composition.kit, id: kit_compo_02}:
14
composition_type: 'theoretical'
15
composition_product_id: kit_product_B
16
composition_version_txt: 'OCG'
17
composition_creation_date: '2010-02-20'
19
I first check the integrity constraint on the product. Kit cannot be perishable.
21
!python {model: product.product}: |
23
self.write(cr, uid, ref("kit_product_A"), {'batch_management': False}, context=context)
28
#print 'exception missing'
29
raise Exception('Exception is Missing for kit product set to perishable')
31
I try to set a product which is not a kit
33
!python {model: composition.kit}: |
35
self.write(cr, uid, ref("kit_compo_01"), {'composition_product_id': ref("kit_product_C")}, context=context)
40
#print 'exception missing'
41
raise Exception('Exception is Missing for kit with a not kit product')
43
I try to set a reference in the theoretical kit
45
!python {model: composition.kit}: |
47
self.write(cr, uid, ref("kit_compo_01"), {'composition_reference': 'reference test'}, context=context)
52
#print 'exception missing'
53
raise Exception('Exception is Missing for theoretical kit with reference')
55
I try to set a batch number in the theoretical kit
57
!python {model: composition.kit}: |
59
self.write(cr, uid, ref("kit_compo_01"), {'composition_lot_id': ref("kit_lot_As")}, context=context)
64
#print 'exception missing'
65
raise Exception('Exception is Missing for theoretical kit with lot id')
67
I try to set an expiry date in the theoretical kit
69
!python {model: composition.kit}: |
71
self.write(cr, uid, ref("kit_compo_01"), {'composition_exp': '2010-06-10'}, context=context)
76
#print 'exception missing'
77
raise Exception('Exception is Missing for theoretical kit with expiry date')
79
I try to set a version object in the theoretical kit
81
!python {model: composition.kit}: |
83
self.write(cr, uid, ref("kit_compo_01"), {'composition_version_id': ref("kit_compo_02")}, context=context)
88
#print 'exception missing'
89
raise Exception('Exception is Missing for theoretical kit with version id')
91
I try now the unique constraints on theoretical kit. Set the same product. Set the same Version. Set the same date, fails.
93
!python {model: composition.kit}: |
94
self.write(cr, uid, ref("kit_compo_01"), {'composition_product_id': ref("kit_product_B")}, context=context)
95
self.write(cr, uid, ref("kit_compo_01"), {'composition_version_txt': 'OCG'}, context=context)
97
self.write(cr, uid, ref("kit_compo_01"), {'composition_creation_date': ref("kit_lot_As")}, context=context)
102
#print 'exception missing'
103
raise Exception('Exception is Missing for theoretical kit with same (product - version - date) values')
107
!python {model: stock.picking}: |