refactor: itemgetter instead of assigned lambda

This commit is contained in:
Ankush Menat 2021-09-01 14:53:21 +05:30
parent 010060d92e
commit 9fec0a5c68
No known key found for this signature in database
GPG Key ID: 8EA82E09BBD13AAF
2 changed files with 4 additions and 2 deletions

View File

@ -4,6 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
from operator import itemgetter
from frappe.utils import date_diff, flt, cint from frappe.utils import date_diff, flt, cint
from six import iteritems from six import iteritems
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
@ -12,7 +13,7 @@ def execute(filters=None):
columns = get_columns(filters) columns = get_columns(filters)
item_details = get_fifo_queue(filters) item_details = get_fifo_queue(filters)
to_date = filters["to_date"] to_date = filters["to_date"]
_func = lambda x: x[1] _func = itemgetter(1)
data = [] data = []
for item, item_dict in iteritems(item_details): for item, item_dict in iteritems(item_details):

View File

@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals from __future__ import unicode_literals
from operator import itemgetter
import frappe, erpnext import frappe, erpnext
from frappe import _ from frappe import _
from frappe.utils import flt, cint, getdate, now, date_diff from frappe.utils import flt, cint, getdate, now, date_diff
@ -44,7 +45,7 @@ def execute(filters=None):
data = [] data = []
conversion_factors = {} conversion_factors = {}
_func = lambda x: x[1] _func = itemgetter(1)
for (company, item, warehouse) in sorted(iwb_map): for (company, item, warehouse) in sorted(iwb_map):
if item_map.get(item): if item_map.get(item):