
-
  In order to test the stock location module, I will create product, locations, SO, warehouse. 
  
- 
  Creating a account.account.type record
- 
  !record {model: account.account.type, id: account_account_type_asset0}:
    close_method: balance
    code: asset
    name: Asset
    sign: 1
    

- 
  Creating a account.account.type record
- 
  !record {model: account.account.type, id: account_account_type_income0}:
    close_method: unreconciled
    code: income
    name: Income
    sign: 1
    
    
- 
  Creating a account.account.type record
- 
  !record {model: account.account.type, id: account_account_type_expense0}:
    close_method: unreconciled
    code: expense
    name: Expense
    sign: 1    
- 
  Creating a account.account.type record
- 
  !record {model: account.account.type, id: account_account_type_receivable0}:
    close_method: balance
    code: receivable
    name: Receivable
    sign: 1
-
 
  Creating a account.account record
- 
  !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
- 
  Creating a account.account record
- 
  !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    
- 
  Creating a account.journal record
- 
  !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
    
- 
  Creating a account.journal record
- 
  !record {model: account.journal, id: account_journal_salejouran0}:
    code: sal
    company_id: base.main_company
    name: Sale Jouran
    sequence_id: account.sequence_sale_journal
    type: sale
    view_id: account.account_journal_view
    
- 
  Creating a account.account record
- 
  !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
- 
  Creating a account.account record
- 
  !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: account_account_type_income0

- 
  Creating a account.account record
- 
  !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
        
- 
  Creating a res.partner record
- 
  !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
-    
  Creating a res.partner record
- 
  !record {model: res.partner, id: res_partner_diasorinltd0}:
    address:
      - country_id: base.in
        street: Ash House, Ash Road
    name: DiaSorin Ltd
    supplier: true
    
        
-
  Creating a res.partner record
- 
  !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        
    
-
  Creating a res.partner.address record
- 
  !record {model: res.partner.address, id: res_partner_address_0}:
    country_id: base.in
    partner_id: res_partner_microlinktechnologies0
    street: Ash House, Ash Road
    title: base.res_partner_title_miss
    
               
-     
  Creating a product.category record
- 
  !record {model: product.category, id: product_category_computer0}:
    name: Computer
-
  Creating a stock.location record
- 
  !record {model: stock.location, id: stock_location_suppiler0}:
    chained_auto_packing: auto
    chained_delay: 15
    chained_location_type: none
    company_id: base.main_company
    name: Suppiler1
    usage: supplier
- 

  Creating a product.product record
- 
  !record {model: product.product, id: product_product_hpcdwriters0}:
    categ_id: 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
    path_ids:
      - auto: auto
        delay: 30
        location_dest_id: stock.location_inventory
        location_from_id: stock_location_suppiler0
    property_stock_inventory: stock.location_inventory
    property_stock_procurement: stock.location_procurement
    property_stock_production: stock.location_production
-
  Creating a stock.location record
- 
  !record {model: stock.location, id: stock_location_suppiler0}:
    address_id: res_partner_address_0
    chained_auto_packing: manual
    chained_delay: 20
    chained_location_type: none
    company_id: base.main_company
    name: Suppiler 1
    usage: internal
-
  I create warehouse.
- 
  !record {model: stock.warehouse, id: warehouse0}:
    company_id: base.main_company
    lot_input_id: stock.stock_location_stock
    lot_output_id: stock_location_suppiler0
    lot_stock_id: stock_location_suppiler0
    name: OpenERP S.A.
    partner_address_id: res_partner_address_0
-
  I create Sale order for HP CD writers.
- 
  !record {model: sale.order, id: sale_order_01}:
    date_order: '2010-04-20'
    invoice_quantity: order
    name: Test/location
    order_line:
      - name: HP CD writers
        price_unit: 1000.0
        product_uom: product.product_uom_unit
        product_uom_qty: 5.0
        state: draft
        product_id: product_product_hpcdwriters0
        type: make_to_order
    order_policy: manual
    partner_id: base.res_partner_agrolait
    partner_invoice_id: base.res_partner_address_8
    partner_order_id: base.res_partner_address_8
    partner_shipping_id: base.res_partner_address_8
    picking_policy: direct
    pricelist_id: product.list0
    shop_id: sale.shop
- 
  I confirm the sale order.
- 
  !workflow {model: sale.order, action: order_confirm, ref: sale_order_01}     
-
  I check the delay mentioned in pushed flow in move. 
-  
  !python {model: stock.move}: |
    product_id=self.pool.get('product.product').search(cr,uid,[('name','=','HP CD writers')])
    location_id=self.pool.get('stock.location').search(cr,uid,[('name','=','Inventory loss')])
    move_ids =self.search(cr, uid, [('product_id','in',product_id),('location_dest_id','=',location_id)])
    if move_ids:
      move_obj=self.browse(cr,uid,move_ids)[0]
      import time
      from_dt = time.mktime(time.strptime(move_obj.date,'%Y-%m-%d %H:%M:%S'))
      to_dt = time.mktime(time.strptime(move_obj.date_planned,'%Y-%m-%d %H:%M:%S'))
      diff_day = (to_dt-from_dt)/(3600*24)
      assert (round(diff_day)+1 ==30)    
