2
In order to test the AMC review function, I will
3
create a wizard, check the AMC is good
5
To do that, I create some stock move with different
6
reason types and I will confirm them
8
!record {model: stock.move, id: sm1}:
11
date_expected: 2011-07-11
14
product_uom: product.product_uom_unit
15
reason_type_id: reason_types_moves.reason_type_external_supply
16
location_dest_id: stock.stock_location_stock
17
location_id: stock.stock_location_customers
21
!python {model: stock.move}: |
22
self.action_confirm(cr, uid, [ref('sm1')])
23
self.action_done(cr, uid, [ref('sm1')])
25
Create a new outgoing stock move
27
!record {model: stock.move, id: sm2}:
30
date_expected: 2011-07-25
33
product_uom: product.product_uom_unit
34
reason_type_id: reason_types_moves.reason_type_external_supply
35
location_dest_id: stock.stock_location_stock
36
location_id: stock.stock_location_customers
40
!python {model: stock.move}: |
41
self.action_confirm(cr, uid, [ref('sm2')])
42
self.action_done(cr, uid, [ref('sm2')])
44
Create a new outgoing stock move
46
!record {model: stock.move, id: sm3}:
49
date_expected: 2011-08-12
52
product_uom: product.product_uom_unit
53
reason_type_id: reason_types_moves.reason_type_return_from_unit
54
location_dest_id: stock.stock_location_stock
55
location_id: stock.stock_location_customers
59
!python {model: stock.move}: |
60
self.action_confirm(cr, uid, [ref('sm3')])
61
self.action_done(cr, uid, [ref('sm3')])
63
Create an incoming stock move
65
!record {model: stock.move, id: sm4}:
68
date_expected: 2011-08-12
71
product_uom: product.product_uom_unit
72
reason_type_id: reason_types_moves.reason_type_external_supply
73
location_dest_id: stock.stock_location_customers
74
location_id: stock.stock_location_stock
78
!python {model: stock.move}: |
79
self.action_confirm(cr, uid, [ref('sm4')])
80
self.action_done(cr, uid, [ref('sm4')])
82
Create an loan outgoing stock move
84
!record {model: stock.move, id: sm5}:
87
date_expected: 2011-08-12
90
product_uom: product.product_uom_unit
91
reason_type_id: reason_types_moves.reason_type_loan
92
location_dest_id: stock.stock_location_customers
93
location_id: stock.stock_location_stock
97
!python {model: stock.move}: |
98
self.action_confirm(cr, uid, [ref('sm5')])
99
self.action_done(cr, uid, [ref('sm5')])
101
Create an donation outgoing stock move
103
!record {model: stock.move, id: sm6}:
106
date_expected: 2011-08-12
109
product_uom: product.product_uom_unit
110
reason_type_id: reason_types_moves.reason_type_donation_expiry
111
location_dest_id: stock.stock_location_customers
112
location_id: stock.stock_location_stock
116
!python {model: stock.move}: |
117
self.action_confirm(cr, uid, [ref('sm6')])
118
self.action_done(cr, uid, [ref('sm6')])
120
Create an loss outgoing stock move
122
!record {model: stock.move, id: sm7}:
125
date_expected: 2011-08-12
128
product_uom: product.product_uom_unit
129
reason_type_id: reason_types_moves.reason_type_loss
130
location_dest_id: stock.stock_location_customers
131
location_id: stock.stock_location_stock
135
!python {model: stock.move}: |
136
self.action_confirm(cr, uid, [ref('sm7')])
137
self.action_done(cr, uid, [ref('sm7')])
139
Create an discrepancy outgoing stock move
141
!record {model: stock.move, id: sm8}:
144
date_expected: 2011-08-12
147
product_uom: product.product_uom_unit
148
reason_type_id: reason_types_moves.reason_type_discrepancy
149
location_dest_id: stock.stock_location_customers
150
location_id: stock.stock_location_stock
154
!python {model: stock.move}: |
155
self.action_confirm(cr, uid, [ref('sm8')])
156
self.action_done(cr, uid, [ref('sm8')])
158
I check the calculate AMC
160
!python {model: product.product}: |
161
context = {'from_date': '2011-06-01','to_date': '2011-08-31'}
162
amc = self.compute_amc(cr, uid, ref('product1'), context=context)
163
assert amc == 15.67, "The calculate AMC is not correct"
b'\\ No newline at end of file'