Skip to content
Browse files

[ADD] MRP : Test auto cancelation MO based on outgoing shipment cancel.

  • Loading branch information...
jir-odoo committed Apr 12, 2019
1 parent 3da2f74 commit 08b4fd4969691ecd04f6a6f69aac1bc57423847e
Showing with 34 additions and 0 deletions.
  1. +34 −0 addons/sale_mrp/tests/
@@ -147,3 +147,37 @@ def test_01_product_route_level_delays(self):
msg="Schedule date of manufacturing order should be equal to: Schedule date of pack type picking - product's Manufacturing Lead Time."

def test_02_forward_cancel_confirm_manufacturing_order(self):
""" Test confirm manufacturing order based on rule with option forward cancelation."""

# Update warehouse_1 with Outgoing Shippings pick + pack + ship
self.warehouse_1.write({'delivery_steps': 'pick_pack_ship'})

# Set delay on pull rule
self.warehouse_1.delivery_route_id.rule_ids.write({'previous_move_propagate': True})
self.warehouse_1.mto_pull_id.write({'previous_move_propagate': True})

# Create sale order of product_1
order_form = Form(self.env['sale.order'])
order_form.partner_id = self.partner_1
order_form.warehouse_id = self.warehouse_1
with as line:
line.product_id = self.product_1
line.product_uom_qty = 6
order =
# Confirm sale order

# Run scheduler

# Check manufacturing order created or not
manufacturing_order = self.env['mrp.production'].search([('product_id', '=',])
self.assertTrue(manufacturing_order, 'Manufacturing order should be created.')
# Check status of manufacturing orders.
self.assertEqual(manufacturing_order.state, 'confirmed')
# Cancel the delivery order.
out = order.picking_ids.filtered(lambda r: r.picking_type_id == self.warehouse_1.out_type_id)
self.assertEqual(manufacturing_order.state, 'confirmed')

0 comments on commit 08b4fd4

Please sign in to comment.
You can’t perform that action at this time.