Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] website_snippet_product_category: Migration to version 18.0 #1020

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1d0e38d
[ADD] website_snippet_product_category
Tardo May 25, 2020
4ee3484
[FIX] website_snippet_product_category: Title s/wesbite/website
pedrobaeza Sep 11, 2020
f38e768
[FIX] website_snippet_product_category: Proper smart-button
pedrobaeza Sep 11, 2020
ca6eb65
Added translation using Weblate (Spanish)
claudiagn Nov 3, 2020
a27a603
Translated using Weblate (Spanish)
claudiagn Nov 3, 2020
01cb52e
Added translation using Weblate (French)
ypapouin Nov 23, 2020
5d5db10
Translated using Weblate (French)
ypapouin Nov 23, 2020
883448a
Added translation using Weblate (Dutch)
bosd Dec 15, 2020
9937bfb
Translated using Weblate (Dutch)
bosd Dec 15, 2020
c1bcef7
Added translation using Weblate (Catalan)
claudiagn Jan 20, 2021
ad358d2
Translated using Weblate (Catalan)
claudiagn Jan 20, 2021
44bcbec
[MIG] website_snippet_product_category: Migration to v13.0
CarlosRoca13 Apr 9, 2021
e731676
[IMP] website_snippet_product_category: Change website published fiel…
sergio-teruel Dec 17, 2021
039de0a
[FIX] website_snippet_product_category: Revert field name swap in web…
pedrobaeza Dec 24, 2021
2febd3f
[IMP] website_snippet_product_category: Reduced the icon size of the …
Tardo Dec 24, 2021
10c62be
website_snippet_product_category 13.0.2.1.0
OCA-git-bot Dec 27, 2021
cac6919
Translated using Weblate (Catalan)
Noel000 Mar 2, 2022
6d03b33
Translated using Weblate (Spanish)
macagua May 24, 2022
9912242
[MIG] website_snippet_product_category: Migration to version 15.0
pilarvargas-tecnativa Feb 9, 2023
f2eccac
[MIG] website_snippet_product_category: Migration to 16.0
pilarvargas-tecnativa Aug 8, 2023
1f8f44a
Added translation using Weblate (Italian)
mymage May 8, 2024
b8f6b38
Translated using Weblate (Italian)
mymage May 8, 2024
2fc4f2f
[IMP] website_snippet_product_category: pre-commit auto fixes
pilarvargas-tecnativa Feb 3, 2025
3fbecc3
[MIG] website_snippet_product_category: Migration to version 17.0
pilarvargas-tecnativa Feb 3, 2025
4ef0137
[UPD] Update website_snippet_product_category.pot
Feb 7, 2025
31bf525
[BOT] post-merge updates
OCA-git-bot Feb 7, 2025
2453b13
[MIG] website_snippet_product_category: Migration to version 18.0
pilarvargas-tecnativa Feb 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 143 additions & 0 deletions website_snippet_product_category/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
================================
Website Snippet Product Category
================================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:403c2b9204ca8734b5628e1fa3e4a5616ccfa408d56d59a2395967489bdeeb85
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fe--commerce-lightgray.png?logo=github
:target: https://github.com/OCA/e-commerce/tree/18.0/website_snippet_product_category
: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-18-0/e-commerce-18-0-website_snippet_product_category
: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=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Adds a new snippet to show e-commerce categories

**Table of contents**

.. contents::
:local:

Configuration
=============

You can select what categories can be shown by the snippet and an image
for the category:

1. Go to website > eCommerce > eCommerce Categories
2. Create or Edit one
3. You can see a new options "Published in product category snippet"

Usage
=====

1. Go to website (frontend)
2. Press 'Edit' button
3. Drag the 'Product Category' snippet to the place of the website that
you want
4. Save changes

Theming
-------

CSS Classes:

- ``.categ_container`` > The container per master category
- ``.categ_scroll_wrapper`` > The scrollable container wrapper
- ``.categ_scroll`` > The scrollable container
- ``.categ_tree_level`` > The category row (image + text)
- ``.main_tree_level`` > The first category row level displayed
- ``.categ_link`` > The link of the category row
- ``.categ_img`` > The container of the icon of the category row

You can use 'data-tree-level' attribute to select the category row of a
selected level (1-4 by design).

Also you can replace the entire template replacing the ``data-template``
attribute value in the ``s_product_category_options`` view. You only
need know that the name of the variable that have all the categories is
called ``object``.

