Ver a proveniência

Merge branch 'master' of github.com:webnotes/wnframework

version-14
Rushabh Mehta há 12 anos
ascendente
cometimento
06abc79c4a
10 ficheiros alterados com 67 adições e 48 eliminações
  1. +19
    -6
      core/doctype/bulk_email/bulk_email.txt
  2. +30
    -20
      public/js/wn/form/dashboard.js
  3. +1
    -1
      public/js/wn/misc/number_format.js
  4. +1
    -1
      public/js/wn/model/meta.js
  5. +1
    -1
      public/js/wn/views/grid_report.js
  6. +1
    -1
      webnotes/model/controller.py
  7. +2
    -2
      webnotes/model/doclist.py
  8. +1
    -1
      webnotes/model/meta.py
  9. +0
    -10
      webnotes/profile.py
  10. +11
    -5
      webnotes/utils/email_lib/bulk.py

+ 19
- 6
core/doctype/bulk_email/bulk_email.txt Ver ficheiro

@@ -2,7 +2,7 @@
{
"creation": "2012-08-02 15:17:28",
"docstatus": 0,
"modified": "2013-07-05 14:29:33",
"modified": "2013-08-06 15:36:00",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -31,7 +31,8 @@
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1
"read": 1,
"role": "System Manager"
},
{
"doctype": "DocType",
@@ -68,11 +69,23 @@
"label": "Error"
},
{
"doctype": "DocPerm",
"role": "Administrator"
"doctype": "DocField",
"fieldname": "ref_doctype",
"fieldtype": "Link",
"label": "Reference DocType",
"options": "DocType",
"read_only": 1,
"reqd": 1
},
{
"doctype": "DocPerm",
"role": "System Manager"
"doctype": "DocField",
"fieldname": "ref_docname",
"fieldtype": "Data",
"label": "Reference DocName",
"read_only": 1,
"reqd": 1
},
{
"doctype": "DocPerm"
}
]

+ 30
- 20
public/js/wn/form/dashboard.js Ver ficheiro

@@ -60,35 +60,45 @@ wn.ui.form.Dashboard = Class.extend({
});
},
add_progress: function(title, percent) {
var width = cint(percent) < 1 ? 1 : percent;
var progress_chart = this.make_progress_chart(title);
var progress_class = "";
if(width < 10)
progress_class = "progress-bar-danger";
if(width > 99.9)
progress_class = "progress-bar-success";
if(!$.isArray(percent)) {
var width = cint(percent) < 1 ? 1 : percent;
var progress_class = "";
if(width < 10)
progress_class = "progress-bar-danger";
if(width > 99.9)
progress_class = "progress-bar-success";
percent = [{
title: title,
width: width,
progress_class: progress_class
}];
}
var progress = $('<div class="progress"></div>').appendTo(progress_chart);
$.each(percent, function(i, opts) {
$(repl('<div class="progress-bar %(progress_class)s" style="width: %(width)s%" \
title="%(title)s"></div>', opts)).appendTo(progress);
});
this.wrapper.toggle(true);
},
make_progress_chart: function(title) {
var progress_area = this.body.find(".progress-area");
if(!progress_area.length) {
progress_area = $('<div class="progress-area">').appendTo(this.body);
}
$(repl('<div class="progress-chart">\
<h5>%(title)s</h5>\
<div class="progress">\
<div class="progress-bar %(progress_class)s" style="width: %(width)s%"></div>\
</div>\
</div>', {
title:title,
width: width,
progress_class: progress_class
})).appendTo(progress_area);
var progress_chart = $('<div class="progress-chart"><h5>'+title+'</h5></div>')
.appendTo(progress_area);
var n_charts = progress_area.find(".progress-chart").length,
cols = Math.floor(12 / n_charts);
progress_area.find(".progress-chart")
.removeClass().addClass("progress-chart col col-lg-" + cols);
this.wrapper.toggle(true);
return progress_chart;
}
})
});

+ 1
- 1
public/js/wn/misc/number_format.js Ver ficheiro

