Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Manufacturing

Entity: mrp.bom.line

Compute Method: _compute_attachments_count

View 17.0 View 19.0
Inputs Method Outputs
  • product_id
  • product_id.id
  • product_id.product_tmpl_id
  • product_id.product_tmpl_id.id
  • product_tmpl_id
  • product_tmpl_id.id
for line in self:
-             nbr_attach = self.env['mrp.document'].search_count([
+             nbr_attach = self.env['product.document'].search_count([
+                 '&', '&', ('attached_on_mrp', '=', 'bom'), ('active', '=', 't'),
                '|',
                '&', ('res_model', '=', 'product.product'), ('res_id', '=', line.product_id.id),
-                 '&', ('res_model', '=', 'product.template'), ('res_id', '=', line.product_id.product_tmpl_id.id)])
+                 '&', ('res_model', '=', 'product.template'), ('res_id', '=', line.product_tmpl_id.id)])
            line.attachments_count = nbr_attach
  • attachments_count

Back to entity