From 0f321f952a0c18c8eb84aa136fd4ec3b70213bae Mon Sep 17 00:00:00 2001 From: Jordi Ballester Date: Mon, 27 Jun 2022 11:11:40 +0200 Subject: [PATCH] [IMP] rma_repair: Add the possibility to indicate a default location in the rma operation --- rma_repair/models/rma_operation.py | 22 +++++++++++++++++++ rma_repair/views/rma_operation_view.xml | 7 ++++++ .../wizards/rma_order_line_make_repair.py | 8 ++++--- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/rma_repair/models/rma_operation.py b/rma_repair/models/rma_operation.py index 8b6e8a2a..b9f69ad9 100644 --- a/rma_repair/models/rma_operation.py +++ b/rma_repair/models/rma_operation.py @@ -19,3 +19,25 @@ class RmaOperation(models.Model): delivery_policy = fields.Selection( selection_add=[("repair", "Based on Repair Quantities")] ) + repair_location_id = fields.Many2one( + string="Repair Location", + comodel_name="stock.location", + help="Indicate here the source location of the product to be repaired", + ) + repair_location_dest_id = fields.Many2one( + string="Repair Destination Location", + comodel_name="stock.location", + help="Indicate here the destination location of the repair", + ) + repair_invoice_method = fields.Selection( + string="Repair Invoice Method", + selection=[ + ("none", "No Invoice"), + ("b4repair", "Before Repair"), + ("after_repair", "After Repair"), + ], + help="Selecting 'Before Repair' or 'After Repair' will allow you " + "to generate invoice before or after the repair is done " + "respectively. 'No invoice' means you don't want to generate " + "invoice for this repair order.", + ) diff --git a/rma_repair/views/rma_operation_view.xml b/rma_repair/views/rma_operation_view.xml index 22d7315f..8c3ab9ed 100644 --- a/rma_repair/views/rma_operation_view.xml +++ b/rma_repair/views/rma_operation_view.xml @@ -17,6 +17,13 @@ rma.operation + + + + + + + diff --git a/rma_repair/wizards/rma_order_line_make_repair.py b/rma_repair/wizards/rma_order_line_make_repair.py index 2473d032..fa3dbc12 100644 --- a/rma_repair/wizards/rma_order_line_make_repair.py +++ b/rma_repair/wizards/rma_order_line_make_repair.py @@ -32,9 +32,11 @@ class RmaLineMakeRepair(models.TransientModel): "partner_id": line.partner_id.id, "to_refurbish": to_refurbish, "refurbish_product_id": refurbish_product_id, - "location_id": line.location_id.id, - "location_dest_id": line.location_id.id, - "invoice_method": "after_repair", + "location_id": line.operation_id.repair_location_id.id + or line.location_id.id, + "location_dest_id": line.operation_id.repair_location_dest_id.id + or line.location_id.id, + "invoice_method": line.operation_id.repair_invoice_method or "after_repair", } @api.model