diff options
| author | Pedro M. Baeza <pedro.baeza@tecnativa.com> | 2020-03-02 11:05:50 +0000 |
|---|---|---|
| committer | Pedro M. Baeza <pedro.baeza@tecnativa.com> | 2020-03-02 17:06:25 +0000 |
| commit | 32c81cc1952f3bf1f95ab58b20f589bed24db257 (patch) | |
| tree | c5f464d3121bd4d23dcd74868e8d9c1d73fbae9d /addons/mrp_subcontracting/tests | |
| parent | 01412dd7d99e65885f240c4ba5e4b8de21c44fa2 (diff) | |
[FIX] mrp_subcontracting: Allow subcontractor contacts to be used
**Steps to reproduce:**
* Create a subcontractor.
* Create a BoM of type Subcontracting and assign the subcontractor.
* Create a children contact for the subcontractor.
* Creat a purchase order (or a receipt picking) with the children contact of the subcontractor.
* Confirm the document.
**Current behavior:**
Subcontractor documents are not created.
**Expected result:**
They should be created.
**Cause:**
The BoM search is not including possible parents of the partners.
**Solution:**
With the use of `parent_of` operator in the search, we cover both cases of the children
and the parent as initiators of the subcontracting.
closes odoo/odoo#46670
X-original-commit: 86726aba26f4ba8d7dadb29ed2415baf49fe54c0
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
Diffstat (limited to 'addons/mrp_subcontracting/tests')
| -rw-r--r-- | addons/mrp_subcontracting/tests/test_subcontracting.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/addons/mrp_subcontracting/tests/test_subcontracting.py b/addons/mrp_subcontracting/tests/test_subcontracting.py index 8f7a2b2abf7..ce27039a047 100644 --- a/addons/mrp_subcontracting/tests/test_subcontracting.py +++ b/addons/mrp_subcontracting/tests/test_subcontracting.py @@ -574,6 +574,28 @@ class TestSubcontractingFlows(TestMrpSubcontractingCommon): self.assertEqual(self.comp1.virtual_available, 0.0) self.assertEqual(self.comp1.virtual_available, 0.0) + def test_flow_10(self): + """Receipts from a children contact of a subcontractor are properly + handled. + """ + # Create a children contact + subcontractor_contact = self.env['res.partner'].create({ + 'name': 'Test children subcontractor contact', + 'parent_id': self.subcontractor_partner1.id, + }) + # 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 = subcontractor_contact + with picking_form.move_ids_without_package.new() as move: + move.product_id = self.finished + move.product_uom_qty = 1 + picking_receipt = picking_form.save() + picking_receipt.action_confirm() + # Check that a manufacturing order is created + mo = self.env['mrp.production'].search([('bom_id', '=', self.bom.id)]) + self.assertEqual(len(mo), 1) + class TestSubcontractingTracking(TransactionCase): def setUp(self): |
