From 6dcc76ca68dcaac35a9cc0af7e322606619e619b Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Mon, 2 Jan 2023 10:22:03 +0100 Subject: [PATCH 01/10] [IMP] rma: rma group supplier form view as a inherited view. The goal is to simplify view defintion and do not duplicate things, requiring to do view changes in two places. The same change was done from rma lines some time ago. --- rma/views/rma_order_view.xml | 189 ++++++------------------ rma/wizards/rma_add_serial_views.xml | 2 + rma/wizards/rma_add_stock_move_view.xml | 2 + 3 files changed, 48 insertions(+), 145 deletions(-) diff --git a/rma/views/rma_order_view.xml b/rma/views/rma_order_view.xml index d5ef1d1a..d951b8c6 100644 --- a/rma/views/rma_order_view.xml +++ b/rma/views/rma_order_view.xml @@ -97,6 +97,10 @@ string="Customer" colspan="4" /> + - + + + @@ -192,151 +199,43 @@ rma.order.supplier.form rma.order + + primary -
-
- -
- - - -
-
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- + rma.group_rma_supplier_user + + + Supplier + {'res_partner_search_mode': 'supplier'} + + + + - -
- + + + + + { + 'form_view_ref':'rma.view_rma_line_supplier_form', + 'default_rma_id': active_id, + 'default_partner_id': partner_id, + 'supplier': 1, + 'hide_title': True} + + diff --git a/rma/wizards/rma_add_serial_views.xml b/rma/wizards/rma_add_serial_views.xml index bd03e5a3..186818ba 100644 --- a/rma/wizards/rma_add_serial_views.xml +++ b/rma/wizards/rma_add_serial_views.xml @@ -55,6 +55,7 @@ name="%(action_rma_add_serial_wiz_customer)d" string="Add Lot/Serial Numbers" type="action" + attrs="{'invisible':[('type', '!=', 'customer')]}" /> @@ -92,6 +93,7 @@ name="%(action_rma_add_serial_wiz_supplier)d" string="Add Lot/Serial numbers" type="action" + attrs="{'invisible':[('type', '!=', 'supplier')]}" /> diff --git a/rma/wizards/rma_add_stock_move_view.xml b/rma/wizards/rma_add_stock_move_view.xml index 9c4e02a9..bd9d1270 100644 --- a/rma/wizards/rma_add_stock_move_view.xml +++ b/rma/wizards/rma_add_stock_move_view.xml @@ -101,6 +101,7 @@ name="%(action_rma_add_stock_move_customer)d" string="Add From Stock Move" type="action" + attrs="{'invisible':[('type', '!=', 'customer')]}" /> @@ -155,6 +156,7 @@ name="%(action_rma_add_stock_move_supplier)d" string="Add From Stock Move" type="action" + attrs="{'invisible':[('type', '!=', 'supplier')]}" /> From 21aa34ba9ab2c220f42597b410caf9f78bcf1b8f Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Mon, 2 Jan 2023 10:24:49 +0100 Subject: [PATCH 02/10] [IMP] rma_sale: adapt to changes in supplier rma group form view. --- rma_sale/views/rma_order_view.xml | 1 + rma_sale/wizards/rma_add_sale.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/rma_sale/views/rma_order_view.xml b/rma_sale/views/rma_order_view.xml index c826ba13..4d8618d0 100644 --- a/rma_sale/views/rma_order_view.xml +++ b/rma_sale/views/rma_order_view.xml @@ -12,6 +12,7 @@ class="oe_stat_button" icon="fa-pencil-square-o" groups="sales_team.group_sale_salesman" + attrs="{'invisible':[('type', '!=', 'customer')]}" > diff --git a/rma_sale/wizards/rma_add_sale.xml b/rma_sale/wizards/rma_add_sale.xml index 75fbe70c..0e823ec0 100644 --- a/rma_sale/wizards/rma_add_sale.xml +++ b/rma_sale/wizards/rma_add_sale.xml @@ -114,6 +114,7 @@ name="%(action_rma_add_sale)d" string="Add From Sale Order" type="action" + attrs="{'invisible':[('type', '!=', 'customer')]}" /> From 4840ca7c789e0ef7ae16d7659c439b708c428c8b Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Mon, 2 Jan 2023 10:25:30 +0100 Subject: [PATCH 03/10] [IMP] rma_account: adapt to changes in supplier rma group form view. --- rma_account/views/rma_order_view.xml | 41 ---------------------------- 1 file changed, 41 deletions(-) diff --git a/rma_account/views/rma_order_view.xml b/rma_account/views/rma_order_view.xml index bed185d5..883ad6c0 100644 --- a/rma_account/views/rma_order_view.xml +++ b/rma_account/views/rma_order_view.xml @@ -35,45 +35,4 @@ - - rma.order.supplier.form - rma.order - - - - - - - - From 10058a80f29f01dca2f719afea526440f394e1fa Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Mon, 2 Jan 2023 10:25:47 +0100 Subject: [PATCH 04/10] [IMP] rma_repair: adapt to changes in supplier rma group form view. --- rma_repair/views/rma_order_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/rma_repair/views/rma_order_view.xml b/rma_repair/views/rma_order_view.xml index 3ea2a0fe..f3547211 100644 --- a/rma_repair/views/rma_order_view.xml +++ b/rma_repair/views/rma_order_view.xml @@ -13,6 +13,7 @@ class="oe_stat_button" icon="fa-wrench" groups="stock.group_stock_user" + attrs="{'invisible':[('type', '!=', 'customer')]}" > Date: Mon, 2 Jan 2023 10:54:00 +0100 Subject: [PATCH 05/10] [IMP] rma: add description to rma order and copy it over to new lines --- rma/models/rma_order.py | 1 + rma/views/rma_order_view.xml | 23 ++++++++++++------- rma/wizards/rma_add_serial.py | 1 + rma/wizards/rma_add_stock_move.py | 1 + .../rma_order_line_make_supplier_rma.py | 1 + 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/rma/models/rma_order.py b/rma/models/rma_order.py index df89802c..b2912939 100644 --- a/rma/models/rma_order.py +++ b/rma/models/rma_order.py @@ -84,6 +84,7 @@ class RmaOrder(models.Model): reference = fields.Char( string="Partner Reference", help="The partner reference of this RMA order." ) + description = fields.Text() comment = fields.Text("Additional Information") date_rma = fields.Datetime( string="Order Date", index=True, default=lambda self: self._default_date_rma() diff --git a/rma/views/rma_order_view.xml b/rma/views/rma_order_view.xml index d951b8c6..6ba95013 100644 --- a/rma/views/rma_order_view.xml +++ b/rma/views/rma_order_view.xml @@ -91,6 +91,7 @@ + - - - + + + + @@ -134,13 +139,15 @@ - - + + - diff --git a/rma/wizards/rma_add_serial.py b/rma/wizards/rma_add_serial.py index 7a6aafc2..b06c16de 100644 --- a/rma/wizards/rma_add_serial.py +++ b/rma/wizards/rma_add_serial.py @@ -102,6 +102,7 @@ class RmaAddSerialWiz(models.TransientModel): vals = { "partner_id": self.partner_id.id, + "description": self.rma_id.description, "product_id": lot.product_id.id, "lot_id": lot.id, "uom_id": lot.product_id.uom_id.id, diff --git a/rma/wizards/rma_add_stock_move.py b/rma/wizards/rma_add_stock_move.py index 8638484b..50db2af5 100644 --- a/rma/wizards/rma_add_stock_move.py +++ b/rma/wizards/rma_add_stock_move.py @@ -122,6 +122,7 @@ class RmaAddStockMove(models.TransientModel): ) data = { "partner_id": self.partner_id.id, + "description": self.rma_id.description, "reference_move_id": sm.id, "product_id": sm.product_id.id, "lot_id": lot and lot.id or False, diff --git a/rma/wizards/rma_order_line_make_supplier_rma.py b/rma/wizards/rma_order_line_make_supplier_rma.py index ba452230..aa8d2119 100644 --- a/rma/wizards/rma_order_line_make_supplier_rma.py +++ b/rma/wizards/rma_order_line_make_supplier_rma.py @@ -113,6 +113,7 @@ class RmaLineMakeSupplierRma(models.TransientModel): ) data = { "partner_id": self.partner_id.id, + "description": self.supplier_rma_id.description, "type": "supplier", "origin": item.line_id.rma_id.name, "customer_address_id": item.line_id.delivery_address_id.id From 9e40f6e3826f3c131ee78c013cbb07d9dd24d61c Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Mon, 2 Jan 2023 10:54:29 +0100 Subject: [PATCH 06/10] [IMP] rma_sale: copy group description to rma lines --- rma_sale/wizards/rma_add_sale.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rma_sale/wizards/rma_add_sale.py b/rma_sale/wizards/rma_add_sale.py index 44700e4e..c4810f1f 100644 --- a/rma_sale/wizards/rma_add_sale.py +++ b/rma_sale/wizards/rma_add_sale.py @@ -123,6 +123,7 @@ class RmaAddSale(models.TransientModel): ) data = { "partner_id": self.partner_id.id, + "description": self.rma_id.description, "sale_line_id": line.id, "product_id": line.product_id.id, "lot_id": lot and lot.id or False, From c9b79241147e7671d205e191d2c8c4bc7eafa790 Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Mon, 2 Jan 2023 10:55:03 +0100 Subject: [PATCH 07/10] [IMP] rma_purchase: copy group description to rma lines --- rma_purchase/wizards/rma_add_purchase.py | 1 + 1 file changed, 1 insertion(+) diff --git a/rma_purchase/wizards/rma_add_purchase.py b/rma_purchase/wizards/rma_add_purchase.py index 018e6012..26aed30a 100644 --- a/rma_purchase/wizards/rma_add_purchase.py +++ b/rma_purchase/wizards/rma_add_purchase.py @@ -78,6 +78,7 @@ class RmaAddPurchase(models.TransientModel): ) data = { "partner_id": self.partner_id.id, + "description": self.rma_id.description, "purchase_order_line_id": line.id, "product_id": line.product_id.id, "origin": line.order_id.name, From 25158ec25de5370323cdc67cc5a914fc281cd7e8 Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Mon, 2 Jan 2023 10:56:18 +0100 Subject: [PATCH 08/10] [IMP] rma: order by id desc --- rma/models/rma_order.py | 1 + rma/models/rma_order_line.py | 1 + rma/views/rma_order_view.xml | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rma/models/rma_order.py b/rma/models/rma_order.py index b2912939..5b3fa6ad 100644 --- a/rma/models/rma_order.py +++ b/rma/models/rma_order.py @@ -11,6 +11,7 @@ class RmaOrder(models.Model): _name = "rma.order" _description = "RMA Group" _inherit = ["mail.thread"] + _order = "id desc" @api.model def _get_default_type(self): diff --git a/rma/models/rma_order_line.py b/rma/models/rma_order_line.py index c3dfbd50..0b81e348 100644 --- a/rma/models/rma_order_line.py +++ b/rma/models/rma_order_line.py @@ -13,6 +13,7 @@ class RmaOrderLine(models.Model): _name = "rma.order.line" _description = "RMA" _inherit = ["mail.thread"] + _order = "id desc" @api.model def _get_default_type(self): diff --git a/rma/views/rma_order_view.xml b/rma/views/rma_order_view.xml index 6ba95013..a9c723de 100644 --- a/rma/views/rma_order_view.xml +++ b/rma/views/rma_order_view.xml @@ -158,7 +158,11 @@ 'default_partner_id': partner_id, 'hide_title': True}" > - + From dbc616f12b3d69b310bc706b43cddace6e542d1a Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Mon, 2 Jan 2023 11:10:02 +0100 Subject: [PATCH 09/10] [IMP] rma: print serial/lot number in RMA group report --- rma/report/rma_report_templates.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rma/report/rma_report_templates.xml b/rma/report/rma_report_templates.xml index 1b3d5345..a700b4d7 100644 --- a/rma/report/rma_report_templates.xml +++ b/rma/report/rma_report_templates.xml @@ -212,11 +212,19 @@ + + @@ -226,6 +234,9 @@ +
Origin Operation ProductLot/Serial Number Quantity Unit Price
From ef1b1ba5766cb5ee0299a959b5dcfcef642b10ea Mon Sep 17 00:00:00 2001 From: Lois Rilo Date: Thu, 5 Jan 2023 15:44:04 +0100 Subject: [PATCH 10/10] [FIX] rma: remove "Add new line" in RMA group. This was not the intended way to add RMA lines to a group. Users are supposed to use the wizards to do so (add from stock move, add from serial, etc.). Having the option to use "add new line" was only leading to errors and confusion. --- rma/views/rma_order_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/rma/views/rma_order_view.xml b/rma/views/rma_order_view.xml index a9c723de..738ab717 100644 --- a/rma/views/rma_order_view.xml +++ b/rma/views/rma_order_view.xml @@ -162,6 +162,7 @@ name="lines" editable="bottom" default_order="id asc" + create="0" >