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

[FIX] make the module working for product variants #255

Merged
merged 3 commits into from
May 15, 2018

Conversation

legalsylvain
Copy link
Contributor

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).

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 {}
Copy link
Member

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):
Copy link
Member

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'] = ...

@legalsylvain
Copy link
Contributor Author

@pedrobaeza. Thanks for your suggestion. modifications done.
regards.

if res.get('value', False):
res['value']['to_weight'] =\
self.env['product.uom'].browse(uom_id).to_weigh
res = res and res or {}
Copy link
Member

Choose a reason for hiding this comment

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

The same applies here

@rafaelbn rafaelbn added this to the 8.0 milestone Apr 26, 2018
Copy link
Member

@rafaelbn rafaelbn left a comment

Choose a reason for hiding this comment

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

👍

Copy link
Member

@pedrobaeza pedrobaeza left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants