<commit_before>-
  In order to test to Cancel purchase order from Approved State,I start by creating a new product 'Pen Drive1'
-
 !record {model: product.product, id: product_product_pendrive1}:
    categ_id: 'product.product_category_3'
    cost_method: standard
    mes_type: fixed
    name: Pen Drive
    price_margin: 1.0
    procure_method: make_to_order
    property_stock_inventory: stock.location_inventory
    property_stock_procurement: stock.location_procurement
    property_stock_production: stock.location_production
    seller_delay: '1'
    standard_price: 500.0
    supply_method: buy
    type: product
    uom_id: product.product_uom_unit
    uom_po_id: product.product_uom_unit
    volume: 0.0
    warranty: 0.0
    weight: 0.0
    weight_net: 0.0
-
  Create second  new product 'Pen Drive2'
-
 !record {model: product.product, id: product_product_pendrive2}:
    categ_id: 'product.product_category_3'
    cost_method: standard
    mes_type: fixed
    name: Pen Drive 2
    price_margin: 1.0
    procure_method: make_to_order
    property_stock_inventory: stock.location_inventory
    property_stock_procurement: stock.location_procurement
    property_stock_production: stock.location_production
    seller_delay: '1'
    standard_price: 500.0
    supply_method: buy
    type: product
    uom_id: product.product_uom_unit
    uom_po_id: product.product_uom_unit
    volume: 0.0
    warranty: 0.0
    weight: 0.0
    weight_net: 0.0
-
  In order to test the  purchase order flow,I create a new record where "invoice_method" is From Order.
-
  I create first purchase order for Pen Drive1.
-
  !record {model: purchase.order, id: purchase_order_pendrive1}:
    company_id: base.main_company
    date_order: !eval time.strftime('%Y-%m-%d')
    invoice_method: order
    location_id: stock.stock_location_stock
    order_line:
      - date_planned: !eval time.strftime('%Y-%m-%d')
        name: <NAME>
        price_unit: 100.0
        product_id: 'product_product_pendrive1'
        product_qty: 10.0
        product_uom: product.product_uom_unit
        state: draft
    partner_address_id: base.res_partner_address_7
    partner_id: base.res_partner_4
    pricelist_id: purchase.list0
-
  Initially  purchase order is in the draft state.
-
  !assert {model: purchase.order, id: purchase_order_pendrive1}:
    - state == 'draft'
-
  I test onchanged on Wharehouse ,Product, Uom, Destination Address .
-
  !python {model: purchase.order}: |
    from tools.translate import _
    self.onchange_warehouse_id(cr, uid, [ref("purchase_order_pendrive1")], 1)
    part_obj = self.pool.get('res.partner')
    price_obj = self.pool.get('product.pricelist')
    product_obj = self.pool.get('product.product')
    addrss_obj = self.pool.get('res.partner.address')
    po_line_obj = self.pool.get('purchase.order.line')
    uom_obj = self.pool.get('product.uom')
    price_id = price_obj.search(cr, uid, [('name','=','Default Purchase Pricelist')])
    product_id = product_obj.search(cr, uid, [('name','=','Pen Drive 2')])
    uom_id = uom_obj.search(cr, uid, [('name','=','PCE')])
    part_ids = part_obj.search(cr, uid, [('name','=','Distrib PC')])
    line_id = po_line_obj.search(cr, uid, [('order_id','=',ref("purchase_order_pendrive1"))])
    po_line_obj.product_id_change(cr, uid, line_id[0], price_id[0], product_id[0], 10, uom_id[0], part_ids[0])
    po_line_obj.product_uom_change(cr, uid, line_id[0], price_id[0], product_id[0], 10, uom_id[0], part_ids[0])
    address_id = addrss_obj.search(cr, uid, [('partner_id','=',part_ids)])
    self.onchange_dest_address_id(cr, uid, [ref("purchase_order_pendrive1")], address_id[0])
-
  I confirm the purchase order for Pen Drive1.
-
  !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_pendrive1}
-
  I check that the order which was initially in the draft state has transmit to confirm state.
-
  !assert {model: purchase.order, id: purchase_order_pendrive1}:
    - state == 'approved'
-
  I have to first cancel Picking of Approved Purchase order .
-
  !python {model: stock.picking}: |
    from tools.translate import _
    search_ids=self.search(cr, uid, [('purchase_id', '=', ref("purchase_order_pendrive1"))])
    self.action_cancel(cr, uid, search_ids)
-
  Now I have to cancel confirm  purchase order for Pen Drive1.
-
  !python {model: purchase.order}: |
    from tools.translate import _
    self.action_cancel(cr, uid, [ref("purchase_order_pendrive1")])
-
  I check that the order which was in approved state has transmit to cancel state.
-
  !assert {model: purchase.order, id: purchase_order_pendrive1}:
    - state == 'cancel'
-
  Now again set purchase order for Pen Drive1 to draft state.
-
  !python {model: purchase.order}: |
    from tools.translate import _
    self.action_cancel_draft(cr, uid, [ref("purchase_order_pendrive1")])   
-
  I check that the order which was in cancel state has transmit to draft state.
-
  !assert {model: purchase.order, id: purchase_order_pendrive1}:
    - state == 'draft'
-
  I test for Copy and Delete Perchase order in Draft state.
-
  !python {model: purchase.order}: |
    from tools.translate import _
    self.copy(cr, uid, ref("purchase_order_pendrive1"))   
    self.unlink(cr, uid, [ref("purchase_order_pendrive1")])   
 <commit_msg>[IMP] Purchase: Remove statement from yml<commit_after>-
  In order to test to Cancel purchase order from Approved State,I start by creating a new product 'Pen Drive1'
