hunk.code_window:         sale_record = self.pool.get("sale.order").browse(cr, uid, ref('sale_order_drp_shpng'))
           procurement_order = self.pool.get("procurement.group").browse(cr, uid, sale_record.procurement_group_id.id).procurement_ids[0]
           purchase_id = procurement_order.purchase_line_id.order_id.id
           workflow.trg_validate(uid, 'purchase.order', purchase_id, 'purchase_confirm', cr)
           po_id = self.pool.get('purchase.order').search(cr, uid, [('partner_id', '=', ref('supplier_dropship'))])
  
hunk.labels: keep keep keep keep replace keep
hunk.after_edit:         self.button_confirm(cr, uid, purchase_id)
  
hunk.file_path: addons/stock_dropshipping/test/dropship.yml
hunk.type: replace
file: -
    Set the company currency as EURO for the sake of repeatibility
  -
     !python {model: res.company}: |
      self.write(cr, uid, [ref('base.main_company')], {'currency_id':ref('base.EUR')}, context=context)
  
  - 
    Set product category removal strategy as LIFO 
  - 
    !record {model: product.category, id: product.product_category_001}:
      name : Lifo Category
      removal_strategy_id: stock.removal_lifo
  -
    Set a product as using lifo price
  -
    !record {model: product.product, id: product_lifo_icecream}:
      default_code: LIFO
      name: LIFO Ice Cream
      type: product
      categ_id: product.product_category_001
      list_price: 100.0
      standard_price: 70.0
      uom_id: product.product_uom_kgm
      uom_po_id: product.product_uom_kgm
      valuation: real_time
      cost_method: real
      property_stock_account_input: o_expense
      property_stock_account_output: o_income
      description: LIFO Ice Cream can be mass-produced and thus is widely available in developed parts of the world. Ice cream can be purchased in large cartons (vats and squrounds) from supermarkets and grocery stores, in smaller quantities from ice cream shops, convenience stores, and milk bars, and in individual servings from small carts or vans at public events.
  - 
    I create a draft Purchase Order for first in move for 10 pieces at 60 euro
  - 
    !record {model: purchase.order, id: purchase_order_lifo1}:
      partner_id: base.res_partner_3
      location_id: stock.stock_location_stock
      order_line:
        - product_id: product_lifo_icecream
          product_qty: 10.0
          product_uom: product.product_uom_kgm
          price_unit: 60.0
          name: 'LIFO Ice Cream'
  - 
    I create a draft Purchase Order for second shipment for 30 pieces at 80 euro
  - 
    !record {model: purchase.order, id: purchase_order_lifo2}:
      partner_id: base.res_partner_3
      location_id: stock.stock_location_stock
      order_line:
        - product_id: product_lifo_icecream
          product_qty: 30.0
          product_uom: product.product_uom_kgm
          price_unit: 80.0
          name: 'LIFO Ice Cream'
  - 
    I confirm the first purchase order
  -
    !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_lifo1}
  -
    I check the "Approved" status of purchase order 1
  -
    !assert {model: purchase.order, id: purchase_order_lifo1}:
      - state == 'approved'
  - 
    Process the receipt of purchase order 1
  -
    !python {model: stock.picking}: |
      order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_lifo1"), context=context).picking_ids[0]
      order.do_transfer()
  - 
    Check the standard price of the product (lifo icecream)
  - 
    !python {model: product.product}: |
      assert self.browse(cr, uid, ref("product_lifo_icecream")).standard_price == 70.0, 'Standard price should not have changed!'
  - 
    I confirm the second purchase order
  - 
    !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_lifo2}
  -
    Process the receipt of purchase order 2
  - 
    !python {model: stock.picking}: |
      order = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_lifo2"), context=context).picking_ids[0]
      order.do_transfer()
  - 
    Check the standard price should not have changed
  - 
    !python {model: product.product}: |
      assert self.browse(cr, uid, ref("product_lifo_icecream")).standard_price == 70.0, 'Standard price as lifo price of second receipt incorrect!'
  - 
    Let us send some goods
  - 
    !record {model: stock.picking, id: outgoing_lifo_shipment}:
      picking_type_id: stock.picking_type_out
  -
    Picking needs movement from stock
  -
    !record {model: stock.move, id: outgoing_shipment_lifo_icecream}:
      picking_id: outgoing_lifo_shipment
      product_id: product_lifo_icecream
      product_uom: product.product_uom_kgm
      location_id: stock.stock_location_stock
      location_dest_id: stock.stock_location_customers
      product_uom_qty: 20.0
      picking_type_id: stock.picking_type_out
  - 
    I assign this outgoing shipment
  - 
    !python {model: stock.picking}: |
      self.action_assign(cr, uid, [ref("outgoing_lifo_shipment")])
  - 
    Process the delivery of the outgoing shipment
  - 
    !python {model: stock.picking}: |
      pick_order = self.pool.get('stock.picking').browse(cr, uid, ref("outgoing_lifo_shipment"), context=context)
      pick_order.do_transfer()
  -
    Check standard price became 80 euro
  -
    !python {model: product.product}: |
      assert self.browse(cr, uid, ref("product_lifo_icecream")).standard_price == 80.0, 'Price should have been 80 euro'
  