From de55c94ff709aeb39990cf2eaf5f045634d2d889 Mon Sep 17 00:00:00 2001 From: Florian da Costa Date: Wed, 8 Jun 2022 15:55:52 +0200 Subject: [PATCH] Hide smart button when empty --- rma/views/rma_order_line_view.xml | 3 +++ rma_account/views/rma_order_line_view.xml | 2 ++ rma_sale/models/rma_order_line.py | 7 +++++++ rma_sale/views/rma_order_line_view.xml | 17 +++++++++++------ 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/rma/views/rma_order_line_view.xml b/rma/views/rma_order_line_view.xml index cf596b95..e8f8a702 100644 --- a/rma/views/rma_order_line_view.xml +++ b/rma/views/rma_order_line_view.xml @@ -100,6 +100,7 @@ name="action_view_in_shipments" class="oe_stat_button" icon="fa-truck" + attrs="{'invisible': [('in_shipment_count', '=', 0)]}" groups="stock.group_stock_user" > @@ -38,6 +39,7 @@ name="action_view_refunds" class="oe_stat_button" icon="fa-pencil-square-o" + attrs="{'invisible': [('refund_count', '=', 0)]}" groups="account.group_account_invoice" > diff --git a/rma_sale/models/rma_order_line.py b/rma_sale/models/rma_order_line.py index 2b08e9b3..722a7e6d 100644 --- a/rma_sale/models/rma_order_line.py +++ b/rma_sale/models/rma_order_line.py @@ -203,6 +203,13 @@ class RmaOrderLine(models.Model): result["domain"] = [("id", "in", order_ids)] return result + def action_view_origin_sale_order(self): + action = self.env.ref("sale.action_orders_salesteams") + result = action.sudo().read()[0] + order_ids = self.sale_id.ids + result["domain"] = [("id", "in", order_ids)] + return result + def _get_rma_sold_qty(self): self.ensure_one() qty = 0.0 diff --git a/rma_sale/views/rma_order_line_view.xml b/rma_sale/views/rma_order_line_view.xml index f9fe62d7..2a8b36df 100644 --- a/rma_sale/views/rma_order_line_view.xml +++ b/rma_sale/views/rma_order_line_view.xml @@ -7,11 +7,21 @@
+
+ - - -