Browse Source

chore: remove all six compat code

develop
Ankush Menat 3 years ago
parent
commit
8fe5feb6a4
  1. 1
      erpnext/__init__.py
  2. 1
      erpnext/accounts/deferred_revenue.py
  3. 7
      erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py
  4. 3
      erpnext/accounts/doctype/account/chart_of_accounts/import_from_openerp.py
  5. 1
      erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py
  6. 1
      erpnext/accounts/doctype/bank/bank_dashboard.py
  7. 1
      erpnext/accounts/doctype/bank_account/bank_account_dashboard.py
  8. 5
      erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py
  9. 3
      erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py
  10. 1
      erpnext/accounts/doctype/cash_flow_mapper/default_cash_flow_mapper.py
  11. 1
      erpnext/accounts/doctype/cost_center/cost_center_dashboard.py
  12. 3
      erpnext/accounts/doctype/dunning/dunning.py
  13. 1
      erpnext/accounts/doctype/dunning/dunning_dashboard.py
  14. 2
      erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation_dashboard.py
  15. 1
      erpnext/accounts/doctype/finance_book/finance_book_dashboard.py
  16. 1
      erpnext/accounts/doctype/fiscal_year/fiscal_year_dashboard.py
  17. 3
      erpnext/accounts/doctype/gl_entry/gl_entry.py
  18. 1
      erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py
  19. 1
      erpnext/accounts/doctype/item_tax_template/item_tax_template_dashboard.py
  20. 9
      erpnext/accounts/doctype/journal_entry/journal_entry.py
  21. 2
      erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py
  22. 1
      erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py
  23. 9
      erpnext/accounts/doctype/payment_entry/payment_entry.py
  24. 2
      erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py
  25. 2
      erpnext/accounts/doctype/payment_order/payment_order_dashboard.py
  26. 1
      erpnext/accounts/doctype/payment_term/payment_term_dashboard.py
  27. 1
      erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py
  28. 6
      erpnext/accounts/doctype/pos_invoice/pos_invoice.py
  29. 3
      erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py
  30. 3
      erpnext/accounts/doctype/pos_profile/pos_profile.py
  31. 9
      erpnext/accounts/doctype/pricing_rule/pricing_rule.py
  32. 3
      erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
  33. 1
      erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py
  34. 1
      erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py
  35. 5
      erpnext/accounts/doctype/sales_invoice/sales_invoice.py
  36. 1
      erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py
  37. 5
      erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
  38. 1
      erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py
  39. 1
      erpnext/accounts/doctype/share_type/share_type_dashboard.py
  40. 2
      erpnext/accounts/doctype/shareholder/shareholder_dashboard.py
  41. 1
      erpnext/accounts/doctype/shipping_rule/shipping_rule_dashboard.py
  42. 1
      erpnext/accounts/doctype/subscription/subscription.py
  43. 1
      erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py
  44. 1
      erpnext/accounts/doctype/tax_category/tax_category_dashboard.py
  45. 3
      erpnext/accounts/doctype/tax_rule/tax_rule.py
  46. 3
      erpnext/accounts/doctype/tax_rule/test_tax_rule.py
  47. 2
      erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py
  48. 2
      erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py
  49. 2
      erpnext/accounts/notification/notification_for_new_fiscal_year/notification_for_new_fiscal_year.py
  50. 3
      erpnext/accounts/party.py
  51. 1
      erpnext/accounts/report/account_balance/test_account_balance.py
  52. 1
      erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py
  53. 3
      erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py
  54. 3
      erpnext/accounts/report/budget_variance_report/budget_variance_report.py
  55. 3
      erpnext/accounts/report/cash_flow/cash_flow.py
  56. 11
      erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py
  57. 3
      erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.py
  58. 4
      erpnext/accounts/report/financial_statements.py
  59. 3
      erpnext/accounts/report/general_ledger/general_ledger.py
  60. 1
      erpnext/accounts/report/tax_detail/test_tax_detail.py
  61. 1
      erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py
  62. 1
      erpnext/accounts/report/utils.py
  63. 1
      erpnext/accounts/test/test_utils.py
  64. 3
      erpnext/accounts/utils.py
  65. 1
      erpnext/agriculture/doctype/crop/crop_dashboard.py
  66. 7
      erpnext/assets/doctype/asset/asset.py
  67. 2
      erpnext/assets/doctype/asset/asset_dashboard.py
  68. 1
      erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py
  69. 3
      erpnext/buying/doctype/request_for_quotation/request_for_quotation.py
  70. 2
      erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py
  71. 1
      erpnext/buying/doctype/supplier/supplier_dashboard.py
  72. 1
      erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py
  73. 1
      erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_dashboard.py
  74. 1
      erpnext/config/education.py
  75. 1
      erpnext/config/projects.py
  76. 5
      erpnext/controllers/accounts_controller.py
  77. 11
      erpnext/controllers/item_variant.py
  78. 2
      erpnext/controllers/taxes_and_totals.py
  79. 4
      erpnext/controllers/tests/test_item_variant.py
  80. 1
      erpnext/controllers/tests/test_mapper.py
  81. 1
      erpnext/controllers/tests/test_qty_based_taxes.py
  82. 3
      erpnext/crm/doctype/contract_template/contract_template.py
  83. 2
      erpnext/crm/doctype/lead/lead_dashboard.py
  84. 2
      erpnext/crm/doctype/opportunity/opportunity_dashboard.py
  85. 1
      erpnext/crm/doctype/utils.py
  86. 5
      erpnext/crm/report/opportunity_summary_by_sales_stage/opportunity_summary_by_sales_stage.py
  87. 5
      erpnext/crm/report/sales_pipeline_analytics/sales_pipeline_analytics.py
  88. 1
      erpnext/demo/demo.py
  89. 1
      erpnext/demo/domains.py
  90. 4
      erpnext/demo/setup/manufacture.py
  91. 4
      erpnext/demo/setup/retail.py
  92. 1
      erpnext/demo/setup/setup_data.py
  93. 1
      erpnext/demo/user/accounts.py
  94. 1
      erpnext/demo/user/education.py
  95. 1
      erpnext/demo/user/fixed_asset.py
  96. 1
      erpnext/demo/user/hr.py
  97. 1
      erpnext/domains/agriculture.py
  98. 1
      erpnext/domains/distribution.py
  99. 1
      erpnext/domains/education.py
  100. 1
      erpnext/domains/hospitality.py

1
erpnext/__init__.py

@ -1,4 +1,3 @@
import inspect import inspect
import frappe import frappe

1
erpnext/accounts/deferred_revenue.py

@ -1,4 +1,3 @@
import frappe import frappe
from frappe import _ from frappe import _
from frappe.email import sendmail_to_system_managers from frappe.email import sendmail_to_system_managers

7
erpnext/accounts/doctype/account/chart_of_accounts/chart_of_accounts.py