-
 !record {model: product.product, id: product_product_pendrive1}:
    categ_id: 'product.product_category_3'
    cost_method: standard
    mes_type: fixed
    name: Pen Drive
    price_margin: 1.0
    procure_method: make_to_order
    property_stock_inventory: stock.location_inventory
    property_stock_procurement: stock.location_procurement
    property_stock_production: stock.location_production
    seller_delay: '1'
    standard_price: 500.0
    supply_method: buy
    type: product
    uom_id: product.product_uom_unit
    uom_po_id: product.product_uom_unit
    volume: 0.0
    warranty: 0.0
    weight: 0.0
    weight_net: 0.0
-
  Create second  new product 'Pen Drive2'
-
 !record {model: product.product, id: product_product_pendrive2}:
    categ_id: 'product.product_category_3'
    cost_method: standard
    mes_type: fixed
    name: Pen Drive 2
    price_margin: 1.0
    procure_method: make_to_order
    property_stock_inventory: stock.location_inventory
    property_stock_procurement: stock.location_procurement
    property_stock_production: stock.location_production
    seller_delay: '1'
    standard_price: 500.0
    supply_method: buy
    type: product
    uom_id: product.product_uom_unit
    uom_po_id: product.product_uom_unit
    volume: 0.0
    warranty: 0.0
    weight: 0.0
    weight_net: 0.0
-
  I create first purchase order for Pen Drive1 where "invoice_method" is From Order.
-
  !record {model: purchase.order, id: purchase_order_pendrive1}:
    company_id: base.main_company
    date_order: !eval time.strftime('%Y-%m-%d')
    invoice_method: order
    location_id: stock.stock_location_stock
    order_line:
      - date_planned: !eval time.strftime('%Y-%m-%d')
        name: Pen Drive
        price_unit: 100.0
        product_id: 'product_product_pendrive1'
        product_qty: 10.0
        product_uom: product.product_uom_unit
        state: draft
    partner_address_id: base.res_partner_address_7
    partner_id: base.res_partner_4
    pricelist_id: purchase.list0
-
  Initially  purchase order is in the draft state.
-
  !assert {model: purchase.order, id: purchase_order_pendrive1}:
    - state == 'draft'
-
  I test onchanged on Wharehouse ,Product, Uom, Destination Address .
-
  !python {model: purchase.order}: |
    from tools.translate import _
    self.onchange_warehouse_id(cr, uid, [ref("purchase_order_pendrive1")], 1)
    part_obj = self.pool.get('res.partner')
    price_obj = self.pool.get('product.pricelist')
    product_obj = self.pool.get('product.product')
    addrss_obj = self.pool.get('res.partner.address')
    po_line_obj = self.pool.get('purchase.order.line')
    uom_obj = self.pool.get('product.uom')
    price_id = price_obj.search(cr, uid, [('name','=','Default Purchase Pricelist')])
    product_id = product_obj.search(cr, uid, [('name','=','Pen Drive 2')])
    uom_id = uom_obj.search(cr, uid, [('name','=','PCE')])
    part_ids = part_obj.search(cr, uid, [('name','=','Distrib PC')])
    line_id = po_line_obj.search(cr, uid, [('order_id','=',ref("purchase_order_pendrive1"))])
    po_line_obj.product_id_change(cr, uid, line_id[0], price_id[0], product_id[0], 10, uom_id[0], part_ids[0])
    po_line_obj.product_uom_change(cr, uid, line_id[0], price_id[0], product_id[0], 10, uom_id[0], part_ids[0])
    address_id = addrss_obj.search(cr, uid, [('partner_id','=',part_ids)])
    self.onchange_dest_address_id(cr, uid, [ref("purchase_order_pendrive1")], address_id[0])
-
  I confirm the purchase order for Pen Drive1.
-
  !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_pendrive1}
-
  I check that the order which was initially in the draft state has transmit to confirm state.
-
  !assert {model: purchase.order, id: purchase_order_pendrive1}:
    - state == 'approved'
-
  I have to first cancel Picking of Approved Purchase order .
-
  !python {model: stock.picking}: |
    from tools.translate import _
    search_ids=self.search(cr, uid, [('purchase_id', '=', ref("purchase_order_pendrive1"))])
    self.action_cancel(cr, uid, search_ids)
-
  Now I have to cancel confirm  purchase order for Pen Drive1.
-
  !python {model: purchase.order}: |
    from tools.translate import _
    self.action_cancel(cr, uid, [ref("purchase_order_pendrive1")])
-
  I check that the order which was in approved state has transmit to cancel state.
-
  !assert {model: purchase.order, id: purchase_order_pendrive1}:
    - state == 'cancel'
-
  Now again set purchase order for Pen Drive1 to draft state.
-
  !python {model: purchase.order}: |
    from tools.translate import _
    self.action_cancel_draft(cr, uid, [ref("purchase_order_pendrive1")])   
-
  I check that the order which was in cancel state has transmit to draft state.
-
  !assert {model: purchase.order, id: purchase_order_pendrive1}:
    - state == 'draft'
-
  I test for Copy and Delete Perchase order in Draft state.
-
  !python {model: purchase.order}: |
    from tools.translate import _
    self.copy(cr, uid, ref("purchase_order_pendrive1"))   
    self.unlink(cr, uid, [ref("purchase_order_pendrive1")])   
 
{'fraction_non_alphanumeric': 0.11294608959757023, 'fraction_numerical': 0.015755504935459377, 'mean_word_length': 3.9773264052905053, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5102323', 'n_tokens_mistral': 3655, 'n_tokens_neox': 3598, 'n_words': 874}