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

« back to all changes in this revision

Viewing changes to purchase_override/test/purchase_test.yml

  • Committer: matthieu.choplin at msf
  • Date: 2012-08-30 07:48:00 UTC
  • mto: This revision was merged to the branch mainline in revision 1118.
  • Revision ID: matthieu.choplin@geneva.msf.org-20120830074800-l442bu42mt0yzutn
[uf-1374]- change the write and create by an _sql_constraint on the financing contract check dates

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
  We check if no invoices has been created by the confirmation of regular1
49
49
-
50
50
  !python {model: account.invoice}: |
51
 
    po_name = self.pool.get('purchase.order').browse(cr, uid, ref('regular1')).name
52
 
    invoice_ids = self.search(cr, uid, [('origin', '=', po_name)])
 
51
    invoice_ids = self.search(cr, uid, [('origin', '=', 'Regular1')])
53
52
    assert not invoice_ids, ('Invoice created from Regular PO with internal supplier')
54
53
-
55
54
  We check if generated stock moves have good data
56
55
-
57
56
  !python {model: stock.move}: |
58
57
    move_ids = self.search(cr, uid, [('purchase_line_id', 'in', [ref('regular1_l1'), ref('regular1_l2')])])
59
 
    reason_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'reason_types_moves', 'reason_type_internal_supply')[1]
 
58
    reason_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'reason_types_moves', 'reason_type_external_supply')[1]
60
59
    assert move_ids, ('No generated stock moves from Regular PO with internal supplier')
61
60
    for move in self.browse(cr, uid, move_ids):
62
61
      assert move.order_priority == 'normal', ('Generated move hasn\'t the good priority')
110
109
  We check if invoice has been created by the confirmation of regular2
111
110
-
112
111
  !python {model: account.invoice}: |
113
 
    po_name = self.pool.get('purchase.order').browse(cr, uid, ref('regular2')).name
114
 
    invoice_ids = self.search(cr, uid, [('origin', '=', po_name)])
 
112
    invoice_ids = self.search(cr, uid, [('origin', '=', 'Regular2')])
115
113
    assert invoice_ids, ('No invoice created from Regular PO with external supplier')
116
114
-
117
115
  We check if generated stock moves have good data
267
265
    categ: other
268
266
    name: other
269
267
    loan_duration: 6
270
 
    partner_id: supplier2
 
268
    partner_id: supplier1
271
269
    company_id: base.main_company
272
270
    date_order: !eval time.strftime('%Y-%m-%d')
273
271
    invoice_method: manual
374
372
  !assert {model: purchase.order, id: loan5}:
375
373
    - state == 'done', ('Loan order is not in done state')
376
374
-
377
 
  We create a new In-Kind Donation with an external partner (supplier2)
 
375
  We create a new In-Kind Donation
378
376
-
379
377
  !record {model: purchase.order, id: inkind6}:
380
378
    order_type: in_kind
381
379
    name: Inkind6
382
 
    partner_id: supplier2
 
380
    partner_id: supplier1
383
381
    company_id: base.main_company
384
382
    date_order: !eval time.strftime('%Y-%m-%d')
385
383
    invoice_method: manual
442
440
    name: List7
443
441
    company_id: base.main_company
444
442
    date_order: !eval time.strftime('%Y-%m-%d')
445
 
    invoice_method: picking
 
443
    invoice_method: order
446
444
    location_id: stock.stock_location_stock
447
445
    partner_address_id: localmarket_addr
448
446
    partner_id: localmarket
487
485
-
488
486
  !python {model: account.invoice}: |
489
487
    invoice_ids = self.search(cr, uid, [('origin', '=', 'List7')])
490
 
    assert not invoice_ids, ("Invoices generated from Purchase List. This should not because of picking invoice method!")
 
488
    assert invoice_ids, ("No invoices generated from Purchase List")
491
489
    for invoice in self.browse(cr, uid, invoice_ids):
492
490
      assert invoice.purchase_list, ("Purchase list isn't checked in Invoice")
493
491
-
549
547
  We check if invoice has been created by the confirmation
550
548
-
551
549
  !python {model: account.invoice}: |
552
 
    po_name = self.pool.get('purchase.order').browse(cr, uid, ref('direct8')).name
553
 
    invoice_ids = self.search(cr, uid, [('origin', '=', po_name)])
 
550
    invoice_ids = self.search(cr, uid, [('name', '=', 'Direct8')])
554
551
    assert invoice_ids, ('No invoice created from Direct Purchase Order')
555
552
-
556
553
  We check if stock moves has been generated with good data
559
556
    move_ids = self.search(cr, uid, [('purchase_line_id', 'in', [ref('direct8_l1'), ref('direct8_l2')])])
