|
|
@ -1,7 +1,7 @@ |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
# Copyright 2017, Grap |
|
|
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
# coding: utf-8 |
|
|
|
# Copyright (C) 2017 - Today: GRAP (http://www.grap.coop) |
|
|
|
# @author: Quentin DUPONT <quentin.dupont@grap.coop> |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
from openerp import api, models |
|
|
|
|
|
|
|
|
|
|
@ -12,7 +12,9 @@ class ProductTemplate(models.Model): |
|
|
|
def onchange_uom(self, uom_id, uom_po_id): |
|
|
|
res = super(ProductTemplate, self).onchange_uom(uom_id, uom_po_id) |
|
|
|
if uom_id: |
|
|
|
if res.get('value', False): |
|
|
|
res['value']['to_weight'] =\ |
|
|
|
self.env['product.uom'].browse(uom_id).to_weigh |
|
|
|
res = res and res or {} |
|
|
|
if not res.get('value', False): |
|
|
|
res['value'] = {} |
|
|
|
res['value']['to_weight'] =\ |
|
|
|
self.env['product.uom'].browse(uom_id).to_weigh |
|
|
|
return res |