Skip to content

Commit

Permalink
Merge PR #952 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Aug 21, 2024
2 parents c6aa9e0 + 25e4a15 commit 60aebc4
Show file tree
Hide file tree
Showing 25 changed files with 1,038 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/website_sale_tax_toggle/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
87 changes: 87 additions & 0 deletions website_sale_tax_toggle/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
=======================
Website Sale Tax Toggle
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ab7bba29c5e2694f722c38d64267357a2bc8d5603a8fbc6d6a57a95f9259be17
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-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/16.0/website_sale_tax_toggle
: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-16-0/e-commerce-16-0-website_sale_tax_toggle
: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=16.0
:alt: Try me on Runboat

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

This module extends the functionality of website sale module adding a toggle
button to allow to user selects view prices with taxes included or without taxes.

**Table of contents**

.. contents::
:local:

Usage
=====

#. Go to Website Shop.
#. Now you can see a taxes toggle button to select prices with taxes included or
without taxes.

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_sale_tax_toggle%0Aversion:%2016.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>`_:

* Carlos Dauden <[email protected]>
* Sergio Teruel <[email protected]>

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.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions website_sale_tax_toggle/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import controllers
from . import models
25 changes: 25 additions & 0 deletions website_sale_tax_toggle/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2020 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Website Sale Tax Toggle",
"summary": "Allow display price in Shop with or without taxes",
"version": "16.0.1.0.0",
"development_status": "Beta",
"category": "Website",
"website": "https://github.com/OCA/e-commerce",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["website_sale"],
"data": ["views/templates.xml"],
"assets": {
"web.assets_frontend": [
"/website_sale_tax_toggle/static/src/js/website_sale_tax_toggle.esm.js",
"/website_sale_tax_toggle/static/src/scss/website_sale_tax_toggle.scss",
],
"web.assets_tests": [
"/website_sale_tax_toggle/static/src/js/website_sale_tax_toggle_tour.esm.js"
],
},
}
2 changes: 2 additions & 0 deletions website_sale_tax_toggle/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import main
17 changes: 17 additions & 0 deletions website_sale_tax_toggle/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2020 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import http
from odoo.http import request

from odoo.addons.website_sale.controllers.main import WebsiteSale


class WebsiteSaleTaxToggle(WebsiteSale):
@http.route(["/website/tax_toggle"], type="json", auth="public", website=True)
def tax_toggle(self):
# Create a session variable
request.session["tax_toggle_taxed"] = not request.session.get(
"tax_toggle_taxed", False
)
return request.session["tax_toggle_taxed"]
31 changes: 31 additions & 0 deletions website_sale_tax_toggle/i18n/ca.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_tax_toggle
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-01-20 20:45+0000\n"
"Last-Translator: claudiagn <[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_sale_tax_toggle
#: model_terms:ir.ui.view,arch_db:website_sale_tax_toggle.tax_toggle_template
msgid ""
"<span/>\n"
" <span>Show prices with taxes included</span>"
msgstr ""
"<span/>\n"
" <span>Mostra preus amb taxes incloses</span>"

#. module: website_sale_tax_toggle
#: model:ir.model,name:website_sale_tax_toggle.model_res_users
msgid "Users"
msgstr "Usuaris"
32 changes: 32 additions & 0 deletions website_sale_tax_toggle/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_tax_toggle
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-07 14:17+0000\n"
"PO-Revision-Date: 2020-07-07 16:19+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.0.6\n"

#. module: website_sale_tax_toggle
#: model_terms:ir.ui.view,arch_db:website_sale_tax_toggle.tax_toggle_template
msgid ""
"<span/>\n"
" <span>Show prices with taxes included</span>"
msgstr ""
"<span/>\n"
" <span>Mostrar precios con impuestos incluidos</span>"

#. module: website_sale_tax_toggle
#: model:ir.model,name:website_sale_tax_toggle.model_res_users
msgid "Users"
msgstr "Usuarios"
31 changes: 31 additions & 0 deletions website_sale_tax_toggle/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_tax_toggle
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2020-11-23 15:36+0000\n"
"Last-Translator: Yann Papouin <[email protected]>\n"
"Language-Team: none\n"
"Language: fr\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 3.10\n"

#. module: website_sale_tax_toggle
#: model_terms:ir.ui.view,arch_db:website_sale_tax_toggle.tax_toggle_template
msgid ""
"<span/>\n"
" <span>Show prices with taxes included</span>"
msgstr ""
"<span/>\n"
" <span>Afficher les prix TTC</span>"

#. module: website_sale_tax_toggle
#: model:ir.model,name:website_sale_tax_toggle.model_res_users
msgid "Users"
msgstr "Utilisateurs"
31 changes: 31 additions & 0 deletions website_sale_tax_toggle/i18n/nl.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_tax_toggle
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-04-05 18:46+0000\n"
"Last-Translator: Bosd <[email protected]>\n"
"Language-Team: none\n"
"Language: nl\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_sale_tax_toggle
#: model_terms:ir.ui.view,arch_db:website_sale_tax_toggle.tax_toggle_template
msgid ""
"<span/>\n"
" <span>Show prices with taxes included</span>"
msgstr ""
"<span/>\n"
" <span>Prijzen weergeven inclusief BTW</span>"

#. module: website_sale_tax_toggle
#: model:ir.model,name:website_sale_tax_toggle.model_res_users
msgid "Users"
msgstr "Gebruikers"
26 changes: 26 additions & 0 deletions website_sale_tax_toggle/i18n/website_sale_tax_toggle.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * website_sale_tax_toggle
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: website_sale_tax_toggle
#: model_terms:ir.ui.view,arch_db:website_sale_tax_toggle.tax_toggle_template
msgid ""
"<span/>\n"
" <span>Show prices with taxes included</span>"
msgstr ""

#. module: website_sale_tax_toggle
#: model:ir.model,name:website_sale_tax_toggle.model_res_users
msgid "Users"
msgstr ""
3 changes: 3 additions & 0 deletions website_sale_tax_toggle/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright 2020 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import res_users
35 changes: 35 additions & 0 deletions website_sale_tax_toggle/models/res_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2020 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, models
from odoo.http import request
from odoo.tools import ormcache


class ResUsers(models.Model):
_inherit = "res.users"

@api.model
def has_group(self, group_ext_id):
tax_included = "account.group_show_line_subtotals_tax_included"
tax_excluded = "account.group_show_line_subtotals_tax_excluded"
if (
self.env.context.get("website_id")
and group_ext_id in [tax_included, tax_excluded]
and not self.env.context.get("skip_tax_toggle_check")
):
taxed = request.session.get(
"tax_toggle_taxed",
self.env.user.with_context(skip_tax_toggle_check=True).has_group(
tax_included
),
)
return group_ext_id != (tax_excluded if taxed else tax_included)
return super().has_group(group_ext_id)

# HACK: To clear cache called from res.users write method
@api.model
@ormcache("self._uid", "group_ext_id")
def _has_group(self, group_ext_id):
return super()._has_group(group_ext_id)

has_group.clear_cache = _has_group.clear_cache
4 changes: 4 additions & 0 deletions website_sale_tax_toggle/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Carlos Dauden <[email protected]>
* Sergio Teruel <[email protected]>
2 changes: 2 additions & 0 deletions website_sale_tax_toggle/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module extends the functionality of website sale module adding a toggle
button to allow to user selects view prices with taxes included or without taxes.
3 changes: 3 additions & 0 deletions website_sale_tax_toggle/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#. Go to Website Shop.
#. Now you can see a taxes toggle button to select prices with taxes included or
without taxes.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 60aebc4

Please sign in to comment.