-
  In order to test the product pulled flow , I create ,partner,product,procurement
-
  I create a account type Asset.
-
  !record {model: account.account.type, id: account_account_type_asset0}:
    close_method: balance
    code: asset_test
    name: Asset For Tests
-
  I create a account type income.
-
  !record {model: account.account.type, id: account_account_type_income0}:
    close_method: unreconciled
    code: income_test
    name: Income For Tests
-
  I create a account type Expense.
-
  !record {model: account.account.type, id: account_account_type_expense0}:
    close_method: unreconciled
    code: expense_test
    name: Expense For Tests
-
  I create a account type Receivable.
-
  !record {model: account.account.type, id: account_account_type_receivable0}:
    close_method: unreconciled
    code: receivable_test
    name: Receivable For Tests
-

  I create a account  Receivable.
-
  !record {model: account.account, id: account_account_receivable0}:
    code: 40000_test
    company_id: base.main_company
    currency_mode: current
    name: Receivable For Tests
    type: receivable
    user_type: account_account_type_receivable0
-
  I create a account  Payable.
-
  !record {model: account.account, id: account_account_payable0}:
    code: 440000_test
    company_id: base.main_company
    currency_mode: current
    name: Payable For Tests
    type: payable
    user_type: account_account_type_expense0
-
  I create a Purchase Journal.
-
  !record {model: account.journal, id: account_journal_purchasejournal0}:
    code: pur_test
    company_id: base.main_company
    name: Purchase Journal For Tests
    sequence_id:  account.sequence_purchase_journal
    type: purchase

-
  I create a Sale Journal.
-
  !record {model: account.journal, id: account_journal_salejouran0}:
    code: sal_test
    company_id: base.main_company
    name: Sale Journal For Tests
    sequence_id: account.sequence_sale_journal
    type: sale

-
  I create an Expense Account
-
  !record {model: account.account, id: account_account_expenseaccount0}:
    code: Expe_test
    company_id: base.main_company
    currency_mode: current
    name: Expense Account For Tests
    type: consolidation
    user_type: account_account_type_asset0
-
  I create  Product Sale account.
-
  !record {model: account.account, id: account_account_productsale0}:
    code: 001_test
    company_id: base.main_company
    currency_mode: current
    name: Product Sale For Tests
    type: other
    user_type: account_account_type_income0

-
  I create  Product Product Purchase.
-
  !record {model: account.account, id: account_account_productpurchase0}:
    code: 0002_test
    company_id: base.main_company
    currency_mode: current
    name: Product Purchase For Tests
    type: other
    user_type: account_account_type_expense0
-
  I create a Supplier.
-
  !record {model: res.partner, id: res_partner_shawtrust0}:
    name: Shaw Trust
    lang: en_US
    country_id: base.in
    street: St James House, Vicar Lane, Sheffiel
    property_account_payable: account_account_payable0
    property_account_receivable: account_account_receivable0
-
  I create a product category.
-
  !record {model: product.category, id: product_category_computer0}:
    name: Computer
-
  I create a product and define the pulled flow condition for stock move.
  I set shipping type Sending Goods. and set Procurement type to move.
-
  !record {model: product.product, id: product_product_hpcdwriters01}:
    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
    flow_pull_ids:
      - invoice_state: none
        location_id: stock.stock_location_shop0
        location_src_id: stock.stock_location_shop1
        name: E001
        partner_address_id: base.res_partner_address_2
        picking_type: out
        procure_method: make_to_stock
        type_proc: move
      - invoice_state: none
        location_id: stock.stock_location_shop1
        location_src_id: stock.stock_location_suppliers
        name: E002
        partner_address_id: base.res_partner_address_7
        picking_type: out
        procure_method: make_to_stock
        type_proc: move
      - invoice_state: none
        location_id: stock.stock_location_suppliers
        location_src_id: stock.stock_location_stock
        name: E003
        type_proc: buy
    property_stock_inventory: stock.location_inventory
    property_stock_procurement: stock.location_procurement
    property_stock_production: stock.location_production
    qty_available: 15
-
  I create a procurement order.
-
  !record {model: procurement.order, id: procurement_order_test0}:
    company_id: base.main_company
    date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S')
    location_id: stock.stock_location_shop0
    name: Testing pulled flow
    priority: '1'
    procure_method: make_to_order
    product_id: product_product_hpcdwriters01
    product_qty: 5.0
    product_uom: product.product_uom_unit
    product_uos: product.product_uom_unit
    product_uos_qty: 0.0
-
  I confirm the procurement order.
-
  !workflow {model: procurement.order, action: button_confirm, ref: procurement_order_test0}
-
  I launch the scheduler to compute  procurement.
-
  !python {model: procurement.order.compute.all}: |
    proc_obj = self.pool.get('procurement.order')
    proc_obj._procure_confirm(cr,uid)

-
  I check the new procurement order has been created .
-
  !python {model: procurement.order }: |
   from tools.translate import _
   procurement_ids=self.search(cr, uid, [('name','=','E001')])
   assert len(procurement_ids), "Procurement order hasn't Created."
-
  I check the Outgoing Picking is created for source location Birmingham Shop and destination Chicago shop.
-
  !python {model: stock.picking }: |
    from tools.translate import _
    picking_id = self.search(cr, uid, [('origin','=','Testing pulled flow:E001'),('type','=','out')])
    assert len(picking_id), "Picking  hasn't Created."
