[minor] fixes after item price move
This commit is contained in:
parent
2ced381976
commit
3673a25176
@ -14,8 +14,9 @@ def execute():
|
|||||||
|
|
||||||
webnotes.reload_doc("setup", "doctype", "applicable_territory")
|
webnotes.reload_doc("setup", "doctype", "applicable_territory")
|
||||||
|
|
||||||
if os.path.exists("app/setup/doctype/for_territory"):
|
path = os.path.join(get_base_path(), "app", "setup", "doctype", "for_territory")
|
||||||
os.system("rm -rf app/setup/doctype/for_territory")
|
if os.path.exists(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))
|
@ -229,4 +229,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",
|
||||||
]
|
]
|
@ -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…
Reference in New Issue
Block a user