Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
87 changes: 87 additions & 0 deletions website_sale_fiscal_position_product_domain/README.rst
Original file line number Diff line number Diff line change
@@ -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 <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_fiscal_position_product_domain%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>`__:

- 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 <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-carlosdauden|

This module is part of the `OCA/e-commerce <https://github.com/OCA/e-commerce/tree/18.0/website_sale_fiscal_position_product_domain>`_ 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_sale_fiscal_position_product_domain/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import controllers
from . import models
15 changes: 15 additions & 0 deletions website_sale_fiscal_position_product_domain/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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"],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_configurator
Original file line number Diff line number Diff line change
@@ -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,
)
22 changes: 22 additions & 0 deletions website_sale_fiscal_position_product_domain/i18n/es.po
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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 ""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_template
Original file line number Diff line number Diff line change
@@ -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,
)
3 changes: 3 additions & 0 deletions website_sale_fiscal_position_product_domain/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [Tecnativa](https://www.tecnativa.com):
- Carlos Dauden
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Applies fiscal position product-domain tax mappings in website sale prices and
product configurators.
Loading
Loading