From d85540c96c90ec30b854cb3dcd852a81e20783d9 Mon Sep 17 00:00:00 2001 From: Jordi Ballester Date: Thu, 4 Aug 2022 08:48:34 +0200 Subject: [PATCH] [ADD] rma_repair_refurbish: split refurbish dependency from rma_repair --- rma_repair/__manifest__.py | 4 +-- rma_repair/models/rma_operation.py | 5 --- rma_repair/views/rma_operation_view.xml | 1 - .../wizards/rma_order_line_make_repair.py | 35 ------------------- .../rma_order_line_make_repair_view.xml | 9 ----- 5 files changed, 2 insertions(+), 52 deletions(-) diff --git a/rma_repair/__manifest__.py b/rma_repair/__manifest__.py index fdc8ad43..c3f288cb 100644 --- a/rma_repair/__manifest__.py +++ b/rma_repair/__manifest__.py @@ -2,13 +2,13 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { "name": "RMA Repair", - "version": "15.0.1.0.0", + "version": "15.0.2.0.0", "license": "AGPL-3", "category": "RMA", "summary": "Links RMA with Repairs.", "author": "ForgeFlow", "website": "https://github.com/ForgeFlow/stock-rma", - "depends": ["rma_account", "repair_refurbish"], + "depends": ["rma_account", "repair"], "data": [ "security/ir.model.access.csv", "views/rma_order_view.xml", diff --git a/rma_repair/models/rma_operation.py b/rma_repair/models/rma_operation.py index 4c62ef20..c24d5345 100644 --- a/rma_repair/models/rma_operation.py +++ b/rma_repair/models/rma_operation.py @@ -24,11 +24,6 @@ class RmaOperation(models.Model): 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( selection=[ ("none", "No Invoice"), diff --git a/rma_repair/views/rma_operation_view.xml b/rma_repair/views/rma_operation_view.xml index 8c3ab9ed..10e29203 100644 --- a/rma_repair/views/rma_operation_view.xml +++ b/rma_repair/views/rma_operation_view.xml @@ -20,7 +20,6 @@ - diff --git a/rma_repair/wizards/rma_order_line_make_repair.py b/rma_repair/wizards/rma_order_line_make_repair.py index 17300779..26176052 100644 --- a/rma_repair/wizards/rma_order_line_make_repair.py +++ b/rma_repair/wizards/rma_order_line_make_repair.py @@ -17,11 +17,6 @@ class RmaLineMakeRepair(models.TransientModel): @api.model def _prepare_item(self, line): - if line.product_id.refurbish_product_id: - to_refurbish = True - refurbish_product_id = line.product_id.refurbish_product_id.id - else: - to_refurbish = refurbish_product_id = False return { "line_id": line.id, "product_id": line.product_id.id, @@ -30,12 +25,8 @@ class RmaLineMakeRepair(models.TransientModel): "out_route_id": line.out_route_id.id, "product_uom_id": line.uom_id.id, "partner_id": line.partner_id.id, - "to_refurbish": to_refurbish, - "refurbish_product_id": refurbish_product_id, "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", } @@ -86,13 +77,6 @@ class RmaLineMakeRepairItem(models.TransientModel): if rec.product_qty <= 0.0: raise ValidationError(_("Quantity must be positive.")) - @api.onchange("to_refurbish") - def _onchange_to_refurbish(self): - if self.to_refurbish: - self.refurbish_product_id = self.product_id.refurbish_product_id - else: - self.refurbish_product_id = False - wiz_id = fields.Many2one( comodel_name="rma.order.line.make.repair", string="Wizard", ondelete="cascade" ) @@ -124,13 +108,6 @@ class RmaLineMakeRepairItem(models.TransientModel): location_id = fields.Many2one( comodel_name="stock.location", string="Location", required=True ) - location_dest_id = fields.Many2one( - comodel_name="stock.location", string="Destination location", required=True - ) - to_refurbish = fields.Boolean(string="To Refurbish?") - refurbish_product_id = fields.Many2one( - comodel_name="product.product", string="Refurbished Product" - ) invoice_method = fields.Selection( selection=[ ("none", "No Invoice"), @@ -146,14 +123,6 @@ class RmaLineMakeRepairItem(models.TransientModel): def _prepare_repair_order(self, rma_line): self.ensure_one() - location_dest = ( - self.location_dest_id - if not self.to_refurbish - else rma_line.product_id.property_stock_refurbish - ) - refurbish_location_dest_id = ( - self.location_dest_id.id if self.to_refurbish else False - ) addr = rma_line.partner_id.address_get(["delivery", "invoice"]) return { "product_id": rma_line.product_id.id, @@ -164,10 +133,6 @@ class RmaLineMakeRepairItem(models.TransientModel): "product_uom": rma_line.product_id.uom_po_id.id, "company_id": rma_line.company_id.id, "location_id": self.location_id.id, - "location_dest_id": location_dest.id, - "refurbish_location_dest_id": refurbish_location_dest_id, - "refurbish_product_id": self.refurbish_product_id.id, - "to_refurbish": self.to_refurbish, "invoice_method": self.invoice_method, "address_id": addr["delivery"], "partner_invoice_id": addr["invoice"], diff --git a/rma_repair/wizards/rma_order_line_make_repair_view.xml b/rma_repair/wizards/rma_order_line_make_repair_view.xml index 0c9b8bf0..ca619669 100644 --- a/rma_repair/wizards/rma_order_line_make_repair_view.xml +++ b/rma_repair/wizards/rma_order_line_make_repair_view.xml @@ -17,18 +17,9 @@ - - -