560
557
    assert not move_ids, ('Generated stock moves from Direct Purchase Order')
561
558
-
 
559
  We create a direct po with a inter-section partner
 
560
-
 
561
  !record {model: purchase.order, id: direct9}:
 
562
    order_type: direct
 
563
    name: Direct9
 
564
    partner_id: section4
 
565
    company_id: base.main_company
 
566
    date_order: !eval time.strftime('%Y-%m-%d')
 
567
    invoice_method: order
 
568
    location_id: stock.stock_location_stock
 
569
    partner_address_id: address4
 
570
    pricelist_id: purchase.list0
 
571
-
 
572
  We create a line for this purchase order
 
573
-
 
574
  !record {model: purchase.order.line, id: direct9_l1}:
 
575
    product_uom: product.product_uom_unit
 
576
    product_id: product1
 
577
    order_id: direct9
 
578
    price_unit: 1.50
 
579
    product_qty: 10
 
580
    name: P1
 
581
    date_planned: !eval time.strftime('%Y-%m-%d')
 
582
-
 
583
  We validate this Direct Purchase Order
 
584
-
 
585
  !workflow {model: purchase.order, action: purchase_confirm, ref: direct9}
 
586
-
 
587
  We validate the direct9
 
588
-
 
589
  !workflow {model: purchase.order, action: purchase_approve, ref: direct9}
 
590
-
 
591
  We check if invoice has been created by the confirmation
 
592
-
 
593
  !python {model: account.invoice}: |
 
594
    invoice_ids = self.search(cr, uid, [('name', '=', 'Direct9')])
 
595
    assert invoice_ids, ('No invoice created from Direct Purchase Order Direct9')
 
596
-
 
597
  We create a direct po with a internal partner
 
598
-
 
599
  !record {model: purchase.order, id: direct10}:
 
600
    order_type: direct
 
601
    name: Direct10
 
602
    partner_id: supplier1
 
603
    company_id: base.main_company
 
604
    date_order: !eval time.strftime('%Y-%m-%d')
 
605
    invoice_method: order
 
606
    location_id: stock.stock_location_stock
 
607
    partner_address_id: address1
 
608
    pricelist_id: purchase.list0
 
609
-
 
610
  We create a line for this purchase order
 
611
-
 
612
  !record {model: purchase.order.line, id: direct10_l1}:
 
613
    product_uom: product.product_uom_unit
 
614
    product_id: product1
 
615
    order_id: direct10
 
616
    price_unit: 1.50
 
617
    product_qty: 10
 
618
    name: P1
 
619
    date_planned: !eval time.strftime('%Y-%m-%d')
 
620
-
 
621
  We create a second line for this purchase order
 
622
-
 
623
  !record {model: purchase.order.line, id: direct10_l2}:
 
624
    product_uom: product.product_uom_unit
 
625
    product_id: product2
 
626
    order_id: direct10
 
627
    price_unit: 3.0
 
628
    product_qty: 25
 
629
    name: P2
 
630
    date_planned: !eval time.strftime('%Y-%m-%d')
 
631
-
 
632
  We validate this Direct Purchase Order
 
633
-
 
634
  !workflow {model: purchase.order, action: purchase_confirm, ref: direct10}
 
635
-
 
636
  We validate the direct10
 
637
-
 
638
  !workflow {model: purchase.order, action: purchase_approve, ref: direct10}
 
639
#-
 
640
#  We check if no invoice has been created by the confirmation
 
641
#-
 
642
#  !python {model: account.invoice}: |
 
643
#    invoice_ids = self.search(cr, uid, [('name', '=', 'Direct10')])
 
644
#    assert not invoice_ids, ('Invoice created from Direct Purchase Order Direct10')
 
645
-
 
646
  We check if stock moves has been generated with good data
 
647
-
 
648
  !python {model: stock.move}: |
 
649
    move_ids = self.search(cr, uid, [('purchase_line_id', 'in', [ref('direct10_l1'), ref('direct10_l2')])])
 
650
    assert not move_ids, ('Generated stock moves from Direct Purchase Order')
 
651
-
562
652
  We create a new regular purchase order with a inter-section partner
563
653
-
564
654
  !record {model: purchase.order, id: regular11}:
593
683
  We check if invoices has been created by the confirmation of regular11
594
684
-
595
685
  !python {model: account.invoice}: |
596
 
    po_name = self.pool.get('purchase.order').browse(cr, uid, ref('regular11')).name
597
 
    invoice_ids = self.search(cr, uid, [('origin', '=', po_name)])
 
686
    invoice_ids = self.search(cr, uid, [('origin', '=', 'Regular11')])
598
687
    assert invoice_ids, ('No invoice created from Regular PO with internal supplier')
599
688
-
600
689
  Try to create a PO to the main company