Commit e8e533d9 by 夏超

[fix] 领料单数据

parent df4b246c
...@@ -160,6 +160,7 @@ class InheritProductionTask(models.Model): ...@@ -160,6 +160,7 @@ class InheritProductionTask(models.Model):
and JSBOM_ZXLS =JSWLZD_LSBH and JSBOM_ZXLS =JSWLZD_LSBH
""") """)
rows = cur.fetchall() rows = cur.fetchall()
rowdesc = cur.description
except Exception as e: except Exception as e:
raise ValidationError("数据库查询失败") raise ValidationError("数据库查询失败")
finally: finally:
...@@ -167,7 +168,11 @@ class InheritProductionTask(models.Model): ...@@ -167,7 +168,11 @@ class InheritProductionTask(models.Model):
conn.close() conn.close()
bom_res = [] bom_res = []
_logger.info(f"数据: {rows}") _logger.info(f"数据: {rows}")
for v in rows: rows_data = [
dict(zip([col[0] for col in rowdesc], row))
for row in rows
]
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({
"material_id": product.id, "material_id": product.id,
......
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