<commit_before>-
  In order to test the manufacturing order working with procurements I will use
  some products with different supply method and procurement method, also check
  the bills of material for the products.
-
  I am creating one manufacturing order.
-
  !record {model: mrp.production, id: mrp_production_mo1}:
    company_id: base.main_company
    date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
    location_dest_id: stock.stock_location_stock
    location_src_id: stock.stock_location_stock
    product_id: product.product_product_pc1
    product_qty: 5.0
    product_uom: product.product_uom_unit
    product_uos_qty: 0.0
-
  I compute the data.
-
  !python {model: mrp.production}: |
    self.action_compute(cr, uid, [ref("mrp_production_mo1")], {"lang": "en_US", "tz":
      False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids":
      [ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"),
      })
-
  I confirm the order.
-
  !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1}
-
  I am checking Procurement orders for components of PC1.
-
  !python {model: procurement.order}: |
    from tools.translate import _
    production_obj = self.pool.get('mrp.production')
    production = production_obj.browse(cr, uid, ref('mrp_production_mo1'))
    product_ids = map(lambda x:x.product_id.id, production.move_lines)
    proc_ids = self.search(cr, uid, [('product_id','in',product_ids)])
    assert proc_ids, _('No Procurements!')
-
  The scheduler runs.
-
  !function {model: procurement.order, name: run_scheduler}:
    - model: procurement.order
      search: "[]"
-
  I am checking Internal picking.
-
  !python {model: stock.picking}: |
    from tools.translate import _
    pick_ids = self.search(cr, uid, [('type','=','internal')])
    assert pick_ids, _('No Internal Pickings!')
-
  I see that there is a manufacturing order for the sub product of PC1 with ready state.
-
  !python {model: mrp.production}: |
    from tools.translate import _
    order_ids = self.search(cr, uid, [('state','=','ready')])
    assert order_ids, _('No manufacturing order in Ready state!')
-
  I start producing that product first. So I marked it as started.
-
  !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo1}
-
  I create record for producing products with quantity 5.00.
-
  !record {model: mrp.product.produce, id: mrp_product_produce0}:
    product_qty: 5.00
    mode: 'consume_produce'
-
  I produce the product.
-
  !python {model: mrp.product.produce}: |
    prod_obj = self.pool.get('mrp.production')
    prod_ids = prod_obj.search(cr, uid, [('state','=','confirmed')])
    self.do_produce(cr, uid, [ref('mrp_product_produce0')], context={'active_ids': prod_ids})
-
  Now the manufacturing order for subproduct CPU_GEN is done and manufacturing
  order for PC1 is in ready state.
-
  !python {model: mrp.production}: |
    from tools.translate import _
    prod_ids = self.search(cr, uid, [('state','=','done')])
    assert prod_ids, _('Manufacturing order is yet not done!')
-
  I start producing the product PC1.
-
  !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo1}
-
  I create record for producing products with quantity 5.00.
-
  !record {model: mrp.product.produce, id: mrp_product_produce1}:
    product_qty: 5.00
    mode: 'consume_produce'
-
  Finally my production order is done.
-
  !python {model: mrp.product.produce}: |
    from tools.translate import _
    prod_obj = self.pool.get('mrp.production')
    prod_ids = prod_obj.search(cr, uid, [('product_id.default_code','=','PC1')])
    self.do_produce(cr, uid, [ref('mrp_product_produce1')], context={'active_ids': prod_ids})
-
  I am creating one manufacturing order.
-
  !record {model: mrp.production, id: mrp_production_mo2}:
    company_id: base.main_company
    date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
    location_dest_id: stock.stock_location_stock
    location_src_id: stock.stock_location_stock
    product_id: product.product_product_pc1
    product_qty: 5.0
    product_uom: product.product_uom_unit
    product_uos_qty: 0.0
-
  I compute the data.
-
  !python {model: mrp.production}: |
    self.action_compute(cr, uid, [ref("mrp_production_mo2")], {"lang": "en_US", "tz":
      False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids":
      [ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"),
      })
-
  I confirm the order.
-
  !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo2}
-
  I am checking Internal picking.
-
  !python {model: stock.picking}: |
    from tools.translate import _
    pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')])
    assert pick_ids, _('No Internal Pickings!')
-
  In order to cancel the MO, I first cancel its picking.
-
  !python {model: stock.picking}: |
    mrp_obj = self.pool.get('mrp.production')
    mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo2"))
    picking_id = self.search(cr, uid, [])
    if picking_id:
      self.action_cancel(cr, uid, picking_id, context=None)
-
  Then I Cancel the production order and related stock moves.
-
  !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo2}
-
  I am set the product quantity.
-
  !record {model: change.production.qty, id: mrp_production_qty}:
    product_qty: 5.0
-
  Changes the Quantity of Product.
-
  !python {model: change.production.qty}: |
    context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_qty")], "tz": False, "active_id":ref('mrp_production_qty')}
    self.default_get(cr, uid, ["product_qty"], context)<commit_msg>[IMP]: remove unuse code and improvement in mrp<commit_after>-
  In order to test the manufacturing order working with procurements I will use
  some products with different supply method and procurement method, also check
  the bills of material for the products.
