[13.0][IMP] mrp_multi_level: index llc

This commit is contained in:
Núria Martín Xifré
2020-08-10 13:40:53 +02:00
committed by davidborromeo
parent af3ce97a59
commit bc37971d76
2 changed files with 2 additions and 3 deletions

View File

@@ -10,7 +10,7 @@ from odoo import fields, models
class Product(models.Model):
_inherit = "product.product"
llc = fields.Integer(string="Low Level Code", default=0)
llc = fields.Integer(string="Low Level Code", default=0, index=True)
manufacturing_order_ids = fields.One2many(
comodel_name="mrp.production",
inverse_name="product_id",

View File

@@ -297,8 +297,7 @@ class MultiLevelMrp(models.TransientModel):
)
products = bom_lines.mapped("product_id")
products.write({"llc": llc})
products = self.env["product.product"].search([("llc", "=", llc)])
counter = len(products)
counter = self.env["product.product"].search_count([("llc", "=", llc)])
log_msg = "Low level code {} finished - Nbr. products: {}".format(
llc, counter
)