[FIX] website_sale_aplicoop: fix account.tax access error and duplicate home-delivery handler

Add sudo() to pricelist_item and fiscal position fallback in _get_pricing_info
so portal users can price the delivery product without triggering an AccessError
on account.tax. Remove the redundant #home-delivery-btn click handler from
website_sale.js — home_delivery.js already owns that button via
bindShopHomeDeliveryButton(), which manages the active class and localStorage cart.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
GitHub Copilot 2026-05-20 18:20:02 +02:00
parent 27097004fb
commit f983d71ea3
2 changed files with 2 additions and 24 deletions

View file

@ -140,7 +140,7 @@ def _get_pricing_info(
product=product, quantity=quantity, target_currency=currency
)
price_before_discount = price
pricelist_item = env["product.pricelist.item"].browse(rule_id)
pricelist_item = env["product.pricelist.item"].sudo().browse(rule_id)
if pricelist_item and pricelist_item._show_discount_on_shop():
price_before_discount = pricelist_item._compute_price_before_discount(
product=product,
@ -155,7 +155,7 @@ def _get_pricing_info(
fiscal_position = (
website.fiscal_position_id.sudo()
if website and getattr(website, "fiscal_position_id", False)
else env["account.fiscal.position"]
else env["account.fiscal.position"].sudo()
)
product_taxes = product.sudo().taxes_id._filter_taxes_by_company(company)
taxes = fiscal_position.map_tax(product_taxes) if product_taxes else product_taxes