@@ -66,7 +66,7 @@ wn.number_format_info = {
window.format_number = function(v, format, decimals){
if (!format) {
format = get_number_format();
if(decimals == null) decimals = cint(wn.defaults.get_default("float_precision")) || 6;
if(decimals == null) decimals = cint(wn.defaults.get_default("float_precision")) || 3;
}

info = get_number_format_info(format);


+ 1
- 1
public/js/wn/model/meta.js Ver ficheiro

@@ -139,7 +139,7 @@ $.extend(wn.meta, {
},
get_field_precision: function(df, doc) {
var precision = wn.defaults.get_default("float_precision") || 6;
var precision = wn.defaults.get_default("float_precision") || 3;
if(df && df.fieldtype === "Currency") {
var currency = this.get_field_currency(df, doc);
var number_format = get_number_format(currency);


+ 1
- 1
public/js/wn/views/grid_report.js Ver ficheiro

@@ -329,7 +329,7 @@ wn.views.GridReport = Class.extend({
var me = this;
$.each(this.columns, function(i, col) {
if (col.formatter==me.currency_formatter) {
item[col.id] = flt(item[col.id], wn.defaults.get_default("float_precision") || 6);
item[col.id] = flt(item[col.id], wn.defaults.get_default("float_precision") || 3);
}
});
},


+ 1
- 1
webnotes/model/controller.py Ver ficheiro

@@ -91,7 +91,7 @@ class DocListController(object):
if not hasattr(self, "_precision"):
self._precision = webnotes._dict({
"default": cint(webnotes.conn.get_default("float_precision")) or 6,
"default": cint(webnotes.conn.get_default("float_precision")) or 3,
"options": {}
})


+ 2
- 2
webnotes/model/doclist.py Ver ficheiro

@@ -65,9 +65,9 @@ class DocList(list):
def get_item_value(self, d, name):
if isinstance(d, dict):
return d[name]
return d.get(name)
else:
return d.fields[name]
return d.fields.get(name)
def filter_valid_fields(self):
import webnotes.model


+ 1
- 1
webnotes/model/meta.py Ver ficheiro

@@ -96,6 +96,6 @@ def get_field_precision(df, doc):
decimal_str, comma_str, precision = get_number_format_info(number_format)

if df.fieldtype == "Float":
precision = cint(webnotes.conn.get_default("float_precision")) or 6
precision = cint(webnotes.conn.get_default("float_precision")) or 3

return precision

+ 0
- 10
webnotes/profile.py Ver ficheiro

@@ -37,17 +37,8 @@ class Profile:
self.doctype_map = {}
for r in webnotes.conn.sql("""select name, in_create, issingle, istable,
read_only, module from tabDocType""", as_dict=1):
r['child_tables'] = []
self.doctype_map[r['name']] = r
for r in webnotes.conn.sql("""select parent, options from tabDocField
where fieldtype="Table"
and parent not like "old_parent:%%"
and ifnull(docstatus,0)=0
"""):
if r[0] in self.doctype_map:
self.doctype_map[r[0]]['child_tables'].append(r[1])
def build_perm_map(self):
"""build map of permissions at level 0"""
@@ -100,7 +91,6 @@ class Profile:
if (p.get('read') or p.get('write') or p.get('create')):
if p.get('report'):
self.can_get_report.append(dt)
self.can_get_report += dtp['child_tables']
if not dtp.get('istable'):
if not dtp.get('issingle') and not dtp.get('read_only'):
self.can_search.append(dt)


+ 11
- 5
webnotes/utils/email_lib/bulk.py Ver ficheiro

@@ -9,7 +9,7 @@ from webnotes.utils import cint
class BulkLimitCrossedError(webnotes.ValidationError): pass

def send(recipients=None, sender=None, doctype='Profile', email_field='email',
subject='[No Subject]', message='[No Content]'):
subject='[No Subject]', message='[No Content]', ref_doctype=None, ref_docname=None):
"""send bulk mail if not unsubscribed and within conf.bulk_mail_limit"""
import webnotes
@@ -69,9 +69,9 @@ def send(recipients=None, sender=None, doctype='Profile', email_field='email',
if not is_unsubscribed(doc):
# add to queue
add(r, sender, subject, update_message(doc), text_content)
add(r, sender, subject, update_message(doc), text_content, ref_doctype, ref_docname)

def add(email, sender, subject, message, text_content = None):
def add(email, sender, subject, message, text_content=None, ref_doctype=None, ref_docname=None):
"""add to bulk mail queue"""
from webnotes.utils.email_lib.smtp import get_email
@@ -86,6 +86,8 @@ def add(email, sender, subject, message, text_content = None):
return
e.status = 'Not Sent'
e.ref_doctype = ref_doctype
e.ref_docname = ref_docname
e.save()
@webnotes.whitelist(allow_guest=True)
@@ -108,12 +110,16 @@ def unsubscribe():
def flush(from_test=False):
"""flush email queue, every time: called from scheduler"""
import webnotes
import webnotes, conf
from webnotes.utils.email_lib.smtp import SMTPServer, get_email
smptserver = SMTPServer()
auto_commit = not from_test
if webnotes.mute_emails or getattr(conf, "mute_emails", False):
webnotes.msgprint("Emails are muted")
from_test = True

for i in xrange(500):
email = webnotes.conn.sql("""select * from `tabBulk Email` where


Carregando…
Cancelar
Guardar