You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
547 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017, Grap
  3. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  4. from openerp import api, models
  5. class ProductTemplate(models.Model):
  6. _inherit = 'product.template'
  7. @api.multi
  8. def onchange_uom(self, uom_id, uom_po_id):
  9. res = super(ProductTemplate, self).onchange_uom(uom_id, uom_po_id)
  10. if uom_id:
  11. if res.get('value', False):
  12. res['value']['to_weight'] =\
  13. self.env['product.uom'].browse(uom_id).to_weigh
  14. return res