From 2ff5919a11d0c97ff663fa2e1390fca887a4615f Mon Sep 17 00:00:00 2001 From: zhaosj <290758660@qq.com> Date: Tue, 9 Jan 2024 09:59:00 +0000 Subject: [PATCH] update zelin_wms/storage_bin_management/doctype/warehouse_task/warehouse_task.py. Signed-off-by: zhaosj <290758660@qq.com> --- .../doctype/warehouse_task/warehouse_task.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zelin_wms/storage_bin_management/doctype/warehouse_task/warehouse_task.py b/zelin_wms/storage_bin_management/doctype/warehouse_task/warehouse_task.py index 6bd354e..2cd46d4 100644 --- a/zelin_wms/storage_bin_management/doctype/warehouse_task/warehouse_task.py +++ b/zelin_wms/storage_bin_management/doctype/warehouse_task/warehouse_task.py @@ -41,7 +41,7 @@ class WarehouseTask(Document): warehouse_field = 't_warehouse' if self.warehouse_task_type == 'Put Away' else 's_warehouse' child_doctype = f'{self.voucher_type} Detail' source = frappe.qb.DocType(child_doctype) - item = frappe.qb.DocType('Item') + item = frappe.qb.DocType('Item Default') warehouse = frappe.qb.DocType('Warehouse') source_doc_qty_list = frappe.qb.from_(source ).join(item @@ -192,12 +192,12 @@ class WarehouseTask(Document): ]) frappe.db.bulk_insert('Storage Bin Qty', fields, insert_list) for row in update_list: - if row.qty: - frappe.db.set_value('Storage Bin Qty', row.name, 'actual_qty', row.qty) + if row.get("qty", 0): + frappe.db.set_value('Storage Bin Qty', row.name, 'actual_qty', row.get("qty", 0)) if self.warehouse_task_type == 'Pick Up': # 删除下架后数量为0的行 - rows_to_delete = [row.name for row in update_list if not row.qty] + rows_to_delete = [row.name for row in update_list if not row.get("qty", 0)] if rows_to_delete: frappe.db.delete("Storage Bin Qty", {'name': ("in", rows_to_delete)}) -- Gitee