Skip to content

[18.0][MIG] product_packaging_level: Migration to 18.0#2

Closed
trisdoan wants to merge 34 commits into18.0from
18.0-mig-product_packaging_level
Closed

[18.0][MIG] product_packaging_level: Migration to 18.0#2
trisdoan wants to merge 34 commits into18.0from
18.0-mig-product_packaging_level

Conversation

@trisdoan
Copy link
Copy Markdown
Owner

@trisdoan trisdoan commented Nov 29, 2024

Changes in 18.0

  1. get became private since here
  2. _lang_get_xxx were merged into one api _get_data which is simpler and easy to extend since here
  3. Odoo 17.0+: product_id is required on model product_packaging since here
    As consequences,
    • no need default value in _compute_qty_per_level
    • Some little changes on test setup
      • test packagings are assigned with a same product

Copy link
Copy Markdown

@nguyenminhchien nguyenminhchien left a comment

Choose a reason for hiding this comment

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

You should start from this PR: OCA#1662

<field name="package_type_id" position="after">
<field name="qty_per_level" />
<field name="packaging_level_id" />
<field name="barcode_required_for_gtin" invisible="1" />
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
<field name="barcode_required_for_gtin" invisible="1" />
<field name="barcode_required_for_gtin" column_invisible="1" />

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Hi anh, I decided to remove it as:

Missing fields used in domains and other attributes are added to the view as invisible automatically

<attribute name="required">barcode_required_for_gtin</attribute>
</xpath>
<field name="name" position="attributes">
<attribute name="invisible">1</attribute>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
<attribute name="invisible">1</attribute>
<attribute name="column_invisible">1</attribute>

]
if len(set(packaging_level_ids)) != len(packaging_level_ids):
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.

Suggested change
_(
self.env._(

activated_packages = self.env.user.has_group("stock.group_tracking_lot")
if packaging.name_policy == "by_package_type" and not activated_packages:
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.

Suggested change
_(
self.env._(

msg = False
default_count = self.search_count([("is_default", "=", True)])
if default_count == 0:
msg = _('There must be one product packaging level set as "Is Default".')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
msg = _('There must be one product packaging level set as "Is Default".')
msg = self.env._('There must be one product packaging level set as "Is Default".')

if default_count == 0:
msg = _('There must be one product packaging level set as "Is Default".')
elif default_count > 1:
msg = _('Only one product packaging level can be set as "Is Default".')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
msg = _('Only one product packaging level can be set as "Is Default".')
msg = self.env._('Only one product packaging level can be set as "Is Default".')

@nguyenminhchien
Copy link
Copy Markdown

You should start from this PR: OCA#1662

You could also review this PR

@nguyenminhchien
Copy link
Copy Markdown

nguyenminhchien commented Dec 3, 2024

This commit 18b6d8a breaks the user-define rule for naming of Packaging: User cannot input name
image

rousseldenis and others added 26 commits December 5, 2024 14:25
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-attribute-16.0/product-attribute-16.0-product_packaging_level
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_packaging_level/
Currently translated at 100.0% (25 of 25 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_packaging_level
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_packaging_level/es/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-attribute-16.0/product-attribute-16.0-product_packaging_level
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_packaging_level/
Currently translated at 100.0% (32 of 32 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_packaging_level
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_packaging_level/es/
Currently translated at 71.8% (23 of 32 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_packaging_level
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_packaging_level/it/
Currently translated at 100.0% (32 of 32 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_packaging_level
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_packaging_level/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-attribute-16.0/product-attribute-16.0-product_packaging_level
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_packaging_level/
Currently translated at 100.0% (32 of 32 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_packaging_level
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_packaging_level/es/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: product-attribute-16.0/product-attribute-16.0-product_packaging_level
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_packaging_level/
Ivorra78 and others added 6 commits December 5, 2024 14:25
Currently translated at 100.0% (34 of 34 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_packaging_level
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_packaging_level/es/
Currently translated at 100.0% (34 of 34 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_packaging_level
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_packaging_level/it/
Currently translated at 100.0% (34 of 34 strings)

Translation: product-attribute-16.0/product-attribute-16.0-product_packaging_level
Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_packaging_level/it/
@trisdoan trisdoan force-pushed the 18.0-mig-product_packaging_level branch 3 times, most recently from 414c3d7 to 60da648 Compare December 5, 2024 08:11
@trisdoan trisdoan force-pushed the 18.0-mig-product_packaging_level branch from 60da648 to 6ec3f39 Compare December 5, 2024 08:12
@trisdoan
Copy link
Copy Markdown
Owner Author

trisdoan commented Dec 5, 2024

This commit 18b6d8a breaks the user-define rule for naming of Packaging: User cannot input name image

Hi anh, indeed, it blocks user to input name even with user_define policy
I created an extra commit (easily to pick to former versions), dont you agree?

@trisdoan trisdoan closed this Dec 9, 2024
def _default_language(self):
lang_code = self.env["ir.default"]._get("res.partner", "lang")
def_lang_id = self.env["res.lang"]._get_data(code=lang_code).id
return def_lang_id or self._active_languages()[0]
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

_active_languages ​​does not exist in product.packaging.level.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

thanks, it's fixed

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.

10 participants