Known issues / Roadmap
======================

- The snippet shows a maximum of 4 levels by design.
- Add a option to configure the initial level
- Add a option to select how many levels can be represented
- Handle large amounts of categories

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/e-commerce/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 <https://github.com/OCA/e-commerce/issues/new?body=module:%20website_snippet_product_category%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Tecnativa

Contributors
------------

- `Tecnativa <https://www.tecnativa.com>`__:

- Alexandre D. Díaz
- Pedro M. Baeza
- Carlos Roca
- Sergio Teruel
- Pilar Vargas

Other credits
-------------

static/img/boxes_32.png - https://www.iconninja.com/box-mario-icon-30561

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-Tardo| image:: https://github.com/Tardo.png?size=40px
:target: https://github.com/Tardo
:alt: Tardo

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-Tardo|

This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/18.0/website_snippet_product_category>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions website_snippet_product_category/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
31 changes: 31 additions & 0 deletions website_snippet_product_category/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2020 Tecnativa - Alexandre Díaz
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
{
"name": "Website Snippet Product Category",
"category": "Website",
"summary": "Adds a new snippet to show e-commerce categories",
"version": "18.0.1.0.0",
"license": "LGPL-3",
"website": "https://github.com/OCA/e-commerce",
"author": "Tecnativa, Odoo Community Association (OCA)",
"depends": ["website_sale"],
"data": [
"templates/snippets.xml",
"views/product_public_category.xml",
],
"assets": {
"web.assets_frontend": [
"/website_snippet_product_category/static/src/scss/snippet.scss",
"/website_snippet_product_category/static/src/js/frontend.esm.js",
],
"website.assets_wysiwyg": [
"/website_snippet_product_category/static/src/js/snippet.options.esm.js",
],
"web.assets_tests": [
"/website_snippet_product_category/static/src/tests/*.esm.js"
],
},
"demo": ["demo/demo.xml", "demo/pages.xml"],
"maintainers": ["Tardo"],
"installable": True,
}
1 change: 1 addition & 0 deletions website_snippet_product_category/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import website
26 changes: 26 additions & 0 deletions website_snippet_product_category/controllers/website.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2020 Tecnativa - Alexandre Díaz
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import http
from odoo.http import request

from odoo.addons.website.controllers.main import QueryURL


class Website(http.Controller):
@http.route(
["/website_sale/render_product_category"],
type="json",
auth="public",
website=True,
)
def render_product_category(self, template, **kwargs):
categories = request.env["product.public.category"].search(
[
("parent_id", "=", False),
("published_in_product_category_snippet", "=", True),
]
)
keep = QueryURL("/shop", category=0)
return request.env["ir.qweb"]._render(
template, {"object": categories, "keep": keep}
)
69 changes: 69 additions & 0 deletions website_snippet_product_category/demo/demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<record id="website_sale.public_category_desks" model="product.public.category">
<field name="published_in_product_category_snippet" eval="True" />
</record>
<record
id="website_sale.public_category_furnitures"
model="product.public.category"
>
<field name="published_in_product_category_snippet" eval="True" />
</record>
<record id="website_sale.public_category_boxes" model="product.public.category">
<field name="published_in_product_category_snippet" eval="True" />
<field
name="image_128"
type="base64"
file="website_snippet_product_category/static/img/boxes_32.png"
/>
</record>
<record id="website_sale.public_category_drawers" model="product.public.category">
<field name="published_in_product_category_snippet" eval="True" />
</record>
<record id="website_sale.public_category_cabinets" model="product.public.category">
<field name="published_in_product_category_snippet" eval="True" />
</record>
<record id="website_sale.public_category_bins" model="product.public.category">
<field name="published_in_product_category_snippet" eval="True" />
</record>
<record id="website_sale.public_category_lamps" model="product.public.category">
<field name="published_in_product_category_snippet" eval="True" />
</record>
<record id="website_sale.public_category_services" model="product.public.category">
<field name="published_in_product_category_snippet" eval="True" />
</record>
<record
id="website_sale.public_category_multimedia"
model="product.public.category"
>
<field name="published_in_product_category_snippet" eval="True" />
</record>
<record id="public_category_boxes_metal" model="product.public.category">
<field name="name">Metal Box</field>
<field name="parent_id" ref="website_sale.public_category_boxes" />
<field name="published_in_product_category_snippet" eval="True" />
</record>
<record id="public_category_boxes_wooden" model="product.public.category">
<field name="name">Wooden Box</field>
<field name="parent_id" ref="website_sale.public_category_boxes" />
<field name="published_in_product_category_snippet" eval="True" />
</record>
<record id="public_category_boxes_metal_spec_a" model="product.public.category">
<field name="name">Spec A</field>
<field name="parent_id" ref="public_category_boxes_metal" />
<field name="published_in_product_category_snippet" eval="True" />
</record>
<record id="public_category_boxes_metal_spec_b" model="product.public.category">
<field name="name">Spec B</field>
<field name="parent_id" ref="public_category_boxes_metal" />
<field name="published_in_product_category_snippet" eval="True" />
</record>
<record
id="public_category_boxes_metal_subspec_b_a"
model="product.public.category"
>
<field name="name">SubSpec B - A</field>
<field name="parent_id" ref="public_category_boxes_metal_spec_b" />
<field name="published_in_product_category_snippet" eval="True" />
</record>
</odoo>
27 changes: 27 additions & 0 deletions website_snippet_product_category/demo/pages.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="snippet_product_category_demo_view"
name="Snippet Product Category Test"
>
<t t-call="website.layout">
<div id="wrap">
<section class="s_product_category py-4">
<div class="js_product_category col-12" />
</section>
</div>
</t>
</template>
<record id="snippet_product_category_demo_page" model="website.page">
<field name="is_published">True</field>
<field name="url">/website_snippet_product_category.demo_page</field>
<field name="view_id" ref="snippet_product_category_demo_view" />
</record>
<record id="snippet_product_category_demo_page_link" model="website.menu">
<field name="name">Snippet Product Category Demo</field>
<field name="url">/website_snippet_product_category.demo_page</field>
<field name="parent_id" ref="website.main_menu" />
<field name="sequence" type="int">50</field>
<field name="page_id" ref="snippet_product_category_demo_page" />
</record>
</odoo>
76 changes: 76 additions & 0 deletions website_snippet_product_category/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_snippet_product_category
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2022-03-02 12:17+0000\n"
"Last-Translator: Noel estudillo <[email protected]>\n"
"Language-Team: none\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"

