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

Syncing from upstream OCA/e-commerce (16.0) #721

Merged
merged 23 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e78ac32
[NEW] website_sale_tax_toggle: Display price with or without taxes
sergio-teruel Jul 7, 2020
1da4c69
[UPD] Update website_sale_tax_toggle.pot
oca-travis Jul 10, 2020
09a543b
[NEW] website_sale_tax_toggle: Test more resilient to pricelists
sergio-teruel Jul 15, 2020
e1847dc
[NEW] website_sale_tax_toggle: Test more resilient to CI
sergio-teruel Jul 16, 2020
d69953f
[IMP] website_sale_tax_toggle: Fix tests
sergio-teruel Jul 28, 2020
627e431
[FIX] website_tax_toggle: make tour effective
Aug 12, 2020
64837a4
[FIX] website_sale_tax_toggle: compatibilize tour with website_sale_b…
Aug 13, 2020
4b22262
Added translation using Weblate (French)
ypapouin Nov 23, 2020
3c1fff4
Added translation using Weblate (Catalan)
claudiagn Jan 20, 2021
c271385
[IMP] website_sale_tax_toggle: black, isort
sergio-teruel Feb 17, 2021
086e9df
[MIG] website_sale_tax_toggle: Migration to v13.0
sergio-teruel Feb 17, 2021
4f5e5b0
[IMP] website_sale_tax_toggle: Making test more resilient
CarlosRoca13 Mar 24, 2021
7a491a3
Added translation using Weblate (Dutch)
bosd Apr 5, 2021
21df619
[IMP] website_sale_tax_toggle: black, isort, prettier
CarlosRoca13 May 12, 2022
678d617
[MIG] website_sale_tax_toggle: Migration to 14.0
CarlosRoca13 May 13, 2022
6fea6cc
[MIG] website_sale_tax_toggle: Migration to 15.0
CarlosRoca13 May 23, 2022
6a7e160
[UPD] Update website_sale_tax_toggle.pot
Dec 19, 2022
9ae302e
[IMP] website_sale_tax_toggle: test performance improvement
josep-tecnativa Oct 18, 2023
b981566
[IMP] website_sale_tax_toggle: pre-commit stuff
carlos-lopez-tecnativa Jul 17, 2024
25e4a15
[MIG] website_sale_tax_toggle: Migration to 16.0
carlos-lopez-tecnativa Jul 17, 2024
60aebc4
Merge PR #952 into 16.0
OCA-git-bot Aug 21, 2024
d8bc9ab
[UPD] Update website_sale_tax_toggle.pot
Aug 21, 2024
dc6e444
[BOT] post-merge updates
OCA-git-bot Aug 21, 2024
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ addon | version | maintainers | summary
[website_sale_stock_list_preview](website_sale_stock_list_preview/) | 16.0.1.0.1 | | Show the stock of products on the product previews
[website_sale_stock_provisioning_date](website_sale_stock_provisioning_date/) | 16.0.1.0.0 | | Display provisioning date for a product in shop online
[website_sale_suggest_create_account](website_sale_suggest_create_account/) | 16.0.1.1.0 | | Suggest users to create an account when buying in the website
[website_sale_tax_toggle](website_sale_tax_toggle/) | 16.0.1.0.0 | | Allow display price in Shop with or without taxes
[website_sale_vat_required](website_sale_vat_required/) | 16.0.1.0.1 | | VAT number required in checkout form
[website_sale_wishlist_hide_price](website_sale_wishlist_hide_price/) | 16.0.1.0.0 | | Hide product prices on the shop
[website_sale_wishlist_keep](website_sale_wishlist_keep/) | 16.0.1.0.1 | | Allows to add products to my cart but keep it in my wishlist"
Expand Down
2 changes: 1 addition & 1 deletion setup/_metapackage/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.0.20240719.0
16.0.20240821.0
1 change: 1 addition & 0 deletions setup/_metapackage/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
'odoo-addon-website_sale_stock_list_preview>=16.0dev,<16.1dev',
'odoo-addon-website_sale_stock_provisioning_date>=16.0dev,<16.1dev',
'odoo-addon-website_sale_suggest_create_account>=16.0dev,<16.1dev',
'odoo-addon-website_sale_tax_toggle>=16.0dev,<16.1dev',
'odoo-addon-website_sale_vat_required>=16.0dev,<16.1dev',
'odoo-addon-website_sale_wishlist_hide_price>=16.0dev,<16.1dev',
'odoo-addon-website_sale_wishlist_keep>=16.0dev,<16.1dev',
Expand Down
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:c270670417ab964514fb4b13777bc5c450f9c199b878c31ca9509e9da8f9c4fc
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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 16.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 "User"
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
Loading