fix: semgrep error

This commit is contained in:
Rohit Waghchaure 2021-06-01 11:24:01 +05:30
parent 7b7ceaadd9
commit 21b58ef045
3 changed files with 16 additions and 21 deletions

View File

@ -104,26 +104,26 @@ def get_columns():
"fieldname": "item_code", "fieldname": "item_code",
"fieldtype": "Link", "fieldtype": "Link",
"options": "Item", "options": "Item",
"width": 140 "width": 160
}, },
{ {
"label": _("Qty"), "label": _("Order Qty"),
"fieldname": "qty", "fieldname": "qty",
"fieldtype": "Float", "fieldtype": "Float",
"width": 70 "width": 90
}, },
{ {
"label": _("Received"), "label": _("Received Qty"),
"fieldname": "received_qty", "fieldname": "received_qty",
"fieldtype": "Float", "fieldtype": "Float",
"width": 80 "width": 110
}, },
{ {
"label": _("Supplied Item"), "label": _("Supplied Item"),
"fieldname": "rm_item_code", "fieldname": "rm_item_code",
"fieldtype": "Link", "fieldtype": "Link",
"options": "Item", "options": "Item",
"width": 140 "width": 160
}, },
{ {
"label": _("Required Qty"), "label": _("Required Qty"),
@ -138,21 +138,15 @@ def get_columns():
"width": 110 "width": 110
}, },
{ {
"label": _("Returned Qty"), "label": _("Consumed Qty"),
"fieldname": "returned_qty", "fieldname": "consumed_qty",
"fieldtype": "Float",
"width": 110
},
{
"label": _("Total Supplied"),
"fieldname": "total_supplied_qty",
"fieldtype": "Float", "fieldtype": "Float",
"width": 120 "width": 120
}, },
{ {
"label": _("Consumed Qty"), "label": _("Returned Qty"),
"fieldname": "consumed_qty", "fieldname": "returned_qty",
"fieldtype": "Float", "fieldtype": "Float",
"width": 110 "width": 110
}, }
] ]

View File

@ -101,9 +101,9 @@ class Subcontracting(object):
self.set_alternative_item_details(row) self.set_alternative_item_details(row)
for doctype in ['Purchase Receipt', 'Purchase Invoice']: 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.''' '''Deduct the consumed materials from the available materials.'''
pr_items = self.get_received_items(doctype) pr_items = self.get_received_items(doctype)
@ -311,7 +311,7 @@ class Subcontracting(object):
return return
self.get_purchase_orders() 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) itemwise_consumed_qty = defaultdict(float)
for row in consumed_items: for row in consumed_items:

View File

@ -1291,7 +1291,8 @@ class StockEntry(StockController):
item_dict[item]["qty"] = 0 item_dict[item]["qty"] = 0
# delete items with 0 qty # 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"]: if not item_dict[item]["qty"]:
del item_dict[item] del item_dict[item]