summaryrefslogtreecommitdiff
path: root/addons/mrp_subcontracting/tests
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-09-20 17:33:22 +0200
committerChristophe Simonis <chs@odoo.com>2019-09-20 17:34:45 +0200
commit64e43808b79badb5869a8d73cc1cc3f3b3aa8e12 (patch)
tree9a22d5f6c03073a4d10faedea8df23a5211e8b8f /addons/mrp_subcontracting/tests
parent944891ced081cda3b8b3db5faf3b7ac23b6b4ce8 (diff)
parent58a83d12228fbbd4e9dde542e133d264204ee0f3 (diff)
[MERGE] forward port branch saas-12.5 up to 58a83d12228
Diffstat (limited to 'addons/mrp_subcontracting/tests')
-rw-r--r--addons/mrp_subcontracting/tests/test_subcontracting.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/addons/mrp_subcontracting/tests/test_subcontracting.py b/addons/mrp_subcontracting/tests/test_subcontracting.py
index 148f99e1816..785599cff5c 100644
--- a/addons/mrp_subcontracting/tests/test_subcontracting.py
+++ b/addons/mrp_subcontracting/tests/test_subcontracting.py
@@ -510,6 +510,36 @@ class TestSubcontractingFlows(TestMrpSubcontractingCommon):
self.assertEqual(move_comp1.move_line_ids.filtered(lambda ml: not ml.product_uom_qty).lot_produced_ids.name, 'LOT F2')
self.assertEqual(move_comp2.move_line_ids.filtered(lambda ml: not ml.product_uom_qty).lot_produced_ids.name, 'LOT F2')
+ def test_flow_8(self):
+ resupply_sub_on_order_route = self.env['stock.location.route'].search([('name', '=', 'Resupply Subcontractor on Order')])
+ (self.comp1 + self.comp2).write({'route_ids': [(4, resupply_sub_on_order_route.id, None)]})
+
+ # Create a receipt picking from the subcontractor
+ picking_form = Form(self.env['stock.picking'])
+ picking_form.picking_type_id = self.env.ref('stock.picking_type_in')
+ picking_form.partner_id = self.subcontractor_partner1
+ with picking_form.move_ids_without_package.new() as move:
+ move.product_id = self.finished
+ move.product_uom_qty = 5
+ picking_receipt = picking_form.save()
+ picking_receipt.action_confirm()
+
+ picking_receipt.move_lines.quantity_done = 3
+ backorder_wiz = picking_receipt.button_validate()
+ backorder_wiz = self.env['stock.backorder.confirmation'].browse(backorder_wiz['res_id'])
+ backorder_wiz.process()
+
+ backorder = self.env['stock.picking'].search([('backorder_id', '=', picking_receipt.id)])
+ self.assertTrue(backorder)
+ self.assertEqual(backorder.move_lines.product_uom_qty, 2)
+ subcontract_order = backorder.move_lines.move_orig_ids.production_id.filtered(lambda p: p.state != 'done')
+ self.assertTrue(subcontract_order)
+ self.assertEqual(subcontract_order.product_uom_qty, 5)
+ self.assertEqual(subcontract_order.qty_produced, 3)
+ backorder.move_lines.quantity_done = 2
+ backorder.action_done()
+ self.assertTrue(picking_receipt.move_lines.move_orig_ids.production_id.state == 'done')
+
class TestSubcontractingTracking(TransactionCase):
def setUp(self):
super(TestSubcontractingTracking, self).setUp()