diff --git a/website_sale_fiscal_position_product_domain/README.rst b/website_sale_fiscal_position_product_domain/README.rst new file mode 100644 index 0000000000..2d0f94d3aa --- /dev/null +++ b/website_sale_fiscal_position_product_domain/README.rst @@ -0,0 +1,87 @@ +=========================================== +Website Sale Fiscal Position Product Domain +=========================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:61f19a10a94a5fcc281bb5b193f5f9372c230e05d340409acacb86c963ad8296 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/18.0/website_sale_fiscal_position_product_domain + :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_sale_fiscal_position_product_domain + :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| + +Applies fiscal position product-domain tax mappings in website sale +prices and product configurators. + +**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 +------- + +* Tecnativa + +Contributors +------------ + +- `Tecnativa `__: + + - Carlos Dauden + +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-carlosdauden| image:: https://github.com/carlosdauden.png?size=40px + :target: https://github.com/carlosdauden + :alt: carlosdauden + +Current `maintainer `__: + +|maintainer-carlosdauden| + +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_fiscal_position_product_domain/__init__.py b/website_sale_fiscal_position_product_domain/__init__.py new file mode 100644 index 0000000000..91c5580fed --- /dev/null +++ b/website_sale_fiscal_position_product_domain/__init__.py @@ -0,0 +1,2 @@ +from . import controllers +from . import models diff --git a/website_sale_fiscal_position_product_domain/__manifest__.py b/website_sale_fiscal_position_product_domain/__manifest__.py new file mode 100644 index 0000000000..294ff4ae73 --- /dev/null +++ b/website_sale_fiscal_position_product_domain/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2026 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Website Sale Fiscal Position Product Domain", + "summary": "Apply fiscal position product domains on eCommerce prices", + "version": "18.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", + "maintainers": ["carlosdauden"], + "installable": True, + "depends": ["website_sale", "sale_fiscal_position_product_domain"], +} diff --git a/website_sale_fiscal_position_product_domain/controllers/__init__.py b/website_sale_fiscal_position_product_domain/controllers/__init__.py new file mode 100644 index 0000000000..3c76586e5c --- /dev/null +++ b/website_sale_fiscal_position_product_domain/controllers/__init__.py @@ -0,0 +1 @@ +from . import product_configurator diff --git a/website_sale_fiscal_position_product_domain/controllers/product_configurator.py b/website_sale_fiscal_position_product_domain/controllers/product_configurator.py new file mode 100644 index 0000000000..269d247bd1 --- /dev/null +++ b/website_sale_fiscal_position_product_domain/controllers/product_configurator.py @@ -0,0 +1,33 @@ +# Copyright 2026 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo.http import request + +from odoo.addons.website_sale.controllers.product_configurator import ( + WebsiteSaleProductConfiguratorController as WebsiteSaleProductConfiguratorBase, +) + + +class WebsiteSaleProductConfiguratorController(WebsiteSaleProductConfiguratorBase): + @staticmethod + def _apply_taxes_to_price(price, product_or_template, currency): + product_taxes = product_or_template.sudo().taxes_id._filter_taxes_by_company( + request.env.company + ) + if not product_taxes: + return price + if product_or_template._name == "product.product": + template = product_or_template.product_tmpl_id + else: + template = product_or_template + fiscal_position = request.website.fiscal_position_id.sudo().with_context( + fp_template=template + ) + taxes = fiscal_position.map_tax(product_taxes) + return request.env["product.template"]._apply_taxes_to_price( + price, + currency, + product_taxes, + taxes, + product_or_template, + website=request.website, + ) diff --git a/website_sale_fiscal_position_product_domain/i18n/es.po b/website_sale_fiscal_position_product_domain/i18n/es.po new file mode 100644 index 0000000000..eebe284c86 --- /dev/null +++ b/website_sale_fiscal_position_product_domain/i18n/es.po @@ -0,0 +1,22 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_fiscal_position_product_domain +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-06-03 11:39+0000\n" +"PO-Revision-Date: 2026-06-03 11:39+0000\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" + +#. module: website_sale_fiscal_position_product_domain +#: model:ir.model,name:website_sale_fiscal_position_product_domain.model_product_template +msgid "Product" +msgstr "Producto" diff --git a/website_sale_fiscal_position_product_domain/i18n/website_sale_fiscal_position_product_domain.pot b/website_sale_fiscal_position_product_domain/i18n/website_sale_fiscal_position_product_domain.pot new file mode 100644 index 0000000000..782df41e42 --- /dev/null +++ b/website_sale_fiscal_position_product_domain/i18n/website_sale_fiscal_position_product_domain.pot @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_sale_fiscal_position_product_domain +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-06-03 11:39+0000\n" +"PO-Revision-Date: 2026-06-03 11:39+0000\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_fiscal_position_product_domain +#: model:ir.model,name:website_sale_fiscal_position_product_domain.model_product_template +msgid "Product" +msgstr "" diff --git a/website_sale_fiscal_position_product_domain/models/__init__.py b/website_sale_fiscal_position_product_domain/models/__init__.py new file mode 100644 index 0000000000..e8fa8f6bf1 --- /dev/null +++ b/website_sale_fiscal_position_product_domain/models/__init__.py @@ -0,0 +1 @@ +from . import product_template diff --git a/website_sale_fiscal_position_product_domain/models/product_template.py b/website_sale_fiscal_position_product_domain/models/product_template.py new file mode 100644 index 0000000000..b70509e9dc --- /dev/null +++ b/website_sale_fiscal_position_product_domain/models/product_template.py @@ -0,0 +1,65 @@ +# Copyright 2026 Tecnativa - Carlos Dauden +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import api, models + +from odoo.addons.website.models import ir_http + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + def _get_sales_prices(self, website): + res = {} + for template in self: + website = website.with_context(fp_template=template) + res.update(super(ProductTemplate, template)._get_sales_prices(website)) + return res + + def _get_additionnal_combination_info( + self, product_or_template, quantity, date, website + ): + template = self.env["product.template"] + if product_or_template._name == "product.product": + template = product_or_template.product_tmpl_id + elif product_or_template._name == "product.template": + template = product_or_template + if template: + website = website.with_context(fp_template=template) + return super()._get_additionnal_combination_info( + product_or_template, quantity, date, website + ) + + @api.model + def _get_configurator_display_price( + self, product_or_template, quantity, date, currency, pricelist, **kwargs + ): + price, pricelist_rule_id = self._get_configurator_price( + product_or_template, quantity, date, currency, pricelist, **kwargs + ) + website = ir_http.get_request_website() + if not website: + return price, pricelist_rule_id + product_taxes = product_or_template.sudo().taxes_id._filter_taxes_by_company( + self.env.company + ) + if not product_taxes: + return price, pricelist_rule_id + if product_or_template._name == "product.product": + template = product_or_template.product_tmpl_id + else: + template = product_or_template + fiscal_position = website.fiscal_position_id.sudo().with_context( + fp_template=template + ) + taxes = fiscal_position.map_tax(product_taxes) + return ( + self._apply_taxes_to_price( + price, + currency, + product_taxes, + taxes, + product_or_template, + website=website, + ), + pricelist_rule_id, + ) diff --git a/website_sale_fiscal_position_product_domain/pyproject.toml b/website_sale_fiscal_position_product_domain/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/website_sale_fiscal_position_product_domain/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/website_sale_fiscal_position_product_domain/readme/CONTRIBUTORS.md b/website_sale_fiscal_position_product_domain/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..37d0fcf44b --- /dev/null +++ b/website_sale_fiscal_position_product_domain/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [Tecnativa](https://www.tecnativa.com): + - Carlos Dauden diff --git a/website_sale_fiscal_position_product_domain/readme/DESCRIPTION.md b/website_sale_fiscal_position_product_domain/readme/DESCRIPTION.md new file mode 100644 index 0000000000..71a2aa3450 --- /dev/null +++ b/website_sale_fiscal_position_product_domain/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +Applies fiscal position product-domain tax mappings in website sale prices and +product configurators. diff --git a/website_sale_fiscal_position_product_domain/static/description/index.html b/website_sale_fiscal_position_product_domain/static/description/index.html new file mode 100644 index 0000000000..ca33819dff --- /dev/null +++ b/website_sale_fiscal_position_product_domain/static/description/index.html @@ -0,0 +1,429 @@ + + + + + +Website Sale Fiscal Position Product Domain + + + +
+

Website Sale Fiscal Position Product Domain

+ + +

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

+

Applies fiscal position product-domain tax mappings in website sale +prices and product configurators.

+

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

+
    +
  • Tecnativa
  • +
+
+
+

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:

+

carlosdauden

+

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.

+
+
+
+ +