Skip to content

[18.0][MIG] product_packaging_level_salable: Migration to 18.0#6

Closed
trisdoan wants to merge 12 commits into18.0from
18.0-mig-product_packaging_level_salable
Closed

[18.0][MIG] product_packaging_level_salable: Migration to 18.0#6
trisdoan wants to merge 12 commits into18.0from
18.0-mig-product_packaging_level_salable

Conversation

@trisdoan
Copy link
Copy Markdown
Owner

@trisdoan trisdoan commented Dec 4, 2024

Note

for line in self:
if line._can_be_sold_error_condition():
raise ValidationError(
_(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You can replace the call to translate a string (_) with self.env._ for getting some performance improvement in some cases. See odoo/odoo#174844.

if self._can_be_sold_error_condition():
return {
"warning": {
"title": _("Warning"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

same above

@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

FYI, to avoid the tracking_disable context, you can use BaseCommon class
from odoo.addons.base.tests.common import BaseCommon

@trisdoan trisdoan force-pushed the 18.0-mig-product_packaging_level_salable branch from f8d08b1 to 0a80b01 Compare December 9, 2024 07:39
Copy link
Copy Markdown

@xaviedoanhduy xaviedoanhduy left a comment

Choose a reason for hiding this comment

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

LGTM

@trisdoan trisdoan closed this Dec 10, 2024
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.

5 participants