Skip to content
Merged
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ addon | version | maintainers | summary
[deltatech_website_sale_status](deltatech_website_sale_status/) | 19.0.2.0.5 | <a href='https://github.com/dhongu'><img src='https://github.com/dhongu.png' width='32' height='32' style='border-radius:50%;' alt='dhongu'/></a> | Additional filters sales orders by status
[deltatech_website_short_description](deltatech_website_short_description/) | 19.0.1.0.3 | <a href='https://github.com/dhongu'><img src='https://github.com/dhongu.png' width='32' height='32' style='border-radius:50%;' alt='dhongu'/></a> | eCommerce short description
[deltatech_website_stock_availability](deltatech_website_stock_availability/) | 19.0.1.0.9 | <a href='https://github.com/dhongu'><img src='https://github.com/dhongu.png' width='32' height='32' style='border-radius:50%;' alt='dhongu'/></a> | eCommerce Stock Availability and lead time
[deltatech_website_vat_validation](deltatech_website_vat_validation/) | 19.0.0.0.1 | <a href='https://github.com/dhongu'><img src='https://github.com/dhongu.png' width='32' height='32' style='border-radius:50%;' alt='dhongu'/></a> | VAT Validation
[deltatech_website_vat_validation](deltatech_website_vat_validation/) | 19.0.0.0.2 | <a href='https://github.com/dhongu'><img src='https://github.com/dhongu.png' width='32' height='32' style='border-radius:50%;' alt='dhongu'/></a> | VAT Validation
[deltatech_website_warehouse_stock](deltatech_website_warehouse_stock/) | 19.0.0.0.1 | <a href='https://github.com/VoicuStefan2001'><img src='https://github.com/VoicuStefan2001.png' width='32' height='32' style='border-radius:50%;' alt='VoicuStefan2001'/></a> | eCommerce Warehouse Stock
[deltatech_widget_fontawesome](deltatech_widget_fontawesome/) | 19.0.1.0.0 | <a href='https://github.com/dhongu'><img src='https://github.com/dhongu.png' width='32' height='32' style='border-radius:50%;' alt='dhongu'/></a> | Font Awesome Widget
[deltatech_widget_many2one_badge](deltatech_widget_many2one_badge/) | 19.0.1.0.1 | | Many2one field widget displayed as colored badge, similar to many2many_tags
Expand Down
1 change: 1 addition & 0 deletions deltatech_website_vat_validation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
# See README.rst file on addons root folder for license details

from . import controllers
from . import models
2 changes: 1 addition & 1 deletion deltatech_website_vat_validation/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Website VAT Validation",
"summary": "VAT Validation",
"version": "19.0.0.0.1",
"version": "19.0.0.0.2",
"author": "Terrabit, Dorin Hongu",
"website": "https://www.terrabit.ro",
"license": "OPL-1",
Expand Down
1 change: 1 addition & 0 deletions deltatech_website_vat_validation/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import website
44 changes: 44 additions & 0 deletions deltatech_website_vat_validation/models/website.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# © 2008-2021 Deltatech
# Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details

from odoo import api, models


class Website(models.Model):
_inherit = "website"

@api.depends("company_id.account_fiscal_country_id")
def _compute_show_line_subtotals_tax_selection(self):
"""EXTENDS 'website_sale' - nu lasa recalculul sa stearga valoarea deja setata.

`show_line_subtotals_tax_selection` e un camp calculat si stocat, fara
override pentru Romania: la fiecare recalcul, `website_sale` il pune
neconditionat pe 'tax_excluded'. Recalculul se declanseaza la orice scriere
pe `company_id.account_fiscal_country_id`, care la randul lui depinde de
adresa partenerului companiei (`res.company._compute_address`) - de exemplu
cand un cron de sincronizare cu ANAF (vezi `l10n_ro_anaf_partner`) rescrie
adresa propriului partener al companiei.

Citim direct din DB (nu prin ORM): campul e in curs de calcul, asa ca o
citire ORM ar re-declansa acelasi compute in loc sa dea ultima valoare
salvata.
"""
real_ids = [record.id for record in self if isinstance(record.id, int)]
previous_values = {}
if real_ids:
# raw SQL nu vede scrierile ORM inca necomise in DB (write() le tine
# doar in cache-ul ORM pana la un flush) - fortam flush-ul intai.
self.env.flush_all()
self.env.cr.execute(
"SELECT id, show_line_subtotals_tax_selection FROM website WHERE id IN %s",
(tuple(real_ids),),
)
previous_values = dict(self.env.cr.fetchall())

super()._compute_show_line_subtotals_tax_selection()

for website in self:
previous_value = previous_values.get(website.id)
if previous_value:
website.show_line_subtotals_tax_selection = previous_value
4 changes: 4 additions & 0 deletions deltatech_website_vat_validation/readme/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 19.0.0.0.2 (2026-08-21)

- Add: `website.show_line_subtotals_tax_selection` ("Display Product Prices") is a computed+stored field with no Romanian override, so `website_sale` resets it to `tax_excluded` on every recompute of `company_id.account_fiscal_country_id` - triggered, for example, by any write on the company's own partner address (e.g. a nightly ANAF partner sync). The new `Website._compute_show_line_subtotals_tax_selection` override preserves the previously saved value instead of letting it reset silently, without forcing either option.

## 19.0.0.0.1 (2026-08-13)

- Fix: `_validate_address_values` still required `is_main_address`, a parameter Odoo 19 no longer passes - the 19.0 migration kept the 18.0 signature. Any address submitted from the website raised a `TypeError` (500) as soon as this module was installed. The parameter is dropped; anything else the caller adds still travels through `**_kwargs`.
1 change: 1 addition & 0 deletions deltatech_website_vat_validation/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
# See README.rst file on addons root folder for license details

from . import test_website_sale
from . import test_website_tax_display
28 changes: 28 additions & 0 deletions deltatech_website_vat_validation/tests/test_website_tax_display.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# © 2008-2021 Deltatech
# Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details

from odoo.tests import TransactionCase, tagged


@tagged("post_install", "-at_install")
class TestWebsiteTaxDisplaySticky(TransactionCase):
def test_company_address_write_does_not_reset_tax_display(self):
website = self.env["website"].search([], limit=1)
website.write({"show_line_subtotals_tax_selection": "tax_included"})
self.assertEqual(website.show_line_subtotals_tax_selection, "tax_included")

partner = website.company_id.partner_id
partner.write({"street": (partner.street or "") + " TEST"})
website.invalidate_recordset(["show_line_subtotals_tax_selection"])

self.assertEqual(
website.show_line_subtotals_tax_selection,
"tax_included",
"Scrierea adresei partenerului companiei nu trebuie sa reseteze "
"silentios setarea de afisare a preturilor pe website.",
)

def test_new_website_keeps_default(self):
website = self.env["website"].create({"name": "Test website sticky default"})
self.assertEqual(website.show_line_subtotals_tax_selection, "tax_excluded")
Loading