[minor] [fixes] view in website and other fixes
diff --git a/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py
index d3ac7ad..af8ea1a 100644
--- a/selling/doctype/sales_order/sales_order.py
+++ b/selling/doctype/sales_order/sales_order.py
@@ -202,7 +202,7 @@
def check_nextdoc_docstatus(self):
# Checks Delivery Note
- submit_dn = webnotes.conn.sql("select t1.name from `tabDelivery Note` t1,`tabDelivery Note Item` t2 where t1.name = t2.parent and t2.prevdoc_docname = '%s' and t1.docstatus = 1" % (self.doc.name))
+ submit_dn = webnotes.conn.sql("select t1.name from `tabDelivery Note` t1,`tabDelivery Note Item` t2 where t1.name = t2.parent and t2.against_sales_order = %s and t1.docstatus = 1", self.doc.name)
if submit_dn:
msgprint("Delivery Note : " + cstr(submit_dn[0][0]) + " has been submitted against " + cstr(self.doc.doctype) + ". Please cancel Delivery Note : " + cstr(submit_dn[0][0]) + " first and then cancel "+ cstr(self.doc.doctype), raise_exception = 1)
diff --git a/setup/doctype/item_group/item_group.js b/setup/doctype/item_group/item_group.js
index 31edef2..0c18db0 100644
--- a/setup/doctype/item_group/item_group.js
+++ b/setup/doctype/item_group/item_group.js
@@ -7,6 +7,12 @@
cur_frm.add_custom_button("Item Group Tree", function() {
wn.set_route("Sales Browser", "Item Group");
})
+
+ if(!doc.__islocal && doc.show_in_website) {
+ cur_frm.add_custom_button("View In Website", function() {
+ window.open(doc.page_name);
+ }, "icon-globe");
+ }
}
cur_frm.cscript.set_root_readonly = function(doc) {
diff --git a/setup/page/setup_wizard/setup_wizard.py b/setup/page/setup_wizard/setup_wizard.py
index 1276763..d506d41 100644
--- a/setup/page/setup_wizard/setup_wizard.py
+++ b/setup/page/setup_wizard/setup_wizard.py
@@ -17,9 +17,8 @@
args = webnotes.local.form_dict
if isinstance(args, basestring):
args = json.loads(args)
-
- webnotes.conn.begin()
-
+ args = webnotes._dict(args)
+
update_profile_name(args)
create_fiscal_year_and_company(args)
set_defaults(args)
diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js
index a83032e..d0b8492 100644
--- a/stock/doctype/item/item.js
+++ b/stock/doctype/item/item.js
@@ -11,14 +11,16 @@
&& doc.__islocal)
cur_frm.toggle_display("item_code", sys_defaults.item_naming_by!="Naming Series"
&& doc.__islocal)
+
+ if(!doc.__islocal && doc.show_in_website) {
+ cur_frm.add_custom_button("View In Website", function() {
+ window.open(doc.page_name);
+ }, "icon-globe");
+ }
-
- if ((!doc.__islocal) && (doc.is_stock_item == 'Yes')) {
- var callback = function(r, rt) {
- var enabled = (r.message == 'exists') ? false : true;
- cur_frm.toggle_enable(['has_serial_no', 'is_stock_item', 'valuation_method'], enabled);
- }
- return $c_obj(make_doclist(doc.doctype, doc.name),'check_if_sle_exists','',callback);
+ if (!doc.__islocal && doc.is_stock_item == 'Yes') {
+ cur_frm.toggle_enable(['has_serial_no', 'is_stock_item', 'valuation_method'],
+ doc.__sle_exists=="exists" ? false : true);
}
}
diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py
index aedb71c..595895f 100644
--- a/stock/doctype/item/item.py
+++ b/stock/doctype/item/item.py
@@ -14,6 +14,9 @@
class WarehouseNotSet(Exception): pass
class DocType(DocListController):
+ def onload(self):
+ self.doc.fields["__sle_exists"] = self.check_if_sle_exists()
+
def autoname(self):
if webnotes.conn.get_default("item_naming_by")=="Naming Series":
from webnotes.model.doc import make_autoname
diff --git a/stock/doctype/serial_no/serial_no.py b/stock/doctype/serial_no/serial_no.py
index 1feab02..3b9704f 100644
--- a/stock/doctype/serial_no/serial_no.py
+++ b/stock/doctype/serial_no/serial_no.py
@@ -14,9 +14,9 @@
class SerialNoCannotCannotChangeError(webnotes.ValidationError): pass
class DocType(StockController):
- def __init__(self, doc, doclist=[]):
+ def __init__(self, doc, doclist=None):
self.doc = doc
- self.doclist = doclist
+ self.doclist = doclist or []
self.via_stock_ledger = False
def validate(self):
diff --git a/utilities/demo/make_erpnext_demo.py b/utilities/demo/make_erpnext_demo.py
index bc25d5e..262a759 100644
--- a/utilities/demo/make_erpnext_demo.py
+++ b/utilities/demo/make_erpnext_demo.py
@@ -15,6 +15,7 @@
make_demo_login_page()
make_demo_on_login_script()
utilities.demo.make_demo.make(reset=False, simulate=True)
+ webnotes.destroy()
def make_demo_user():
from webnotes.auth import _update_password