Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instead of checking identical packaging code, odoo checks packaging #24301

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/delivery/models/stock_picking.py
Expand Up @@ -200,7 +200,7 @@ def check_packages_are_identical(self):
self.ensure_one()
if self.package_ids:
packages = [p.packaging_id for p in self.package_ids]
if len(set(packages)) != 1:
if len(set([package.shipper_package_code for package in packages])) != 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

can be also expressed packages.mapped('shipper_package_code')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"packages.mapped('shipper_package_code')"
Here packages is a 'list' object.We can't use 'mapped'.

package_names = ', '.join([str(p.name) for p in packages])
raise UserError(_('You are shipping different packaging types in the same shipment.\nPackaging Types: %s' % package_names))
return True
Expand Down