-
-
Notifications
You must be signed in to change notification settings - Fork 726
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
[16.0][MIG] stock_package_autoload: Migration to 16.0 #2218
base: 16.0
Are you sure you want to change the base?
Conversation
This module allows to automatically add the content of a package to the transfer lines
d1514e1
to
57d6aeb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review, LGTM, one possible suggestion
[ | ||
( | ||
"id", | ||
"in", | ||
self.env["stock.quant.package"] | ||
.search([("quant_ids.product_id", "=", self.product_id.id)]) | ||
.ids, | ||
) | ||
] | ||
if self.product_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question:Would it be possible to avoid the search (line 28) and return
[("quant_ids.product.id", "=", self.product_id.id ])
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated without search
57d6aeb
to
edb1d64
Compare
"category": "Warehouse Management", | ||
"depends": [ | ||
"stock", | ||
"web_domain_field", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: this module is deprecated, the same can be achieved in base Odoo by using a Binary field. See: https://github.com/OCA/web/blob/16.0/web_domain_field/README.rst
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry on missing to notice the deprecation. Thank you for noticing it.
edb1d64
to
15738ff
Compare
self.write({"package_domain": "[]"}) | ||
return | ||
for sm in self: | ||
sm.package_domain = sm._package_domain() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: please keep the json.dumps()
https://github.com/OCA/stock-logistics-warehouse/compare/edb1d646519c4e674a32693ca26c3dc85cf83d0f..15738ffc2951eba89528320cc84f8ff18a3e00c6#diff-166f2ecf2683b4ba59287e869e301a4d7bbb12e6a0ac826345a1addd6a11688bL38-L39
it's a best practice when passing data from the python backend to the JavaScript frontend to ensure that there are no issues with encoding, character escaping etc. (Most of the times it works fine even without it, but it's better to keep it, in case)
While trying to use json.dumps() on domain value, I was observing below frontend error where argument expects to be array: I thought due to json encoding the domain is converted to string and hence it is not required to use json.dumps() here. I also tried to check on other modules for similar implementation such as sale_purchase_force_vendor module under "purchase-workflow" which uses similar binary field and does not encode domain using json.(https://github.com/OCA/purchase-workflow/blob/16.0/sale_purchase_force_vendor/models/sale_order_line.py#L36 ) As you have mentioned, it is best pratice to encode while passing to frontend, I am not sure whether my understanding regarding above error is right. I am not able to figure out other way to overcome it. Please let me know your suggestions on it. |
@anusriNPS You're probably correct that with the Binary field, it's not necessary to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code and functional review, LGTM
Migrating stock_package_autoload to 16.0
This module is migrated in 16.0 as this module is introduced as part of this PR in 14.0 : #2027