From c9bed9553cde955804081a743f34d03edadce8b1 Mon Sep 17 00:00:00 2001 From: Ernesto Tejeda Date: Sat, 12 Dec 2020 10:18:13 -0500 Subject: [PATCH] [IMP] *rma*: Avoid RMAs of kits until rma_mrp is installed --- website_rma/controllers/main.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/website_rma/controllers/main.py b/website_rma/controllers/main.py index 2ba75fdc..437188ca 100644 --- a/website_rma/controllers/main.py +++ b/website_rma/controllers/main.py @@ -23,10 +23,19 @@ class WebsiteRMA(http.Controller): """Domain used for the products to be shown in selection of the web form. """ - return [ + domain = [ ("name", "=ilike", "%{}%".format(q or "")), ("sale_ok", "=", True), ] + # HACK: As there is no glue module for this purpose we have put + # this this condition to check that the mrp module is installed. + if "bom_ids" in request.env["product.product"]._fields: + domain += [ + "|", + ("bom_ids.type", "!=", "phantom"), + ("bom_ids", "=", False), + ] + return domain @http.route(["/requestrma"], type="http", auth="user", website=True) def request_rma(self, **kw):