Merge branch '1310' of github.com:webnotes/erpnext
diff --git a/patches/october_2013/p07_rename_for_territory.py b/patches/october_2013/p07_rename_for_territory.py
index 240a957..520f3bc 100644
--- a/patches/october_2013/p07_rename_for_territory.py
+++ b/patches/october_2013/p07_rename_for_territory.py
@@ -20,4 +20,4 @@
os.system("rm -rf {path}".format(path=path))
if webnotes.conn.exists("DocType", "For Territory"):
- webnotes.delete_doc("DocType", "For Territory")
\ No newline at end of file
+ webnotes.delete_doc("DocType", "For Territory")
diff --git a/patches/october_2013/p08_cleanup_after_item_price_module_change.py b/patches/october_2013/p08_cleanup_after_item_price_module_change.py
new file mode 100644
index 0000000..4169d96
--- /dev/null
+++ b/patches/october_2013/p08_cleanup_after_item_price_module_change.py
@@ -0,0 +1,13 @@
+# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
+# License: GNU General Public License v3. See license.txt
+
+from __future__ import unicode_literals
+import webnotes, os
+
+def execute():
+ from webnotes.utils import get_base_path
+
+ for dt in ("item_price", "price_list"):
+ path = os.path.join(get_base_path(), "app", "setup", "doctype", dt)
+ if os.path.exists(path):
+ os.system("rm -rf {path}".format(path=path))
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index e55991b..1581841 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -236,4 +236,5 @@
"patches.october_2013.p06_update_control_panel_and_global_defaults",
"patches.october_2013.p07_rename_for_territory",
"patches.june_2013.p07_taxes_price_list_for_territory",
+ "patches.october_2013.p08_cleanup_after_item_price_module_change",
]
\ No newline at end of file
diff --git a/setup/page/setup_wizard/setup_wizard.py b/setup/page/setup_wizard/setup_wizard.py
index 7ed9300..61af55b 100644
--- a/setup/page/setup_wizard/setup_wizard.py
+++ b/setup/page/setup_wizard/setup_wizard.py
@@ -124,7 +124,9 @@
'default_currency': args.get('currency'),
'default_company':args.get('company_name'),
'date_format': webnotes.conn.get_value("Country", args.get("country"), "date_format"),
- "float_precision": 4
+ "float_precision": 3,
+ "country": args.get("country"),
+ "time_zone": args.get("time_zone")
})
global_defaults.save()
@@ -164,9 +166,7 @@
# control panel
cp = webnotes.doc("Control Panel", "Control Panel")
- for k in ['country', 'timezone', 'company_name']:
- cp.fields[k] = args[k]
-
+ cp.company_name = args["company_name"]
cp.save()
def create_feed_and_todo():
diff --git a/stock/doctype/item_price/item_price.py b/stock/doctype/item_price/item_price.py
index be235de..b398326 100644
--- a/stock/doctype/item_price/item_price.py
+++ b/stock/doctype/item_price/item_price.py
@@ -7,7 +7,7 @@
import webnotes
from webnotes import _
-class ItemPriceDuplicateItem(Exception): pass
+class ItemPriceDuplicateItem(webnotes.ValidationError): pass
class DocType:
def __init__(self, d, dl):
@@ -30,6 +30,10 @@
if webnotes.conn.sql("""select name from `tabItem Price`
where item_code=%s and price_list=%s and name!=%s""",
(self.doc.item_code, self.doc.price_list, self.doc.name)):
- webnotes.throw(_("Duplicate Item: ") + self.doc.item_code +
- _(" already available in Price List: ") + self.doc.price_list,
- ItemPriceDuplicateItem)
\ No newline at end of file
+ webnotes.throw("{duplicate_item}: {item_code}, {already}: {price_list}".format(**{
+ "duplicate_item": _("Duplicate Item"),
+ "item_code": self.doc.item_code,
+ "already": _("already available in Price List"),
+ "price_list": self.doc.price_list
+ }), ItemPriceDuplicateItem)
+
\ No newline at end of file
diff --git a/stock/doctype/item_price/test_item_price.py b/stock/doctype/item_price/test_item_price.py
index 43694da..73b8a8c 100644
--- a/stock/doctype/item_price/test_item_price.py
+++ b/stock/doctype/item_price/test_item_price.py
@@ -4,12 +4,12 @@
from __future__ import unicode_literals
import unittest
import webnotes
-from setup.doctype.item_price.item_price import ItemPriceDuplicateItem
class TestItem(unittest.TestCase):
def test_duplicate_item(self):
- item_price = webnotes.bean(copy=test_records[0])
- self.assertRaises(ItemPriceDuplicateItem, item_price.insert)
+ from stock.doctype.item_price.item_price import ItemPriceDuplicateItem
+ bean = webnotes.bean(copy=test_records[0])
+ self.assertRaises(ItemPriceDuplicateItem, bean.insert)
test_records = [
[