task listview and added footer to email digest
This commit is contained in:
parent
f64372ba81
commit
5af4056cff
@ -9,30 +9,41 @@ wn.doclistviews['Task'] = wn.views.ListView.extend({
|
|||||||
'`tabTask`.priority',
|
'`tabTask`.priority',
|
||||||
'`tabTask`.allocated_to',
|
'`tabTask`.allocated_to',
|
||||||
]);
|
]);
|
||||||
|
this.stats = this.stats.concat(['status']);
|
||||||
|
},
|
||||||
|
|
||||||
|
label_style: {
|
||||||
|
"status": {
|
||||||
|
"Open": "danger",
|
||||||
|
"Closed": "success",
|
||||||
|
"Hold": "info",
|
||||||
|
"Waiting for Customer": "info"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
prepare_data: function(data) {
|
prepare_data: function(data) {
|
||||||
this._super(data);
|
this._super(data);
|
||||||
data.opening_date = wn.datetime.str_to_user(data.opening_date);
|
|
||||||
|
data.label_style = this.label_style.status[data.status];
|
||||||
|
|
||||||
|
data.status_html = repl('<span class="label \
|
||||||
|
label-%(label_style)s">%(status)s</span>', data);
|
||||||
|
|
||||||
|
// escape double quotes
|
||||||
|
data.description = cstr(data.subject)
|
||||||
|
+ " | " + cstr(data.description);
|
||||||
|
|
||||||
|
data.description = data.description.replace(/"/gi, '\"')
|
||||||
|
.replace(/</gi, '<').replace(/>/gi, '>');
|
||||||
},
|
},
|
||||||
|
|
||||||
columns: [
|
columns: [
|
||||||
{width: '3%', content: 'check'},
|
{width: '3%', content: 'check'},
|
||||||
{width: '5%', content: 'avatar'},
|
{width: '5%', content: 'avatar_modified'},
|
||||||
{width: '3%', content: 'docstatus'},
|
{width: '20%', content:'name'},
|
||||||
{width: '12%', content: 'name'},
|
{width: '10%', content:'status_html'},
|
||||||
{width: '30%', content: 'subject+tags'},
|
{width: '40%', content: 'subject+tags'},
|
||||||
{
|
|
||||||
width: '15%',
|
|
||||||
content: function(parent, data) {
|
|
||||||
$(parent).html(data.status +
|
|
||||||
(data.priority ? " [" + data.priority + "]" : "")
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{width: '20%', content: 'allocated_to'},
|
{width: '20%', content: 'allocated_to'},
|
||||||
{width: '12%', content:'opening_date', css: {
|
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
|
||||||
'text-align': 'right', 'color':'#777'
|
|
||||||
}},
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
@ -28,6 +28,22 @@ content_sequence = ["income_year_to_date", "bank_balance",
|
|||||||
"new_purchase_orders", "new_purchase_receipts", "new_stock_entries",
|
"new_purchase_orders", "new_purchase_receipts", "new_stock_entries",
|
||||||
"new_support_tickets", "new_communications", "new_projects", "open_tickets"]
|
"new_support_tickets", "new_communications", "new_projects", "open_tickets"]
|
||||||
|
|
||||||
|
digest_template = """<h2>%(digest)s</h2>
|
||||||
|
<p style='color: grey'>%(date)s</p>
|
||||||
|
<h4>%(company)s</h4>
|
||||||
|
<hr>
|
||||||
|
%(with_value)s
|
||||||
|
%(no_value)s
|
||||||
|
<hr>
|
||||||
|
<p style="color: #888; font-size: 90%%">To change what you see here,
|
||||||
|
create more digests, go to Setup > Email Digest</p>"""
|
||||||
|
|
||||||
|
row_template = """<p style="%(style)s">
|
||||||
|
<span>%(label)s</span>:
|
||||||
|
<span style="font-weight: bold; font-size: 110%%">
|
||||||
|
<span style="color: grey">%(currency)s</span>%(value)s
|
||||||
|
</span></p>"""
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, doc, doclist=[]):
|
def __init__(self, doc, doclist=[]):
|
||||||
self.doc, self.doclist = doc, doclist
|
self.doc, self.doclist = doc, doclist
|
||||||
@ -87,12 +103,7 @@ class DocType:
|
|||||||
date = self.doc.frequency == "Daily" and formatdate(self.from_date) or \
|
date = self.doc.frequency == "Daily" and formatdate(self.from_date) or \
|
||||||
"%s to %s" % (formatdate(self.from_date), formatdate(self.to_date))
|
"%s to %s" % (formatdate(self.from_date), formatdate(self.to_date))
|
||||||
|
|
||||||
msg = """<h2>%(digest)s</h2>
|
msg = digest_template % {
|
||||||
<p style='color: grey'>%(date)s</p>
|
|
||||||
<h4>%(company)s</h4>
|
|
||||||
<hr>
|
|
||||||
%(with_value)s
|
|
||||||
%(no_value)s""" % {
|
|
||||||
"digest": self.doc.frequency + " Digest",
|
"digest": self.doc.frequency + " Digest",
|
||||||
"date": date,
|
"date": date,
|
||||||
"company": self.doc.company,
|
"company": self.doc.company,
|
||||||
@ -259,11 +270,7 @@ class DocType:
|
|||||||
|
|
||||||
def get_html(self, label, currency, value, style=None):
|
def get_html(self, label, currency, value, style=None):
|
||||||
"""get html output"""
|
"""get html output"""
|
||||||
return """<p style="%(style)s">
|
return row_template % {
|
||||||
<span>%(label)s</span>:
|
|
||||||
<span style="font-weight: bold; font-size: 110%%">
|
|
||||||
<span style="color: grey">%(currency)s</span>%(value)s
|
|
||||||
</span></p>""" % {
|
|
||||||
"style": style or "",
|
"style": style or "",
|
||||||
"label": label,
|
"label": label,
|
||||||
"currency": currency and (currency+" ") or "",
|
"currency": currency and (currency+" ") or "",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user