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
7 I create Asset Account Type.
9 !record {model: account.account.type, id: account_account_type_asset0}:
16 I create Income Account Type.
18 !record {model: account.account.type, id: account_account_type_income0}:
19 close_method: unreconciled
26 I create Expense Account Type.
28 !record {model: account.account.type, id: account_account_type_expense0}:
29 close_method: unreconciled
34 I create Cash Account Type.
36 !record {model: account.account.type, id: account_account_type_cash0}:
44 I create Receivable Account Type.
46 !record {model: account.account.type, id: account_account_type_receivable0}:
53 I create Receivable Account .
55 !record {model: account.account, id: account_account_receivable0}:
56 code: '40000-stock-test'
57 company_id: base.main_company
58 currency_mode: current
63 user_type: account_account_type_receivable0
65 I create Payable Account.
67 !record {model: account.account, id: account_account_payable0}:
68 code: '440000-stock-test'
69 company_id: base.main_company
70 currency_mode: current
75 user_type: account_account_type_expense0
77 I create Purchase Journal.
79 !record {model: account.journal, id: account_journal_purchasejournal0}:
81 company_id: base.main_company
82 name: Purchase Journal
83 sequence_id: account.sequence_purchase_journal
85 view_id: account.account_journal_bank_view
88 I create Sale Journal.
90 !record {model: account.journal, id: account_journal_salejouran0}:
92 company_id: base.main_company
94 sequence_id: account.sequence_sale_journal
96 view_id: account.account_journal_view
99 I create Expense Account.
101 !record {model: account.account, id: account_account_expenseaccount0}:
103 company_id: base.main_company
104 currency_mode: current
105 name: Expense Account
109 user_type: account_account_type_asset0
111 I create Product Sale Account.
113 !record {model: account.account, id: account_account_productsale0}:
114 code: '001-stock-test'
115 company_id: base.main_company
116 currency_mode: current
119 user_type: stock.account_account_type_income0
123 I create Product Purchase Account.
125 !record {model: account.account, id: account_account_productpurchase0}:
126 code: '0002-stock-test'
127 company_id: base.main_company
128 currency_mode: current
129 name: Product Purchase
131 user_type: account_account_type_expense0
136 !record {model: res.partner, id: res_partner_shawtrust0}:
138 - country_id: base.in
139 - street: St James House, Vicar Lane, Sheffield
142 property_account_payable: account_account_payable0
143 property_account_receivable: account_account_receivable0
147 !record {model: res.partner, id: res_partner_diasorinltd0}:
149 - country_id: base.in
150 street: Ash House, Ash Road
158 !record {model: res.partner, id: res_partner_microlinktechnologies0}:
160 - street: Kailash Vaibhav, Parksite
161 name: Micro Link Technologies
162 property_account_payable: account_account_payable0
163 property_account_receivable: account_account_receivable0
167 I create partner address.
169 !record {model: res.partner.address, id: res_partner_address_0}:
171 partner_id: stock.res_partner_diasorinltd0
172 street: Ash House, Ash Road
173 title: base.res_partner_title_miss
177 I create product.category .
179 !record {model: product.category, id: product_category_computer0}:
183 I create product HP Pavilion Desktop PCs .
185 !record {model: product.product, id: product_product_hppaviliondesktoppcs0}:
186 categ_id: stock.product_category_computer0
187 cost_method: standard
190 name: HP Pavilion Desktop PCs
191 procure_method: make_to_stock
194 name: stock.res_partner_shawtrust0
198 uom_id: product.product_uom_unit
199 uom_po_id: product.product_uom_unit
200 property_account_expense: account_account_productsale0
201 property_account_income: account_account_productsale0
204 I create product HP CD writers.
206 !record {model: product.product, id: product_product_hpcdwriters0}:
207 categ_id: stock.product_category_computer0
208 cost_method: standard
212 procure_method: make_to_stock
215 name: res_partner_shawtrust0
219 uom_id: product.product_uom_unit
220 uom_po_id: product.product_uom_unit
221 property_account_expense: account_account_productpurchase0
222 property_account_income: account_account_productsale0
225 I create Physical Inventory for the products.
227 !record {model: stock.inventory, id: stock_inventory_physicalinventoy0}:
228 company_id: base.main_company
229 date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
230 date_done: !eval time.strftime('%Y-%m-%d %H:%M:%S')
232 - company_id: base.main_company
233 location_id: stock.stock_location_stock
234 product_id: stock.product_product_hpcdwriters0
236 product_uom: product.product_uom_unit
237 - company_id: base.main_company
238 location_id: stock.stock_location_stock
239 product_id: stock.product_product_hppaviliondesktoppcs0
241 product_uom: product.product_uom_unit
242 name: Physical inventory
247 I confirm the Inventory for HP CD writers.
249 !python {model: stock.inventory}: |
250 self.action_confirm(cr,uid,[ref('stock_inventory_physicalinventoy0')])
251 self.action_done(cr,uid,[ref('stock_inventory_physicalinventoy0')])
253 I create stock.fill.inventory .
255 !record {model: stock.fill.inventory, id: stock_fill_inventory_0}:
256 location_id: stock.stock_location_stock
259 I fill inventory for HP CD writers.
261 !python {model: stock.fill.inventory}: |
262 self.fill_inventory(cr, uid, [ref("stock_fill_inventory_0")], {"lang": 'en_US',
263 "full": "1", "tz": False, "active_model": "stock.inventory", "active_ids":
264 [ref("stock_inventory_physicalinventoy0")], "active_id": ref("stock_inventory_physicalinventoy0"), })
267 I create stock.move.split record.
269 !record {model: stock.move.split, id: stock_move_split_0}:
271 - name: '00001-stock-test'
273 product_id: stock.product_product_hpcdwriters0
276 I Split into production line.
278 !python {model: stock.move.split}: |
279 move_obj=self.pool.get('stock.move')
280 product_obj=self.pool.get('product.product')
281 product_id=product_obj.search(cr,uid,[('name','=','HP CD writers')])
282 move_ids=move_obj.search(cr,uid,[('product_id','in',product_id)])
283 self.split_lot(cr, uid, [ref("stock_move_split_0")], {"lang": 'en_US', "active_model":
284 "stock.move", "active_ids": move_ids, "tz": False, "active_id":move_ids[0]
288 In Order to test the picking I create picking with move lines.
290 !record {model: stock.picking, id: stock_picking_0}:
292 address_id: base.res_partner_address_4
293 company_id: base.main_company
294 date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
297 - company_id: base.main_company
298 date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
299 location_dest_id: stock.stock_location_customers
300 location_id: stock.stock_location_stock
302 product_id: product.product_product_pc1
304 product_uom: product.product_uom_unit
305 date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
312 I click on draft_force_assign on picking.
314 !python {model: stock.picking}: |
315 self.draft_force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model":
316 "ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display":
317 "partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id":
318 ref("stock.menu_action_picking_tree6"), })
322 I click on force_assign on picking.
324 !python {model: stock.picking}: |
325 self.force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model":
326 "ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display":
327 "partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id":
328 ref("stock.menu_action_picking_tree6"), })
331 I confirm the picking.
333 !python {model: stock.picking }: |
335 pick=self.browse(cr,uid,ref('stock_picking_0'))
336 move =pick.move_lines[0]
338 'partner_id':pick.address_id.partner_id.id,
339 'address_id': pick.address_id.id,
340 'delivery_date' : time.strftime('%Y-%m-%d')
342 partial_datas['move%s'%(move.id)]= {
343 'product_id': move.product_id,
344 'product_qty': move.product_qty,
345 'product_uom': move.product_uom.id,
347 self.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas)