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.

16 lines
511 B

  1. # Copyright (C) 2018 - Today: GRAP (http://www.grap.coop)
  2. # @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo import api, models
  5. class ProductProduct(models.Model):
  6. _inherit = 'product.product'
  7. @api.onchange('uom_id', 'uom_po_id')
  8. def _onchange_uom(self):
  9. res = super(ProductProduct, self)._onchange_uom()
  10. if self.uom_id:
  11. self.to_weight = self.uom_id.to_weigh
  12. return res