ran 2to3, evaluation (#13499)
* ran 2to3, evaluation * Update update_gstin.py * Update accounts_receivable_summary.py
This commit is contained in:
parent
c141eb00ee
commit
efb731941d
@ -1,10 +1,11 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe, os, json
|
||||
from frappe.utils import cstr
|
||||
from unidecode import unidecode
|
||||
from six import iteritems
|
||||
|
||||
def create_charts(company, chart_template=None, existing_company=None):
|
||||
chart = get_chart(chart_template, existing_company)
|
||||
@ -12,7 +13,7 @@ def create_charts(company, chart_template=None, existing_company=None):
|
||||
accounts = []
|
||||
|
||||
def _import_accounts(children, parent, root_type, root_account=False):
|
||||
for account_name, child in children.items():
|
||||
for account_name, child in iteritems(children):
|
||||
if root_account:
|
||||
root_type = child.get("root_type")
|
||||
|
||||
@ -184,7 +185,7 @@ def validate_bank_account(coa, bank_account):
|
||||
|
||||
if chart:
|
||||
def _get_account_names(account_master):
|
||||
for account_name, child in account_master.items():
|
||||
for account_name, child in iteritems(account_master):
|
||||
if account_name not in ["account_number", "account_type",
|
||||
"root_type", "is_group", "tax_rate"]:
|
||||
accounts.append(account_name)
|
||||
|
@ -62,7 +62,7 @@ class JournalEntry(AccountsController):
|
||||
if d.reference_type in ("Sales Order", "Purchase Order", "Employee Advance"):
|
||||
advance_paid.setdefault(d.reference_type, []).append(d.reference_name)
|
||||
|
||||
for voucher_type, order_list in advance_paid.items():
|
||||
for voucher_type, order_list in iteritems(advance_paid):
|
||||
for voucher_no in list(set(order_list)):
|
||||
frappe.get_doc(voucher_type, voucher_no).set_total_advance_paid()
|
||||
|
||||
@ -219,7 +219,7 @@ class JournalEntry(AccountsController):
|
||||
d.reference_name = None
|
||||
if not d.reference_name:
|
||||
d.reference_type = None
|
||||
if d.reference_type and d.reference_name and (d.reference_type in field_dict.keys()):
|
||||
if d.reference_type and d.reference_name and (d.reference_type in list(field_dict)):
|
||||
dr_or_cr = "credit_in_account_currency" \
|
||||
if d.reference_type in ("Sales Order", "Sales Invoice") else "debit_in_account_currency"
|
||||
|
||||
|
@ -14,7 +14,7 @@ from erpnext.accounts.general_ledger import make_gl_entries
|
||||
from erpnext.hr.doctype.expense_claim.expense_claim import update_reimbursed_amount
|
||||
from erpnext.controllers.accounts_controller import AccountsController, get_supplier_block_status
|
||||
|
||||
from six import string_types
|
||||
from six import string_types, iteritems
|
||||
|
||||
class InvalidPaymentEntry(ValidationError):
|
||||
pass
|
||||
@ -147,7 +147,7 @@ class PaymentEntry(AccountsController):
|
||||
ref_details = get_reference_details(d.reference_doctype,
|
||||
d.reference_name, self.party_account_currency)
|
||||
|
||||
for field, value in ref_details.items():
|
||||
for field, value in iteritems(ref_details):
|
||||
if not d.get(field) or force:
|
||||
d.set(field, value)
|
||||
|
||||
|
@ -7,7 +7,7 @@ from frappe import msgprint, _
|
||||
from frappe.utils import cint, now
|
||||
from erpnext.accounts.doctype.sales_invoice.pos import get_child_nodes
|
||||
from erpnext.accounts.doctype.sales_invoice.sales_invoice import set_account_for_mode_of_payment
|
||||
|
||||
from six import iteritems
|
||||
from frappe.model.document import Document
|
||||
|
||||
class POSProfile(Document):
|
||||
@ -39,7 +39,7 @@ class POSProfile(Document):
|
||||
self.expense_account], "Cost Center": [self.cost_center],
|
||||
"Warehouse": [self.warehouse]}
|
||||
|
||||
for link_dt, dn_list in accounts.items():
|
||||
for link_dt, dn_list in iteritems(accounts):
|
||||
for link_dn in dn_list:
|
||||
if link_dn and not frappe.db.exists({"doctype": link_dt,
|
||||
"company": self.company, "name": link_dn}):
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe, erpnext
|
||||
from frappe.utils import cint, cstr, formatdate, flt, getdate, nowdate
|
||||
from frappe import _, throw
|
||||
@ -17,6 +17,7 @@ from erpnext.accounts.doctype.gl_entry.gl_entry import update_outstanding_amt
|
||||
from erpnext.buying.utils import check_for_closed_status
|
||||
from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center
|
||||
from frappe.model.mapper import get_mapped_doc
|
||||
from six import iteritems
|
||||
from erpnext.accounts.doctype.sales_invoice.sales_invoice import validate_inter_company_party, update_linked_invoice,\
|
||||
unlink_inter_company_invoice
|
||||
from erpnext.assets.doctype.asset_category.asset_category import get_asset_category_account
|
||||
@ -572,7 +573,7 @@ class PurchaseInvoice(BuyingController):
|
||||
total_valuation_amount = sum(valuation_tax.values())
|
||||
amount_including_divisional_loss = self.negative_expense_to_be_booked
|
||||
i = 1
|
||||
for cost_center, amount in valuation_tax.items():
|
||||
for cost_center, amount in iteritems(valuation_tax):
|
||||
if i == len(valuation_tax):
|
||||
applicable_amount = amount_including_divisional_loss
|
||||
else:
|
||||
@ -592,7 +593,7 @@ class PurchaseInvoice(BuyingController):
|
||||
i += 1
|
||||
|
||||
if self.auto_accounting_for_stock and self.update_stock and valuation_tax:
|
||||
for cost_center, amount in valuation_tax.items():
|
||||
for cost_center, amount in iteritems(valuation_tax):
|
||||
gl_entries.append(
|
||||
self.get_gl_dict({
|
||||
"account": self.expenses_included_in_valuation,
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import json
|
||||
|
||||
@ -14,7 +14,7 @@ from frappe import _
|
||||
from frappe.core.doctype.communication.email import make
|
||||
from frappe.utils import nowdate
|
||||
|
||||
from six import string_types
|
||||
from six import string_types, iteritems
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
@ -368,7 +368,7 @@ def make_invoice(doc_list={}, email_queue_list={}, customers_list={}):
|
||||
customers_list = make_customer_and_address(customers_list)
|
||||
name_list = []
|
||||
for docs in doc_list:
|
||||
for name, doc in docs.items():
|
||||
for name, doc in iteritems(docs):
|
||||
if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}):
|
||||
validate_records(doc)
|
||||
si_doc = frappe.new_doc('Sales Invoice')
|
||||
@ -414,7 +414,7 @@ def get_customer_id(doc, customer=None):
|
||||
|
||||
def make_customer_and_address(customers):
|
||||
customers_list = []
|
||||
for customer, data in customers.items():
|
||||
for customer, data in iteritems(customers):
|
||||
data = json.loads(data)
|
||||
cust_id = get_customer_id(data, customer)
|
||||
if not cust_id:
|
||||
@ -511,7 +511,7 @@ def make_address(args, customer):
|
||||
|
||||
def make_email_queue(email_queue):
|
||||
name_list = []
|
||||
for key, data in email_queue.items():
|
||||
for key, data in iteritems(email_queue):
|
||||
name = frappe.db.get_value('Sales Invoice', {'offline_pos_name': key}, 'name')
|
||||
data = json.loads(data)
|
||||
sender = frappe.session.user
|
||||
|
@ -22,6 +22,8 @@ from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos, get_delive
|
||||
from erpnext.setup.doctype.company.company import update_company_current_month_sales
|
||||
from erpnext.accounts.general_ledger import get_round_off_account_and_cost_center
|
||||
|
||||
from six import iteritems
|
||||
|
||||
form_grid_templates = {
|
||||
"items": "templates/form_grid/item_grid.html"
|
||||
}
|
||||
@ -340,7 +342,7 @@ class SalesInvoice(SellingController):
|
||||
for item in self.get("items"):
|
||||
if item.get('item_code'):
|
||||
for fname, val in get_pos_profile_item_details(pos,
|
||||
frappe._dict(item.as_dict()), pos).items():
|
||||
iteritems(frappe._dict(item.as_dict()), pos)):
|
||||
|
||||
if (not for_validate) or (for_validate and not item.get(fname)):
|
||||
item.set(fname, val)
|
||||
|
@ -16,7 +16,7 @@ from erpnext.stock.doctype.serial_no.serial_no import SerialNoWarehouseError
|
||||
from frappe.model.naming import make_autoname
|
||||
from erpnext.accounts.doctype.account.test_account import get_inventory_account
|
||||
from erpnext.controllers.taxes_and_totals import get_itemised_tax_breakup_data
|
||||
|
||||
from six import iteritems
|
||||
class TestSalesInvoice(unittest.TestCase):
|
||||
def make(self):
|
||||
w = frappe.copy_doc(test_records[0])
|
||||
@ -277,7 +277,7 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
|
||||
# check if item values are calculated
|
||||
for i, d in enumerate(si.get("items")):
|
||||
for k, v in expected_values[i].items():
|
||||
for k, v in iteritems(expected_values[i]):
|
||||
self.assertEqual(d.get(k), v)
|
||||
|
||||
# check net total
|
||||
@ -523,7 +523,7 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
|
||||
# check if item values are calculated
|
||||
for i, d in enumerate(si.get("items")):
|
||||
for key, val in expected_values[i].items():
|
||||
for key, val in iteritems(expected_values[i]):
|
||||
self.assertEqual(d.get(key), val)
|
||||
|
||||
# check net total
|
||||
|
@ -7,6 +7,9 @@ from frappe import _
|
||||
from frappe.utils import flt
|
||||
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
|
||||
|
||||
from six import iteritems
|
||||
from six.moves import zip
|
||||
|
||||
class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
def run(self, args):
|
||||
party_naming_by = frappe.db.get_value(args.get("naming_by")[0], None, args.get("naming_by")[1])
|
||||
@ -52,7 +55,7 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
|
||||
partywise_total = self.get_partywise_total(party_naming_by, args)
|
||||
|
||||
for party, party_dict in partywise_total.items():
|
||||
for party, party_dict in iteritems(partywise_total):
|
||||
row = [party]
|
||||
|
||||
if party_naming_by == "Naming Series":
|
||||
@ -88,7 +91,7 @@ class AccountsReceivableSummary(ReceivablePayableReport):
|
||||
"range4": 0
|
||||
})
|
||||
)
|
||||
for k in party_total[d.party].keys():
|
||||
for k in list(party_total[d.party]):
|
||||
if k != "currency":
|
||||
party_total[d.party][k] += flt(d.get(k, 0))
|
||||
|
||||
|
@ -8,6 +8,8 @@ from frappe.utils import flt
|
||||
from frappe.utils import formatdate
|
||||
from erpnext.controllers.trends import get_period_date_ranges, get_period_month_ranges
|
||||
|
||||
from six import iteritems
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters = {}
|
||||
|
||||
@ -20,7 +22,7 @@ def execute(filters=None):
|
||||
for cost_center in cost_centers:
|
||||
cost_center_items = cam_map.get(cost_center)
|
||||
if cost_center_items:
|
||||
for account, monthwise_data in cost_center_items.items():
|
||||
for account, monthwise_data in iteritems(cost_center_items):
|
||||
row = [cost_center, account]
|
||||
totals = [0, 0, 0]
|
||||
for relevant_months in period_month_ranges:
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import re
|
||||
from past.builtins import cmp
|
||||
@ -13,6 +13,7 @@ from erpnext.accounts.utils import get_fiscal_year
|
||||
from frappe import _
|
||||
from frappe.utils import (flt, getdate, get_first_day, add_months, add_days, formatdate)
|
||||
|
||||
from six import itervalues
|
||||
|
||||
def get_period_list(from_fiscal_year, to_fiscal_year, periodicity, accumulated_values=False,
|
||||
company=None, reset_period_on_fy_change=True):
|
||||
@ -166,7 +167,7 @@ def get_appropriate_currency(company, filters=None):
|
||||
|
||||
def calculate_values(
|
||||
accounts_by_name, gl_entries_by_account, period_list, accumulated_values, ignore_accumulated_values_for_fy):
|
||||
for entries in gl_entries_by_account.values():
|
||||
for entries in itervalues(gl_entries_by_account):
|
||||
for entry in entries:
|
||||
d = accounts_by_name.get(entry.account)
|
||||
if not d:
|
||||
|
@ -9,6 +9,7 @@ from frappe.utils import getdate, cstr, flt, fmt_money
|
||||
from frappe import _, _dict
|
||||
from erpnext.accounts.utils import get_account_currency
|
||||
|
||||
from six import iteritems
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters:
|
||||
@ -194,7 +195,7 @@ def get_data_with_opening_closing(filters, account_details, gl_entries):
|
||||
data.append(totals.opening)
|
||||
|
||||
if filters.get("group_by") in ["Group by Account", "Group by Party"]:
|
||||
for acc, acc_dict in gle_map.items():
|
||||
for acc, acc_dict in iteritems(gle_map):
|
||||
# acc
|
||||
if acc_dict.entries:
|
||||
# opening
|
||||
|
@ -149,7 +149,7 @@ class GrossProfitGenerator(object):
|
||||
|
||||
def get_average_rate_based_on_group_by(self):
|
||||
# sum buying / selling totals for group
|
||||
for key in self.grouped.keys():
|
||||
for key in list(self.grouped):
|
||||
if self.filters.get("group_by") != "Invoice":
|
||||
for i, row in enumerate(self.grouped[key]):
|
||||
if i==0:
|
||||
|
@ -1,14 +1,14 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
import frappe, erpnext
|
||||
import frappe.defaults
|
||||
from frappe.utils import nowdate, cstr, flt, cint, now, getdate
|
||||
from frappe import throw, _
|
||||
from frappe.utils import formatdate, get_number_format_info
|
||||
|
||||
from six import iteritems
|
||||
# imported to enable erpnext.accounts.utils.get_account_currency
|
||||
from erpnext.accounts.doctype.account.account import get_account_currency
|
||||
|
||||
@ -423,7 +423,7 @@ def update_reference_in_payment_entry(d, payment_entry):
|
||||
if d.allocated_amount < original_row.allocated_amount:
|
||||
new_row = payment_entry.append("references")
|
||||
new_row.docstatus = 1
|
||||
for field in reference_details.keys():
|
||||
for field in list(reference_details):
|
||||
new_row.set(field, original_row[field])
|
||||
|
||||
new_row.allocated_amount = original_row.allocated_amount - d.allocated_amount
|
||||
@ -526,7 +526,7 @@ def get_stock_and_account_difference(account_list=None, posting_date=None):
|
||||
difference = {}
|
||||
warehouse_account = get_warehouse_account_map()
|
||||
|
||||
for warehouse, account_data in warehouse_account.items():
|
||||
for warehouse, account_data in iteritems(warehouse_account):
|
||||
if account_data.get('account') in account_list:
|
||||
account_balance = get_balance_on(account_data.get('account'), posting_date, in_account_currency=False)
|
||||
stock_value = get_stock_value_on(warehouse, posting_date)
|
||||
|
@ -55,7 +55,7 @@ def check_task_creation():
|
||||
all_tasks = frappe.get_all('Task')
|
||||
for task in all_tasks:
|
||||
sample_task = frappe.get_doc('Task', task.name)
|
||||
if sample_task.subject in all_task_dict.keys():
|
||||
if sample_task.subject in list(all_task_dict):
|
||||
if sample_task.exp_start_date != all_task_dict[sample_task.subject]['exp_start_date'] or sample_task.exp_end_date != all_task_dict[sample_task.subject]['exp_end_date']:
|
||||
return False
|
||||
all_task_dict.pop(sample_task.subject)
|
||||
|
@ -105,14 +105,14 @@ class Asset(AccountsController):
|
||||
|
||||
number_of_pending_depreciations += 1
|
||||
for n in range(number_of_pending_depreciations):
|
||||
if n == range(number_of_pending_depreciations)[-1]:
|
||||
if n == list(range(number_of_pending_depreciations))[-1]:
|
||||
schedule_date = add_months(self.available_for_use_date, n * 12)
|
||||
previous_scheduled_date = add_months(d.depreciation_start_date, (n-1) * 12)
|
||||
depreciation_amount = \
|
||||
self.get_depreciation_amount_prorata_temporis(value_after_depreciation,
|
||||
d, previous_scheduled_date, schedule_date)
|
||||
|
||||
elif n == range(number_of_pending_depreciations)[0]:
|
||||
elif n == list(range(number_of_pending_depreciations))[0]:
|
||||
schedule_date = d.depreciation_start_date
|
||||
depreciation_amount = \
|
||||
self.get_depreciation_amount_prorata_temporis(value_after_depreciation,
|
||||
|
@ -13,6 +13,7 @@ from erpnext.controllers.buying_controller import BuyingController
|
||||
from erpnext.accounts.utils import get_account_currency
|
||||
from frappe.desk.notifications import clear_doctype_notifications
|
||||
from erpnext.buying.utils import check_for_closed_status
|
||||
from six import iteritems
|
||||
from erpnext.assets.doctype.asset_category.asset_category import get_asset_category_account
|
||||
|
||||
form_grid_templates = {
|
||||
@ -283,7 +284,7 @@ class PurchaseReceipt(BuyingController):
|
||||
total_valuation_amount = sum(valuation_tax.values())
|
||||
amount_including_divisional_loss = negative_expense_to_be_booked
|
||||
i = 1
|
||||
for cost_center, amount in valuation_tax.items():
|
||||
for cost_center, amount in iteritems(valuation_tax):
|
||||
if i == len(valuation_tax):
|
||||
applicable_amount = amount_including_divisional_loss
|
||||
else:
|
||||
|
@ -2,7 +2,7 @@
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import unittest
|
||||
import frappe, erpnext
|
||||
import frappe.defaults
|
||||
@ -12,7 +12,7 @@ from erpnext import set_perpetual_inventory
|
||||
from erpnext.stock.doctype.serial_no.serial_no import SerialNoDuplicateError
|
||||
from erpnext.accounts.doctype.account.test_account import get_inventory_account
|
||||
from erpnext.stock.doctype.item.test_item import make_item
|
||||
|
||||
from six import iteritems
|
||||
class TestPurchaseReceipt(unittest.TestCase):
|
||||
def setUp(self):
|
||||
frappe.db.set_value("Buying Settings", None, "allow_multiple_items", 1)
|
||||
@ -180,7 +180,7 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
def test_purchase_return_for_serialized_items(self):
|
||||
def _check_serial_no_values(serial_no, field_values):
|
||||
serial_no = frappe.get_doc("Serial No", serial_no)
|
||||
for field, value in field_values.items():
|
||||
for field, value in iteritems(field_values):
|
||||
self.assertEqual(cstr(serial_no.get(field)), value)
|
||||
|
||||
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos
|
||||
@ -217,7 +217,7 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
return_pr = make_purchase_receipt(item_code=item_code, qty=-10, uom="Unit",
|
||||
stock_uom="Box", conversion_factor=0.1, is_return=1, return_against=pr.name)
|
||||
|
||||
self.assertEquals(abs(return_pr.items[0].stock_qty), 1.0)
|
||||
self.assertEqual(abs(return_pr.items[0].stock_qty), 1.0)
|
||||
|
||||
def test_closed_purchase_receipt(self):
|
||||
from erpnext.stock.doctype.purchase_receipt.purchase_receipt import update_purchase_receipt_status
|
||||
|
@ -9,7 +9,7 @@ from frappe.utils import cint, cstr, flt, add_days, nowdate, getdate
|
||||
from frappe import _, ValidationError
|
||||
|
||||
from erpnext.controllers.stock_controller import StockController
|
||||
|
||||
from six.moves import map
|
||||
class SerialNoCannotCreateDirectError(ValidationError): pass
|
||||
class SerialNoCannotCannotChangeError(ValidationError): pass
|
||||
class SerialNoNotRequiredError(ValidationError): pass
|
||||
@ -174,7 +174,7 @@ class SerialNo(StockController):
|
||||
serial_nos = map(lambda i: new if i.upper()==old.upper() else i, item[1].split('\n'))
|
||||
frappe.db.sql("""update `tab%s` set serial_no = %s
|
||||
where name=%s""" % (dt[0], '%s', '%s'),
|
||||
('\n'.join(serial_nos), item[0]))
|
||||
('\n'.join(list(serial_nos)), item[0]))
|
||||
|
||||
def on_stock_ledger_entry(self):
|
||||
if self.via_stock_ledger and not self.get("__islocal"):
|
||||
|
@ -15,7 +15,7 @@ from erpnext.manufacturing.doctype.bom.bom import validate_bom_no
|
||||
from erpnext.stock.utils import get_bin
|
||||
import json
|
||||
|
||||
from six import string_types
|
||||
from six import string_types, itervalues, iteritems
|
||||
|
||||
class IncorrectValuationRateError(frappe.ValidationError): pass
|
||||
class DuplicateEntryForWorkOrderError(frappe.ValidationError): pass
|
||||
@ -638,7 +638,7 @@ class StockEntry(StockController):
|
||||
if self.work_order and self.purpose == "Material Transfer for Manufacture":
|
||||
item_dict = self.get_pending_raw_materials()
|
||||
if self.to_warehouse and self.pro_doc:
|
||||
for item in item_dict.values():
|
||||
for item in itervalues(item_dict):
|
||||
item["to_warehouse"] = self.pro_doc.wip_warehouse
|
||||
self.add_to_stock_entry_detail(item_dict)
|
||||
|
||||
@ -665,7 +665,7 @@ class StockEntry(StockController):
|
||||
from `tabPurchase Order` po, `tabPurchase Order Item Supplied` poitemsup
|
||||
where po.name = poitemsup.parent
|
||||
and po.name = %s""",self.purchase_order))
|
||||
for item in item_dict.values():
|
||||
for item in itervalues(item_dict):
|
||||
if self.pro_doc and not self.pro_doc.skip_transfer:
|
||||
item["from_warehouse"] = self.pro_doc.wip_warehouse
|
||||
#Get Reserve Warehouse from PO
|
||||
@ -677,7 +677,7 @@ class StockEntry(StockController):
|
||||
|
||||
if self.purpose != "Subcontract":
|
||||
scrap_item_dict = self.get_bom_scrap_material(self.fg_completed_qty)
|
||||
for item in scrap_item_dict.values():
|
||||
for item in itervalues(scrap_item_dict):
|
||||
if self.pro_doc and self.pro_doc.scrap_warehouse:
|
||||
item["to_warehouse"] = self.pro_doc.scrap_warehouse
|
||||
|
||||
@ -744,7 +744,7 @@ class StockEntry(StockController):
|
||||
fetch_exploded = self.use_multi_level_bom)
|
||||
|
||||
used_alternative_items = get_used_alternative_items(work_order = self.work_order)
|
||||
for item in item_dict.values():
|
||||
for item in itervalues(item_dict):
|
||||
# if source warehouse presents in BOM set from_warehouse as bom source_warehouse
|
||||
if item["allow_alternative_item"]:
|
||||
item["allow_alternative_item"] = frappe.db.get_value('Work Order',
|
||||
@ -769,7 +769,7 @@ class StockEntry(StockController):
|
||||
item_dict = get_bom_items_as_dict(self.bom_no, self.company, qty=qty,
|
||||
fetch_exploded = 0, fetch_scrap_items = 1)
|
||||
|
||||
for item in item_dict.values():
|
||||
for item in itervalues(item_dict):
|
||||
item.from_warehouse = ""
|
||||
return item_dict
|
||||
|
||||
@ -905,7 +905,7 @@ class StockEntry(StockController):
|
||||
"""
|
||||
item_dict = self.get_pro_order_required_items()
|
||||
max_qty = flt(self.pro_doc.qty)
|
||||
for item, item_details in item_dict.items():
|
||||
for item, item_details in iteritems(item_dict):
|
||||
pending_to_issue = flt(item_details.required_qty) - flt(item_details.transferred_qty)
|
||||
desire_to_transfer = flt(self.fg_completed_qty) * flt(item_details.required_qty) / max_qty
|
||||
|
||||
|
@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import date_diff, flt
|
||||
from six import iteritems
|
||||
|
||||
def execute(filters=None):
|
||||
|
||||
@ -12,7 +13,7 @@ def execute(filters=None):
|
||||
item_details = get_fifo_queue(filters)
|
||||
to_date = filters["to_date"]
|
||||
data = []
|
||||
for item, item_dict in item_details.items():
|
||||
for item, item_dict in iteritems(item_details):
|
||||
fifo_queue = item_dict["fifo_queue"]
|
||||
details = item_dict["details"]
|
||||
if not fifo_queue: continue
|
||||
|
@ -171,7 +171,7 @@ def filter_items_with_no_transactions(iwb_map):
|
||||
|
||||
no_transactions = True
|
||||
float_precision = cint(frappe.db.get_default("float_precision")) or 3
|
||||
for key, val in qty_dict.items():
|
||||
for key, val in iteritems(qty_dict):
|
||||
val = flt(val, float_precision)
|
||||
qty_dict[key] = val
|
||||
if key != "val_rate" and val:
|
||||
@ -212,7 +212,7 @@ def get_item_details(items, sle, filters):
|
||||
item_details.setdefault(item.name, item)
|
||||
|
||||
if filters.get('show_variant_attributes', 0) == 1:
|
||||
variant_values = get_variant_values_for(item_details.keys())
|
||||
variant_values = get_variant_values_for(list(item_details))
|
||||
item_details = {k: v.update(variant_values.get(k, {})) for k, v in iteritems(item_details)}
|
||||
|
||||
return item_details
|
||||
|
@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt
|
||||
from six import iteritems
|
||||
|
||||
def execute(filters=None):
|
||||
columns = get_columns(filters)
|
||||
@ -13,7 +14,7 @@ def execute(filters=None):
|
||||
material_transfer_vouchers = get_material_transfer_vouchers()
|
||||
data = []
|
||||
|
||||
for item_code, suppliers in supplier_details.items():
|
||||
for item_code, suppliers in iteritems(supplier_details):
|
||||
consumed_qty = consumed_amount = delivered_qty = delivered_amount = 0.0
|
||||
total_qty = total_amount = 0.0
|
||||
if consumed_details.get(item_code):
|
||||
@ -85,7 +86,7 @@ def get_suppliers_details(filters):
|
||||
item_supplier_map.setdefault(d.item_code, []).append(d.supplier)
|
||||
|
||||
if supplier:
|
||||
for item_code, suppliers in item_supplier_map.items():
|
||||
for item_code, suppliers in iteritems(item_supplier_map):
|
||||
if supplier not in suppliers:
|
||||
del item_supplier_map[item_code]
|
||||
|
||||
|
@ -10,7 +10,7 @@ from frappe import _
|
||||
from frappe.utils import flt, cint, getdate
|
||||
from erpnext.stock.report.stock_balance.stock_balance import get_item_details, get_item_reorder_details, get_item_warehouse_map
|
||||
from erpnext.stock.report.stock_ageing.stock_ageing import get_fifo_queue, get_average_age
|
||||
|
||||
from six import iteritems
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters = {}
|
||||
@ -41,7 +41,7 @@ def execute(filters=None):
|
||||
|
||||
|
||||
# sum bal_qty by item
|
||||
for (item, item_group), wh_balance in item_balance.items():
|
||||
for (item, item_group), wh_balance in iteritems(item_balance):
|
||||
total_stock_value = sum(item_value[(item, item_group)])
|
||||
row = [item, item_group, total_stock_value]
|
||||
|
||||
|
@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import add_to_date, getdate, get_datetime
|
||||
from six import iteritems
|
||||
|
||||
time_slots = {
|
||||
'12AM - 3AM': '00:00:00-03:00:00',
|
||||
@ -33,7 +34,7 @@ def get_data(filters):
|
||||
time_slot_wise_total_count = {}
|
||||
while(start_date <= getdate(filters.to_date)):
|
||||
hours_count = {'date': start_date}
|
||||
for key, value in time_slots.items():
|
||||
for key, value in iteritems(time_slots):
|
||||
start_time, end_time = value.split('-')
|
||||
start_time = get_datetime("{0} {1}".format(start_date.strftime("%Y-%m-%d"), start_time))
|
||||
end_time = get_datetime("{0} {1}".format(start_date.strftime("%Y-%m-%d"), end_time))
|
||||
|
@ -1,5 +1,6 @@
|
||||
import frappe
|
||||
from frappe import _
|
||||
from six import iteritems
|
||||
|
||||
def get_context(context):
|
||||
context.no_cache = 1
|
||||
@ -28,7 +29,7 @@ def get_context(context):
|
||||
|
||||
def update_gstin(context):
|
||||
dirty = False
|
||||
for key, value in frappe.form_dict.items():
|
||||
for key, value in iteritems(frappe.form_dict):
|
||||
if key != 'party':
|
||||
address_name = frappe.get_value('Address', key)
|
||||
if address_name:
|
||||
|
Loading…
x
Reference in New Issue
Block a user