[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

@@ -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):