From 21b58ef045cc60f3ad8d321308d7095ab8b4d7b4 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Tue, 1 Jun 2021 11:24:01 +0530 Subject: [PATCH] fix: semgrep error --- .../subcontract_order_summary.py | 28 ++++++++----------- erpnext/controllers/subcontracting.py | 6 ++-- .../stock/doctype/stock_entry/stock_entry.py | 3 +- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/erpnext/buying/report/subcontract_order_summary/subcontract_order_summary.py b/erpnext/buying/report/subcontract_order_summary/subcontract_order_summary.py index 8b08d2a284..0b14e119ab 100644 --- a/erpnext/buying/report/subcontract_order_summary/subcontract_order_summary.py +++ b/erpnext/buying/report/subcontract_order_summary/subcontract_order_summary.py @@ -104,26 +104,26 @@ def get_columns(): "fieldname": "item_code", "fieldtype": "Link", "options": "Item", - "width": 140 + "width": 160 }, { - "label": _("Qty"), + "label": _("Order Qty"), "fieldname": "qty", "fieldtype": "Float", - "width": 70 + "width": 90 }, { - "label": _("Received"), + "label": _("Received Qty"), "fieldname": "received_qty", "fieldtype": "Float", - "width": 80 + "width": 110 }, { "label": _("Supplied Item"), "fieldname": "rm_item_code", "fieldtype": "Link", "options": "Item", - "width": 140 + "width": 160 }, { "label": _("Required Qty"), @@ -138,21 +138,15 @@ def get_columns(): "width": 110 }, { - "label": _("Returned Qty"), - "fieldname": "returned_qty", - "fieldtype": "Float", - "width": 110 - }, - { - "label": _("Total Supplied"), - "fieldname": "total_supplied_qty", + "label": _("Consumed Qty"), + "fieldname": "consumed_qty", "fieldtype": "Float", "width": 120 }, { - "label": _("Consumed Qty"), - "fieldname": "consumed_qty", + "label": _("Returned Qty"), + "fieldname": "returned_qty", "fieldtype": "Float", "width": 110 - }, + } ] \ No newline at end of file diff --git a/erpnext/controllers/subcontracting.py b/erpnext/controllers/subcontracting.py index fe775766da..a9a38bd02d 100644 --- a/erpnext/controllers/subcontracting.py +++ b/erpnext/controllers/subcontracting.py @@ -101,9 +101,9 @@ class Subcontracting(object): self.set_alternative_item_details(row) for doctype in ['Purchase Receipt', 'Purchase Invoice']: - self.remove_consumed_materials(doctype) + self.update_consumed_materials(doctype) - def remove_consumed_materials(self, doctype, return_consumed_items=False): + def update_consumed_materials(self, doctype, return_consumed_items=False): '''Deduct the consumed materials from the available materials.''' pr_items = self.get_received_items(doctype) @@ -311,7 +311,7 @@ class Subcontracting(object): return self.get_purchase_orders() - consumed_items, pr_items = self.remove_consumed_materials(self.doctype, return_consumed_items=True) + consumed_items, pr_items = self.update_consumed_materials(self.doctype, return_consumed_items=True) itemwise_consumed_qty = defaultdict(float) for row in consumed_items: diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 213280870a..0009926f5d 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -1291,7 +1291,8 @@ class StockEntry(StockController): item_dict[item]["qty"] = 0 # delete items with 0 qty - for item in item_dict.keys(): + list_of_items = item_dict.keys() + for item in list_of_items: if not item_dict[item]["qty"]: del item_dict[item]