231
230
warehouse_id: warehouse_proc_cycle
233
I create a batch for product 3 with today + 2 months as expiry date
235
!record {model: stock.production.lot, id: lot1}:
240
I add the life date on the lot
242
!python {model: stock.production.lot }: |
244
from datetime import datetime
245
from dateutil.relativedelta import relativedelta
246
req_date = (datetime.strptime(time.strftime('%Y-%m-%d'), '%Y-%m-%d') + relativedelta(months=2)).strftime('%Y-%m-%d')
247
self.write(cr, uid, ref('lot1'), {'life_date': req_date}, context=context)
249
I create a batch for product 3 with today + 1 month as expiry date
251
!record {model: stock.production.lot, id: lot2}:
256
I add the life date on the lot
258
!python {model: stock.production.lot }: |
260
from datetime import datetime
261
from dateutil.relativedelta import relativedelta
262
req_date = (datetime.strptime(time.strftime('%Y-%m-%d'), '%Y-%m-%d') + relativedelta(months=1)).strftime('%Y-%m-%d')
263
self.write(cr, uid, ref('lot2'), {'life_date': req_date}, context=context)
265
I create a batch for product 3 with today + 15 days as expiry date
267
!record {model: stock.production.lot, id: lot3}:
272
I add the life date on the lot
274
!python {model: stock.production.lot }: |
276
from datetime import datetime
277
from dateutil.relativedelta import relativedelta
278
req_date = (datetime.strptime(time.strftime('%Y-%m-%d'), '%Y-%m-%d') + relativedelta(days=15)).strftime('%Y-%m-%d')
279
self.write(cr, uid, ref('lot3'), {'life_date': req_date}, context=context)
281
I create a batch for product 3 with today + 6 months as expiry date
283
!record {model: stock.production.lot, id: lot4}:
288
I add the life date on the lot
290
!python {model: stock.production.lot }: |
292
from datetime import datetime
293
from dateutil.relativedelta import relativedelta
294
req_date = (datetime.strptime(time.strftime('%Y-%m-%d'), '%Y-%m-%d') + relativedelta(months=6)).strftime('%Y-%m-%d')
295
self.write(cr, uid, ref('lot4'), {'life_date': req_date}, context=context)
297
I create a batch for product 3 with today + 2 years as expiry date
299
!record {model: stock.production.lot, id: lot5}:
304
I add the life date on the lot
306
!python {model: stock.production.lot }: |
308
from datetime import datetime
309
from dateutil.relativedelta import relativedelta
310
req_date = (datetime.strptime(time.strftime('%Y-%m-%d'), '%Y-%m-%d') + relativedelta(years=2)).strftime('%Y-%m-%d')
311
self.write(cr, uid, ref('lot5'), {'life_date': req_date}, context=context)
313
!record {model: stock.production.lot, id: lot22}:
317
life_date: !eval "(DateTime.now()+DateTime.RelativeDateTime(years=10)).strftime('%Y-%m-%d')"
320
232
I create an inventory to add products in stock
322
234
!record {model: stock.inventory, id: inv1}:
484
374
I check if the availability of P3 is correct
486
376
!assert {model: product.product, id: product3}:
487
- qty_available == 830.0
488
- virtual_available == 865.0
490
I crete a new FMC report for Sloc 2
492
!record {model: monthly.review.consumption, id: mrc2}:
493
cons_location_id: cycle_sloc2
494
period_from: 2011-01-01
495
period_to: !eval time.strftime('%Y-%m-%d')
507
I create a new FMC report for Sloc 1
509
!record {model: monthly.review.consumption, id: mrc1}:
510
cons_location_id: cycle_sloc1
511
period_from: 2011-01-01
512
period_to: !eval time.strftime('%Y-%m-%d')
521
I create a stock move for P1 in SLoc 2
523
!record {model: stock.move, id: sm_p1_sloc2}:
524
name: Product 1 SLoc 2
526
product_uom: product.product_uom_unit
527
date_expected: !eval time.strftime('%Y-%m-%d')
528
date: !eval time.strftime('%Y-%m-%d')
529
location_id: cycle_sloc2
530
location_dest_id: stock.stock_location_customers
532
reason_type_id: reason_types_moves.reason_type_deliver_partner
535
I confirm the stock move
537
!python {model: stock.move}: |
538
self.action_confirm(cr, uid, ref('sm_p1_sloc2'), context=context)
539
self.action_done(cr, uid, ref('sm_p1_sloc2'), context=context)
541
I create a stock move for P1 in SLoc 1
543
!record {model: stock.move, id: sm_p1_sloc1}:
544
name: Product 1 SLoc 1
546
product_uom: product.product_uom_unit
547
date_expected: !eval time.strftime('%Y-%m-%d')
548
date: !eval time.strftime('%Y-%m-%d')
549
location_id: cycle_sloc1
550
location_dest_id: stock.stock_location_customers
552
reason_type_id: reason_types_moves.reason_type_deliver_partner
555
I confirm the stock move
557
!python {model: stock.move}: |
558
self.action_confirm(cr, uid, ref('sm_p1_sloc1'), context=context)
559
self.action_done(cr, uid, ref('sm_p1_sloc1'), context=context)
561
I create a stock move for P2 in SLoc 1
563
!record {model: stock.move, id: sm_p2_sloc1}:
564
name: Product 2 SLoc 1
566
product_uom: product.product_uom_unit
567
date_expected: !eval time.strftime('%Y-%m-%d')
568
date: !eval time.strftime('%Y-%m-%d')
569
location_id: cycle_sloc1
570
location_dest_id: stock.stock_location_customers
572
reason_type_id: reason_types_moves.reason_type_deliver_partner
575
I confirm the stock move
577
!python {model: stock.move}: |
578
self.action_confirm(cr, uid, ref('sm_p2_sloc1'), context=context)
579
self.action_done(cr, uid, ref('sm_p2_sloc1'), context=context)
581
I create a stock move for P2 in SLoc 1
583
!record {model: stock.move, id: sm_p2_sloc2}:
584
name: Product 2 SLoc 2
586
product_uom: product.product_uom_unit
587
date_expected: !eval time.strftime('%Y-%m-%d')
588
date: !eval time.strftime('%Y-%m-%d')
589
location_id: cycle_sloc2
590
location_dest_id: stock.stock_location_customers
592
reason_type_id: reason_types_moves.reason_type_deliver_partner
595
I confirm the stock move
597
!python {model: stock.move}: |
598
self.action_confirm(cr, uid, ref('sm_p2_sloc2'), context=context)
599
self.action_done(cr, uid, ref('sm_p2_sloc2'), context=context)
601
I create a stock move for P2 in SLoc 1
603
!record {model: stock.move, id: sm_p3_sloc1}:
604
name: Product 3 SLoc 1
606
product_uom: product.product_uom_unit
607
date_expected: !eval time.strftime('%Y-%m-%d')
608
date: !eval time.strftime('%Y-%m-%d')
609
location_id: cycle_sloc1
610
location_dest_id: stock.stock_location_customers
613
reason_type_id: reason_types_moves.reason_type_deliver_partner
616
I confirm the stock move
618
!python {model: stock.move}: |
619
self.action_confirm(cr, uid, ref('sm_p3_sloc1'), context=context)
620
self.action_done(cr, uid, ref('sm_p3_sloc1'), context=context)
622
I create a stock move for P2 in SLoc 1
624
!record {model: stock.move, id: sm_p4_sloc2}:
625
name: Product 4 SLoc 2
627
product_uom: product.product_uom_unit
628
date_expected: !eval time.strftime('%Y-%m-%d')
629
date: !eval time.strftime('%Y-%m-%d')
630
location_id: cycle_sloc2
631
location_dest_id: stock.stock_location_customers
633
reason_type_id: reason_types_moves.reason_type_deliver_partner
636
I confirm the stock move
638
!python {model: stock.move}: |
639
self.action_confirm(cr, uid, ref('sm_p4_sloc2'), context=context)
640
self.action_done(cr, uid, ref('sm_p4_sloc2'), context=context)
377
- qty_available == 90.0
378
- virtual_available == 125.0