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.

15 lines
498 B

  1. # Copyright (C) 2017 - Today: GRAP (http://www.grap.coop)
  2. # @author: Quentin DUPONT <quentin.dupont@grap.coop>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo import api, models
  5. class ProductTemplate(models.Model):
  6. _inherit = 'product.template'
  7. @api.onchange('uom_id')
  8. def _onchange_uom_id(self):
  9. res = super(ProductTemplate, self)._onchange_uom_id()
  10. if self.uom_id:
  11. self.to_weight = self.uom_id.to_weigh
  12. return res