48
48
category_id: product_cat1
49
49
product_id: product3
51
We create a new rule for Categ2 on Sloc2
51
We create a new rule for Categ0 on Sloc2
53
53
!record {model: stock.warehouse.order.cycle, id: r3, context: {'button': 'test'}}:
54
54
warehouse_id: stock.warehouse0
82
82
We run the scheduler
84
84
!python {model: procurement.order, context: {'button': 'test'}}: |
85
self.run_automatic_cycle(cr, uid, False, context=context)
85
self.run_automatic_cycle(cr, uid, False, context={})
87
87
Check if the procurement for P1 in Sloc1 has good values
90
90
p1_s1_id = self.search(cr, uid, [('product_id', '=', ref('product1')), ('location_id', '=', ref('cycle_sloc1'))])
91
91
assert p1_s1_id, "The scheduler hasn't created the procurement order for P1 in Sloc1"
92
92
for proc in self.browse(cr, uid, p1_s1_id):
93
assert proc.product_qty == 170.00, "Bad quantity on procurement order for P1 in Sloc1"
93
assert proc.product_qty == 435.00, "Bad quantity on procurement order for P1 in Sloc1"
95
95
Check if the procurement for P1 in Sloc2 has good values
98
98
p1_s2_id = self.search(cr, uid, [('product_id', '=', ref('product1')), ('location_id', '=', ref('cycle_sloc2')), ('origin', '=', 'R4')])
99
99
assert p1_s2_id, "The scheduler hasn't created the procurement order for P1 in Sloc2"
100
100
for proc in self.browse(cr, uid, p1_s2_id):
101
assert proc.product_qty == 39.00, "Bad quantity on procurement order for P1 in Sloc2"
101
assert proc.product_qty == 166.00, "Bad quantity on procurement order for P1 in Sloc2"
103
103
Check if the procurement for P2 in Sloc1 has good values
106
106
p2_s1_id = self.search(cr, uid, [('product_id', '=', ref('product2')), ('location_id', '=', ref('cycle_sloc1'))])
107
107
assert p2_s1_id, "The scheduler hasn't created the procurement order for P2 in Sloc1"
108
108
for proc in self.browse(cr, uid, p2_s1_id):
109
assert proc.product_qty == 450.00, "Bad quantity on procurement order for P2 in Sloc1"
109
assert proc.product_qty == 488.00, "Bad quantity on procurement order for P2 in Sloc1"
111
111
Check if the procurement for P2 in Sloc2 has good values
114
114
p2_s2_id = self.search(cr, uid, [('product_id', '=', ref('product2')), ('location_id', '=', ref('cycle_sloc2'))])
115
115
assert p2_s2_id, "The scheduler hasn't created the procurement order for P2 in Sloc2"
116
116
for proc in self.browse(cr, uid, p2_s2_id):
117
assert proc.product_qty == 183.00, "Bad quantity on procurement order for P2 in Sloc2"
117
assert round(proc.product_qty) == 198.00, "Bad quantity on procurement order for P2 in Sloc2"
119
119
Check if the procurement for P3 in Sloc1 has good values
122
122
p3_s1_id = self.search(cr, uid, [('product_id', '=', ref('product3')), ('location_id', '=', ref('cycle_sloc1'))])
123
123
assert p3_s1_id, "The scheduler hasn't created the procurement order for P3 in Sloc1"
124
124
for proc in self.browse(cr, uid, p3_s1_id):
125
assert proc.product_qty == 1397.00, "Bad quantity on procurement order for P3 in Sloc1"
125
assert proc.product_qty == 305.00, "Bad quantity on procurement order for P3 in Sloc1"
127
127
Check if the procurement for P3 in Sloc2 has good values
129
129
!python {model: procurement.order}: |
132
130
p3_s2_id = self.search(cr, uid, [('product_id', '=', ref('product3')), ('location_id', '=', ref('cycle_sloc2'))])
133
131
assert p3_s2_id, "The scheduler hasn't created the procurement order for P3 in Sloc2"
134
132
for proc in self.browse(cr, uid, p3_s2_id):
135
if calendar.mdays[datetime.date.today().month] == 29 or (calendar.mdays[datetime.date.today().month] == 28 and datetime.date.today().year%4 == 0):
136
assert proc.product_qty == 355.00, "Bad quantity on procurement order for P3 in Sloc2"
137
elif calendar.mdays[datetime.date.today().month] == 28:
138
assert proc.product_qty == 350.00, "Bad quantity on procurement order for P3 in Sloc2"
139
elif calendar.mdays[datetime.date.today().month] == 30:
140
assert proc.product_qty == 366.00, "Bad quantity on procurement order for P3 in Sloc2"
141
elif calendar.mdays[datetime.date.today().month] == 31:
142
assert proc.product_qty == 365.00, "Bad quantity on procurement order for P3 in Sloc2"
144
assert proc.product_qty == 366.00, "Bad quantity on procurement order for P3 in SLoc2"
133
assert proc.product_qty == 330.00, "Bad quantity on procurement order for P3 in Sloc2"
146
135
Check if the procurement for P4 in Sloc2 has good values