
-
  In order to test the stock module, I will create product,
  create physical inventory ,fill inventory lines from location,split inventory line into production lot
     
- 
  I create Asset Account Type.
- 
  !record {model: account.account.type, id: account_account_type_asset0}:
    close_method: balance
    code: asset
    name: Asset
    sign: 1
    
- 
   I create Income Account Type.
- 
  !record {model: account.account.type, id: account_account_type_income0}:
    close_method: unreconciled
    code: income
    name: Income
    sign: 1
    
    
- 
  I create Expense Account Type.
- 
  !record {model: account.account.type, id: account_account_type_expense0}:
    close_method: unreconciled
    code: expense
    name: Expense
    sign: 1    
- 
  I create Cash Account Type.
- 
  !record {model: account.account.type, id: account_account_type_cash0}:
    close_method: balance
    code: cash
    name: Cash
    sign: 1
    
    
- 
  I create Receivable Account Type.
- 
  !record {model: account.account.type, id: account_account_type_receivable0}:
    close_method: balance
    code: receivable
    name: Receivable
    sign: 1
-
 
  I create Receivable Account .
- 
  !record {model: account.account, id: account_account_receivable0}:
    code: '40000'
    company_id: base.main_company
    currency_mode: current
    name: Receivable
    parent_left: 1
    parent_right: 2
    type: receivable
    user_type: account_account_type_receivable0
- 
  I create Payable Account.
- 
  !record {model: account.account, id: account_account_payable0}:
    code: '440000'
    company_id: base.main_company
    currency_mode: current
    name: Payable
    parent_left: 3
    parent_right: 4
    type: payable
    user_type: account_account_type_expense0    
- 
  I create Purchase Journal.
- 
  !record {model: account.journal, id: account_journal_purchasejournal0}:
    code: pur
    company_id: base.main_company
    name: Purchase Journal
    sequence_id:  account.sequence_purchase_journal
    type: purchase
    view_id: account.account_journal_bank_view
    
- 
  I create Sale Journal.
- 
  !record {model: account.journal, id: account_journal_salejouran0}:
    code: sal
    company_id: base.main_company
    name: Sale Journal
    sequence_id: account.sequence_sale_journal
    type: sale
    view_id: account.account_journal_view
    
- 
  I create Expense Account.
- 
  !record {model: account.account, id: account_account_expenseaccount0}:
    code: Expe
    company_id: base.main_company
    currency_mode: current
    name: Expense Account
    parent_left: 5
    parent_right: 6
    type: consolidation
    user_type: account_account_type_asset0
- 
  I create Product Sale Account.
- 
  !record {model: account.account, id: account_account_productsale0}:
    code: '001'
    company_id: base.main_company
    currency_mode: current
    name: Product Sale
    type: other
    user_type: stock.account_account_type_income0
    
    
- 
  I create Product Purchase Account.
- 
  !record {model: account.account, id: account_account_productpurchase0}:
    code: '0002'
    company_id: base.main_company
    currency_mode: current
    name: Product Purchase
    type: other
    user_type: account_account_type_expense0
        
- 
  I create partner.
- 
  !record {model: res.partner, id: res_partner_shawtrust0}:
    address:
      - country_id: base.in    
      - street: St James House, Vicar Lane, Sheffield
    lang: en_US
    name: 'Shaw Trust '
    property_account_payable: account_account_payable0
    property_account_receivable: account_account_receivable0
-    
  I create partner.
- 
  !record {model: res.partner, id: res_partner_diasorinltd0}:
    address:
      - country_id: base.in
        street: Ash House, Ash Road
    name: DiaSorin Ltd
    supplier: true
    
        
-
  I create partner.
- 
  !record {model: res.partner, id: res_partner_microlinktechnologies0}:
    address:
      - street: Kailash Vaibhav, Parksite
    name: Micro Link Technologies
    property_account_payable: account_account_payable0
    property_account_receivable: account_account_receivable0   
    supplier: true        
    
-
  I create partner address.
- 
  !record {model: res.partner.address, id: res_partner_address_0}:
    country_id: base.in
    partner_id: stock.res_partner_diasorinltd0
    street: Ash House, Ash Road
    title: base.res_partner_title_miss
    
               
-     
  I create  product.category .
- 
  !record {model: product.category, id: product_category_computer0}:
    name: Computer

- 
   I create  product HP Pavilion Desktop PCs .
- 
  !record {model: product.product, id: product_product_hppaviliondesktoppcs0}:
    categ_id: stock.product_category_computer0
    cost_method: standard
    mes_type: fixed
    list_price: 1000.0    
    name: HP Pavilion Desktop PCs
    procure_method: make_to_stock
    seller_ids:
      - delay: 1
        name: stock.res_partner_shawtrust0
        min_qty: 5.0
    supply_method: buy
    type: product
    uom_id: product.product_uom_unit
    uom_po_id: product.product_uom_unit
    property_account_expense: account_account_productsale0
    property_account_income: account_account_productsale0    
    
