Commit 336c14d5 by 夏超

[fix] 领料单数据

parent dc797414
...@@ -167,19 +167,18 @@ class InheritProductionTask(models.Model): ...@@ -167,19 +167,18 @@ class InheritProductionTask(models.Model):
cur.close() cur.close()
conn.close() conn.close()
bom_res = [] bom_res = []
_logger.info(f"数据: {rows}")
_logger.info(f"数据: {rowdesc}")
rows_data = [ rows_data = [
dict(zip([col[0] for col in rowdesc], row)) dict(zip([col[0] for col in rowdesc], row))
for row in rows for row in rows
] ]
for v in rows_data: for v in rows_data:
product = self.env["roke.product"].sudo().search([("code", "=", v.get("wlbh", ""))], limit=1) product = self.env["roke.product"].sudo().search([("code", "=", v.get("wlbh", ""))], limit=1)
bom_res.append({ bom_res.append((0, 0, {
"material_id": product.id, "material_id": product.id,
"demand_qty": self.plan_qty * v.get("compare", 1), "demand_qty": self.plan_qty * v.get("compare", 1),
"qty": self.plan_qty * v.get("compare", 1) "qty": self.plan_qty * v.get("compare", 1)
}) }))
_logger.info(f"数据: {product.id}")
res = self.env["roke.bom.create.picking.wizard"].create({ res = self.env["roke.bom.create.picking.wizard"].create({
"line_ids": bom_res "line_ids": bom_res
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment