<commit_before>-
  In order to test process of the Sale Order,
-
  First I check the total amount of the Quotation before Approved.
-
  !assert {model: sale.order, id: sale.sale_order_6, string: The amount of the Quotation is not correctly computed}:
    - sum([l.price_subtotal for l in order_line]) == amount_untaxed
- 
  I set an explicit invoicing partner that is different from the main SO Customer
-
  !python {model: sale.order, id: sale.sale_order_6}: |
    order = self.browse(cr, uid, ref("sale.sale_order_6"))
    order.write({'partner_invoice_id': ref('base.res_partner_address_29')})
-
  I confirm the quotation with Invoice based on deliveries policy.
-
  !workflow {model: sale.order, action: order_confirm, ref: sale.sale_order_6}
-
  I check that invoice should not created before dispatch delivery.
-
  !python {model: sale.order}: |
    order = self.pool.get('sale.order').browse(cr, uid, ref("sale.sale_order_6"))
    assert order.state == 'progress', 'Order should be in inprogress.'
    assert len(order.invoice_ids) == False, "Invoice should not created."
-
  I check the details of procurement after confirmed quotation.
-
  !python {model: sale.order}: |
    from datetime import datetime, timedelta
    from dateutil.relativedelta import relativedelta
    from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
    order = self.browse(cr, uid, ref("sale.sale_order_6"))
    for order_line in order.order_line:
        procurement = order_line.procurement_ids[0]
        date_planned = datetime.strptime(order.date_order, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=order_line.delay or 0.0)
        date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
        assert procurement.date_planned == date_planned, "Scheduled date is not correspond."
        assert procurement.product_id.id == order_line.product_id.id, "Product is not correspond."
        assert procurement.product_qty == order_line.product_uom_qty, "Qty is not correspond."
        assert procurement.product_uom.id == order_line.product_uom.id, "UOM is not correspond."
-
  I check the details of delivery order after confirmed quotation.
-
  !python {model: sale.order}: |
    from datetime import datetime, timedelta
    from dateutil.relativedelta import relativedelta
    from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
    sale_order = self.browse(cr, uid, ref("sale.sale_order_6"))
    assert sale_order.picking_ids, "Delivery order is not created."
    for picking in sale_order.picking_ids:
      assert picking.state == "auto" or "confirmed", "Delivery order should be in 'Waitting Availability' state."
      assert picking.origin == sale_order.name,"Origin of Delivery order is not correspond with sequence number of sale order."
      assert picking.picking_type_id == self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'picking_type_out', context=context),"Shipment should be Outgoing."
      assert picking.move_type == sale_order.picking_policy,"Delivery Method is not corresponding with delivery method of sale order."
      assert picking.partner_id.id == sale_order.partner_shipping_id.id,"Shipping Address is not correspond with sale order."
      assert picking.note == sale_order.note,"Note is not correspond with sale order."
      assert picking.invoice_state == (sale_order.order_policy=='picking' and '2binvoiced') or 'none',"Invoice policy is not correspond with sale order."
      assert len(picking.move_lines) == len(sale_order.order_line), "Total move of delivery order are not corresposning with total sale order lines."
      location_id = sale_order.warehouse_id.lot_stock_id.id
      for move in picking.move_lines:
         order_line = move.procurement_id.sale_line_id
         date_planned = datetime.strptime(sale_order.date_order, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=order_line.delay or 0.0)
         date_planned = (date_planned - timedelta(days=sale_order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
         assert datetime.strptime(move.date_expected, DEFAULT_SERVER_DATETIME_FORMAT) == datetime.strptime(date_planned, DEFAULT_SERVER_DATETIME_FORMAT), "Excepted Date is not correspond with Planned Date."
         assert move.product_id.id == order_line.product_id.id,"Product is not correspond."
         assert move.product_qty == order_line.product_uom_qty,"Product Quantity is not correspond."
         assert move.product_uom.id == order_line.product_uom.id,"Product UOM is not correspond."
         assert move.product_uos_qty == (order_line.product_uos and order_line.product_uos_qty) or order_line.product_uom_qty,"Product UOS Quantity is not correspond."
         assert move.product_uos == (order_line.product_uos and order_line.product_uos.id) or order_line.product_uom.id,"Product UOS is not correspond"
         assert move.product_packaging.id == order_line.product_packaging.id,"Product packaging is not correspond."
         assert move.partner_id.id == order_line.address_allotment_id.id or sale_order.partner_shipping_id.id,"Address is not correspond"
         #assert move.location_id.id == location_id,"Source Location is not correspond."
         assert move.price_unit == order_line.product_id.standard_price or 0.0,"Price Unit is not correspond"
-
  Now, I dispatch delivery order.
-
  !python {model: stock.picking}: |
    order = self.pool.get('sale.order').browse(cr, uid, ref("sale.sale_order_6"))
    for pick in order.picking_ids:
        data = pick.force_assign()
        if data == True:<commit_msg>[FIX]sale_stock: remove assert test on unit_price between move and sol which is not relevant<commit_after>-
  In order to test process of the Sale Order,
-
  First I check the total amount of the Quotation before Approved.
-
  !assert {model: sale.order, id: sale.sale_order_6, string: The amount of the Quotation is not correctly computed}:
    - sum([l.price_subtotal for l in order_line]) == amount_untaxed
- 
  I set an explicit invoicing partner that is different from the main SO Customer
-
  !python {model: sale.order, id: sale.sale_order_6}: |
    order = self.browse(cr, uid, ref("sale.sale_order_6"))
    order.write({'partner_invoice_id': ref('base.res_partner_address_29')})
-
  I confirm the quotation with Invoice based on deliveries policy.
-
  !workflow {model: sale.order, action: order_confirm, ref: sale.sale_order_6}
-
  I check that invoice should not created before dispatch delivery.
-
  !python {model: sale.order}: |
    order = self.pool.get('sale.order').browse(cr, uid, ref("sale.sale_order_6"))
    assert order.state == 'progress', 'Order should be in inprogress.'
    assert len(order.invoice_ids) == False, "Invoice should not created."
-
  I check the details of procurement after confirmed quotation.
-
  !python {model: sale.order}: |
    from datetime import datetime, timedelta
    from dateutil.relativedelta import relativedelta
    from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
    order = self.browse(cr, uid, ref("sale.sale_order_6"))
    for order_line in order.order_line:
        procurement = order_line.procurement_ids[0]
        date_planned = datetime.strptime(order.date_order, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=order_line.delay or 0.0)
        date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
        assert procurement.date_planned == date_planned, "Scheduled date is not correspond."
        assert procurement.product_id.id == order_line.product_id.id, "Product is not correspond."
        assert procurement.product_qty == order_line.product_uom_qty, "Qty is not correspond."
        assert procurement.product_uom.id == order_line.product_uom.id, "UOM is not correspond."
-
  I check the details of delivery order after confirmed quotation.
-
  !python {model: sale.order}: |
    from datetime import datetime, timedelta
    from dateutil.relativedelta import relativedelta
    from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
    sale_order = self.browse(cr, uid, ref("sale.sale_order_6"))
    assert sale_order.picking_ids, "Delivery order is not created."
    for picking in sale_order.picking_ids:
      assert picking.state == "auto" or "confirmed", "Delivery order should be in 'Waitting Availability' state."
      assert picking.origin == sale_order.name,"Origin of Delivery order is not correspond with sequence number of sale order."
      assert picking.picking_type_id == self.pool.get('ir.model.data').get_object(cr, uid, 'stock', 'picking_type_out', context=context),"Shipment should be Outgoing."
      assert picking.move_type == sale_order.picking_policy,"Delivery Method is not corresponding with delivery method of sale order."
      assert picking.partner_id.id == sale_order.partner_shipping_id.id,"Shipping Address is not correspond with sale order."
      assert picking.note == sale_order.note,"Note is not correspond with sale order."
      assert picking.invoice_state == (sale_order.order_policy=='picking' and '2binvoiced') or 'none',"Invoice policy is not correspond with sale order."
      assert len(picking.move_lines) == len(sale_order.order_line), "Total move of delivery order are not corresposning with total sale order lines."
      location_id = sale_order.warehouse_id.lot_stock_id.id
      for move in picking.move_lines:
         order_line = move.procurement_id.sale_line_id
         date_planned = datetime.strptime(sale_order.date_order, DEFAULT_SERVER_DATETIME_FORMAT) + relativedelta(days=order_line.delay or 0.0)
         date_planned = (date_planned - timedelta(days=sale_order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
         assert datetime.strptime(move.date_expected, DEFAULT_SERVER_DATETIME_FORMAT) == datetime.strptime(date_planned, DEFAULT_SERVER_DATETIME_FORMAT), "Excepted Date is not correspond with Planned Date."
         assert move.product_id.id == order_line.product_id.id,"Product is not correspond."
         assert move.product_qty == order_line.product_uom_qty,"Product Quantity is not correspond."
         assert move.product_uom.id == order_line.product_uom.id,"Product UOM is not correspond."
         assert move.product_uos_qty == (order_line.product_uos and order_line.product_uos_qty) or order_line.product_uom_qty,"Product UOS Quantity is not correspond."
         assert move.product_uos == (order_line.product_uos and order_line.product_uos.id) or order_line.product_uom.id,"Product UOS is not correspond"
         assert move.product_packaging.id == order_line.product_packaging.id,"Product packaging is not correspond."
         assert move.partner_id.id == order_line.address_allotment_id.id or sale_order.partner_shipping_id.id,"Address is not correspond"
         #assert move.location_id.id == location_id,"Source Location is not correspond."
-
  Now, I dispatch delivery order.
-
  !python {model: stock.picking}: |
    order = self.pool.get('sale.order').browse(cr, uid, ref("sale.sale_order_6"))
    for pick in order.picking_ids:
        data = pick.force_assign()
        if data == True:
{'fraction_non_alphanumeric': 0.09268941072219761, 'fraction_numerical': 0.003012848914488259, 'mean_word_length': 4.381974248927039, 'pattern_counts': {'":': 0, '<': 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': '4815623', 'n_tokens_mistral': 3511, 'n_tokens_neox': 3365, 'n_words': 917}