Merge branch '1310' of github.com:webnotes/erpnext
This commit is contained in:
parent
daaa14c079
commit
b03f870441
@ -20,4 +20,4 @@ def execute():
|
|||||||
os.system("rm -rf {path}".format(path=path))
|
os.system("rm -rf {path}".format(path=path))
|
||||||
|
|
||||||
if webnotes.conn.exists("DocType", "For Territory"):
|
if webnotes.conn.exists("DocType", "For Territory"):
|
||||||
webnotes.delete_doc("DocType", "For Territory")
|
webnotes.delete_doc("DocType", "For Territory")
|
||||||
|
@ -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))
|
@ -236,4 +236,5 @@ patch_list = [
|
|||||||
"patches.october_2013.p06_update_control_panel_and_global_defaults",
|
"patches.october_2013.p06_update_control_panel_and_global_defaults",
|
||||||
"patches.october_2013.p07_rename_for_territory",
|
"patches.october_2013.p07_rename_for_territory",
|
||||||
"patches.june_2013.p07_taxes_price_list_for_territory",
|
"patches.june_2013.p07_taxes_price_list_for_territory",
|
||||||
|
"patches.october_2013.p08_cleanup_after_item_price_module_change",
|
||||||
]
|
]
|
@ -124,7 +124,9 @@ def set_defaults(args):
|
|||||||
'default_currency': args.get('currency'),
|
'default_currency': args.get('currency'),
|
||||||
'default_company':args.get('company_name'),
|
'default_company':args.get('company_name'),
|
||||||
'date_format': webnotes.conn.get_value("Country", args.get("country"), "date_format"),
|
'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()
|
global_defaults.save()
|
||||||
|
|
||||||
@ -164,9 +166,7 @@ def set_defaults(args):
|
|||||||
|
|
||||||
# control panel
|
# control panel
|
||||||
cp = webnotes.doc("Control Panel", "Control Panel")
|
cp = webnotes.doc("Control Panel", "Control Panel")
|
||||||
for k in ['country', 'timezone', 'company_name']:
|
cp.company_name = args["company_name"]
|
||||||
cp.fields[k] = args[k]
|
|
||||||
|
|
||||||
cp.save()
|
cp.save()
|
||||||
|
|
||||||
def create_feed_and_todo():
|
def create_feed_and_todo():
|
||||||
|
@ -7,7 +7,7 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
from webnotes import _
|
from webnotes import _
|
||||||
|
|
||||||
class ItemPriceDuplicateItem(Exception): pass
|
class ItemPriceDuplicateItem(webnotes.ValidationError): pass
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, d, dl):
|
def __init__(self, d, dl):
|
||||||
@ -30,6 +30,10 @@ class DocType:
|
|||||||
if webnotes.conn.sql("""select name from `tabItem Price`
|
if webnotes.conn.sql("""select name from `tabItem Price`
|
||||||
where item_code=%s and price_list=%s and name!=%s""",
|
where item_code=%s and price_list=%s and name!=%s""",
|
||||||
(self.doc.item_code, self.doc.price_list, self.doc.name)):
|
(self.doc.item_code, self.doc.price_list, self.doc.name)):
|
||||||
webnotes.throw(_("Duplicate Item: ") + self.doc.item_code +
|
webnotes.throw("{duplicate_item}: {item_code}, {already}: {price_list}".format(**{
|
||||||
_(" already available in Price List: ") + self.doc.price_list,
|
"duplicate_item": _("Duplicate Item"),
|
||||||
ItemPriceDuplicateItem)
|
"item_code": self.doc.item_code,
|
||||||
|
"already": _("already available in Price List"),
|
||||||
|
"price_list": self.doc.price_list
|
||||||
|
}), ItemPriceDuplicateItem)
|
||||||
|
|
@ -4,12 +4,12 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import unittest
|
import unittest
|
||||||
import webnotes
|
import webnotes
|
||||||
from setup.doctype.item_price.item_price import ItemPriceDuplicateItem
|
|
||||||
|
|
||||||
class TestItem(unittest.TestCase):
|
class TestItem(unittest.TestCase):
|
||||||
def test_duplicate_item(self):
|
def test_duplicate_item(self):
|
||||||
item_price = webnotes.bean(copy=test_records[0])
|
from stock.doctype.item_price.item_price import ItemPriceDuplicateItem
|
||||||
self.assertRaises(ItemPriceDuplicateItem, item_price.insert)
|
bean = webnotes.bean(copy=test_records[0])
|
||||||
|
self.assertRaises(ItemPriceDuplicateItem, bean.insert)
|
||||||
|
|
||||||
test_records = [
|
test_records = [
|
||||||
[
|
[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user