[FIX]mrp_multi_level: avoid mixing str with boolean

This commit is contained in:
LaiaTForgeFlow
2022-06-15 12:40:54 +02:00
committed by Miquel Raïch
parent c08e2d36c9
commit da4dbe99a3
2 changed files with 8 additions and 8 deletions

View File

@@ -83,8 +83,8 @@ class MrpInventoryProcure(models.TransientModel):
item.qty, item.qty,
item.uom_id, item.uom_id,
item.location_id, item.location_id,
"MRP: " + item.planned_order_id.name or str(self.env.user.login), "MRP: " + (item.planned_order_id.name or self.env.user.login),
"MRP: " + item.planned_order_id.origin or str(self.env.user.login), "MRP: " + (item.planned_order_id.origin or self.env.user.login),
item.mrp_inventory_id.company_id, item.mrp_inventory_id.company_id,
values, values,
) )

View File

@@ -95,7 +95,7 @@ class MultiLevelMrp(models.TransientModel):
"mrp_date": mrp_date, "mrp_date": mrp_date,
"current_date": move.date, "current_date": move.date,
"mrp_type": mrp_type, "mrp_type": mrp_type,
"mrp_origin": origin, "mrp_origin": origin or "",
"mrp_order_number": order_number, "mrp_order_number": order_number,
"parent_product_id": parent_product_id, "parent_product_id": parent_product_id,
"name": order_number, "name": order_number,
@@ -513,7 +513,7 @@ class MultiLevelMrp(models.TransientModel):
product_name=product_mrp_area.product_id.display_name, product_name=product_mrp_area.product_id.display_name,
delta_days=grouping_delta, delta_days=grouping_delta,
) )
origin = ",".join(list(set(demand_origin))) origin = ",".join(list({x for x in demand_origin if x}))
qtytoorder = product_mrp_area.mrp_minimum_stock - onhand - last_qty qtytoorder = product_mrp_area.mrp_minimum_stock - onhand - last_qty
cm = self.create_action( cm = self.create_action(
product_mrp_area_id=product_mrp_area, product_mrp_area_id=product_mrp_area,
@@ -541,7 +541,7 @@ class MultiLevelMrp(models.TransientModel):
else: else:
last_date = fields.Date.from_string(move.mrp_date) last_date = fields.Date.from_string(move.mrp_date)
onhand += move.mrp_qty onhand += move.mrp_qty
demand_origin.append(move.origin or move.name) demand_origin.append(move.origin or move.name or "")
if last_date and last_qty != 0.00: if last_date and last_qty != 0.00:
name = _( name = _(
@@ -550,7 +550,7 @@ class MultiLevelMrp(models.TransientModel):
product_name=product_mrp_area.product_id.display_name, product_name=product_mrp_area.product_id.display_name,
delta_days=grouping_delta, delta_days=grouping_delta,
) )
origin = ",".join(list(set(demand_origin))) origin = ",".join(list({x for x in demand_origin if x}))
qtytoorder = product_mrp_area.mrp_minimum_stock - onhand - last_qty qtytoorder = product_mrp_area.mrp_minimum_stock - onhand - last_qty
cm = self.create_action( cm = self.create_action(
product_mrp_area_id=product_mrp_area, product_mrp_area_id=product_mrp_area,
@@ -601,8 +601,8 @@ class MultiLevelMrp(models.TransientModel):
product_mrp_area_id=product_mrp_area, product_mrp_area_id=product_mrp_area,
mrp_date=move.mrp_date, mrp_date=move.mrp_date,
mrp_qty=qtytoorder, mrp_qty=qtytoorder,
name=move.name, name=move.name or "",
values=dict(origin=move.origin), values=dict(origin=move.origin or ""),
) )
qty_ordered = cm["qty_ordered"] qty_ordered = cm["qty_ordered"]
onhand += move.mrp_qty + qty_ordered onhand += move.mrp_qty + qty_ordered