-
-
Notifications
You must be signed in to change notification settings - Fork 711
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
[17.0][ADD] product_total_weight: New module product_weight #1799
base: 17.0
Are you sure you want to change the base?
Conversation
36069fc
to
901ce47
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.
Hi. Thanks for sharing your module.
Change Proposal : I think the name should be better "product_total_weight".
Request Changes :
- you should handle conversion in all computation. for the time being, if you have a quant with 1 gram and a quant with 1 kilo, the total displayed is 2 kilo. That is wrong.
- you should not hardcode "kg" in the name, as it is possible to use odoo with other anglo saxon unit system. (See odoo core option).
product_weight/models/product.py
Outdated
_inherit = "product.product" | ||
|
||
total_weight = fields.Float( | ||
"Total Weight(kg)", compute="_compute_total_weight", store=True |
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.
this field can not be stored, as it depends on a non stored field. (qty_available) (same for field on product.template).
product_weight/models/product.py
Outdated
"Total Weight(kg)", compute="_compute_total_weight", store=True | ||
) | ||
|
||
@api.depends("qty_available") |
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.
this should depends on weight also.
position="inside" | ||
> | ||
<br /> | ||
Total Weight: <field name="total_weight" /> kg |
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.
hardcoded kg can be replaced by the core configuration.
901ce47
to
4461864
Compare
Thanks for the anottations, i refactor the code but i can't undestand what do you want to do when i want to show the uom units in the tree views. |
4461864
to
6ca6d00
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.
LGTM
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.
LGTM, tested in runboat
I think you should not display it. If you really want, you can simply add a new column, with this field "weight_uom_name". |
Not necessary in my opinion. Can you review again please @legalsylvain. Thanks! |
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.
two minors comments. otherwise LGTM.
Note : I just saw that the module was using product_weight from product_logistics_uom. i don't use this module, so I'm not totally sure how to handle this new weight_uom_id.
I let other people reviewing this part.
thanks for the changes.
6ca6d00
to
f6fe595
Compare
Yes, the module depends of product_logistics_uom because you have option to choose the uom_id of the product on logistics section. |
f6fe595
to
1b10676
Compare
This module adds a field in different views associated to product to see how many kilograms are depending of the weight field thats appears on inventory tab of product form.
cc https://github.com/APSL 164365
@miquelalzanillas @lbarry-apsl @javierobcn @mpascuall @BernatObrador @ppyczko please review