Fixed iteritems and exceptions

This commit is contained in:
Achilles Rasquinha 2018-02-13 19:05:54 +05:30
parent bb821ec2af
commit 5cf536b39d
5 changed files with 13 additions and 7 deletions

View File

@ -11,6 +11,8 @@ from frappe.contacts.doctype.address.address import get_default_address
from frappe.utils.nestedset import get_root_of
from erpnext.setup.doctype.customer_group.customer_group import get_parent_customer_groups
from six import iteritems
class IncorrectCustomerGroup(frappe.ValidationError): pass
class IncorrectSupplierType(frappe.ValidationError): pass
class ConflictingTaxRule(frappe.ValidationError): pass
@ -133,7 +135,7 @@ def get_tax_template(posting_date, args):
conditions = ["""(from_date is null or from_date <= '{0}')
and (to_date is null or to_date >= '{0}')""".format(posting_date)]
for key, value in args.iteritems():
for key, value in iteritems(args):
if key=="use_for_shopping_cart":
conditions.append("use_for_shopping_cart = {0}".format(1 if value else 0))
if key == 'customer_group':

View File

@ -167,9 +167,9 @@ def make_holiday(holiday_list_name):
current_fiscal_year = get_fiscal_year(nowdate(), as_dict=True)
dt = getdate(nowdate())
new_year = dt + relativedelta(month=01, day=01, year=dt.year)
republic_day = dt + relativedelta(month=01, day=26, year=dt.year)
test_holiday = dt + relativedelta(month=02, day=02, year=dt.year)
new_year = dt + relativedelta(month=1, day=1, year=dt.year)
republic_day = dt + relativedelta(month=1, day=26, year=dt.year)
test_holiday = dt + relativedelta(month=2, day=2, year=dt.year)
frappe.get_doc({
'doctype': 'Holiday List',

View File

@ -8,4 +8,4 @@ def execute():
from frappe.modules.patch_handler import executed
last_v3_patch = 'patches.1401.fix_pos_outstanding'
if not executed(last_v3_patch):
raise Exception, "site not ready to migrate to version 4"
raise Exception("site not ready to migrate to version 4")

View File

@ -17,9 +17,11 @@ from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
from erpnext.accounts.doctype.account.test_account import get_inventory_account
from erpnext.stock.doctype.stock_entry.stock_entry import move_sample_to_retention_warehouse
from six import iteritems
def get_sle(**args):
condition, values = "", []
for key, value in args.iteritems():
for key, value in iteritems(args.iteritems):
condition += " and " if condition else " where "
condition += "`{0}`=%s".format(key)
values.append(value)

View File

@ -8,6 +8,8 @@ from frappe.utils import cint, flt, cstr, now
from erpnext.stock.utils import get_valuation_method
import json
from six import iteritems
# future reposting
class NegativeStockError(frappe.ValidationError): pass
@ -87,7 +89,7 @@ class update_entries_after(object):
"allow_negative_stock"))
self.args = args
for key, value in args.iteritems():
for key, value in iteritems(args):
setattr(self, key, value)
self.previous_sle = self.get_sle_before_datetime()