@ -7,7 +7,6 @@ import os
import frappe import frappe
from frappe.utils import cstr from frappe.utils import cstr
from frappe.utils.nestedset import rebuild_tree from frappe.utils.nestedset import rebuild_tree
from six import iteritems
from unidecode import unidecode from unidecode import unidecode
@ -17,7 +16,7 @@ def create_charts(company, chart_template=None, existing_company=None, custom_ch
accounts = [] accounts = []
def _import_accounts(children, parent, root_type, root_account=False): def _import_accounts(children, parent, root_type, root_account=False):
for account_name, child in iteritems(children): for account_name, child in children.items():
if root_account: if root_account:
root_type = child.get("root_type") root_type = child.get("root_type")
@ -200,7 +199,7 @@ def validate_bank_account(coa, bank_account):
if chart: if chart:
def _get_account_names(account_master): def _get_account_names(account_master):
for account_name, child in iteritems(account_master): for account_name, child in account_master.items():
if account_name not in ["account_number", "account_type", if account_name not in ["account_number", "account_type",
"root_type", "is_group", "tax_rate"]: "root_type", "is_group", "tax_rate"]:
accounts.append(account_name) accounts.append(account_name)
@ -223,7 +222,7 @@ def build_tree_from_json(chart_template, chart_data=None, from_coa_importer=Fals
accounts = [] accounts = []
def _import_accounts(children, parent): def _import_accounts(children, parent):
''' recursively called to form a parent-child based list of dict from chart template ''' ''' recursively called to form a parent-child based list of dict from chart template '''
for account_name, child in iteritems(children): for account_name, child in children.items():
account = {} account = {}
if account_name in ["account_name", "account_number", "account_type",\ if account_name in ["account_name", "account_number", "account_type",\
"root_type", "is_group", "tax_rate"]: continue "root_type", "is_group", "tax_rate"]: continue

3
erpnext/accounts/doctype/account/chart_of_accounts/import_from_openerp.py

@ -12,7 +12,6 @@ from xml.etree import ElementTree as ET
import frappe import frappe
from frappe.utils.csvutils import read_csv_content from frappe.utils.csvutils import read_csv_content
from six import iteritems
path = "/Users/nabinhait/projects/odoo/addons" path = "/Users/nabinhait/projects/odoo/addons"
@ -139,7 +138,7 @@ def get_account_types(root_list, csv_content, prefix=None):
def make_maps_for_xml(xml_roots, account_types, country_dir): def make_maps_for_xml(xml_roots, account_types, country_dir):
"""make maps for `charts` and `accounts`""" """make maps for `charts` and `accounts`"""
for model, root_list in iteritems(xml_roots): for model, root_list in xml_roots.items():
for root in root_list: for root in root_list:
for node in root[0].findall("record"): for node in root[0].findall("record"):
if node.get("model")=="account.account.template": if node.get("model")=="account.account.template":

1
erpnext/accounts/doctype/accounts_settings/test_accounts_settings.py

@ -1,4 +1,3 @@
import unittest import unittest
import frappe import frappe

1
erpnext/accounts/doctype/bank/bank_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

1
erpnext/accounts/doctype/bank_account/bank_account_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

5
erpnext/accounts/doctype/bank_statement_import/bank_statement_import.py

@ -15,7 +15,6 @@ from frappe.utils.background_jobs import enqueue
from frappe.utils.xlsxutils import ILLEGAL_CHARACTERS_RE, handle_html from frappe.utils.xlsxutils import ILLEGAL_CHARACTERS_RE, handle_html
from openpyxl.styles import Font from openpyxl.styles import Font
from openpyxl.utils import get_column_letter from openpyxl.utils import get_column_letter
from six import string_types
class BankStatementImport(DataImport): class BankStatementImport(DataImport):
@ -179,12 +178,12 @@ def write_xlsx(data, sheet_name, wb=None, column_widths=None, file_path=None):
for row in data: for row in data:
clean_row = [] clean_row = []
for item in row: for item in row:
if isinstance(item, string_types) and (sheet_name not in ['Data Import Template', 'Data Export']): if isinstance(item, str) and (sheet_name not in ['Data Import Template', 'Data Export']):
value = handle_html(item) value = handle_html(item)
else: else:
value = item value = item
if isinstance(item, string_types) and next(ILLEGAL_CHARACTERS_RE.finditer(value), None): if isinstance(item, str) and next(ILLEGAL_CHARACTERS_RE.finditer(value), None):
# Remove illegal characters from the string # Remove illegal characters from the string
value = re.sub(ILLEGAL_CHARACTERS_RE, '', value) value = re.sub(ILLEGAL_CHARACTERS_RE, '', value)

3
erpnext/accounts/doctype/bank_transaction/bank_transaction_upload.py

@ -7,7 +7,6 @@ import json
import frappe import frappe
from frappe.utils import getdate from frappe.utils import getdate
from frappe.utils.dateutils import parse_date from frappe.utils.dateutils import parse_date
from six import iteritems
@frappe.whitelist() @frappe.whitelist()
@ -43,7 +42,7 @@ def create_bank_entries(columns, data, bank_account):
if all(item is None for item in d) is True: if all(item is None for item in d) is True:
continue continue
fields = {} fields = {}
for key, value in iteritems(header_map): for key, value in header_map.items():
fields.update({key: d[int(value)-1]}) fields.update({key: d[int(value)-1]})
try: try:

1
erpnext/accounts/doctype/cash_flow_mapper/default_cash_flow_mapper.py

@ -1,4 +1,3 @@
DEFAULT_MAPPERS = [ DEFAULT_MAPPERS = [
{ {
'doctype': 'Cash Flow Mapper', 'doctype': 'Cash Flow Mapper',

1
erpnext/accounts/doctype/cost_center/cost_center_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

3
erpnext/accounts/doctype/dunning/dunning.py

@ -6,7 +6,6 @@ import json
import frappe import frappe
from frappe.utils import cint, flt, getdate from frappe.utils import cint, flt, getdate
from six import string_types
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import ( from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
get_accounting_dimensions, get_accounting_dimensions,
@ -108,7 +107,7 @@ def calculate_interest_and_amount(outstanding_amount, rate_of_interest, dunning_
@frappe.whitelist() @frappe.whitelist()
def get_dunning_letter_text(dunning_type, doc, language=None): def get_dunning_letter_text(dunning_type, doc, language=None):
if isinstance(doc, string_types): if isinstance(doc, str):
doc = json.loads(doc) doc = json.loads(doc)
if language: if language:
filters = {'parent': dunning_type, 'language': language} filters = {'parent': dunning_type, 'language': language}

1
erpnext/accounts/doctype/dunning/dunning_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

2
erpnext/accounts/doctype/exchange_rate_revaluation/exchange_rate_revaluation_dashboard.py

@ -1,5 +1,3 @@
def get_data(): def get_data():
return { return {
'fieldname': 'reference_name', 'fieldname': 'reference_name',

1
erpnext/accounts/doctype/finance_book/finance_book_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

1
erpnext/accounts/doctype/fiscal_year/fiscal_year_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

3
erpnext/accounts/doctype/gl_entry/gl_entry.py

@ -8,7 +8,6 @@ from frappe.model.document import Document
from frappe.model.meta import get_field_precision from frappe.model.meta import get_field_precision
from frappe.model.naming import set_name_from_naming_options from frappe.model.naming import set_name_from_naming_options
from frappe.utils import flt, fmt_money from frappe.utils import flt, fmt_money
from six import iteritems
import erpnext import erpnext
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import ( from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
@ -115,7 +114,7 @@ class GLEntry(Document):
def validate_allowed_dimensions(self): def validate_allowed_dimensions(self):
dimension_filter_map = get_dimension_filter_map() dimension_filter_map = get_dimension_filter_map()
for key, value in iteritems(dimension_filter_map): for key, value in dimension_filter_map.items():
dimension = key[0] dimension = key[0]
account = key[1] account = key[1]

1
erpnext/accounts/doctype/invoice_discounting/invoice_discounting_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

1
erpnext/accounts/doctype/item_tax_template/item_tax_template_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

9
erpnext/accounts/doctype/journal_entry/journal_entry.py

@ -7,7 +7,6 @@ import json
import frappe import frappe
from frappe import _, msgprint, scrub from frappe import _, msgprint, scrub
from frappe.utils import cint, cstr, flt, fmt_money, formatdate, get_link_to_form, nowdate from frappe.utils import cint, cstr, flt, fmt_money, formatdate, get_link_to_form, nowdate
from six import iteritems, string_types
import erpnext import erpnext
from erpnext.accounts.deferred_revenue import get_deferred_booking_accounts from erpnext.accounts.deferred_revenue import get_deferred_booking_accounts
@ -116,7 +115,7 @@ class JournalEntry(AccountsController):
if d.reference_type in ("Sales Order", "Purchase Order", "Employee Advance"): if d.reference_type in ("Sales Order", "Purchase Order", "Employee Advance"):
advance_paid.setdefault(d.reference_type, []).append(d.reference_name) advance_paid.setdefault(d.reference_type, []).append(d.reference_name)
for voucher_type, order_list in iteritems(advance_paid): for voucher_type, order_list in advance_paid.items():
for voucher_no in list(set(order_list)): for voucher_no in list(set(order_list)):
frappe.get_doc(voucher_type, voucher_no).set_total_advance_paid() frappe.get_doc(voucher_type, voucher_no).set_total_advance_paid()
@ -431,7 +430,7 @@ class JournalEntry(AccountsController):
def validate_orders(self): def validate_orders(self):
"""Validate totals, closed and docstatus for orders""" """Validate totals, closed and docstatus for orders"""
for reference_name, total in iteritems(self.reference_totals): for reference_name, total in self.reference_totals.items():
reference_type = self.reference_types[reference_name] reference_type = self.reference_types[reference_name]
account = self.reference_accounts[reference_name] account = self.reference_accounts[reference_name]
@ -462,7 +461,7 @@ class JournalEntry(AccountsController):
def validate_invoices(self): def validate_invoices(self):
"""Validate totals and docstatus for invoices""" """Validate totals and docstatus for invoices"""
for reference_name, total in iteritems(self.reference_totals): for reference_name, total in self.reference_totals.items():
reference_type = self.reference_types[reference_name] reference_type = self.reference_types[reference_name]
if (reference_type in ("Sales Invoice", "Purchase Invoice") and if (reference_type in ("Sales Invoice", "Purchase Invoice") and
@ -1007,7 +1006,7 @@ def get_outstanding(args):
if not frappe.has_permission("Account"): if not frappe.has_permission("Account"):
frappe.msgprint(_("No Permission"), raise_exception=1) frappe.msgprint(_("No Permission"), raise_exception=1)
if isinstance(args, string_types): if isinstance(args, str):
args = json.loads(args) args = json.loads(args)
company_currency = erpnext.get_company_currency(args.get("company")) company_currency = erpnext.get_company_currency(args.get("company"))

2
erpnext/accounts/doctype/loyalty_program/loyalty_program_dashboard.py

@ -1,5 +1,3 @@
def get_data(): def get_data():
return { return {
'fieldname': 'loyalty_program', 'fieldname': 'loyalty_program',

1
erpnext/accounts/doctype/monthly_distribution/monthly_distribution_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

9
erpnext/accounts/doctype/payment_entry/payment_entry.py

@ -7,7 +7,6 @@ import json
import frappe import frappe
from frappe import ValidationError, _, scrub, throw from frappe import ValidationError, _, scrub, throw
from frappe.utils import cint, comma_or, flt, getdate, nowdate from frappe.utils import cint, comma_or, flt, getdate, nowdate
from six import iteritems, string_types
import erpnext import erpnext
from erpnext.accounts.doctype.bank_account.bank_account import ( from erpnext.accounts.doctype.bank_account.bank_account import (
@ -203,7 +202,7 @@ class PaymentEntry(AccountsController):
ref_details = get_reference_details(d.reference_doctype, ref_details = get_reference_details(d.reference_doctype,
d.reference_name, self.party_account_currency) d.reference_name, self.party_account_currency)
for field, value in iteritems(ref_details): for field, value in ref_details.items():
if d.exchange_gain_loss: if d.exchange_gain_loss:
# for cases where gain/loss is booked into invoice # for cases where gain/loss is booked into invoice
# exchange_gain_loss is calculated from invoice & populated # exchange_gain_loss is calculated from invoice & populated
@ -387,7 +386,7 @@ class PaymentEntry(AccountsController):
invoice_paid_amount_map[invoice_key]['outstanding'] = term.outstanding invoice_paid_amount_map[invoice_key]['outstanding'] = term.outstanding
invoice_paid_amount_map[invoice_key]['discounted_amt'] = ref.total_amount * (term.discount / 100) invoice_paid_amount_map[invoice_key]['discounted_amt'] = ref.total_amount * (term.discount / 100)
for idx, (key, allocated_amount) in enumerate(iteritems(invoice_payment_amount_map), 1): for idx, (key, allocated_amount) in enumerate(invoice_payment_amount_map.items(), 1):
if not invoice_paid_amount_map.get(key): if not invoice_paid_amount_map.get(key):
frappe.throw(_('Payment term {0} not used in {1}').format(key[0], key[1])) frappe.throw(_('Payment term {0} not used in {1}').format(key[0], key[1]))
@ -912,7 +911,7 @@ class PaymentEntry(AccountsController):
self.paid_amount_after_tax = self.paid_amount self.paid_amount_after_tax = self.paid_amount
def determine_exclusive_rate(self): def determine_exclusive_rate(self):
if not any((cint(tax.included_in_paid_amount) for tax in self.get("taxes"))): if not any(cint(tax.included_in_paid_amount) for tax in self.get("taxes")):
return return
cumulated_tax_fraction = 0 cumulated_tax_fraction = 0
@ -1032,7 +1031,7 @@ def validate_inclusive_tax(tax, doc):
@frappe.whitelist() @frappe.whitelist()
def get_outstanding_reference_documents(args): def get_outstanding_reference_documents(args):
if isinstance(args, string_types): if isinstance(args, str):
args = json.loads(args) args = json.loads(args)
if args.get('party_type') == 'Member': if args.get('party_type') == 'Member':

2
erpnext/accounts/doctype/payment_gateway_account/payment_gateway_account_dashboard.py

@ -1,5 +1,3 @@
def get_data(): def get_data():
return { return {
'fieldname': 'payment_gateway_account', 'fieldname': 'payment_gateway_account',

2
erpnext/accounts/doctype/payment_order/payment_order_dashboard.py

@ -1,5 +1,3 @@
def get_data(): def get_data():
return { return {
'fieldname': 'payment_order', 'fieldname': 'payment_order',

1
erpnext/accounts/doctype/payment_term/payment_term_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

1
erpnext/accounts/doctype/payment_terms_template/payment_terms_template_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

6
erpnext/accounts/doctype/pos_invoice/pos_invoice.py

@ -5,7 +5,6 @@
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import cint, flt, get_link_to_form, getdate, nowdate from frappe.utils import cint, flt, get_link_to_form, getdate, nowdate
from six import iteritems
from erpnext.accounts.doctype.loyalty_program.loyalty_program import validate_loyalty_points from erpnext.accounts.doctype.loyalty_program.loyalty_program import validate_loyalty_points
from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request from erpnext.accounts.doctype.payment_request.payment_request import make_payment_request
@ -364,7 +363,7 @@ class POSInvoice(SalesInvoice):
for item in self.get("items"): for item in self.get("items"):
if item.get('item_code'): if item.get('item_code'):
profile_details = get_pos_profile_item_details(profile.get("company"), frappe._dict(item.as_dict()), profile) profile_details = get_pos_profile_item_details(profile.get("company"), frappe._dict(item.as_dict()), profile)
for fname, val in iteritems(profile_details): for fname, val in profile_details.items():
if (not for_validate) or (for_validate and not item.get(fname)): if (not for_validate) or (for_validate and not item.get(fname)):
item.set(fname, val) item.set(fname, val)
@ -524,9 +523,8 @@ def make_sales_return(source_name, target_doc=None):
def make_merge_log(invoices): def make_merge_log(invoices):
import json import json
from six import string_types
if isinstance(invoices, string_types): if isinstance(invoices, str):
invoices = json.loads(invoices) invoices = json.loads(invoices)
if len(invoices) == 0: if len(invoices) == 0:

3
erpnext/accounts/doctype/pos_invoice_merge_log/pos_invoice_merge_log.py

@ -5,7 +5,6 @@
import json import json
import frappe import frappe
import six
from frappe import _ from frappe import _
from frappe.core.page.background_jobs.background_jobs import get_info from frappe.core.page.background_jobs.background_jobs import get_info
from frappe.model.document import Document from frappe.model.document import Document
@ -282,7 +281,7 @@ def unconsolidate_pos_invoices(closing_entry):
def create_merge_logs(invoice_by_customer, closing_entry=None): def create_merge_logs(invoice_by_customer, closing_entry=None):
try: try:
for customer, invoices in six.iteritems(invoice_by_customer): for customer, invoices in invoice_by_customer.items():
merge_log = frappe.new_doc('POS Invoice Merge Log') merge_log = frappe.new_doc('POS Invoice Merge Log')
merge_log.posting_date = getdate(closing_entry.get('posting_date')) if closing_entry else nowdate() merge_log.posting_date = getdate(closing_entry.get('posting_date')) if closing_entry else nowdate()
merge_log.customer = customer merge_log.customer = customer

3
erpnext/accounts/doctype/pos_profile/pos_profile.py

@ -6,7 +6,6 @@ import frappe
from frappe import _, msgprint from frappe import _, msgprint
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import get_link_to_form, now from frappe.utils import get_link_to_form, now
from six import iteritems
class POSProfile(Document): class POSProfile(Document):
@ -37,7 +36,7 @@ class POSProfile(Document):
self.expense_account], "Cost Center": [self.cost_center], self.expense_account], "Cost Center": [self.cost_center],
"Warehouse": [self.warehouse]} "Warehouse": [self.warehouse]}
for link_dt, dn_list in iteritems(accounts): for link_dt, dn_list in accounts.items():
for link_dn in dn_list: for link_dn in dn_list:
if link_dn and not frappe.db.exists({"doctype": link_dt, if link_dn and not frappe.db.exists({"doctype": link_dt,
"company": self.company, "name": link_dn}): "company": self.company, "name": link_dn}):

9
erpnext/accounts/doctype/pricing_rule/pricing_rule.py

@ -11,7 +11,6 @@ import frappe
from frappe import _, throw from frappe import _, throw
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import cint, flt, getdate from frappe.utils import cint, flt, getdate
from six import string_types
apply_on_dict = {"Item Code": "items", apply_on_dict = {"Item Code": "items",
"Item Group": "item_groups", "Brand": "brands"} "Item Group": "item_groups", "Brand": "brands"}
@ -178,7 +177,7 @@ def apply_pricing_rule(args, doc=None):
} }
""" """
if isinstance(args, string_types): if isinstance(args, str):
args = json.loads(args) args = json.loads(args)
args = frappe._dict(args) args = frappe._dict(args)
@ -234,7 +233,7 @@ def get_pricing_rule_for_item(args, price_list_rate=0, doc=None, for_validate=Fa
get_product_discount_rule, get_product_discount_rule,
) )
if isinstance(doc, string_types): if isinstance(doc, str):
doc = json.loads(doc) doc = json.loads(doc)
if doc: if doc:
@ -270,7 +269,7 @@ def get_pricing_rule_for_item(args, price_list_rate=0, doc=None, for_validate=Fa
for pricing_rule in pricing_rules: for pricing_rule in pricing_rules:
if not pricing_rule: continue if not pricing_rule: continue
if isinstance(pricing_rule, string_types): if isinstance(pricing_rule, str):
pricing_rule = frappe.get_cached_doc("Pricing Rule", pricing_rule) pricing_rule = frappe.get_cached_doc("Pricing Rule", pricing_rule)
pricing_rule.apply_rule_on_other_items = get_pricing_rule_items(pricing_rule) pricing_rule.apply_rule_on_other_items = get_pricing_rule_items(pricing_rule)
@ -427,7 +426,7 @@ def remove_pricing_rule_for_item(pricing_rules, item_details, item_code=None):
@frappe.whitelist() @frappe.whitelist()
def remove_pricing_rules(item_list): def remove_pricing_rules(item_list):
if isinstance(item_list, string_types): if isinstance(item_list, str):
item_list = json.loads(item_list) item_list = json.loads(item_list)
out = [] out = []

3
erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py

@ -6,7 +6,6 @@ import frappe
from frappe import _, throw from frappe import _, throw
from frappe.model.mapper import get_mapped_doc from frappe.model.mapper import get_mapped_doc
from frappe.utils import cint, cstr, flt, formatdate, get_link_to_form, getdate, nowdate from frappe.utils import cint, cstr, flt, formatdate, get_link_to_form, getdate, nowdate
from six import iteritems
import erpnext import erpnext
from erpnext.accounts.deferred_revenue import validate_service_stop_date from erpnext.accounts.deferred_revenue import validate_service_stop_date
@ -600,7 +599,7 @@ class PurchaseInvoice(BuyingController):
# Amount added through landed-cost-voucher # Amount added through landed-cost-voucher
if landed_cost_entries: if landed_cost_entries:
for account, amount in iteritems(landed_cost_entries[(item.item_code, item.name)]): for account, amount in landed_cost_entries[(item.item_code, item.name)].items():
gl_entries.append(self.get_gl_dict({ gl_entries.append(self.get_gl_dict({
"account": account, "account": account,
"against": item.expense_account, "against": item.expense_account,

1
erpnext/accounts/doctype/purchase_invoice/purchase_invoice_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

1
erpnext/accounts/doctype/purchase_taxes_and_charges_template/purchase_taxes_and_charges_template_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

5
erpnext/accounts/doctype/sales_invoice/sales_invoice.py

@ -18,7 +18,6 @@ from frappe.utils import (
getdate, getdate,
nowdate, nowdate,
) )
from six import iteritems
import erpnext import erpnext
from erpnext.accounts.deferred_revenue import validate_service_stop_date from erpnext.accounts.deferred_revenue import validate_service_stop_date
@ -533,7 +532,7 @@ class SalesInvoice(SellingController):
for item in self.get("items"): for item in self.get("items"):
if item.get('item_code'): if item.get('item_code'):
profile_details = get_pos_profile_item_details(pos, frappe._dict(item.as_dict()), pos, update_data=True) profile_details = get_pos_profile_item_details(pos, frappe._dict(item.as_dict()), pos, update_data=True)
for fname, val in iteritems(profile_details): for fname, val in profile_details.items():
if (not for_validate) or (for_validate and not item.get(fname)): if (not for_validate) or (for_validate and not item.get(fname)):
item.set(fname, val) item.set(fname, val)
@ -639,7 +638,7 @@ class SalesInvoice(SellingController):
return return
prev_doc_field_map = {'Sales Order': ['so_required', 'is_pos'],'Delivery Note': ['dn_required', 'update_stock']} prev_doc_field_map = {'Sales Order': ['so_required', 'is_pos'],'Delivery Note': ['dn_required', 'update_stock']}
for key, value in iteritems(prev_doc_field_map): for key, value in prev_doc_field_map.items():
if frappe.db.get_single_value('Selling Settings', value[0]) == 'Yes': if frappe.db.get_single_value('Selling Settings', value[0]) == 'Yes':
if frappe.get_value('Customer', self.customer, value[0]): if frappe.get_value('Customer', self.customer, value[0]):

1
erpnext/accounts/doctype/sales_invoice/sales_invoice_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

5
erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py

@ -8,7 +8,6 @@ import frappe
from frappe.model.dynamic_links import get_dynamic_link_map from frappe.model.dynamic_links import get_dynamic_link_map
from frappe.model.naming import make_autoname from frappe.model.naming import make_autoname
from frappe.utils import add_days, flt, getdate, nowdate from frappe.utils import add_days, flt, getdate, nowdate
from six import iteritems
import erpnext import erpnext
from erpnext.accounts.doctype.account.test_account import create_account, get_inventory_account from erpnext.accounts.doctype.account.test_account import create_account, get_inventory_account
@ -345,7 +344,7 @@ class TestSalesInvoice(unittest.TestCase):
# check if item values are calculated # check if item values are calculated
for i, d in enumerate(si.get("items")): for i, d in enumerate(si.get("items")):
for k, v in iteritems(expected_values[i]): for k, v in expected_values[i].items():
self.assertEqual(d.get(k), v) self.assertEqual(d.get(k), v)
# check net total # check net total
@ -648,7 +647,7 @@ class TestSalesInvoice(unittest.TestCase):
# check if item values are calculated # check if item values are calculated
for i, d in enumerate(si.get("items")): for i, d in enumerate(si.get("items")):
for key, val in iteritems(expected_values[i]): for key, val in expected_values[i].items():
self.assertEqual(d.get(key), val) self.assertEqual(d.get(key), val)
# check net total # check net total

1
erpnext/accounts/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

1
erpnext/accounts/doctype/share_type/share_type_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

2
erpnext/accounts/doctype/shareholder/shareholder_dashboard.py

@ -1,5 +1,3 @@
def get_data(): def get_data():
return { return {
'fieldname': 'shareholder', 'fieldname': 'shareholder',

1
erpnext/accounts/doctype/shipping_rule/shipping_rule_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

1
erpnext/accounts/doctype/subscription/subscription.py

@ -1,4 +1,3 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt # For license information, please see license.txt

1
erpnext/accounts/doctype/subscription_plan/subscription_plan_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

1
erpnext/accounts/doctype/tax_category/tax_category_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

3
erpnext/accounts/doctype/tax_rule/tax_rule.py

@ -10,7 +10,6 @@ from frappe.contacts.doctype.address.address import get_default_address
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import cint, cstr from frappe.utils import cint, cstr
from frappe.utils.nestedset import get_root_of from frappe.utils.nestedset import get_root_of
from six import iteritems
from erpnext.setup.doctype.customer_group.customer_group import get_parent_customer_groups from erpnext.setup.doctype.customer_group.customer_group import get_parent_customer_groups
@ -148,7 +147,7 @@ def get_tax_template(posting_date, args):
if 'tax_category' in args.keys(): if 'tax_category' in args.keys():
del args['tax_category'] del args['tax_category']
for key, value in iteritems(args): for key, value in args.items():
if key=="use_for_shopping_cart": if key=="use_for_shopping_cart":
conditions.append("use_for_shopping_cart = {0}".format(1 if value else 0)) conditions.append("use_for_shopping_cart = {0}".format(1 if value else 0))
elif key == 'customer_group': elif key == 'customer_group':

3
erpnext/accounts/doctype/tax_rule/test_tax_rule.py

@ -11,7 +11,6 @@ from erpnext.crm.doctype.opportunity.test_opportunity import make_opportunity
test_records = frappe.get_test_records('Tax Rule') test_records = frappe.get_test_records('Tax Rule')
from six import iteritems
class TestTaxRule(unittest.TestCase): class TestTaxRule(unittest.TestCase):
@ -175,7 +174,7 @@ def make_tax_rule(**args):
tax_rule = frappe.new_doc("Tax Rule") tax_rule = frappe.new_doc("Tax Rule")
for key, val in iteritems(args): for key, val in args.items():
if key != "save": if key != "save":
tax_rule.set(key, val) tax_rule.set(key, val)

2
erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category.py

@ -378,7 +378,7 @@ def get_tcs_amount(parties, inv, tax_details, vouchers, adv_vouchers):
current_invoice_total = get_invoice_total_without_tcs(inv, tax_details) current_invoice_total = get_invoice_total_without_tcs(inv, tax_details)
total_invoiced_amt = current_invoice_total + invoiced_amt + advance_amt - credit_note_amt total_invoiced_amt = current_invoice_total + invoiced_amt + advance_amt - credit_note_amt
if ((cumulative_threshold and total_invoiced_amt >= cumulative_threshold)): if (cumulative_threshold and total_invoiced_amt >= cumulative_threshold):
chargeable_amt = total_invoiced_amt - cumulative_threshold chargeable_amt = total_invoiced_amt - cumulative_threshold
tcs_amount = chargeable_amt * tax_details.rate / 100 if chargeable_amt > 0 else 0 tcs_amount = chargeable_amt * tax_details.rate / 100 if chargeable_amt > 0 else 0

2
erpnext/accounts/doctype/tax_withholding_category/tax_withholding_category_dashboard.py

@ -1,5 +1,3 @@
def get_data(): def get_data():
return { return {
'fieldname': 'tax_withholding_category', 'fieldname': 'tax_withholding_category',

2
erpnext/accounts/notification/notification_for_new_fiscal_year/notification_for_new_fiscal_year.py

@ -1,5 +1,3 @@
def get_context(context): def get_context(context):
# do your magic here # do your magic here
pass pass

3
erpnext/accounts/party.py

@ -26,7 +26,6 @@ from frappe.utils import (
getdate, getdate,
nowdate, nowdate,
) )
from six import iteritems
import erpnext import erpnext
from erpnext import get_company_currency from erpnext import get_company_currency
@ -508,7 +507,7 @@ def get_timeline_data(doctype, name):
timeline_items = dict(data) timeline_items = dict(data)
for date, count in iteritems(timeline_items): for date, count in timeline_items.items():
timestamp = get_timestamp(date) timestamp = get_timestamp(date)
out.update({ timestamp: count }) out.update({ timestamp: count })

1
erpnext/accounts/report/account_balance/test_account_balance.py

@ -1,4 +1,3 @@
import unittest import unittest
import frappe import frappe

1
erpnext/accounts/report/accounts_receivable/test_accounts_receivable.py

@ -1,4 +1,3 @@
import unittest import unittest
import frappe import frappe

3
erpnext/accounts/report/accounts_receivable_summary/accounts_receivable_summary.py

@ -5,7 +5,6 @@
import frappe import frappe
from frappe import _, scrub from frappe import _, scrub
from frappe.utils import cint from frappe.utils import cint
from six import iteritems
from erpnext.accounts.party import get_partywise_advanced_payment_amount from erpnext.accounts.party import get_partywise_advanced_payment_amount
from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport from erpnext.accounts.report.accounts_receivable.accounts_receivable import ReceivablePayableReport
@ -37,7 +36,7 @@ class AccountsReceivableSummary(ReceivablePayableReport):
party_advance_amount = get_partywise_advanced_payment_amount(self.party_type, party_advance_amount = get_partywise_advanced_payment_amount(self.party_type,
self.filters.report_date, self.filters.show_future_payments, self.filters.company) or {} self.filters.report_date, self.filters.show_future_payments, self.filters.company) or {}
for party, party_dict in iteritems(self.party_total): for party, party_dict in self.party_total.items():
if party_dict.outstanding == 0: if party_dict.outstanding == 0:
continue continue

3
erpnext/accounts/report/budget_variance_report/budget_variance_report.py

@ -7,7 +7,6 @@ import datetime
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import flt, formatdate from frappe.utils import flt, formatdate
from six import iteritems
from erpnext.controllers.trends import get_period_date_ranges, get_period_month_ranges from erpnext.controllers.trends import get_period_date_ranges, get_period_month_ranges
@ -48,7 +47,7 @@ def execute(filters=None):
return columns, data, None, chart return columns, data, None, chart
def get_final_data(dimension, dimension_items, filters, period_month_ranges, data, DCC_allocation): def get_final_data(dimension, dimension_items, filters, period_month_ranges, data, DCC_allocation):
for account, monthwise_data in iteritems(dimension_items): for account, monthwise_data in dimension_items.items():
row = [dimension, account] row = [dimension, account]
totals = [0, 0, 0] totals = [0, 0, 0]
for year in get_fiscal_years(filters): for year in get_fiscal_years(filters):

3
erpnext/accounts/report/cash_flow/cash_flow.py

@ -5,7 +5,6 @@
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import cint, cstr from frappe.utils import cint, cstr
from six import iteritems
from erpnext.accounts.report.financial_statements import ( from erpnext.accounts.report.financial_statements import (
get_columns, get_columns,
@ -201,7 +200,7 @@ def add_total_row_account(out, data, label, period_list, currency, summary_data,
def get_report_summary(summary_data, currency): def get_report_summary(summary_data, currency):
report_summary = [] report_summary = []
for label, value in iteritems(summary_data): for label, value in summary_data.items():
report_summary.append( report_summary.append(
{ {
"value": value, "value": value,

11
erpnext/accounts/report/customer_ledger_summary/customer_ledger_summary.py

@ -5,7 +5,6 @@
import frappe import frappe
from frappe import _, scrub from frappe import _, scrub
from frappe.utils import getdate, nowdate from frappe.utils import getdate, nowdate
from six import iteritems, itervalues
class PartyLedgerSummaryReport(object): class PartyLedgerSummaryReport(object):
@ -143,9 +142,9 @@ class PartyLedgerSummaryReport(object):
self.party_data[gle.party].paid_amount -= amount self.party_data[gle.party].paid_amount -= amount
out = [] out = []
for party, row in iteritems(self.party_data): for party, row in self.party_data.items():
if row.opening_balance or row.invoiced_amount or row.paid_amount or row.return_amount or row.closing_amount: if row.opening_balance or row.invoiced_amount or row.paid_amount or row.return_amount or row.closing_amount:
total_party_adjustment = sum(amount for amount in itervalues(self.party_adjustment_details.get(party, {}))) total_party_adjustment = sum(amount for amount in self.party_adjustment_details.get(party, {}).values())
row.paid_amount -= total_party_adjustment row.paid_amount -= total_party_adjustment
adjustments = self.party_adjustment_details.get(party, {}) adjustments = self.party_adjustment_details.get(party, {})
@ -267,7 +266,7 @@ class PartyLedgerSummaryReport(object):
adjustment_voucher_entries.setdefault((gle.voucher_type, gle.voucher_no), []) adjustment_voucher_entries.setdefault((gle.voucher_type, gle.voucher_no), [])
adjustment_voucher_entries[(gle.voucher_type, gle.voucher_no)].append(gle) adjustment_voucher_entries[(gle.voucher_type, gle.voucher_no)].append(gle)
for voucher_gl_entries in itervalues(adjustment_voucher_entries): for voucher_gl_entries in adjustment_voucher_entries.values():
parties = {} parties = {}
accounts = {} accounts = {}
has_irrelevant_entry = False has_irrelevant_entry = False
@ -287,7 +286,7 @@ class PartyLedgerSummaryReport(object):
if parties and accounts: if parties and accounts:
if len(parties) == 1: if len(parties) == 1:
party = list(parties.keys())[0] party = list(parties.keys())[0]
for account, amount in iteritems(accounts): for account, amount in accounts.items():
self.party_adjustment_accounts.add(account) self.party_adjustment_accounts.add(account)
self.party_adjustment_details.setdefault(party, {}) self.party_adjustment_details.setdefault(party, {})
self.party_adjustment_details[party].setdefault(account, 0) self.party_adjustment_details[party].setdefault(account, 0)
@ -295,7 +294,7 @@ class PartyLedgerSummaryReport(object):
elif len(accounts) == 1 and not has_irrelevant_entry: elif len(accounts) == 1 and not has_irrelevant_entry:
account = list(accounts.keys())[0] account = list(accounts.keys())[0]
self.party_adjustment_accounts.add(account) self.party_adjustment_accounts.add(account)
for party, amount in iteritems(parties): for party, amount in parties.items():
self.party_adjustment_details.setdefault(party, {}) self.party_adjustment_details.setdefault(party, {})
self.party_adjustment_details[party].setdefault(account, 0) self.party_adjustment_details[party].setdefault(account, 0)
self.party_adjustment_details[party][account] += amount self.party_adjustment_details[party][account] += amount

3
erpnext/accounts/report/dimension_wise_accounts_balance_report/dimension_wise_accounts_balance_report.py

@ -5,7 +5,6 @@
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import cstr, flt from frappe.utils import cstr, flt
from six import itervalues
import erpnext import erpnext
from erpnext.accounts.report.financial_statements import ( from erpnext.accounts.report.financial_statements import (
@ -107,7 +106,7 @@ def set_gl_entries_by_account(dimension_items_list, filters, account, gl_entries
def format_gl_entries(gl_entries_by_account, accounts_by_name, dimension_items_list): def format_gl_entries(gl_entries_by_account, accounts_by_name, dimension_items_list):
for entries in itervalues(gl_entries_by_account): for entries in gl_entries_by_account.values():
for entry in entries: for entry in entries:
d = accounts_by_name.get(entry.account) d = accounts_by_name.get(entry.account)
if not d: if not d:

4
erpnext/accounts/report/financial_statements.py

@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt
@ -10,7 +9,6 @@ import re
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import add_days, add_months, cint, cstr, flt, formatdate, get_first_day, getdate from frappe.utils import add_days, add_months, cint, cstr, flt, formatdate, get_first_day, getdate
from six import itervalues
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import ( from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
get_accounting_dimensions, get_accounting_dimensions,
@ -188,7 +186,7 @@ def get_appropriate_currency(company, filters=None):
def calculate_values( def calculate_values(
accounts_by_name, gl_entries_by_account, period_list, accumulated_values, ignore_accumulated_values_for_fy): accounts_by_name, gl_entries_by_account, period_list, accumulated_values, ignore_accumulated_values_for_fy):
for entries in itervalues(gl_entries_by_account): for entries in gl_entries_by_account.values():
for entry in entries: for entry in entries:
d = accounts_by_name.get(entry.account) d = accounts_by_name.get(entry.account)
if not d: if not d:

3
erpnext/accounts/report/general_ledger/general_ledger.py

@ -7,7 +7,6 @@ from collections import OrderedDict
import frappe import frappe
from frappe import _, _dict from frappe import _, _dict
from frappe.utils import cstr, flt, getdate from frappe.utils import cstr, flt, getdate
from six import iteritems
from erpnext import get_company_currency, get_default_company from erpnext import get_company_currency, get_default_company
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import ( from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
@ -314,7 +313,7 @@ def get_data_with_opening_closing(filters, account_details, accounting_dimension
data.append(totals.opening) data.append(totals.opening)
if filters.get("group_by") != 'Group by Voucher (Consolidated)': if filters.get("group_by") != 'Group by Voucher (Consolidated)':
for acc, acc_dict in iteritems(gle_map): for acc, acc_dict in gle_map.items():
# acc # acc
if acc_dict.entries: if acc_dict.entries:
# opening # opening

1
erpnext/accounts/report/tax_detail/test_tax_detail.py

@ -1,4 +1,3 @@
import datetime import datetime
import json import json
import os import os

1
erpnext/accounts/report/tds_computation_summary/tds_computation_summary.py

@ -1,4 +1,3 @@
import frappe import frappe
from frappe import _ from frappe import _

1
erpnext/accounts/report/utils.py

@ -1,4 +1,3 @@
import frappe import frappe
from frappe.utils import flt, formatdate, get_datetime_str from frappe.utils import flt, formatdate, get_datetime_str

1
erpnext/accounts/test/test_utils.py

@ -1,4 +1,3 @@
import unittest import unittest
from frappe.test_runner import make_test_objects from frappe.test_runner import make_test_objects

3
erpnext/accounts/utils.py

@ -9,7 +9,6 @@ import frappe.defaults
from frappe import _, throw from frappe import _, throw
from frappe.model.meta import get_field_precision from frappe.model.meta import get_field_precision
from frappe.utils import cint, cstr, flt, formatdate, get_number_format_info, getdate, now, nowdate from frappe.utils import cint, cstr, flt, formatdate, get_number_format_info, getdate, now, nowdate
from six import string_types
import erpnext import erpnext
@ -795,7 +794,7 @@ def get_children(doctype, parent, company, is_root=False):
@frappe.whitelist() @frappe.whitelist()
def get_account_balances(accounts, company): def get_account_balances(accounts, company):
if isinstance(accounts, string_types): if isinstance(accounts, str):
accounts = loads(accounts) accounts = loads(accounts)
if not accounts: if not accounts:

1
erpnext/agriculture/doctype/crop/crop_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

7
erpnext/assets/doctype/asset/asset.py

@ -20,7 +20,6 @@ from frappe.utils import (
nowdate, nowdate,
today, today,
) )
from six import string_types
import erpnext import erpnext
from erpnext.accounts.general_ledger import make_reverse_gl_entries from erpnext.accounts.general_ledger import make_reverse_gl_entries
@ -625,7 +624,7 @@ class Asset(AccountsController):
@frappe.whitelist() @frappe.whitelist()
def get_depreciation_rate(self, args, on_validate=False): def get_depreciation_rate(self, args, on_validate=False):
if isinstance(args, string_types): if isinstance(args, str):
args = json.loads(args) args = json.loads(args)
float_precision = cint(frappe.db.get_default("float_precision")) or 2 float_precision = cint(frappe.db.get_default("float_precision")) or 2
@ -820,9 +819,7 @@ def make_journal_entry(asset_name):
def make_asset_movement(assets, purpose=None): def make_asset_movement(assets, purpose=None):
import json import json
from six import string_types if isinstance(assets, str):
if isinstance(assets, string_types):
assets = json.loads(assets) assets = json.loads(assets)
if len(assets) == 0: if len(assets) == 0:

2
erpnext/assets/doctype/asset/asset_dashboard.py

@ -1,5 +1,3 @@
def get_data(): def get_data():
return { return {
'non_standard_fieldnames': { 'non_standard_fieldnames': {

1
erpnext/buying/doctype/purchase_order/purchase_order_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

3
erpnext/buying/doctype/request_for_quotation/request_for_quotation.py

@ -12,7 +12,6 @@ from frappe.model.mapper import get_mapped_doc
from frappe.utils import get_url from frappe.utils import get_url
from frappe.utils.print_format import download_pdf from frappe.utils.print_format import download_pdf
from frappe.utils.user import get_user_fullname from frappe.utils.user import get_user_fullname
from six import string_types
from erpnext.accounts.party import get_party_account_currency, get_party_details from erpnext.accounts.party import get_party_account_currency, get_party_details
from erpnext.buying.utils import validate_for_items from erpnext.buying.utils import validate_for_items
@ -288,7 +287,7 @@ def make_supplier_quotation_from_rfq(source_name, target_doc=None, for_supplier=
# This method is used to make supplier quotation from supplier's portal. # This method is used to make supplier quotation from supplier's portal.
@frappe.whitelist() @frappe.whitelist()
def create_supplier_quotation(doc): def create_supplier_quotation(doc):
if isinstance(doc, string_types): if isinstance(doc, str):
doc = json.loads(doc) doc = json.loads(doc)
try: try:

2
erpnext/buying/doctype/request_for_quotation/request_for_quotation_dashboard.py

@ -1,5 +1,3 @@
def get_data(): def get_data():
return { return {
'docstatus': 1, 'docstatus': 1,

1
erpnext/buying/doctype/supplier/supplier_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

1
erpnext/buying/doctype/supplier_quotation/supplier_quotation_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

1
erpnext/buying/doctype/supplier_scorecard/supplier_scorecard_dashboard.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

1
erpnext/config/education.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

1
erpnext/config/projects.py

@ -1,4 +1,3 @@
from frappe import _ from frappe import _

5
erpnext/controllers/accounts_controller.py

@ -20,7 +20,6 @@ from frappe.utils import (
nowdate, nowdate,
today, today,
) )
from six import text_type
import erpnext import erpnext
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import ( from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import (
@ -1080,7 +1079,7 @@ class AccountsController(TransactionBase):
stock_items = [r[0] for r in frappe.db.sql(""" stock_items = [r[0] for r in frappe.db.sql("""
select name from `tabItem` select name from `tabItem`
where name in (%s) and is_stock_item=1 where name in (%s) and is_stock_item=1
""" % (", ".join((["%s"] * len(item_codes))),), item_codes)] """ % (", ".join(["%s"] * len(item_codes)),), item_codes)]
return stock_items return stock_items
@ -1789,7 +1788,7 @@ def get_payment_terms(terms_template, posting_date=None, grand_total=None, base_
@frappe.whitelist() @frappe.whitelist()
def get_payment_term_details(term, posting_date=None, grand_total=None, base_grand_total=None, bill_date=None): def get_payment_term_details(term, posting_date=None, grand_total=None, base_grand_total=None, bill_date=None):
term_details = frappe._dict() term_details = frappe._dict()
if isinstance(term, text_type): if isinstance(term, str):
term = frappe.get_doc("Payment Term", term) term = frappe.get_doc("Payment Term", term)
else: else:
term_details.payment_term = term.payment_term term_details.payment_term = term.payment_term

11
erpnext/controllers/item_variant.py

@ -8,7 +8,6 @@ import json
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import cstr, flt from frappe.utils import cstr, flt
from six import string_types
class ItemVariantExistsError(frappe.ValidationError): pass class ItemVariantExistsError(frappe.ValidationError): pass
@ -30,7 +29,7 @@ def get_variant(template, args=None, variant=None, manufacturer=None,
return make_variant_based_on_manufacturer(item_template, manufacturer, return make_variant_based_on_manufacturer(item_template, manufacturer,
manufacturer_part_no) manufacturer_part_no)
else: else:
if isinstance(args, string_types): if isinstance(args, str):
args = json.loads(args) args = json.loads(args)
if not args: if not args:
@ -54,7 +53,7 @@ def make_variant_based_on_manufacturer(template, manufacturer, manufacturer_part
return variant return variant
def validate_item_variant_attributes(item, args=None): def validate_item_variant_attributes(item, args=None):
if isinstance(item, string_types): if isinstance(item, str):
item = frappe.get_doc('Item', item) item = frappe.get_doc('Item', item)
if not args: if not args:
@ -156,7 +155,7 @@ def find_variant(template, args, variant_item_code=None):
@frappe.whitelist() @frappe.whitelist()
def create_variant(item, args): def create_variant(item, args):
if isinstance(args, string_types): if isinstance(args, str):
args = json.loads(args) args = json.loads(args)
template = frappe.get_doc("Item", item) template = frappe.get_doc("Item", item)
@ -179,7 +178,7 @@ def create_variant(item, args):
@frappe.whitelist() @frappe.whitelist()
def enqueue_multiple_variant_creation(item, args): def enqueue_multiple_variant_creation(item, args):
# There can be innumerable attribute combinations, enqueue # There can be innumerable attribute combinations, enqueue
if isinstance(args, string_types): if isinstance(args, str):
variants = json.loads(args) variants = json.loads(args)
total_variants = 1 total_variants = 1
for key in variants: for key in variants:
@ -196,7 +195,7 @@ def enqueue_multiple_variant_creation(item, args):
def create_multiple_variants(item, args): def create_multiple_variants(item, args):
count = 0 count = 0
if isinstance(args, string_types): if isinstance(args, str):
args = json.loads(args) args = json.loads(args)
args_set = generate_keyed_value_combinations(args) args_set = generate_keyed_value_combinations(args)

2
erpnext/controllers/taxes_and_totals.py

@ -176,7 +176,7 @@ class calculate_taxes_and_totals(object):
self.doc.round_floats_in(tax) self.doc.round_floats_in(tax)
def determine_exclusive_rate(self): def determine_exclusive_rate(self):
if not any((cint(tax.included_in_print_rate) for tax in self.doc.get("taxes"))): if not any(cint(tax.included_in_print_rate) for tax in self.doc.get("taxes")):
return return
for item in self.doc.get("items"): for item in self.doc.get("items"):

4
erpnext/controllers/tests/test_item_variant.py

@ -1,9 +1,7 @@
import json import json
import unittest import unittest
import frappe import frappe
from six import string_types
from erpnext.controllers.item_variant import copy_attributes_to_variant, make_variant_item_code from erpnext.controllers.item_variant import copy_attributes_to_variant, make_variant_item_code
from erpnext.stock.doctype.item.test_item import set_item_variant_settings from erpnext.stock.doctype.item.test_item import set_item_variant_settings
@ -20,7 +18,7 @@ class TestItemVariant(unittest.TestCase):
self.assertEqual(variant.get("quality_inspection_template"), "_Test QC Template") self.assertEqual(variant.get("quality_inspection_template"), "_Test QC Template")
def create_variant_with_tables(item, args): def create_variant_with_tables(item, args):
if isinstance(args, string_types): if isinstance(args, str):
args = json.loads(args) args = json.loads(args)
qc_name = make_quality_inspection_template() qc_name = make_quality_inspection_template()

1
erpnext/controllers/tests/test_mapper.py

@ -1,4 +1,3 @@
import json import json
import unittest import unittest

1
erpnext/controllers/tests/test_qty_based_taxes.py

@ -1,4 +1,3 @@
import unittest import unittest
from uuid import uuid4 as _uuid4 from uuid import uuid4 as _uuid4

3
erpnext/crm/doctype/contract_template/contract_template.py

@ -7,7 +7,6 @@ import json
import frappe import frappe
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils.jinja import validate_template from frappe.utils.jinja import validate_template
from six import string_types
class ContractTemplate(Document): class ContractTemplate(Document):
@ -17,7 +16,7 @@ class ContractTemplate(Document):
@frappe.whitelist() @frappe.whitelist()
def get_contract_template(template_name, doc): def get_contract_template(template_name, doc):
if isinstance(doc, string_types): if isinstance(doc, str):
doc = json.loads(doc) doc = json.loads(doc)
contract_template = frappe.get_doc("Contract Template", template_name) contract_template = frappe.get_doc("Contract Template", template_name)

2
erpnext/crm/doctype/lead/lead_dashboard.py

@ -1,5 +1,3 @@
def get_data(): def get_data():
return { return {
'fieldname': 'lead', 'fieldname': 'lead',

2
erpnext/crm/doctype/opportunity/opportunity_dashboard.py

@ -1,5 +1,3 @@
def get_data(): def get_data():
return { return {
'fieldname': 'opportunity', 'fieldname': 'opportunity',

1
erpnext/crm/doctype/utils.py

@ -1,4 +1,3 @@
import frappe import frappe

5
erpnext/crm/report/opportunity_summary_by_sales_stage/opportunity_summary_by_sales_stage.py

@ -6,7 +6,6 @@ import frappe
import pandas import pandas
from frappe import _ from frappe import _
from frappe.utils import flt from frappe.utils import flt
from six import iteritems
from erpnext.setup.utils import get_exchange_rate from erpnext.setup.utils import get_exchange_rate
@ -126,7 +125,7 @@ class OpportunitySummaryBySalesStage(object):
self.data = [] self.data = []
self.get_formatted_data() self.get_formatted_data()
for based_on,data in iteritems(self.formatted_data): for based_on,data in self.formatted_data.items():
row_based_on={ row_based_on={
'Opportunity Owner': 'opportunity_owner', 'Opportunity Owner': 'opportunity_owner',
'Source': 'source', 'Source': 'source',
@ -251,4 +250,4 @@ class OpportunitySummaryBySalesStage(object):
if data.get('currency') != default_currency: if data.get('currency') != default_currency:
opportunity_currency = data.get('currency') opportunity_currency = data.get('currency')
value = self.currency_conversion(opportunity_currency,default_currency) value = self.currency_conversion(opportunity_currency,default_currency)
data['amount'] = data['amount'] * value data['amount'] = data['amount'] * value

5
erpnext/crm/report/sales_pipeline_analytics/sales_pipeline_analytics.py

@ -9,7 +9,6 @@ import pandas
from dateutil.relativedelta import relativedelta from dateutil.relativedelta import relativedelta
from frappe import _ from frappe import _
from frappe.utils import cint, flt from frappe.utils import cint, flt
from six import iteritems
from erpnext.setup.utils import get_exchange_rate from erpnext.setup.utils import get_exchange_rate
@ -295,7 +294,7 @@ class SalesPipelineAnalytics(object):
def append_data(self, pipeline_by, period_by): def append_data(self, pipeline_by, period_by):
self.data = [] self.data = []
for pipeline,period_data in iteritems(self.periodic_data): for pipeline,period_data in self.periodic_data.items():
row = {pipeline_by : pipeline} row = {pipeline_by : pipeline}
for info in self.query_result: for info in self.query_result:
if self.filters.get('range') == 'Monthly': if self.filters.get('range') == 'Monthly':
@ -330,4 +329,4 @@ class SalesPipelineAnalytics(object):
if data.get('currency') != default_currency: if data.get('currency') != default_currency:
opportunity_currency = data.get('currency') opportunity_currency = data.get('currency')
value = self.get_currency_rate(opportunity_currency,default_currency) value = self.get_currency_rate(opportunity_currency,default_currency)
data['amount'] = data['amount'] * value data['amount'] = data['amount'] * value

1
erpnext/demo/demo.py

@ -1,4 +1,3 @@
import sys import sys
import frappe import frappe

1
erpnext/demo/domains.py

@ -1,4 +1,3 @@
data = { data = {
'Manufacturing': { 'Manufacturing': {
'company_name': 'Wind Power LLC' 'company_name': 'Wind Power LLC'

4
erpnext/demo/setup/manufacture.py

@ -1,10 +1,8 @@
import json import json
import random import random
import frappe import frappe
from frappe.utils import add_days, nowdate from frappe.utils import add_days, nowdate
from six import iteritems
from erpnext.demo.domains import data from erpnext.demo.domains import data
from erpnext.demo.setup.setup_data import import_json from erpnext.demo.setup.setup_data import import_json
@ -130,7 +128,7 @@ def setup_item_price():
} }
for price_list in ("standard_buying", "standard_selling"): for price_list in ("standard_buying", "standard_selling"):
for item, rate in iteritems(locals().get(price_list)): for item, rate in locals().get(price_list).items():
frappe.get_doc({ frappe.get_doc({
"doctype": "Item Price", "doctype": "Item Price",
"price_list": price_list.replace("_", " ").title(), "price_list": price_list.replace("_", " ").title(),

4
erpnext/demo/setup/retail.py

@ -1,8 +1,6 @@
import json import json
import frappe import frappe
from six import iteritems
from erpnext.demo.domains import data from erpnext.demo.domains import data
@ -52,7 +50,7 @@ def setup_item_price():
} }
for price_list in ("standard_buying", "standard_selling"): for price_list in ("standard_buying", "standard_selling"):
for item, rate in iteritems(locals().get(price_list)): for item, rate in locals().get(price_list).items():
frappe.get_doc({ frappe.get_doc({
"doctype": "Item Price", "doctype": "Item Price",
"price_list": price_list.replace("_", " ").title(), "price_list": price_list.replace("_", " ").title(),

1
erpnext/demo/setup/setup_data.py

@ -1,4 +1,3 @@
import json import json
import random import random

1
erpnext/demo/user/accounts.py

@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt

1
erpnext/demo/user/education.py

@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt

1
erpnext/demo/user/fixed_asset.py

@ -1,4 +1,3 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt # License: GNU General Public License v3. See license.txt

1
erpnext/demo/user/hr.py

@ -1,4 +1,3 @@
import datetime import datetime
import random import random

1
erpnext/domains/agriculture.py

@ -1,4 +1,3 @@
data = { data = {
'desktop_icons': [ 'desktop_icons': [
'Agriculture Task', 'Agriculture Task',

1
erpnext/domains/distribution.py

@ -1,4 +1,3 @@
data = { data = {
'desktop_icons': [ 'desktop_icons': [
'Item', 'Item',

1
erpnext/domains/education.py

@ -1,4 +1,3 @@
data = { data = {
'desktop_icons': [ 'desktop_icons': [
'Student', 'Student',

1
erpnext/domains/hospitality.py

@ -1,4 +1,3 @@
data = { data = {
'desktop_icons': [ 'desktop_icons': [
'Restaurant', 'Restaurant',

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save