#. module: website_snippet_product_category
#. odoo-javascript
#: code:addons/website_snippet_product_category/static/src/js/frontend.js:0
#, python-format
msgid ""
"An error occured with this product categories block. If the problem "
"persists, please consider deleting it and adding a new one"
msgstr ""
"S'ha produït un error amb aquest bloc de categories de productes. Si el "
"problema continua, penseu en suprimir-lo i afegir-ne un de nou"

#. module: website_snippet_product_category
#: model:product.public.category,name:website_snippet_product_category.public_category_boxes_metal
msgid "Metal Box"
msgstr "Caixa de metall"

#. module: website_snippet_product_category
#. odoo-javascript
#: code:addons/website_snippet_product_category/static/src/js/frontend.js:0
#, python-format
msgid "No categories were found. Make sure you have categories defined."
msgstr ""
"No s'han trobat categories. Assegureu-vos que teniu categories definides."

#. module: website_snippet_product_category
#: model:ir.model.fields,field_description:website_snippet_product_category.field_product_public_category__published_in_product_category_snippet
msgid "Published in product category snippet"
msgstr "Publicat al fragment de categoria de producte"

#. module: website_snippet_product_category
#: model:website.menu,name:website_snippet_product_category.snippet_product_category_demo_page_link
msgid "Snippet Product Category Demo"
msgstr "Demostració de la categoria de producte del fragment"

#. module: website_snippet_product_category
#: model:product.public.category,name:website_snippet_product_category.public_category_boxes_metal_spec_a
msgid "Spec A"
msgstr "Especificació A"

#. module: website_snippet_product_category
#: model:product.public.category,name:website_snippet_product_category.public_category_boxes_metal_spec_b
msgid "Spec B"
msgstr "Especificació B"

#. module: website_snippet_product_category
#: model:product.public.category,name:website_snippet_product_category.public_category_boxes_metal_subspec_b_a
msgid "SubSpec B - A"
msgstr "Subespecificació B-A"

#. module: website_snippet_product_category
#: model:ir.model,name:website_snippet_product_category.model_product_public_category
msgid "Website Product Category"
msgstr "Categoria de producte del lloc web"

#. module: website_snippet_product_category
#: model:product.public.category,name:website_snippet_product_category.public_category_boxes_wooden
msgid "Wooden Box"
msgstr "Caixa de fusta"
Loading