-
  I am creating one manufacturing order.
-
  !record {model: mrp.production, id: mrp_production_mo1}:
    company_id: base.main_company
    date_planned: !eval datetime.today().strftime("%Y-%m-%d %H:%M:%S")
    location_dest_id: stock.stock_location_stock
    location_src_id: stock.stock_location_stock
    product_id: product.product_product_pc1
    product_qty: 5.0
    product_uom: product.product_uom_unit
    product_uos_qty: 0.0
-
  I compute the data.
-
  !python {model: mrp.production}: |
    self.action_compute(cr, uid, [ref("mrp_production_mo1")], {"lang": "en_US", "tz":
      False, "search_default_current": 1, "active_model": "ir.ui.menu", "active_ids":
      [ref("mrp.menu_mrp_production_action")], "active_id": ref("mrp.menu_mrp_production_action"),
      })
-
  I confirm the order.
-
  !workflow {model: mrp.production, action: button_confirm, ref: mrp_production_mo1}
-
  I am checking Procurement orders for components of PC1.
-
  !python {model: procurement.order}: |
    from tools.translate import _
    production_obj = self.pool.get('mrp.production')
    production = production_obj.browse(cr, uid, ref('mrp_production_mo1'))
    product_ids = map(lambda x:x.product_id.id, production.move_lines)
    proc_ids = self.search(cr, uid, [('product_id','in',product_ids)])
    assert proc_ids, _('No Procurements!')
-
  The scheduler runs.
-
  !function {model: procurement.order, name: run_scheduler}:
    - model: procurement.order
      search: "[]"
-
  I am checking Internal picking.
-
  !python {model: stock.picking}: |
    from tools.translate import _
    pick_ids = self.search(cr, uid, [('type','=','internal')])
    assert pick_ids, _('No Internal Pickings!')
-
  I see that there is a manufacturing order for the sub product of PC1 with ready state.
-
  !python {model: mrp.production}: |
    from tools.translate import _
    order_ids = self.search(cr, uid, [('state','=','ready')])
    assert order_ids, _('No manufacturing order in Ready state!')
-
  In order to cancel the MO, I first cancel its picking.
-
  !python {model: stock.picking}: |
    mrp_obj = self.pool.get('mrp.production')
    mo = mrp_obj.browse(cr, uid, ref("mrp_production_mo1"))
    picking_id = self.search(cr, uid, [])
    if picking_id:
      self.action_cancel(cr, uid, picking_id, context=None)
-
  Then I Cancel the production order and related stock moves.
-
  !workflow {model: mrp.production, action: button_cancel, ref: mrp_production_mo1}
-
  I start producing that product first. So I marked it as started.
-
  !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo1}
-
  I create record for producing products with quantity 5.00.
-
  !record {model: mrp.product.produce, id: mrp_product_produce0}:
    product_qty: 5.00
    mode: 'consume_produce'
-
  I produce the product.
-
  !python {model: mrp.product.produce}: |
    prod_obj = self.pool.get('mrp.production')
    prod_ids = prod_obj.search(cr, uid, [('state','=','confirmed')])
    self.do_produce(cr, uid, [ref('mrp_product_produce0')], context={'active_ids': prod_ids})
-
  Now the manufacturing order for subproduct CPU_GEN is done and manufacturing
  order for PC1 is in ready state.
-
  !python {model: mrp.production}: |
    from tools.translate import _
    prod_ids = self.search(cr, uid, [('state','=','done')])
    assert prod_ids, _('Manufacturing order is yet not done!')
-
  I start producing the product PC1.
-
  !workflow {model: mrp.production, action: button_produce, ref: mrp_production_mo1}
-
  I create record for producing products with quantity 5.00.
-
  !record {model: mrp.product.produce, id: mrp_product_produce1}:
    product_qty: 5.00
    mode: 'consume_produce'
-
  Finally my production order is done.
-
  !python {model: mrp.product.produce}: |
    from tools.translate import _
    prod_obj = self.pool.get('mrp.production')
    prod_ids = prod_obj.search(cr, uid, [('product_id.default_code','=','PC1')])
    self.do_produce(cr, uid, [ref('mrp_product_produce1')], context={'active_ids': prod_ids})
-
  I am set the product quantity.
-
  !record {model: change.production.qty, id: mrp_production_qty}:
    product_qty: 5.0
-
  Changes the Quantity of Product.
-
  !python {model: change.production.qty}: |
    context = {"lang": 'en_US', "active_model":"mrp.production", "active_ids": [ref("mrp_production_qty")], "tz": False, "active_id":ref('mrp_production_qty')}
    self.default_get(cr, uid, ["product_qty"], context)
{'fraction_non_alphanumeric': 0.13383216518279978, 'fraction_numerical': 0.007861337374502746, 'mean_word_length': 4.1938022626660105, 'pattern_counts': {'":': 28, '<': 3, '<?xml version=': 0, '>': 3, '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': '4215478', 'n_tokens_mistral': 3656, 'n_tokens_neox': 3591, 'n_words': 924}