diff --git a/base_url/models/abstract_url.py b/base_url/models/abstract_url.py
index a553f2328c..7a679d1510 100644
--- a/base_url/models/abstract_url.py
+++ b/base_url/models/abstract_url.py
@@ -131,12 +131,15 @@ def _compute_redirect_url_url_ids(self):
self.flush()
for record in self:
record.redirect_url_url_ids = record.env["url.url"].search(
- [
- ("model_id", "=", get_model_ref(record)),
- ("redirect", "=", True),
- ]
+ record._redirect_url_domain()
)
+ def _redirect_url_domain(self):
+ return [
+ ("model_id", "=", get_model_ref(self)),
+ ("redirect", "=", True),
+ ]
+
@api.depends("url_key")
def _compute_url_url_ids(self):
self.flush()
@@ -228,3 +231,16 @@ def unlink(self):
urls.unlink()
self.flush()
return super(AbstractUrl, self).unlink()
+
+ def action_view_redirect_url(self):
+ self.ensure_one()
+ action = self.env["ir.actions.actions"]._for_xml_id(
+ "base_url.base_url_action_view"
+ )
+ action["name"] = action["display_name"] = _("Redirects")
+ action["domain"] = self._redirect_url_domain()
+ action["context"] = {
+ "default_model_id": get_model_ref(self),
+ "default_redirect": True,
+ }
+ return action
diff --git a/base_url/models/url_url.py b/base_url/models/url_url.py
index 407843cf85..7cee2d3038 100644
--- a/base_url/models/url_url.py
+++ b/base_url/models/url_url.py
@@ -21,7 +21,7 @@ class UrlUrl(models.Model):
selection="_selection_target_model",
help="The id of content linked to the url.",
readonly=True,
- string="Model",
+ string="Record",
required=True,
index=True,
)
diff --git a/base_url/views/url_view.xml b/base_url/views/url_view.xml
index 3767cceed8..cc4d8c1fba 100644
--- a/base_url/views/url_view.xml
+++ b/base_url/views/url_view.xml
@@ -21,11 +21,28 @@
url.url
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ url.url
+
+
+
+
+
+
+
+
diff --git a/shopinvader/views/shopinvader_category_view.xml b/shopinvader/views/shopinvader_category_view.xml
index d725123132..f50fedc309 100644
--- a/shopinvader/views/shopinvader_category_view.xml
+++ b/shopinvader/views/shopinvader_category_view.xml
@@ -63,6 +63,12 @@
+
diff --git a/shopinvader/views/shopinvader_product_view.xml b/shopinvader/views/shopinvader_product_view.xml
index 92b238c13e..72498d7466 100644
--- a/shopinvader/views/shopinvader_product_view.xml
+++ b/shopinvader/views/shopinvader_product_view.xml
@@ -147,6 +147,13 @@
+
+
diff --git a/shopinvader/views/shopinvader_variant_view.xml b/shopinvader/views/shopinvader_variant_view.xml
index 4920136aec..6aba400f1a 100644
--- a/shopinvader/views/shopinvader_variant_view.xml
+++ b/shopinvader/views/shopinvader_variant_view.xml
@@ -166,4 +166,18 @@
+
+ URLs
+ url.url
+ tree,form
+ [('model_id', 'like', 'shopinvader.%')]
+
+
+
+