~camptocamp/carriers-deliveries/vre-configuration-test-postlogitics-ireland

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-
  In order to test process of the Delivery Optional Invoice Line,
- 
  I set the do_not_create_invoice_line field as True on the free_delivery_carrier.
-  
  !record {model: delivery.carrier, id: delivery.free_delivery_carrier}:
    do_not_create_invoice_line: True
-
  I create sale order having picking as order_policy and free_delivery_carrier as carrier_id.
-
  !record {model: sale.order, id: sale_order_test}:
    partner_id: base.res_partner_2
    order_policy: picking
    carrier_id: delivery.free_delivery_carrier
    order_line: 
      - product_id: product.product_product_7
        product_uom_qty: 8
-
  I confirm sale order.
-
  !workflow {model: sale.order, action: order_confirm, ref: sale_order_test}
-
  Now, I dispatch delivery order.
-
  !python {model: stock.partial.picking}: |
    order = self.pool.get('sale.order').browse(cr, uid, ref("sale_order_test"))
    for pick in order.picking_ids:
        data = pick.force_assign()
        if data == True:
          partial_id = self.create(cr, uid, {}, context={'active_model': 'stock.picking','active_ids': [pick.id]})
          self.do_partial(cr, uid, [partial_id])
-
  I create invoice from delivery order.
-
  !python {model: stock.invoice.onshipping}: |
    sale = self.pool.get('sale.order')
    sale_order = sale.browse(cr, uid, ref("sale_order_test"))
    ship_ids = [x.id for x in sale_order.picking_ids]
    wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')},
      {'active_ids': ship_ids, 'active_model': 'stock.picking'})
    self.create_invoice(cr, uid, [wiz_id], {"active_ids": ship_ids, "active_id": ship_ids[0]})
-
  I check the invoice details after dispatched delivery.
-
  !python {model: sale.order}: |
    order = self.browse(cr, uid, ref("sale_order_test"))
    assert order.invoice_ids, "Invoice is not created."
    for invoice in order.invoice_ids:
    	assert len(invoice.invoice_line) == len(order.order_line), "Lines of Invoice and Sale Order are not correspond"