-
-
Notifications
You must be signed in to change notification settings - Fork 499
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
25 changed files
with
1,038 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/website_sale_tax_toggle/odoo/addons/website_sale_tax_toggle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../website_sale_tax_toggle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.