[MERGE] Missing modelines, requested and provided by Lionel Sausin (Numerigraphe)
[odoo/odoo.git] / addons / stock_location / test / stock_location_push_flow.yml
1 -
2   In order to test the product pushed flow , I create account ,partner,product,shipment
3   Push flow specification indicates which location is chained with which location.
4 -
5   I create product category.
6 -
7   !record {model: product.category, id: product_category_computer0}:
8     name: Computer
9
10 -
11   I create Supplier.
12 -
13   !record {model: res.partner, id: res_partner_microlinktechnologies0}:
14     address:
15       - street: Kailash Vaibhav, Parksite
16     name: Micro Link Technologies
17     property_account_payable: account_account_payable0
18     property_account_receivable: account_account_receivable0
19     supplier: true
20
21 -
22   I create Supplier address.
23 -
24   !record {model: res.partner.address, id: res_partner_address_0}:
25     country_id: base.in
26     partner_id: res_partner_microlinktechnologies0
27     street: Ash House, Ash Road
28     title: base.res_partner_title_miss
29
30 -
31   I create product and define the pushed flow .
32 -
33   I set the chain location Supplier to stock Input
34   Stock Input to Quality test and Quality test -Stock  .
35 -
36   !record {model: product.product, id: product_product_hpcdwriters01}:
37     categ_id: product_category_computer0
38     cost_method: standard
39     list_price: 1000.0
40     mes_type: fixed
41     name: HP CD writers
42     procure_method: make_to_stock
43     seller_ids:
44       - delay: 1
45         name: res_partner_microlinktechnologies0
46         min_qty: 5.0
47     path_ids:
48       - auto: auto
49         invoice_state: none
50         location_dest_id: stock_location.stock_location_qualitytest0
51         location_from_id: stock.stock_location_stock
52       - auto: auto
53         invoice_state: none
54         location_dest_id: stock.stock_location_components
55         location_from_id: stock_location.stock_location_qualitytest0
56     supply_method: buy
57     type: product
58     uom_id: product.product_uom_unit
59     uom_po_id: product.product_uom_unit
60     property_stock_inventory: stock.location_inventory
61     property_stock_procurement: stock.location_procurement
62     property_stock_production: stock.location_production
63 -
64   In order to test pushed flow .I buy the product from Micro Link Technologies supplier. I create a Picking.
65 -
66    !record {model: stock.picking , id: stock_picking_in0}:
67     address_id: res_partner_address_0
68     company_id: base.main_company
69     invoice_state: none
70     move_lines:
71       - date_expected: !eval time.strftime('%Y-%m-%d %H:%M:%S')
72         location_dest_id: stock.stock_location_stock
73         location_id: stock.stock_location_suppliers
74         name: 'HP CD writers'
75         product_id: product_product_hpcdwriters01
76         product_qty: 6.0
77         product_uom: product.product_uom_unit
78         product_uos_qty: 6.0
79     name: Pushed Flow Test
80     type: in
81 -
82   I confirm picking.
83 -
84   !python {model: stock.picking }: |
85     self.draft_force_assign(cr, uid, [ref("stock_picking_in0")], {"lang": "en_US",
86       "search_default_available": 1, "tz": False, "active_model": "ir.ui.menu",
87       "contact_display": "partner_address", "active_ids": [ref("stock.menu_action_picking_tree4")],
88       "active_id": ref("stock.menu_action_picking_tree4"), })
89 -
90   I check that the outgoing order of the supplier  is create with two move line.
91   Stock/Input To Quality test and Quality test  To Stock.
92 -
93   I check the move is in waiting state.
94 -
95   !python {model: stock.picking }: |
96    from tools.translate import _
97    picking_id = self.search(cr, uid, [('origin','=','Pushed Flow Test'),('type','=','out')])
98    if picking_id:
99       pick=self.browse(cr,uid,picking_id[0])
100       for move in pick.move_lines:
101          assert(move.state == 'waiting'), _('Stock  is  not in waiting state')
102 -
103   I receive the order of the supplier Micro Link Technologies from the Incoming Shipments menu.
104 -
105   !python {model: stock.picking }: |
106    import time
107    picking_id = self.search(cr, uid, [('address_id.partner_id','=',ref('res_partner_microlinktechnologies0')),('type','=','in')])
108    if picking_id:
109       pick=self.browse(cr,uid,picking_id[0])
110       move =pick.move_lines[0]
111       partial_datas = {
112            'partner_id':pick.address_id.partner_id.id,
113             'address_id': pick.address_id.id,
114             'delivery_date' : time.strftime('%Y-%m-%d'),
115            }
116       partial_datas['move%s'%(move.id)]= {
117           'product_id': move.product_id.id,
118           'product_qty': move.product_qty,
119           'product_uom': move.product_uom.id,
120       }
121       self.do_partial(cr, uid, picking_id,partial_datas)
122 -
123   I check the Outgoing Orders is automatically  done.
124 -
125   !python {model: stock.picking }: |
126    from tools.translate import _
127    picking_id = self.search(cr, uid, [('origin','=','Pushed Flow Test'),('type','=','out')])
128    if picking_id:
129       pick=self.browse(cr,uid,picking_id[0])
130       assert(pick.state == 'done'), _('Picking  is  not in done state')