~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to consumption_calculation/test/amc_review.yml

UF-385 [ADD] Added consumption_calculation module

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-
 
2
  In order to test the AMC review function, I will
 
3
  create a wizard, check the AMC is good
 
4
-
 
5
  To do that, I create some stock move with different
 
6
  reason types and I will confirm them
 
7
-
 
8
  !record {model: stock.move, id: sm1}:
 
9
    name: sm1
 
10
    product_id: product1
 
11
    date_expected: 2011-07-11
 
12
    date: 2011-07-10
 
13
    product_qty: 12.0
 
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
 
18
-
 
19
  I confirm it
 
20
-
 
21
  !python {model: stock.move}: |
 
22
    self.action_confirm(cr, uid, [ref('sm1')])
 
23
    self.action_done(cr, uid, [ref('sm1')])
 
24
-
 
25
  Create a new outgoing stock move
 
26
-
 
27
  !record {model: stock.move, id: sm2}:
 
28
    name: sm2
 
29
    product_id: product1
 
30
    date_expected: 2011-07-25
 
31
    date: 2011-07-10
 
32
    product_qty: 55.0
 
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
 
37
-
 
38
  I confirm it
 
39
-
 
40
  !python {model: stock.move}: |
 
41
    self.action_confirm(cr, uid, [ref('sm2')])
 
42
    self.action_done(cr, uid, [ref('sm2')])
 
43
-
 
44
  Create a new outgoing stock move
 
45
-
 
46
  !record {model: stock.move, id: sm3}:
 
47
    name: sm3
 
48
    product_id: product1
 
49
    date_expected: 2011-08-12
 
50
    date: 2011-07-10
 
51
    product_qty: 25.0
 
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
 
56
-
 
57
  I confirm it
 
58
-
 
59
  !python {model: stock.move}: |
 
60
    self.action_confirm(cr, uid, [ref('sm3')])
 
61
    self.action_done(cr, uid, [ref('sm3')])
 
62
-
 
63
    Create an incoming stock move
 
64
-
 
65
  !record {model: stock.move, id: sm4}:
 
66
    name: sm4
 
67
    product_id: product1
 
68
    date_expected: 2011-08-12
 
69
    date: 2011-07-10
 
70
    product_qty: 5.0
 
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
 
75
-
 
76
  I confirm it
 
77
-
 
78
  !python {model: stock.move}: |
 
79
    self.action_confirm(cr, uid, [ref('sm4')])
 
80
    self.action_done(cr, uid, [ref('sm4')])
 
81
-
 
82
    Create an loan outgoing stock move
 
83
-
 
84
  !record {model: stock.move, id: sm5}:
 
85
    name: sm5
 
86
    product_id: product1
 
87
    date_expected: 2011-08-12
 
88
    date: 2011-07-10
 
89
    product_qty: 5.0
 
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
 
94
-
 
95
  I confirm it
 
96
-
 
97
  !python {model: stock.move}: |
 
98
    self.action_confirm(cr, uid, [ref('sm5')])
 
99
    self.action_done(cr, uid, [ref('sm5')])
 
100
-
 
101
    Create an donation outgoing stock move
 
102
-
 
103
  !record {model: stock.move, id: sm6}:
 
104
    name: sm6
 
105
    product_id: product1
 
106
    date_expected: 2011-08-12
 
107
    date: 2011-07-10
 
108
    product_qty: 12.0
 
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
 
113
-
 
114
  I confirm it
 
115
-
 
116
  !python {model: stock.move}: |
 
117
    self.action_confirm(cr, uid, [ref('sm6')])
 
118
    self.action_done(cr, uid, [ref('sm6')])
 
119
-
 
120
    Create an loss outgoing stock move
 
121
-
 
122
  !record {model: stock.move, id: sm7}:
 
123
    name: sm7
 
124
    product_id: product1
 
125
    date_expected: 2011-08-12
 
126
    date: 2011-07-10
 
127
    product_qty: 25.0
 
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
 
132
-
 
133
  I confirm it
 
134
-
 
135
  !python {model: stock.move}: |
 
136
    self.action_confirm(cr, uid, [ref('sm7')])
 
137
    self.action_done(cr, uid, [ref('sm7')])
 
138
-
 
139
    Create an discrepancy outgoing stock move
 
140
-
 
141
  !record {model: stock.move, id: sm8}:
 
142
    name: sm8
 
143
    product_id: product1
 
144
    date_expected: 2011-08-12
 
145
    date: 2011-07-10
 
146
    product_qty: 7.0
 
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
 
151
-
 
152
  I confirm it
 
153
-
 
154
  !python {model: stock.move}: |
 
155
    self.action_confirm(cr, uid, [ref('sm8')])
 
156
    self.action_done(cr, uid, [ref('sm8')])
 
157
-
 
158
  I check the calculate AMC
 
159
-
 
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'