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
8 I create Receivable Account .
10 !record {model: account.account, id: account_account_receivable0}:
11 code: '40000-stock-test'
12 company_id: base.main_company
13 currency_mode: current
18 user_type: account.account_type_receivable
20 I create Payable Account.
22 !record {model: account.account, id: account_account_payable0}:
23 code: '440000-stock-test'
24 company_id: base.main_company
25 currency_mode: current
30 user_type: account.account_type_payable
32 I create Purchase Journal - (test).
34 !record {model: account.journal, id: account_journal_purchasejournal0}:
36 company_id: base.main_company
37 name: Purchase Journal - (test)
38 sequence_id: account.sequence_purchase_journal
40 view_id: account.account_journal_bank_view
43 I create Sale Journal.
45 !record {model: account.journal, id: account_journal_salejouran0}:
47 company_id: base.main_company
49 sequence_id: account.sequence_sale_journal
51 view_id: account.account_journal_view
54 I create Expense Account.
56 !record {model: account.account, id: account_account_expenseaccount0}:
58 company_id: base.main_company
59 currency_mode: current
64 user_type: account.account_type_expense
66 I create Product Sale Account.
68 !record {model: account.account, id: account_account_productsale0}:
69 code: '001-stock-test'
70 company_id: base.main_company
71 currency_mode: current
74 user_type: account.account_type_income
78 I create Product Purchase Account.
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
86 user_type: account.account_type_expense
91 !record {model: res.partner, id: res_partner_shawtrust0}:
94 - street: St James House, Vicar Lane, Sheffield
97 property_account_payable: account_account_payable0
98 property_account_receivable: account_account_receivable0
102 !record {model: res.partner, id: res_partner_diasorinltd0}:
104 - country_id: base.in
105 street: Ash House, Ash Road
113 !record {model: res.partner, id: res_partner_microlinktechnologies0}:
115 - street: Kailash Vaibhav, Parksite
116 name: Micro Link Technologies
117 property_account_payable: account_account_payable0
118 property_account_receivable: account_account_receivable0
122 I create partner address.
124 !record {model: res.partner.address, id: res_partner_address_0}:
126 partner_id: stock.res_partner_diasorinltd0
127 street: Ash House, Ash Road
128 title: base.res_partner_title_miss
132 I create product.category .
134 !record {model: product.category, id: product_category_computer0}:
138 I create product HP Pavilion Desktop PCs .
140 !record {model: product.product, id: product_product_hppaviliondesktoppcs0}:
141 categ_id: stock.product_category_computer0
142 cost_method: standard
145 name: HP Pavilion Desktop PCs
146 procure_method: make_to_stock
149 name: stock.res_partner_shawtrust0
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
159 I create product HP CD writers.
161 !record {model: product.product, id: product_product_hpcdwriters0}:
162 categ_id: stock.product_category_computer0
163 cost_method: standard
167 procure_method: make_to_stock
170 name: res_partner_shawtrust0
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
180 I create Physical Inventory for the products.
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')
187 - company_id: base.main_company
188 location_id: stock.stock_location_stock
189 product_id: stock.product_product_hpcdwriters0
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
196 product_uom: product.product_uom_unit
197 name: Physical inventory
202 I confirm the Inventory for HP CD writers.
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')])
208 I create stock.fill.inventory .
210 !record {model: stock.fill.inventory, id: stock_fill_inventory_0}:
211 location_id: stock.stock_location_stock
214 I fill inventory for HP CD writers.
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"), })
222 I create stock.move.split record.
224 !record {model: stock.move.split, id: stock_move_split_0}:
226 - name: '00001-stock-test'
228 product_id: stock.product_product_hpcdwriters0
231 I Split into production line.
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]
243 In Order to test the picking I create picking with move lines.
245 !record {model: stock.picking, id: stock_picking_0}:
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')
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
257 product_id: product.product_product_pc1
259 product_uom: product.product_uom_unit
260 date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
267 I click on draft_force_assign on picking.
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"), })
277 I click on force_assign on picking.
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"), })
286 I confirm the picking.
288 !python {model: stock.picking }: |
290 pick=self.browse(cr,uid,ref('stock_picking_0'))
291 move =pick.move_lines[0]
293 'partner_id':pick.address_id.partner_id.id,
294 'address_id': pick.address_id.id,
295 'delivery_date' : time.strftime('%Y-%m-%d')
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,
302 self.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas)