~camptocamp/stock-logistic-warehouse/add-stock_ownership_nbi

« back to all changes in this revision

Viewing changes to stock_location_ownership/test/sale_order_not_sourced.yml

  • Committer: Joel Grand-Guillaume
  • Date: 2013-07-29 13:41:11 UTC
  • Revision ID: joel.grandguillaume@camptocamp.com-20130729134111-0a2b0q9vcbhtjy8a
[ADD] stock_location_ownership: first steps of the module
  (/tmp/trunk-generic/ rev 15.2.3)
(/tmp/7.0-add-sale_sourced_and_stock_ownership rev 21)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-
 
2
  In order to check if the source location of a sale order line
 
3
  still use the location of the shop if not specified on the
 
4
  sale order line.
 
5
-
 
6
  !record {model: sale.order, id: sale_notsourced_01}:
 
7
    partner_id: base.res_partner_2
 
8
    note: Invoice after delivery
 
9
    order_line:
 
10
      - product_id: product.product_product_7
 
11
        product_uom_qty: 8
 
12
-
 
13
  When I confirm the sale order
 
14
-
 
15
  !workflow {model: sale.order, action: order_confirm, ref: sale_notsourced_01}
 
16
-
 
17
  Then a delivery order should have been generated
 
18
-
 
19
  !python {model: sale.order}: |
 
20
    sale_order = self.browse(cr, uid, ref("sale_notsourced_01"))
 
21
    assert len(sale_order.picking_ids) == 1, (
 
22
        "1 delivery order expected, got %d" % len(sale_order.picking_ids))
 
23
-
 
24
  And the source location of the stock move should be the one of
 
25
  the sales order's shop
 
26
-
 
27
  !python {model: sale.order}: |
 
28
    sale_order = self.browse(cr, uid, ref("sale_notsourced_01"))
 
29
    picking = sale_order.picking_ids[0]
 
30
    location_id = sale_order.shop_id.warehouse_id.lot_stock_id
 
31
    for move in picking.move_lines:
 
32
        assert move.location_id == location_id, (
 
33
            "Wrong location_id, expected %s, got %s" %
 
34
            (location_id, move.location_id))
 
35
        for procurement in move.procurements:
 
36
            assert procurement.location_id == location_id, (
 
37
                "Wrong location_id in procurement.order, expected %s, got %s" %
 
38
                (location_id, procurement.location_id))