Merge branch 'edge' of github.com:webnotes/wnframework into webshop
This commit is contained in:
commit
d6432930e1
12 changed files with 55 additions and 18 deletions
|
|
@ -1295,11 +1295,11 @@ _f.ButtonField.prototype.make_input = function() { var me = this;
|
|||
}
|
||||
|
||||
_f.ButtonField.prototype.hide = function() {
|
||||
$dh(this.button_area);
|
||||
$dh(this.wrapper);
|
||||
};
|
||||
|
||||
_f.ButtonField.prototype.show = function() {
|
||||
$ds(this.button_area);
|
||||
$ds(this.wrapper);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ wn.form.formatters = {
|
|||
parseInt(wn.boot.sysdefaults.float_precision) : null;
|
||||
|
||||
return "<div style='text-align: right'>" +
|
||||
format_number(value, null, decimals) + "</div>";
|
||||
((value==null || value==="") ? "" :
|
||||
format_number(value, null, decimals)) + "</div>";
|
||||
},
|
||||
Int: function(value) {
|
||||
return cint(value);
|
||||
|
|
|
|||
|
|
@ -205,7 +205,6 @@ wn.views.CommunicationComposer = Class.extend({
|
|||
})
|
||||
|
||||
_p.build(form_values.select_print_format || "", function(print_format_html) {
|
||||
me.dialog.hide();
|
||||
if(form_values.attach_document_print) {
|
||||
var print_html = print_format_html
|
||||
if(cint(wn.boot.send_print_in_body_and_attachment)) {
|
||||
|
|
@ -238,7 +237,10 @@ wn.views.CommunicationComposer = Class.extend({
|
|||
if(!r.exc) {
|
||||
if(form_values.send_email)
|
||||
msgprint("Email sent to " + form_values.recipients);
|
||||
me.dialog.hide();
|
||||
cur_frm.reload_doc();
|
||||
} else {
|
||||
msgprint("There were errors while sending email. Please try again.")
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -129,7 +129,8 @@ wn.views.QueryReport = Class.extend({
|
|||
.css({
|
||||
"display": "inline-block",
|
||||
"margin-left": "5px",
|
||||
"margin-bottom": "2px"
|
||||
"margin-bottom": "4px",
|
||||
"margin-top": "4px"
|
||||
})
|
||||
.attr("title", df.label).tooltip();
|
||||
me.filters.push(f);
|
||||
|
|
|
|||
|
|
@ -46,9 +46,12 @@
|
|||
<p style="text-align: center" id="forgot-wrapper">
|
||||
<a id="forgot-password" style="cursor:pointer"
|
||||
onclick="return login.show_forgot_password()">Forgot Password</a></p>
|
||||
|
||||
{% if not disable_signup %}
|
||||
<p style="text-align: center" id="sign-up-wrapper">
|
||||
New user? <a id="sign-up" style="cursor:pointer"
|
||||
onclick="return login.sign_up()">Sign Up</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="web-footer login-footer container">
|
||||
|
|
|
|||
|
|
@ -309,6 +309,9 @@ class Database:
|
|||
return ret and ((len(ret[0]) > 1 or as_dict) and ret[0] or ret[0][0]) or None
|
||||
|
||||
def get_values(self, doctype, filters=None, fieldname="name", ignore=None, as_dict=False, debug=False):
|
||||
if isinstance(filters, list):
|
||||
return self.get_value_for_many_names(doctype, filters, fieldname, debug=debug)
|
||||
|
||||
fields = fieldname
|
||||
if fieldname!="*":
|
||||
if isinstance(fieldname, basestring):
|
||||
|
|
@ -367,6 +370,15 @@ class Database:
|
|||
|
||||
return r
|
||||
|
||||
def get_value_for_many_names(self, doctype, names, field, debug=False):
|
||||
names = filter(None, names)
|
||||
|
||||
if names:
|
||||
return dict(self.sql("select name, `%s` from `tab%s` where name in (%s)" \
|
||||
% (field, doctype, ", ".join(["%s"]*len(names))), names, debug=debug))
|
||||
else:
|
||||
return {}
|
||||
|
||||
def set_value(self, dt, dn, field, val, modified=None, modified_by=None):
|
||||
from webnotes.utils import now
|
||||
if dn and dt!=dn:
|
||||
|
|
|
|||
|
|
@ -536,11 +536,14 @@ def make_autoname(key, doctype=''):
|
|||
"""
|
||||
n = ''
|
||||
l = key.split('.')
|
||||
series_set = False
|
||||
for e in l:
|
||||
en = ''
|
||||
if e.startswith('#'):
|
||||
digits = len(e)
|
||||
en = getseries(n, digits, doctype)
|
||||
if not series_set:
|
||||
digits = len(e)
|
||||
en = getseries(n, digits, doctype)
|
||||
series_set = True
|
||||
elif e=='YY':
|
||||
import time
|
||||
en = time.strftime('%y')
|
||||
|
|
|
|||
|
|
@ -29,7 +29,8 @@ class DocList(list):
|
|||
def get(self, filters, limit=0):
|
||||
"""pass filters as:
|
||||
{"key": "val", "key": ["!=", "val"],
|
||||
"key": ["in", "val"], "key": ["not in", "val"], "key": "^val"}"""
|
||||
"key": ["in", "val"], "key": ["not in", "val"], "key": "^val",
|
||||
"key" : True (exists), "key": False (does not exist) }"""
|
||||
|
||||
out = []
|
||||
|
||||
|
|
@ -39,7 +40,11 @@ class DocList(list):
|
|||
for f in filters:
|
||||
fval = filters[f]
|
||||
|
||||
if not isinstance(fval, list):
|
||||
if fval==True:
|
||||
fval = ["not None", fval]
|
||||
elif fval==False:
|
||||
fval = ["None", fval]
|
||||
elif not isinstance(fval, list):
|
||||
if isinstance(fval, basestring) and fval.startswith("^"):
|
||||
fval = ["^", fval[1:]]
|
||||
else:
|
||||
|
|
@ -55,6 +60,9 @@ class DocList(list):
|
|||
break
|
||||
|
||||
return DocList(out)
|
||||
|
||||
def get_distinct_values(self, fieldname):
|
||||
return list(set(map(lambda d: d.fields.get(fieldname), self)))
|
||||
|
||||
def remove_items(self, filters):
|
||||
for d in self.get(filters):
|
||||
|
|
|
|||
|
|
@ -825,6 +825,8 @@ operator_map = {
|
|||
"<": lambda (a, b): operator.lt(a, b),
|
||||
">=": lambda (a, b): operator.ge(a, b),
|
||||
"<=": lambda (a, b): operator.le(a, b),
|
||||
"not None": lambda (a, b): a and True or False,
|
||||
"None": lambda (a, b): (not a) and True or False
|
||||
}
|
||||
|
||||
def compare(val1, condition, val2):
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import extract_email_id, convert_utc_to_user_timezone
|
||||
|
||||
class IncomingMail:
|
||||
|
|
@ -31,7 +32,6 @@ class IncomingMail:
|
|||
import email
|
||||
import email.utils
|
||||
import datetime
|
||||
import time
|
||||
|
||||
self.mail = email.message_from_string(content)
|
||||
|
||||
|
|
|
|||
|
|
@ -52,14 +52,19 @@ def execute():
|
|||
|
||||
out = []
|
||||
|
||||
# if first task of the day execute daily tasks
|
||||
nowtime = webnotes.utils.now_datetime()
|
||||
last = webnotes.conn.get_global('scheduler_last_event')
|
||||
|
||||
# set scheduler last event
|
||||
webnotes.conn.begin()
|
||||
webnotes.conn.set_global('scheduler_last_event', nowtime.strftime(format))
|
||||
webnotes.conn.commit()
|
||||
|
||||
if last:
|
||||
last = datetime.strptime(last, format)
|
||||
|
||||
if nowtime.day != last.day:
|
||||
|
||||
# if first task of the day execute daily tasks
|
||||
out.append('daily:' + trigger('execute_daily'))
|
||||
|
||||
if nowtime.month != last.month:
|
||||
|
|
@ -73,10 +78,6 @@ def execute():
|
|||
|
||||
out.append('all:' + trigger('execute_all'))
|
||||
|
||||
webnotes.conn.begin()
|
||||
webnotes.conn.set_global('scheduler_last_event', nowtime.strftime(format))
|
||||
webnotes.conn.commit()
|
||||
|
||||
return '\n'.join(out)
|
||||
|
||||
def trigger(method):
|
||||
|
|
@ -90,12 +91,16 @@ def trigger(method):
|
|||
webnotes.conn.commit()
|
||||
return 'ok'
|
||||
|
||||
except Exception, e:
|
||||
except Exception:
|
||||
return log(method)
|
||||
|
||||
def log(method):
|
||||
"""log error in patch_log"""
|
||||
import webnotes
|
||||
|
||||
if not (webnotes.conn and webnotes.conn._conn):
|
||||
webnotes.connect()
|
||||
|
||||
webnotes.conn.rollback()
|
||||
traceback = webnotes.getTraceback()
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ def run(report_name, filters=None):
|
|||
+ ".report." + scrub(report.name) + "." + scrub(report.name) + ".execute"
|
||||
columns, result = webnotes.get_method(method_name)(filters or {})
|
||||
|
||||
if cint(report.add_total_row):
|
||||
if cint(report.add_total_row) and result:
|
||||
result = add_total_row(result, columns)
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue