c5360ce67c596fd8f1521b4f8bcae72e746ebb87
[odoo/odoo.git] / addons / stock_location / test / stock_location.yml
1
2 -
3   In order to test the stock location module, I will create product, locations, SO, warehouse. 
4   
5
6   Creating a account.account.type record
7
8   !record {model: account.account.type, id: account_account_type_asset0}:
9     close_method: balance
10     code: asset
11     name: Asset
12     sign: 1
13     
14
15
16   Creating a account.account.type record
17
18   !record {model: account.account.type, id: account_account_type_income0}:
19     close_method: unreconciled
20     code: income
21     name: Income
22     sign: 1
23     
24     
25
26   Creating a account.account.type record
27
28   !record {model: account.account.type, id: account_account_type_expense0}:
29     close_method: unreconciled
30     code: expense
31     name: Expense
32     sign: 1    
33
34   Creating a account.account.type record
35
36   !record {model: account.account.type, id: account_account_type_receivable0}:
37     close_method: balance
38     code: receivable
39     name: Receivable
40     sign: 1
41 -
42  
43   Creating a account.account record
44
45   !record {model: account.account, id: account_account_receivable0}:
46     code: '40000'
47     company_id: base.main_company
48     currency_mode: current
49     name: Receivable
50     parent_left: 1
51     parent_right: 2
52     type: receivable
53     user_type: account_account_type_receivable0
54
55   Creating a account.account record
56
57   !record {model: account.account, id: account_account_payable0}:
58     code: '440000'
59     company_id: base.main_company
60     currency_mode: current
61     name: Payable
62     parent_left: 3
63     parent_right: 4
64     type: payable
65     user_type: account_account_type_expense0    
66
67   Creating a account.journal record
68
69   !record {model: account.journal, id: account_journal_purchasejournal0}:
70     code: pur
71     company_id: base.main_company
72     name: Purchase Journal
73     sequence_id:  account.sequence_purchase_journal
74     type: purchase
75     view_id: account.account_journal_bank_view
76     
77
78   Creating a account.journal record
79
80   !record {model: account.journal, id: account_journal_salejouran0}:
81     code: sal
82     company_id: base.main_company
83     name: Sale Jouran
84     sequence_id: account.sequence_sale_journal
85     type: sale
86     view_id: account.account_journal_view
87     
88
89   Creating a account.account record
90
91   !record {model: account.account, id: account_account_expenseaccount0}:
92     code: Expe
93     company_id: base.main_company
94     currency_mode: current
95     name: Expense Account
96     parent_left: 5
97     parent_right: 6
98     type: consolidation
99     user_type: account_account_type_asset0
100
101   Creating a account.account record
102
103   !record {model: account.account, id: account_account_productsale0}:
104     code: '001'
105     company_id: base.main_company
106     currency_mode: current
107     name: Product Sale
108     type: other
109     user_type: account_account_type_income0
110
111
112   Creating a account.account record
113
114   !record {model: account.account, id: account_account_productpurchase0}:
115     code: '0002'
116     company_id: base.main_company
117     currency_mode: current
118     name: Product Purchase
119     type: other
120     user_type: account_account_type_expense0
121         
122
123   Creating a res.partner record
124
125   !record {model: res.partner, id: res_partner_shawtrust0}:
126     address:
127       - country_id: base.in    
128       - street: St James House, Vicar Lane, Sheffield
129     lang: en_US
130     name: 'Shaw Trust '
131     property_account_payable: account_account_payable0
132     property_account_receivable: account_account_receivable0
133 -    
134   Creating a res.partner record
135
136   !record {model: res.partner, id: res_partner_diasorinltd0}:
137     address:
138       - country_id: base.in
139         street: Ash House, Ash Road
140     name: DiaSorin Ltd
141     supplier: true
142     
143         
144 -
145   Creating a res.partner record
146
147   !record {model: res.partner, id: res_partner_microlinktechnologies0}:
148     address:
149       - street: Kailash Vaibhav, Parksite
150     name: Micro Link Technologies
151     property_account_payable: account_account_payable0
152     property_account_receivable: account_account_receivable0   
153     supplier: true        
154     
155 -
156   Creating a res.partner.address record
157
158   !record {model: res.partner.address, id: res_partner_address_0}:
159     country_id: base.in
160     partner_id: res_partner_microlinktechnologies0
161     street: Ash House, Ash Road
162     title: base.res_partner_title_miss
163     
164                
165 -     
166   Creating a product.category record
167
168   !record {model: product.category, id: product_category_computer0}:
169     name: Computer
170 -
171   Creating a stock.location record
172
173   !record {model: stock.location, id: stock_location_suppiler0}:
174     chained_auto_packing: auto
175     chained_delay: 15
176     chained_location_type: none
177     company_id: base.main_company
178     name: Suppiler1
179     usage: supplier
180
181
182   Creating a product.product record
183
184   !record {model: product.product, id: product_product_hpcdwriters0}:
185     categ_id: product_category_computer0
186     cost_method: standard
187     list_price: 1000.0
188     mes_type: fixed
189     name: HP CD writers
190     procure_method: make_to_stock
191     seller_ids:
192       - delay: 1
193         name: res_partner_shawtrust0
194         min_qty: 5.0
195     supply_method: buy
196     type: product
197     uom_id: product.product_uom_unit
198     uom_po_id: product.product_uom_unit
199     property_account_expense: account_account_productpurchase0
200     property_account_income: account_account_productsale0
201     path_ids:
202       - auto: auto
203         delay: 30
204         location_dest_id: stock.location_inventory
205         location_from_id: stock_location_suppiler0
206     property_stock_inventory: stock.location_inventory
207     property_stock_procurement: stock.location_procurement
208     property_stock_production: stock.location_production
209 -
210   Creating a stock.location record
211
212   !record {model: stock.location, id: stock_location_suppiler0}:
213     address_id: res_partner_address_0
214     chained_auto_packing: manual
215     chained_delay: 20
216     chained_location_type: none
217     company_id: base.main_company
218     name: Suppiler 1
219     usage: internal
220 -
221   I create warehouse.
222
223   !record {model: stock.warehouse, id: warehouse0}:
224     company_id: base.main_company
225     lot_input_id: stock.stock_location_stock
226     lot_output_id: stock_location_suppiler0
227     lot_stock_id: stock_location_suppiler0
228     name: OpenERP S.A.
229     partner_address_id: res_partner_address_0
230 -
231   I create Sale order for HP CD writers.
232
233   !record {model: sale.order, id: sale_order_01}:
234     date_order: '2010-04-20'
235     invoice_quantity: order
236     name: Test/location
237     order_line:
238       - name: HP CD writers
239         price_unit: 1000.0
240         product_uom: product.product_uom_unit
241         product_uom_qty: 5.0
242         state: draft
243         product_id: product_product_hpcdwriters0
244         type: make_to_order
245     order_policy: manual
246     partner_id: base.res_partner_agrolait
247     partner_invoice_id: base.res_partner_address_8
248     partner_order_id: base.res_partner_address_8
249     partner_shipping_id: base.res_partner_address_8
250     picking_policy: direct
251     pricelist_id: product.list0
252     shop_id: sale.shop
253
254   I confirm the sale order.
255
256   !workflow {model: sale.order, action: order_confirm, ref: sale_order_01}     
257 -
258   I check the delay mentioned in pushed flow in move. 
259 -  
260   !python {model: stock.move}: |
261     product_id=self.pool.get('product.product').search(cr,uid,[('name','=','HP CD writers')])
262     location_id=self.pool.get('stock.location').search(cr,uid,[('name','=','Inventory loss')])
263     move_ids =self.search(cr, uid, [('product_id','in',product_id),('location_dest_id','=',location_id)])
264     if move_ids:
265       move_obj=self.browse(cr,uid,move_ids)[0]
266       import time
267       from_dt = time.mktime(time.strptime(move_obj.date,'%Y-%m-%d %H:%M:%S'))
268       to_dt = time.mktime(time.strptime(move_obj.date_planned,'%Y-%m-%d %H:%M:%S'))
269       diff_day = (to_dt-from_dt)/(3600*24)
270       assert (round(diff_day)+1 ==30)