-
-
Notifications
You must be signed in to change notification settings - Fork 600
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
[FIX] make the module working for product variants #255
Conversation
def onchange_uom(self, uom_id, uom_po_id): | ||
res = super(ProductProduct, self).onchange_uom(uom_id, uom_po_id) | ||
if uom_id: | ||
res = res and res or {} |
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.
It's enough with res = res or {}
res = super(ProductProduct, self).onchange_uom(uom_id, uom_po_id) | ||
if uom_id: | ||
res = res and res or {} | ||
if not res.get('value', False): |
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.
You can use val = res.setdefault('value', {})
and then val['to_weight'] = ...
@pedrobaeza. Thanks for your suggestion. modifications done. |
if res.get('value', False): | ||
res['value']['to_weight'] =\ | ||
self.env['product.uom'].browse(uom_id).to_weigh | ||
res = res and res or {} |
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.
The same applies here
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.
👍
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.
Let's not block more.
due to bad design in odoo 8.0 (not refactored in new API in 8.0), the onchange function should be defined in both models (product.product and product.template).