diff --git a/README.md b/README.md index c6cdb9526..12344f394 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ addon | version | maintainers | summary [rma_lot_autocreate](rma_lot_autocreate/) | 16.0.1.0.0 | sbejaoui | Auto-generate stock lot at RMA confirm using per-operation sequence [rma_procurement_customer](rma_procurement_customer/) | 16.0.1.0.0 | | Rma Procurement Customer [rma_reason](rma_reason/) | 16.0.1.0.1 | sbejaoui | Rma Reason -[rma_repair](rma_repair/) | 16.0.1.0.0 | peluko00 | Create a repair order from rma +[rma_repair](rma_repair/) | 16.0.1.1.0 | peluko00 | Create a repair order from rma [rma_sale](rma_sale/) | 16.0.4.0.2 | pedrobaeza | Sale Order - Return Merchandise Authorization (RMA) [rma_sale_lot](rma_sale_lot/) | 16.0.1.0.0 | | Manage sale returns with lot. [rma_sale_mrp](rma_sale_mrp/) | 16.0.2.2.2 | chienandalu | Allow doing RMAs from MRP kits diff --git a/rma_repair/README.rst b/rma_repair/README.rst index 7ed8d666c..6ef188956 100644 --- a/rma_repair/README.rst +++ b/rma_repair/README.rst @@ -11,7 +11,7 @@ RMA Repair !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:34062beeacf5c1e8b31f6c68ba89ecc7625cc8a2b01d154e397a0fbc7cfc6c99 + !! source digest: sha256:822c9728409407a45117c89311d45c8d32ff27f568ffac2bbf004d31fce6a7ed !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/rma_repair/__manifest__.py b/rma_repair/__manifest__.py index 04ec384c1..d32f66942 100644 --- a/rma_repair/__manifest__.py +++ b/rma_repair/__manifest__.py @@ -3,7 +3,7 @@ { "name": "RMA Repair", "summary": "Create a repair order from rma", - "version": "16.0.1.0.0", + "version": "16.0.1.1.0", "category": "RMA", "website": "https://github.com/OCA/rma", "author": "Antoni Marroig, Odoo Community Association (OCA)", diff --git a/rma_repair/models/rma.py b/rma_repair/models/rma.py index 0de387544..cad0db82b 100644 --- a/rma_repair/models/rma.py +++ b/rma_repair/models/rma.py @@ -7,7 +7,7 @@ class RMA(models.Model): _inherit = "rma" - repair_id = fields.Many2one("repair.order") + repair_id = fields.Many2one("repair.order", copy=False) can_be_repaired = fields.Boolean(compute="_compute_can_be_repaired") @api.depends("repair_id", "state", "operation_id.action_create_repair") @@ -69,6 +69,7 @@ def _get_repair_order_default_vals(self): "default_address_id": self.partner_shipping_id.id, "default_partner_invoice_id": self.partner_invoice_id.id, "default_picking_id": self.reception_move_id.picking_id.id, + "default_user_id": False, } if self.lot_id: vals["default_lot_id"] = self.lot_id.id @@ -97,12 +98,14 @@ def _create_repair(self): self.ensure_one() if self.repair_id: return self.repair_id - return ( + repair = ( self.env["repair.order"] .with_context(**self._get_repair_order_default_vals()) - .create({}) + .create({"user_id": False}) ) + return repair + def action_confirm(self): res = super().action_confirm() for rec in self: diff --git a/rma_repair/tests/test_rma_repair_order.py b/rma_repair/tests/test_rma_repair_order.py index f69aa47d6..958306c6e 100644 --- a/rma_repair/tests/test_rma_repair_order.py +++ b/rma_repair/tests/test_rma_repair_order.py @@ -60,6 +60,7 @@ def test_action_create_repair_order(self): "default_address_id": self.rma.partner_shipping_id.id, "default_partner_invoice_id": self.rma.partner_invoice_id.id, "default_picking_id": self.rma.reception_move_id.picking_id.id, + "default_user_id": False, } for key, expected_value in expected.items(): self.assertIn(key, ctx, f"Missing context key: {key}") @@ -179,3 +180,18 @@ def test_automatically_create_repair_after_receipt(self): self.assertFalse(self.rma_without_repair.can_be_repaired) self.assertTrue(self.rma_without_repair.repair_id) self.assertFalse(self.rma_without_repair.can_be_repaired) + + def test_rma_repair_no_defualt_user_id(self): + """ + Ensure repair order create from RMA is not assigned a responsible. + + Rationale: + The customer service agent confirming the RMA is often not + part of the technical repair team. Automatically assigning the RMA + validator as the repair responsible would create unwanted notifications. + """ + rma = self.rma.copy() + rma.operation_id.action_create_repair = "automatic_on_confirm" + rma.action_confirm() + self.assertTrue(rma.repair_id) + self.assertFalse(rma.repair_id.user_id)