mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 04:09:11 +00:00
chore: remove all six compat code
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -9,7 +9,6 @@ import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils import cstr, flt
|
||||
from six import iteritems
|
||||
|
||||
from erpnext.regional.india import state_numbers
|
||||
|
||||
@@ -281,7 +280,7 @@ class GSTR3BReport(Document):
|
||||
|
||||
if self.get('invoice_items'):
|
||||
# Build itemised tax for export invoices, nil and exempted where tax table is blank
|
||||
for invoice, items in iteritems(self.invoice_items):
|
||||
for invoice, items in self.invoice_items.items():
|
||||
if invoice not in self.items_based_on_tax_rate and self.invoice_detail_map.get(invoice, {}).get('export_type') \
|
||||
== "Without Payment of Tax" and self.invoice_detail_map.get(invoice, {}).get('gst_category') == "Overseas":
|
||||
self.items_based_on_tax_rate.setdefault(invoice, {}).setdefault(0, items.keys())
|
||||
@@ -349,7 +348,7 @@ class GSTR3BReport(Document):
|
||||
self.report_dict['sup_details']['isup_rev']['txval'] += taxable_value
|
||||
|
||||
def set_inter_state_supply(self, inter_state_supply):
|
||||
for key, value in iteritems(inter_state_supply):
|
||||
for key, value in inter_state_supply.items():
|
||||
if key[0] == "Unregistered":
|
||||
self.report_dict["inter_sup"]["unreg_details"].append(value)
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# coding: utf-8
|
||||
"""Constants used in datev.py."""
|
||||
|
||||
TRANSACTION_COLUMNS = [
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# coding: utf-8
|
||||
|
||||
import datetime
|
||||
import zipfile
|
||||
from csv import QUOTE_NONNUMERIC
|
||||
@@ -45,7 +43,7 @@ def get_datev_csv(data, filters, csv_class):
|
||||
|
||||
data = result.to_csv(
|
||||
# Reason for str(';'): https://github.com/pandas-dev/pandas/issues/6035
|
||||
sep=str(';'),
|
||||
sep=';',
|
||||
# European decimal seperator
|
||||
decimal=',',
|
||||
# Windows "ANSI" encoding
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
from six import iteritems
|
||||
|
||||
states = [
|
||||
'',
|
||||
'Andaman and Nicobar Islands',
|
||||
@@ -82,4 +80,4 @@ state_numbers = {
|
||||
"West Bengal": "19",
|
||||
}
|
||||
|
||||
number_state_mapping = {v: k for k, v in iteritems(state_numbers)}
|
||||
number_state_mapping = {v: k for k, v in state_numbers.items()}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
@@ -6,7 +5,6 @@ import frappe
|
||||
from frappe import _
|
||||
from frappe.model.utils import get_fetch_values
|
||||
from frappe.utils import cint, cstr, date_diff, flt, getdate, nowdate
|
||||
from six import string_types
|
||||
|
||||
from erpnext.controllers.accounts_controller import get_taxes_and_charges
|
||||
from erpnext.controllers.taxes_and_totals import get_itemised_tax, get_itemised_taxable_amount
|
||||
@@ -193,7 +191,7 @@ def get_place_of_supply(party_details, doctype):
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_regional_address_details(party_details, doctype, company):
|
||||
if isinstance(party_details, string_types):
|
||||
if isinstance(party_details, str):
|
||||
party_details = json.loads(party_details)
|
||||
party_details = frappe._dict(party_details)
|
||||
|
||||
@@ -790,7 +788,7 @@ def get_regional_round_off_accounts(company, account_list):
|
||||
if country != 'India':
|
||||
return
|
||||
|
||||
if isinstance(account_list, string_types):
|
||||
if isinstance(account_list, str):
|
||||
account_list = json.loads(account_list)
|
||||
|
||||
if not frappe.db.get_single_value('GST Settings', 'round_off_gst_values'):
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# coding=utf-8
|
||||
|
||||
fiscal_regimes = [
|
||||
"RF01-Ordinario",
|
||||
"RF02-Contribuenti minimi (art.1, c.96-117, L. 244/07)",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import io
|
||||
import json
|
||||
|
||||
@@ -6,7 +5,6 @@ import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import cstr, flt
|
||||
from frappe.utils.file_manager import remove_file
|
||||
from six import string_types
|
||||
|
||||
from erpnext.controllers.taxes_and_totals import get_itemised_tax
|
||||
from erpnext.regional.italy import state_codes
|
||||
@@ -167,7 +165,7 @@ def get_invoice_summary(items, taxes):
|
||||
if tax.rate == 0:
|
||||
for item in items:
|
||||
item_tax_rate = item.item_tax_rate
|
||||
if isinstance(item.item_tax_rate, string_types):
|
||||
if isinstance(item.item_tax_rate, str):
|
||||
item_tax_rate = json.loads(item.item_tax_rate)
|
||||
|
||||
if item_tax_rate and tax.account_head in item_tax_rate:
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# coding: utf-8
|
||||
"""
|
||||
Provide a report and downloadable CSV according to the German DATEV format.
|
||||
|
||||
@@ -12,7 +11,6 @@ import json
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
from six import string_types
|
||||
|
||||
from erpnext.accounts.utils import get_fiscal_year
|
||||
from erpnext.regional.germany.utils.datev.datev_constants import (
|
||||
@@ -545,7 +543,7 @@ def download_datev_csv(filters):
|
||||
Arguments / Params:
|
||||
filters -- dict of filters to be passed to the sql query
|
||||
"""
|
||||
if isinstance(filters, string_types):
|
||||
if isinstance(filters, str):
|
||||
filters = json.loads(filters)
|
||||
|
||||
validate(filters)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# coding=utf-8
|
||||
|
||||
import zipfile
|
||||
from unittest import TestCase
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ from datetime import date
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt, formatdate, getdate
|
||||
from six import iteritems
|
||||
|
||||
from erpnext.regional.india.utils import get_gst_accounts
|
||||
|
||||
@@ -123,7 +122,7 @@ class Gstr1Report(object):
|
||||
row["cess_amount"] += flt(self.invoice_cess.get(inv), 2)
|
||||
row["type"] = "E" if ecommerce_gstin else "OE"
|
||||
|
||||
for key, value in iteritems(b2cs_output):
|
||||
for key, value in b2cs_output.items():
|
||||
self.data.append(value)
|
||||
|
||||
def get_row_data_for_invoice(self, invoice, invoice_details, tax_rate, items):
|
||||
@@ -317,7 +316,7 @@ class Gstr1Report(object):
|
||||
+ "<br>" + "<br>".join(unidentified_gst_accounts), alert=True)
|
||||
|
||||
# Build itemised tax for export invoices where tax table is blank
|
||||
for invoice, items in iteritems(self.invoice_items):
|
||||
for invoice, items in self.invoice_items.items():
|
||||
if invoice not in self.items_based_on_tax_rate and invoice not in unidentified_gst_accounts_invoice \
|
||||
and self.invoices.get(invoice, {}).get('export_type') == "Without Payment of Tax" \
|
||||
and self.invoices.get(invoice, {}).get('gst_category') == "Overseas":
|
||||
@@ -782,7 +781,7 @@ def get_b2b_json(res, gstin):
|
||||
b2b_item, inv = {"ctin": gst_in, "inv": []}, []
|
||||
if not gst_in: continue
|
||||
|
||||
for number, invoice in iteritems(res[gst_in]):
|
||||
for number, invoice in res[gst_in].items():
|
||||
if not invoice[0]["place_of_supply"]:
|
||||
frappe.throw(_("""{0} not entered in Invoice {1}.
|
||||
Please update and try again""").format(frappe.bold("Place Of Supply"),
|
||||
@@ -851,7 +850,7 @@ def get_b2cs_json(data, gstin):
|
||||
def get_advances_json(data, gstin):
|
||||
company_state_number = gstin[0:2]
|
||||
out = []
|
||||
for place_of_supply, items in iteritems(data):
|
||||
for place_of_supply, items in data.items():
|
||||
supply_type = "INTRA" if company_state_number == place_of_supply.split('-')[0] else "INTER"
|
||||
row = {
|
||||
"pos": place_of_supply.split('-')[0],
|
||||
@@ -933,7 +932,7 @@ def get_cdnr_reg_json(res, gstin):
|
||||
cdnr_item, inv = {"ctin": gst_in, "nt": []}, []
|
||||
if not gst_in: continue
|
||||
|
||||
for number, invoice in iteritems(res[gst_in]):
|
||||
for number, invoice in res[gst_in].items():
|
||||
if not invoice[0]["place_of_supply"]:
|
||||
frappe.throw(_("""{0} not entered in Invoice {1}.
|
||||
Please update and try again""").format(frappe.bold("Place Of Supply"),
|
||||
@@ -964,7 +963,7 @@ def get_cdnr_reg_json(res, gstin):
|
||||
def get_cdnr_unreg_json(res, gstin):
|
||||
out = []
|
||||
|
||||
for invoice, items in iteritems(res):
|
||||
for invoice, items in res.items():
|
||||
inv_item = {
|
||||
"nt_num": items[0]["invoice_number"],
|
||||
"nt_dt": getdate(items[0]["posting_date"]).strftime('%d-%m-%Y'),
|
||||
|
||||
@@ -8,7 +8,6 @@ import frappe
|
||||
from frappe import _
|
||||
from frappe.model.meta import get_field_precision
|
||||
from frappe.utils import cstr, flt, getdate
|
||||
from six import iteritems
|
||||
|
||||
import erpnext
|
||||
from erpnext.regional.india.utils import get_gst_accounts
|
||||
@@ -212,7 +211,7 @@ def get_merged_data(columns, data):
|
||||
else:
|
||||
merged_hsn_dict[row[0]][d['fieldname']] = row[i]
|
||||
|
||||
for key, value in iteritems(merged_hsn_dict):
|
||||
for key, value in merged_hsn_dict.items():
|
||||
result.append(value)
|
||||
|
||||
return result
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# coding=utf-8
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
import frappe
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
|
||||
def setup(company=None, patch=True):
|
||||
pass
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt, money_in_words, round_based_on_smallest_currency_fraction
|
||||
from six import iteritems
|
||||
|
||||
import erpnext
|
||||
from erpnext.controllers.taxes_and_totals import get_itemised_tax
|
||||
@@ -23,7 +21,7 @@ def update_itemised_tax_data(doc):
|
||||
# First check if tax rate is present
|
||||
# If not then look up in item_wise_tax_detail
|
||||
if item_tax_rate:
|
||||
for account, rate in iteritems(item_tax_rate):
|
||||
for account, rate in item_tax_rate.items():
|
||||
tax_rate += rate
|
||||
elif row.item_code and itemised_tax.get(row.item_code):
|
||||
tax_rate = sum([tax.get('tax_rate', 0) for d, tax in itemised_tax.get(row.item_code).items()])
|
||||
|
||||
Reference in New Issue
Block a user