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.

17 lines
519 B

  1. # Copyright 2017, Grap
  2. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
  3. from odoo import fields, models, api
  4. class UomCategory(models.Model):
  5. _inherit = 'uom.category'
  6. to_weigh = fields.Boolean('To weigh', default=False)
  7. @api.multi
  8. def action_recompute_to_weigh(self):
  9. for categ in self:
  10. domain = [('uom_id.category_id', '=', categ.id)]
  11. products = self.env['product.template'].search(domain)
  12. products.write({'to_weight': categ.to_weigh})