Skip to content

Conversation

SilvioC2C
Copy link

@SilvioC2C SilvioC2C commented Oct 17, 2025

No description provided.

@SilvioC2C SilvioC2C changed the title [FIX] delivery_carrier_pricelist: prevent AccessError [18.0][FIX] delivery_carrier_pricelist: prevent AccessError Oct 17, 2025
@SilvioC2C SilvioC2C force-pushed the FIX-delivery_carrier_pricelist branch 3 times, most recently from d70a47f to 6abc1de Compare October 18, 2025 09:02
@SilvioC2C SilvioC2C force-pushed the FIX-delivery_carrier_pricelist branch from 6abc1de to 0c7e835 Compare October 20, 2025 13:12
@SilvioC2C SilvioC2C requested a review from simahawk October 20, 2025 13:12
@SilvioC2C SilvioC2C force-pushed the FIX-delivery_carrier_pricelist branch from 0c7e835 to 9301fda Compare October 20, 2025 13:38

from odoo import api, fields, models

_logger = getLogger(__name__)
Copy link
Contributor

Choose a reason for hiding this comment

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

to be discarded

if self.invoice_policy != "pricelist" or self.delivery_type == "pricelist":
return super().rate_shipment(order)

# Use ``sudo()`` to prevent ``AccessError`` when updating the delivery type
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO we should finally propose a change to odoo core avoid this stuff.
I would propose the addition of _rate_shipment_get_handler instead of using getattr directly.
This way, in v19 or 20 we can get rid of this hack.
Also note that some specific carrier implementation rely on computed fields depending on delivery_type so we might trigger unnecessary changes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants