[minor] [fixes] view in website and other fixes

This commit is contained in:
Anand Doshi 2013-10-10 15:43:32 +05:30
parent 7798934989
commit b604eddbfd
7 changed files with 24 additions and 13 deletions

View File

@ -202,7 +202,7 @@ class DocType(SellingController):
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)

View File

@ -7,6 +7,12 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
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) {

View File

@ -17,9 +17,8 @@ def setup_account(args=None):
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)

View File

@ -11,14 +11,16 @@ cur_frm.cscript.refresh = function(doc) {
&& 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);
}
}

View File

@ -14,6 +14,9 @@ from webnotes.model.controller import DocListController
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

View File

@ -14,9 +14,9 @@ class SerialNoCannotCreateDirectError(webnotes.ValidationError): pass
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):

View File

@ -15,6 +15,7 @@ def make_demo_app(site=None):
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