234
230
warehouse_id: warehouse_proc_cycle
236
I create a batch for product 3 with today + 2 months as expiry date
238
!record {model: stock.production.lot, id: lot1}:
243
I add the life date on the lot
245
!python {model: stock.production.lot }: |
247
from datetime import datetime
248
from dateutil.relativedelta import relativedelta
249
req_date = (datetime.strptime(time.strftime('%Y-%m-%d'), '%Y-%m-%d') + relativedelta(months=2)).strftime('%Y-%m-%d')
250
self.write(cr, uid, ref('lot1'), {'life_date': req_date}, context=context)
252
I create a batch for product 3 with today + 1 month as expiry date
254
!record {model: stock.production.lot, id: lot2}:
259
I add the life date on the lot
261
!python {model: stock.production.lot }: |
263
from datetime import datetime
264
from dateutil.relativedelta import relativedelta
265
req_date = (datetime.strptime(time.strftime('%Y-%m-%d'), '%Y-%m-%d') + relativedelta(months=1)).strftime('%Y-%m-%d')
266
self.write(cr, uid, ref('lot2'), {'life_date': req_date}, context=context)
268
I create a batch for product 3 with today + 15 days as expiry date
270
!record {model: stock.production.lot, id: lot3}:
275
I add the life date on the lot
277
!python {model: stock.production.lot }: |
279
from datetime import datetime
280
from dateutil.relativedelta import relativedelta
281
req_date = (datetime.strptime(time.strftime('%Y-%m-%d'), '%Y-%m-%d') + relativedelta(days=15)).strftime('%Y-%m-%d')
282
self.write(cr, uid, ref('lot3'), {'life_date': req_date}, context=context)
284
I create a batch for product 3 with today + 6 months as expiry date
286
!record {model: stock.production.lot, id: lot4}:
291
I add the life date on the lot
293
!python {model: stock.production.lot }: |
295
from datetime import datetime
296
from dateutil.relativedelta import relativedelta
297
req_date = (datetime.strptime(time.strftime('%Y-%m-%d'), '%Y-%m-%d') + relativedelta(months=6)).strftime('%Y-%m-%d')
298
self.write(cr, uid, ref('lot4'), {'life_date': req_date}, context=context)
300
I create a batch for product 3 with today + 2 years as expiry date
302
!record {model: stock.production.lot, id: lot5}:
307
I add the life date on the lot
309
!python {model: stock.production.lot }: |
311
from datetime import datetime
312
from dateutil.relativedelta import relativedelta
313
req_date = (datetime.strptime(time.strftime('%Y-%m-%d'), '%Y-%m-%d') + relativedelta(years=2)).strftime('%Y-%m-%d')
314
self.write(cr, uid, ref('lot5'), {'life_date': req_date}, context=context)
316
!record {model: stock.production.lot, id: lot22}:
320
life_date: !eval "(DateTime.now()+DateTime.RelativeDateTime(months=1)).strftime('%Y-%m-%d')"
323
232
I create an inventory to add products in stock
325
234
!record {model: stock.inventory, id: inv1}:
356
265
- company_id: base.main_company
357
266
location_id: cycle_sloc1
358
267
product_id: product3
361
product_uom: product.product_uom_unit
362
- company_id: base.main_company
363
location_id: cycle_sloc2
367
product_uom: product.product_uom_unit
368
- company_id: base.main_company
369
location_id: cycle_sloc2
373
product_uom: product.product_uom_unit
374
- company_id: base.main_company
375
location_id: cycle_sloc2
379
product_uom: product.product_uom_unit
380
- company_id: base.main_company
381
location_id: cycle_sloc2
269
product_uom: product.product_uom_unit
270
- company_id: base.main_company
271
location_id: cycle_sloc2
385
274
product_uom: product.product_uom_unit
386
275
- company_id: base.main_company
387
276
location_id: cycle_sloc3
388
277
product_id: product3
389
278
product_qty: 10.0
391
279
product_uom: product.product_uom_unit
392
280
- company_id: base.main_company
393
281
location_id: cycle_sloc4
394
282
product_id: product3
395
283
product_qty: 25.0
397
284
product_uom: product.product_uom_unit
398
285
- company_id: base.main_company
399
286
location_id: cycle_sloc2
476
363
partner_id: supplier1
477
364
pricelist_id: purchase.list0
479
I validate this purchase order
366
I confirm this purchase order
481
368
!workflow {model: purchase.order, action: purchase_confirm, ref: po1}
483
I approve this purchase order
485
!workflow {model: purchase.order, action: purchase_approve, ref: po1}
487
370
I check if the availability of P3 is correct
489
372
!assert {model: product.product, id: product3}:
490
- qty_available == 830.0
491
- virtual_available == 865.0
493
I crete a new FMC report for Sloc 2
495
!record {model: monthly.review.consumption, id: mrc2}:
496
cons_location_id: cycle_sloc2
497
period_from: 2011-01-01
498
period_to: !eval time.strftime('%Y-%m-%d')
510
I create a stock move for P1 in SLoc 2
512
!record {model: stock.move, id: sm_p1_sloc2}:
513
name: Product 1 SLoc 2
515
product_uom: product.product_uom_unit
516
date_expected: !eval time.strftime('%Y-%m-%d')
517
date: !eval time.strftime('%Y-%m-%d')
518
location_id: cycle_sloc2
519
location_dest_id: stock.stock_location_customers
521
reason_type_id: reason_types_moves.reason_type_deliver_partner
524
I confirm the stock move
526
!python {model: stock.move}: |
527
self.action_confirm(cr, uid, ref('sm_p1_sloc2'), context=context)
528
self.action_done(cr, uid, ref('sm_p1_sloc2'), context=context)
530
I create a stock move for P1 in SLoc 1
532
!record {model: stock.move, id: sm_p1_sloc1}:
533
name: Product 1 SLoc 1
535
product_uom: product.product_uom_unit
536
date_expected: !eval time.strftime('%Y-%m-%d')
537
date: !eval time.strftime('%Y-%m-%d')
538
location_id: cycle_sloc1
539
location_dest_id: stock.stock_location_customers
541
reason_type_id: reason_types_moves.reason_type_deliver_partner
544
I confirm the stock move
546
!python {model: stock.move}: |
547
self.action_confirm(cr, uid, ref('sm_p1_sloc1'), context=context)
548
self.action_done(cr, uid, ref('sm_p1_sloc1'), context=context)
550
I create a stock move for P2 in SLoc 1
552
!record {model: stock.move, id: sm_p2_sloc1}:
553
name: Product 2 SLoc 1
555
product_uom: product.product_uom_unit
556
date_expected: !eval time.strftime('%Y-%m-%d')
557
date: !eval time.strftime('%Y-%m-%d')
558
location_id: cycle_sloc1
559
location_dest_id: stock.stock_location_customers
561
reason_type_id: reason_types_moves.reason_type_deliver_partner
564
I confirm the stock move
566
!python {model: stock.move}: |
567
self.action_confirm(cr, uid, ref('sm_p2_sloc1'), context=context)
568
self.action_done(cr, uid, ref('sm_p2_sloc1'), context=context)
570
I create a stock move for P2 in SLoc 2
572
!record {model: stock.move, id: sm_p2_sloc2}:
573
name: Product 2 SLoc 2
575
product_uom: product.product_uom_unit
576
date_expected: !eval time.strftime('%Y-%m-%d')
577
date: !eval time.strftime('%Y-%m-%d')
578
location_id: cycle_sloc2
579
location_dest_id: stock.stock_location_customers
581
reason_type_id: reason_types_moves.reason_type_deliver_partner
584
I confirm the stock move
586
!python {model: stock.move}: |
587
self.action_confirm(cr, uid, ref('sm_p2_sloc2'), context=context)
588
self.action_done(cr, uid, ref('sm_p2_sloc2'), context=context)
590
I create a stock move for P3 in SLoc 1
592
!record {model: stock.move, id: sm_p3_sloc1}:
593
name: Product 3 SLoc 1
595
product_uom: product.product_uom_unit
596
date_expected: !eval time.strftime('%Y-%m-%d')
597
date: !eval time.strftime('%Y-%m-%d')
598
location_id: cycle_sloc1
599
location_dest_id: stock.stock_location_customers
602
reason_type_id: reason_types_moves.reason_type_deliver_partner
605
I confirm the stock move
607
!python {model: stock.move}: |
608
self.action_confirm(cr, uid, ref('sm_p3_sloc1'), context=context)
609
self.action_done(cr, uid, ref('sm_p3_sloc1'), context=context)
611
I create a stock move for P2 in SLoc 1
613
!record {model: stock.move, id: sm_p4_sloc2}:
614
name: Product 4 SLoc 2
616
product_uom: product.product_uom_unit
617
date_expected: !eval time.strftime('%Y-%m-%d')
618
date: !eval time.strftime('%Y-%m-%d')
619
location_id: cycle_sloc2
620
location_dest_id: stock.stock_location_customers
622
reason_type_id: reason_types_moves.reason_type_deliver_partner
625
I confirm the stock move
627
!python {model: stock.move}: |
628
self.action_confirm(cr, uid, ref('sm_p4_sloc2'), context=context)
629
self.action_done(cr, uid, ref('sm_p4_sloc2'), context=context)
373
- qty_available == 90.0
374
- virtual_available == 125.0
b'\\ No newline at end of file'