- 
  I create  product HP CD writers.
- 
  !record {model: product.product, id: product_product_hpcdwriters0}:
    categ_id: stock.product_category_computer0
    cost_method: standard
    list_price: 1000.0
    mes_type: fixed
    name: HP CD writers
    procure_method: make_to_stock
    seller_ids:
      - delay: 1
        name: res_partner_shawtrust0
        min_qty: 5.0
    supply_method: buy
    type: product
    uom_id: product.product_uom_unit
    uom_po_id: product.product_uom_unit
    property_account_expense: account_account_productpurchase0
    property_account_income: account_account_productsale0
    
- 
  I create Physical Inventory for the products.
-  
   !record {model: stock.inventory, id: stock_inventory_physicalinventoy0}:  
    company_id: base.main_company
    date: '2010-05-10 18:19:13'
    date_done: '2010-05-10 18:19:59'
    inventory_line_id:
      - company_id: base.main_company
        location_id: stock.stock_location_stock
        product_id: stock.product_product_hpcdwriters0
        product_qty: 10.0
        product_uom: product.product_uom_unit
      - company_id: base.main_company
        location_id: stock.stock_location_stock
        product_id: stock.product_product_hppaviliondesktoppcs0
        product_qty: 10.0
        product_uom: product.product_uom_unit
    name: Physical inventory
    state: draft
    

- 
  I confirm the Inventory for HP CD writers.
- 
  !python {model: stock.inventory}: |
   self.action_done(cr,uid,[ref('stock_inventory_physicalinventoy0')])
- 
  I create stock.fill.inventory .
- 
  !record {model: stock.fill.inventory, id: stock_fill_inventory_0}:
    location_id: stock.stock_location_stock
       
- 
  I fill inventory for HP CD writers.
- 
  !python {model: stock.fill.inventory}: |
    self.fill_inventory(cr, uid, [ref("stock_fill_inventory_0")], {"lang": 'en_US',
      "full": "1", "tz": False, "active_model": "stock.inventory", "active_ids":
      [ref("stock_inventory_physicalinventoy0")], "active_id": ref("stock_inventory_physicalinventoy0"), })

- 
  I create stock.move.split record.
- 
  !record {model: stock.move.split, id: stock_move_split_0}:
    line_ids:
      - name: '00001'
        quantity: 5      
    product_id: stock.product_product_hpcdwriters0
     
- 
  I Split into production line.
- 
  !python {model: stock.move.split}: |
    move_obj=self.pool.get('stock.move')
    product_obj=self.pool.get('product.product')
    product_id=product_obj.search(cr,uid,[('name','=','HP CD writers')])
    move_ids=move_obj.search(cr,uid,[('product_id','in',product_id)])
    self.split_lot(cr, uid, [ref("stock_move_split_0")], {"lang": 'en_US', "active_model":
      "stock.move", "active_ids": move_ids, "tz": False, "active_id":move_ids[0]
      })
-
 
  In Order to test the picking I create picking with move lines.
- 
  !record {model: stock.picking, id: stock_picking_0}:
    name: test_picking
    address_id: res_partner_address_0
    company_id: base.main_company
    date: '2010-05-11 15:18:52'
    invoice_state: none
    move_lines:
      - company_id: base.main_company
        date_planned: '2010-05-11 15:18:57'
        location_dest_id: stock.stock_location_customers
        location_id: stock.stock_location_stock
        name: HP CD writers
        product_id: stock.product_product_hpcdwriters0
        product_qty: 3.0
        product_uom: product.product_uom_unit
        date: '2010-05-11 15:18:57'
        product_uos_qty: 3.0
    move_type: direct
    type: internal
    
    
- 
  I click on draft_force_assign on picking.
- 
  !python {model: stock.picking}: |
    self.draft_force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model":
      "ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display":
      "partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id":
      ref("stock.menu_action_picking_tree6"), })
    
    
- 
  I click on force_assign on picking.
- 
  !python {model: stock.picking}: |
    self.force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model":
      "ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display":
      "partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id":
      ref("stock.menu_action_picking_tree6"), })
    
-
  I confirm the picking.
-  
  !python {model: stock.picking }: |
   import time
   pick=self.browse(cr,uid,ref('stock_picking_0'))
   move =pick.move_lines[0]
   partial_datas = {
          'partner_id':pick.address_id.partner_id.id,
           'address_id': pick.address_id.id,
           'delivery_date' : time.strftime('%Y-%m-%d')
            }
   partial_datas['move%s'%(move.id)]= {
          'product_id': move.product_id,
          'product_qty': move.product_qty,
          'product_uom': move.product_uom.id,
      } 
   self.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas)