From 280b87ec287fbd5f361569d813da1bb5bb7a76e3 Mon Sep 17 00:00:00 2001 From: JasminSForgeFlow Date: Wed, 6 May 2026 11:11:34 +0000 Subject: [PATCH] [ADD] website_sale_category_smart_button --- website_sale_category_smart_button/README.rst | 93 ++++ .../__init__.py | 1 + .../__manifest__.py | 19 + .../models/__init__.py | 1 + .../models/product_public_category.py | 28 ++ .../pyproject.toml | 3 + .../readme/CONTRIBUTORS.md | 2 + .../readme/DESCRIPTION.md | 4 + .../static/description/index.html | 437 ++++++++++++++++++ .../views/product_public_category_views.xml | 22 + 10 files changed, 610 insertions(+) create mode 100644 website_sale_category_smart_button/README.rst create mode 100644 website_sale_category_smart_button/__init__.py create mode 100644 website_sale_category_smart_button/__manifest__.py create mode 100644 website_sale_category_smart_button/models/__init__.py create mode 100644 website_sale_category_smart_button/models/product_public_category.py create mode 100644 website_sale_category_smart_button/pyproject.toml create mode 100644 website_sale_category_smart_button/readme/CONTRIBUTORS.md create mode 100644 website_sale_category_smart_button/readme/DESCRIPTION.md create mode 100644 website_sale_category_smart_button/static/description/index.html create mode 100644 website_sale_category_smart_button/views/product_public_category_views.xml diff --git a/website_sale_category_smart_button/README.rst b/website_sale_category_smart_button/README.rst new file mode 100644 index 0000000000..f1687914f6 --- /dev/null +++ b/website_sale_category_smart_button/README.rst @@ -0,0 +1,93 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + +================================== +Website Sale Category Smart Button +================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:51f086bf97de577bbd1bd9d77466a4ad6393e656809275da6a6f9c58be01fadc + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github + :target: https://github.com/OCA/e-commerce/tree/19.0/website_sale_category_smart_button + :alt: OCA/e-commerce +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/e-commerce-19-0/e-commerce-19-0-website_sale_category_smart_button + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/e-commerce&target_branch=19.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Adds a "Go to Website" smart button on the eCommerce category backend +form view, allowing users to navigate directly to the shop category page +(``/shop/category/``), the same way products have a "Go to +Website" button. + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* ForgeFlow + +Contributors +------------ + +- `ForgeFlow `__ + + - Jasmin Solanki + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-JasminSForgeFlow| image:: https://github.com/JasminSForgeFlow.png?size=40px + :target: https://github.com/JasminSForgeFlow + :alt: JasminSForgeFlow + +Current `maintainer `__: + +|maintainer-JasminSForgeFlow| + +This module is part of the `OCA/e-commerce `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_sale_category_smart_button/__init__.py b/website_sale_category_smart_button/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/website_sale_category_smart_button/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/website_sale_category_smart_button/__manifest__.py b/website_sale_category_smart_button/__manifest__.py new file mode 100644 index 0000000000..b44b0401bf --- /dev/null +++ b/website_sale_category_smart_button/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Website Sale Category Smart Button", + "summary": "Adds a 'Go to Website' smart button on the eCommerce category" + " form view", + "version": "19.0.1.0.0", + "author": "ForgeFlow, Odoo Community Association (OCA)", + "maintainers": ["JasminSForgeFlow"], + "website": "https://github.com/OCA/e-commerce", + "license": "AGPL-3", + "category": "Website", + "depends": ["website_sale"], + "data": [ + "views/product_public_category_views.xml", + ], + "installable": True, +} diff --git a/website_sale_category_smart_button/models/__init__.py b/website_sale_category_smart_button/models/__init__.py new file mode 100644 index 0000000000..0a91ef28d4 --- /dev/null +++ b/website_sale_category_smart_button/models/__init__.py @@ -0,0 +1 @@ +from . import product_public_category diff --git a/website_sale_category_smart_button/models/product_public_category.py b/website_sale_category_smart_button/models/product_public_category.py new file mode 100644 index 0000000000..2dba902085 --- /dev/null +++ b/website_sale_category_smart_button/models/product_public_category.py @@ -0,0 +1,28 @@ +# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class ProductPublicCategory(models.Model): + _inherit = "product.public.category" + + website_url = fields.Char( + string="Website URL", + compute="_compute_website_url", + ) + + @api.depends("seo_name") + @api.depends_context("lang") + def _compute_website_url(self): + for category in self: + if category.id: + category.website_url = ( + f"/shop/category/{self.env['ir.http']._slug(category)}" + ) + else: + category.website_url = "#" + + def open_website_url(self): + self.ensure_one() + return self.env["website"].get_client_action(self.website_url) diff --git a/website_sale_category_smart_button/pyproject.toml b/website_sale_category_smart_button/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/website_sale_category_smart_button/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/website_sale_category_smart_button/readme/CONTRIBUTORS.md b/website_sale_category_smart_button/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..195652ad1e --- /dev/null +++ b/website_sale_category_smart_button/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [ForgeFlow](https://www.forgeflow.com) + - Jasmin Solanki \<\> diff --git a/website_sale_category_smart_button/readme/DESCRIPTION.md b/website_sale_category_smart_button/readme/DESCRIPTION.md new file mode 100644 index 0000000000..c5fb36bc6f --- /dev/null +++ b/website_sale_category_smart_button/readme/DESCRIPTION.md @@ -0,0 +1,4 @@ +Adds a "Go to Website" smart button on the eCommerce category backend form +view, allowing users to navigate directly to the shop category page +(`/shop/category/`), the same way products have a "Go to Website" +button. diff --git a/website_sale_category_smart_button/static/description/index.html b/website_sale_category_smart_button/static/description/index.html new file mode 100644 index 0000000000..c42f3b5896 --- /dev/null +++ b/website_sale_category_smart_button/static/description/index.html @@ -0,0 +1,437 @@ + + + + + +README.rst + + + +
+ + + +Odoo Community Association + +
+

Website Sale Category Smart Button

+ +

Beta License: AGPL-3 OCA/e-commerce Translate me on Weblate Try me on Runboat

+

Adds a “Go to Website” smart button on the eCommerce category backend +form view, allowing users to navigate directly to the shop category page +(/shop/category/<slug>), the same way products have a “Go to +Website” button.

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • ForgeFlow
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

JasminSForgeFlow

+

This module is part of the OCA/e-commerce project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+
+ + diff --git a/website_sale_category_smart_button/views/product_public_category_views.xml b/website_sale_category_smart_button/views/product_public_category_views.xml new file mode 100644 index 0000000000..5e9a43cf75 --- /dev/null +++ b/website_sale_category_smart_button/views/product_public_category_views.xml @@ -0,0 +1,22 @@ + + + + product.public.category.form.inherit.smart.button + product.public.category + + + +
+ +
+
+
+
+