6a82846492db473bd4b4522dea269681a82f7778
[odoo/odoo.git] / addons / stock / test / stock_test.yml
1
2 -
3   In order to test the stock module, I will create product,
4   create physical inventory ,fill inventory lines from location,split inventory line into production lot
5
6 -
7
8   I create Receivable Account .
9 -
10   !record {model: account.account, id: account_account_receivable0}:
11     code: '40000-stock-test'
12     company_id: base.main_company
13     currency_mode: current
14     name: Receivable
15     parent_left: 1
16     parent_right: 2
17     type: receivable
18     user_type: account.account_type_receivable
19 -
20   I create Payable Account.
21 -
22   !record {model: account.account, id: account_account_payable0}:
23     code: '440000-stock-test'
24     company_id: base.main_company
25     currency_mode: current
26     name: Payable
27     parent_left: 3
28     parent_right: 4
29     type: payable
30     user_type: account.account_type_payable
31 -
32   I create Purchase Journal - (test).
33 -
34   !record {model: account.journal, id: account_journal_purchasejournal0}:
35     code: pur
36     company_id: base.main_company
37     name: Purchase Journal - (test)
38     sequence_id:  account.sequence_purchase_journal
39     type: purchase
40     view_id: account.account_journal_bank_view
41
42 -
43   I create Sale Journal.
44 -
45   !record {model: account.journal, id: account_journal_salejouran0}:
46     code: sal
47     company_id: base.main_company
48     name: Sale Journal
49     sequence_id: account.sequence_sale_journal
50     type: sale
51     view_id: account.account_journal_view
52
53 -
54   I create Expense Account.
55 -
56   !record {model: account.account, id: account_account_expenseaccount0}:
57     code: Expe
58     company_id: base.main_company
59     currency_mode: current
60     name: Expense Account
61     parent_left: 5
62     parent_right: 6
63     type: consolidation
64     user_type: account.account_type_expense
65 -
66   I create Product Sale Account.
67 -
68   !record {model: account.account, id: account_account_productsale0}:
69     code: '001-stock-test'
70     company_id: base.main_company
71     currency_mode: current
72     name: Product Sale
73     type: other
74     user_type: account.account_type_income
75
76
77 -
78   I create Product Purchase Account.
79 -
80   !record {model: account.account, id: account_account_productpurchase0}:
81     code: '0002-stock-test'
82     company_id: base.main_company
83     currency_mode: current
84     name: Product Purchase
85     type: other
86     user_type: account.account_type_expense
87
88 -
89   I create partner.
90 -
91   !record {model: res.partner, id: res_partner_shawtrust0}:
92     address:
93       - country_id: base.in
94       - street: St James House, Vicar Lane, Sheffield
95     lang: en_US
96     name: 'Shaw Trust '
97     property_account_payable: account_account_payable0
98     property_account_receivable: account_account_receivable0
99 -
100   I create partner.
101 -
102   !record {model: res.partner, id: res_partner_diasorinltd0}:
103     address:
104       - country_id: base.in
105         street: Ash House, Ash Road
106     name: DiaSorin Ltd
107     supplier: true
108
109
110 -
111   I create partner.
112 -
113   !record {model: res.partner, id: res_partner_microlinktechnologies0}:
114     address:
115       - street: Kailash Vaibhav, Parksite
116     name: Micro Link Technologies
117     property_account_payable: account_account_payable0
118     property_account_receivable: account_account_receivable0
119     supplier: true
120
121 -
122   I create partner address.
123 -
124   !record {model: res.partner.address, id: res_partner_address_0}:
125     country_id: base.in
126     partner_id: stock.res_partner_diasorinltd0
127     street: Ash House, Ash Road
128     title: base.res_partner_title_miss
129
130
131 -
132   I create  product.category .
133 -
134   !record {model: product.category, id: product_category_computer0}:
135     name: Computer
136
137 -
138    I create  product HP Pavilion Desktop PCs .
139 -
140   !record {model: product.product, id: product_product_hppaviliondesktoppcs0}:
141     categ_id: stock.product_category_computer0
142     cost_method: standard
143     mes_type: fixed
144     list_price: 1000.0
145     name: HP Pavilion Desktop PCs
146     procure_method: make_to_stock
147     seller_ids:
148       - delay: 1
149         name: stock.res_partner_shawtrust0
150         min_qty: 5.0
151     supply_method: buy
152     type: product
153     uom_id: product.product_uom_unit
154     uom_po_id: product.product_uom_unit
155     property_account_expense: account_account_productsale0
156     property_account_income: account_account_productsale0
157
158 -
159   I create  product HP CD writers.
160 -
161   !record {model: product.product, id: product_product_hpcdwriters0}:
162     categ_id: stock.product_category_computer0
163     cost_method: standard
164     list_price: 1000.0
165     mes_type: fixed
166     name: HP CD writers
167     procure_method: make_to_stock
168     seller_ids:
169       - delay: 1
170         name: res_partner_shawtrust0
171         min_qty: 5.0
172     supply_method: buy
173     type: product
174     uom_id: product.product_uom_unit
175     uom_po_id: product.product_uom_unit
176     property_account_expense: account_account_productpurchase0
177     property_account_income: account_account_productsale0
178
179 -
180   I create Physical Inventory for the products.
181 -
182    !record {model: stock.inventory, id: stock_inventory_physicalinventoy0}:
183     company_id: base.main_company
184     date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
185     date_done: !eval time.strftime('%Y-%m-%d %H:%M:%S')
186     inventory_line_id:
187       - company_id: base.main_company
188         location_id: stock.stock_location_stock
189         product_id: stock.product_product_hpcdwriters0
190         product_qty: 10.0
191         product_uom: product.product_uom_unit
192       - company_id: base.main_company
193         location_id: stock.stock_location_stock
194         product_id: stock.product_product_hppaviliondesktoppcs0
195         product_qty: 10.0
196         product_uom: product.product_uom_unit
197     name: Physical inventory
198     state: draft
199
200
201 -
202   I confirm the Inventory for HP CD writers.
203 -
204   !python {model: stock.inventory}: |
205    self.action_confirm(cr,uid,[ref('stock_inventory_physicalinventoy0')])
206    self.action_done(cr,uid,[ref('stock_inventory_physicalinventoy0')])
207 -
208   I create stock.fill.inventory .
209 -
210   !record {model: stock.fill.inventory, id: stock_fill_inventory_0}:
211     location_id: stock.stock_location_stock
212
213 -
214   I fill inventory for HP CD writers.
215 -
216   !python {model: stock.fill.inventory}: |
217     self.fill_inventory(cr, uid, [ref("stock_fill_inventory_0")], {"lang": 'en_US',
218       "full": "1", "tz": False, "active_model": "stock.inventory", "active_ids":
219       [ref("stock_inventory_physicalinventoy0")], "active_id": ref("stock_inventory_physicalinventoy0"), })
220
221 -
222   I create stock.move.split record.
223 -
224   !record {model: stock.move.split, id: stock_move_split_0}:
225     line_ids:
226       - name: '00001-stock-test'
227         quantity: 5
228     product_id: stock.product_product_hpcdwriters0
229
230 -
231   I Split into production line.
232 -
233   !python {model: stock.move.split}: |
234     move_obj=self.pool.get('stock.move')
235     product_obj=self.pool.get('product.product')
236     product_id=product_obj.search(cr,uid,[('name','=','HP CD writers')])
237     move_ids=move_obj.search(cr,uid,[('product_id','in',product_id)])
238     self.split_lot(cr, uid, [ref("stock_move_split_0")], {"lang": 'en_US', "active_model":
239       "stock.move", "active_ids": move_ids, "tz": False, "active_id":move_ids[0]
240       })
241 -
242
243   In Order to test the picking I create picking with move lines.
244 -
245   !record {model: stock.picking, id: stock_picking_0}:
246     name: test_picking
247     address_id: base.res_partner_address_4
248     company_id: base.main_company
249     date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
250     invoice_state: none
251     move_lines:
252       - company_id: base.main_company
253         date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
254         location_dest_id: stock.stock_location_customers
255         location_id: stock.stock_location_stock
256         name: HP CD writers
257         product_id: product.product_product_pc1
258         product_qty: 3.0
259         product_uom: product.product_uom_unit
260         date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
261         product_uos_qty: 3.0
262     move_type: direct
263     type: internal
264
265
266 -
267   I click on draft_force_assign on picking.
268 -
269   !python {model: stock.picking}: |
270     self.draft_force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model":
271       "ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display":
272       "partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id":
273       ref("stock.menu_action_picking_tree6"), })
274
275
276 -
277   I click on force_assign on picking.
278 -
279   !python {model: stock.picking}: |
280     self.force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model":
281       "ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display":
282       "partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id":
283       ref("stock.menu_action_picking_tree6"), })
284
285 -
286   I confirm the picking.
287 -
288   !python {model: stock.picking }: |
289    import time
290    pick=self.browse(cr,uid,ref('stock_picking_0'))
291    move =pick.move_lines[0]
292    partial_datas = {
293           'partner_id':pick.address_id.partner_id.id,
294            'address_id': pick.address_id.id,
295            'delivery_date' : time.strftime('%Y-%m-%d')
296             }
297    partial_datas['move%s'%(move.id)]= {
298           'product_id': move.product_id,
299           'product_qty': move.product_qty,
300           'product_uom': move.product_uom.id,
301       }
302    self.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas)