Skip to content

[19.0][ADD] website_sale_tax_selection: website sale tax display partner preference#1258

Open
yankinmax wants to merge 1 commit into
OCA:19.0from
camptocamp:add-website_sale_tax_selection
Open

[19.0][ADD] website_sale_tax_selection: website sale tax display partner preference#1258
yankinmax wants to merge 1 commit into
OCA:19.0from
camptocamp:add-website_sale_tax_selection

Conversation

@yankinmax

Copy link
Copy Markdown
Contributor

Allow partners to specify how prices are displayed on the e-commerce website: tax excluded, tax included, or standard website behavior when no preference is set.
The website tax display field is made non-stored so it can be computed dynamically from the current website user’s partner, with contact preferences taking precedence over commercial entity preferences.

@OCA-git-bot OCA-git-bot added series:19.0 mod:website_sale_tax_selection Module website_sale_tax_selection labels Jun 30, 2026

@ivantodorovich ivantodorovich left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment thread website_sale_tax_selection/models/website.py Outdated
Comment thread website_sale_tax_selection/models/website.py Outdated
Comment thread website_sale_tax_selection/__init__.py Outdated
Comment thread website_sale_tax_selection/tests/__init__.py Outdated
Comment thread website_sale_tax_selection/models/website.py
@yankinmax yankinmax force-pushed the add-website_sale_tax_selection branch from 5fd0e89 to bbbd2e0 Compare July 3, 2026 06:31

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This description needs to be updated. Stating it will visually disable the website_tax_inclusion_setting is IMHO crucial

Comment on lines +17 to +27
@api.depends("company_id.account_fiscal_country_id")
@api.depends_context("uid")
def _compute_show_line_subtotals_tax_selection(self):
# OVERRIDE: apply the current website partner tax display preference,
# when set, on top of the standard website behavior.
partner = self._get_current_website_tax_selection_partner()
if partner_tax_selection := partner.website_show_line_subtotals_tax_selection:
for website in self:
website.show_line_subtotals_tax_selection = partner_tax_selection
else:
return super()._compute_show_line_subtotals_tax_selection()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will never trigger if partner.website_show_line_subtotals_tax_selection gets updated during the session 🤔

I would add something like this write override in res.partner:

def write(self, vals):
    result = super().write(vals)
    if "website_show_line_subtotals_tax_selection" in vals:
        # The website's non-stored compute reads this field through the
        # current request/env user's partner, a path `@api.depends` can't
        # express, so its cache is never auto-invalidated on this write.
        self.env["website"].invalidate_model(
            ["show_line_subtotals_tax_selection"]
        )
    return result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:website_sale_tax_selection Module website_sale_tax_selection series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants