48
48
We check if no invoices has been created by the confirmation of regular1
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')
55
54
We check if generated stock moves have good data
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
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')
117
115
We check if generated stock moves have good data
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")
549
547
We check if invoice has been created by the confirmation
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')
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')
559
We create a direct po with a inter-section partner
561
!record {model: purchase.order, id: direct9}:
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
572
We create a line for this purchase order
574
!record {model: purchase.order.line, id: direct9_l1}:
575
product_uom: product.product_uom_unit
581
date_planned: !eval time.strftime('%Y-%m-%d')
583
We validate this Direct Purchase Order
585
!workflow {model: purchase.order, action: purchase_confirm, ref: direct9}
587
We validate the direct9
589
!workflow {model: purchase.order, action: purchase_approve, ref: direct9}
591
We check if invoice has been created by the confirmation
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')
597
We create a direct po with a internal partner
599
!record {model: purchase.order, id: 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
610
We create a line for this purchase order
612
!record {model: purchase.order.line, id: direct10_l1}:
613
product_uom: product.product_uom_unit
619
date_planned: !eval time.strftime('%Y-%m-%d')
621
We create a second line for this purchase order
623
!record {model: purchase.order.line, id: direct10_l2}:
624
product_uom: product.product_uom_unit
630
date_planned: !eval time.strftime('%Y-%m-%d')
632
We validate this Direct Purchase Order
634
!workflow {model: purchase.order, action: purchase_confirm, ref: direct10}
636
We validate the direct10
638
!workflow {model: purchase.order, action: purchase_approve, ref: direct10}
640
# We check if no invoice has been created by the confirmation
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')
646
We check if stock moves has been generated with good data
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')
562
652
We create a new regular purchase order with a inter-section partner
564
654
!record {model: purchase.order, id: regular11}:
593
683
We check if invoices has been created by the confirmation of regular11
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')
600
689
Try to create a PO to the main company