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

This commit is contained in:
Anand Doshi 2012-10-04 13:54:17 +05:30
commit 278f93c941
19 changed files with 88 additions and 2439 deletions

View File

@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
wn.require("lib/js/wn/views/grid_report.js");
wn.require("app/js/account_tree_grid.js");
wn.pages['financial-analytics'].onload = function(wrapper) {

View File

@ -25,6 +25,8 @@ wn.pages['general-ledger'].onload = function(wrapper) {
}
wn.require("lib/js/wn/views/grid_report.js");
erpnext.GeneralLedger = wn.views.GridReport.extend({
init: function(wrapper) {
this._super({

View File

@ -14,6 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
wn.require("lib/js/wn/views/grid_report.js");
wn.require("app/js/account_tree_grid.js");
wn.pages['trial-balance'].onload = function(wrapper) {

View File

@ -23,6 +23,7 @@ wn.pages['purchase-analytics'].onload = function(wrapper) {
new erpnext.PurchaseAnalytics(wrapper);
}
wn.require("lib/js/wn/views/grid_report.js");
erpnext.PurchaseAnalytics = wn.views.TreeGridReport.extend({
init: function(wrapper) {

View File

@ -18,7 +18,7 @@ erpnext.ActivityFeed = Class.extend({
this.scrub_data(data);
this.add_date_separator(row, data);
$(row).append(sprintf('<div style="margin: 0px">\
<span class="avatar-small"><img src="%(imgsrc)s" /></span> \
<span class="avatar avatar-small"><img src="%(imgsrc)s" /></span> \
<span %(onclick)s class="label %(add_class)s">%(feed_type)s</span>\
%(link)s %(subject)s <span class="user-info">%(by)s</span></div>', data));
},

View File

@ -38,7 +38,7 @@ def execute():
other_charges_deducted = %s,
other_charges_deducted_import = other_charges_deducted / conversion_rate,
grand_total = net_total + other_charges_added - other_charges_deducted,
grand_total_import = grand_total / conversion_rate,
grand_total_import = grand_total / conversion_rate,
total_amount_to_pay = grand_total - total_tds_on_voucher,
outstanding_amount = total_amount_to_pay - total_advance
where
@ -51,11 +51,17 @@ def execute():
update `tab%s`
set
total_tax = %s,
other_charges_added = %s,
other_charges_added_import = other_charges_added / conversion_rate,
other_charges_deducted = %s,
other_charges_deducted_import = other_charges_deducted / conversion_rate,
grand_total = net_total + total_tax,
grand_total_import = grand_total / conversion_rate
grand_total_import = grand_total / conversion_rate,
rounded_total = round(grand_total)
where
name = %s
""" % (d[1], '%s', '%s'), (correct_total_tax, d['parent']))
""" % (d['parenttype'], '%s', '%s', '%s', '%s'),
(correct_total_tax, d['tax_added'], d['tax_ded'], d['parent']))
# set in words
obj = get_obj(d['parenttype'], d['parent'], with_children=1)
@ -70,7 +76,7 @@ def execute():
# fix gl entries
if d['parenttype'] == 'Purchase Invoice' and d['docstatus'] == 1:
webnotes.conn.sql("""update `tabGL Entry` set is_cancelled = 'No'
webnotes.conn.sql("""update `tabGL Entry` set is_cancelled = 'Yes'
where voucher_type = %s and voucher_no = %s""",
(d['parenttype'], d['parent']))

View File

@ -615,4 +615,8 @@ patch_list = [
'patch_module': 'patches.october_2012',
'patch_file': 'reload_gl_mapper',
},
{
'patch_module': 'patches.october_2012',
'patch_file': 'fix_wrong_vouchers',
},
]

File diff suppressed because one or more lines are too long

View File

@ -93,6 +93,8 @@ erpnext.toolbar.add_modules = function() {
erpnext.toolbar.set_new_comments = function(new_comments) {
var navbar_nc = $('.navbar-new-comments');
if(wn.container.page && wn.container.page.page_name=="messages")
return;
if(new_comments && new_comments.length>0) {
navbar_nc.text(new_comments.length);
navbar_nc.addClass('navbar-new-comments-true')
@ -102,7 +104,7 @@ erpnext.toolbar.set_new_comments = function(new_comments) {
if(!$('#' + id)[0]) {
show_alert(msg).attr("id", id);
}
})
});
} else {
navbar_nc.removeClass('navbar-new-comments-true');
navbar_nc.text(0);

View File

@ -13,9 +13,9 @@
}
.toggle.expand {
background: url(images/expand.gif) no-repeat center center;
background: url(app/images/expand.gif) no-repeat center center;
}
.toggle.collapse {
background: url(images/collapse.gif) no-repeat center center;
background: url(app/images/collapse.gif) no-repeat center center;
}

View File

@ -4,7 +4,8 @@ wn.doclistviews['Lead'] = wn.views.ListView.extend({
this.fields = this.fields.concat([
'tabLead.lead_name',
'tabLead.status',
'tabLead.source'
'tabLead.source',
'tabLead.modified_by'
]);
this.stats = this.stats.concat(['status', 'source', 'rating', 'company']);
},
@ -25,7 +26,7 @@ wn.doclistviews['Lead'] = wn.views.ListView.extend({
columns: [
{width: '3%', content: 'check'},
{width: '5%', content:'avatar'},
{width: '5%', content:'avatar_modified'},
{width: '30%', content:'lead_name'},
{width: '12%', content:'status_html'},
{width: '38%', content:'lead_status+tags', css: {color:'#222'}},

View File

@ -23,6 +23,8 @@ wn.pages['sales-analytics'].onload = function(wrapper) {
new erpnext.SalesAnalytics(wrapper);
}
wn.require("lib/js/wn/views/grid_report.js");
erpnext.SalesAnalytics = wn.views.TreeGridReport.extend({
init: function(wrapper) {
this._super({

View File

@ -26,6 +26,7 @@ wn.pages['stock-ageing'].onload = function(wrapper) {
}
wn.require("lib/js/wn/views/grid_report.js");
wn.require("app/js/stock_grid_report.js");
erpnext.StockAgeing = erpnext.StockGridReport.extend({

View File

@ -24,6 +24,7 @@ wn.pages['stock-analytics'].onload = function(wrapper) {
new erpnext.StockAnalytics(wrapper);
}
wn.require("lib/js/wn/views/grid_report.js");
wn.require("app/js/stock_grid_report.js");
erpnext.StockAnalytics = erpnext.StockGridReport.extend({

View File

@ -24,6 +24,7 @@ wn.pages['stock-ledger'].onload = function(wrapper) {
new erpnext.StockLedger(wrapper);
}
wn.require("lib/js/wn/views/grid_report.js");
wn.require("app/js/stock_grid_report.js");
erpnext.StockLedger = erpnext.StockGridReport.extend({

View File

@ -5,7 +5,9 @@ wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({
this.fields = this.fields.concat([
"`tabSupport Ticket`.status",
"`tabSupport Ticket`.subject",
"`tabSupport Ticket`.description"
"`tabSupport Ticket`.description",
'`tabSupport Ticket`.modified_by'
]);
this.stats = this.stats.concat(['status']);
this.show_hide_check_column();
@ -38,10 +40,11 @@ wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({
columns: [
{width: '3%', content: 'check'},
{width: '5%', content:'avatar_modified'},
{width: '20%', content:'name'},
{width: '10%', content:'status_html'},
{width: '50%', content:'description+tags', css: {color:'#222'}},
{width: '14%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]
});

View File

@ -6,9 +6,17 @@
.message {
padding: 7px;
padding-left: 17px;
border-bottom: 1px solid #ccc;
}
.message-mark {
margin-left: -17px;
width: 9px;
position: absolute;
height: 30px;
}
.message .help {
margin-bottom: 0px;
padding-bottom: 0px;

View File

@ -22,11 +22,11 @@ wn.pages.messages.onload = function(wrapper) {
title: "Messages"
});
$('<h3 id="message-title">Everyone</h3>\
<div id="show-everyone" style="display: none;">\
<a href="#messages/'+user+'" style="font-size: 80%;">\
Show messages from everyone</a></div><hr>\
<div id="post-message" style="display: none">\
$('<div><div class="avatar avatar-large">\
<img id="avatar-image" src="lib/images/ui/avatar.png"></div>\
<h3 style="display: inline-block" id="message-title">Everyone</h3>\
</div><hr>\
<div id="post-message">\
<textarea style="width: 100%; height: 24px;"></textarea>\
<div><button class="btn btn-small">Post</button></div><hr>\
</div>\
@ -40,7 +40,7 @@ $(wn.pages.messages).bind('show', function() {
$('#alert-container .alert').remove();
erpnext.messages.show();
setTimeout("erpnext.messages.refresh()", 7000);
setTimeout("erpnext.messages.refresh()", 17000);
})
erpnext.Messages = Class.extend({
@ -83,14 +83,15 @@ erpnext.Messages = Class.extend({
show: function() {
var contact = this.get_contact() || this.contact || user;
$('#message-title').text(contact==user ? "Everyone" :
wn.boot.user_info[contact].fullname)
$('#message-title').html(contact==user ? "Everyone" :
wn.user_info(contact).fullname)
$('#avatar-image').attr("src", wn.user_info(contact).image);
$("#show-everyone").toggle(contact!=user);
// can't send message to self
$('#post-message').toggle(contact!=user);
$("#post-message button").text(contact==user ? "Post Publicly" : "Post to user")
this.contact = contact;
this.list.opts.args.contact = contact;
this.list.run();
@ -98,7 +99,7 @@ erpnext.Messages = Class.extend({
},
// check for updates every 5 seconds if page is active
refresh: function() {
setTimeout("erpnext.messages.refresh()", 7000);
setTimeout("erpnext.messages.refresh()", 17000);
if(wn.container.page.label != 'Messages') return;
this.show();
},
@ -126,6 +127,8 @@ erpnext.Messages = Class.extend({
data.creation = dateutil.comment_when(data.creation);
data.comment_by_fullname = wn.user_info(data.owner).fullname;
data.image = wn.user_info(data.owner).image;
data.mark_html = "";
data.reply_html = '';
if(data.owner==user) {
@ -133,10 +136,6 @@ erpnext.Messages = Class.extend({
data.comment_by_fullname = 'You';
} else {
data.cls = 'message-other';
if(this.contact==user) {
data.reply_html = repl('<a href="#!messages/%(owner)s">\
<i class="icon-share-alt"></i> Reply</a>', data)
}
}
// delete
@ -146,11 +145,17 @@ erpnext.Messages = Class.extend({
onclick="erpnext.messages.delete(this)"\
data-name="%(name)s">&times;</a>', data);
}
if(data.owner==data.comment_docname) {
data.mark_html = "<div class='message-mark' title='Public'\
style='background-color: green'></div>"
}
wrapper.innerHTML = repl('<div class="message %(cls)s">%(delete_html)s\
<b>%(comment)s</b>\
wrapper.innerHTML = repl('<div class="message %(cls)s">%(mark_html)s\
<span class="avatar avatar-small"><img src="%(image)s"></span><b>%(comment)s</b>\
%(delete_html)s\
<div class="help">by %(comment_by_fullname)s, %(creation)s</div>\
%(reply_html)s</div>\
</div>\
<div style="clear: both;"></div>', data);
}
});
@ -173,15 +178,24 @@ erpnext.Messages = Class.extend({
method:'get_active_users',
callback: function(r,rt) {
var $body = $(me.wrapper).find('.layout-side-section');
$("<h4>Users</h4><hr>").appendTo($body);
$('<h4>Users</h4><hr>\
<div id="show-everyone">\
<a href="#messages/'+user+'" class="btn btn-small">\
Show messages from everyone</a><hr></div>\
').appendTo($body);
r.message.sort(function(a, b) { return b.has_session - a.has_session; });
for(var i in r.message) {
var p = r.message[i];
if(p.name != user) {
p.fullname = wn.user_info(p.name).fullname;
p.image = wn.user_info(p.name).image;
p.name = p.name.replace('@', '__at__');
p.label_status = p.has_session ? "label-success" : "";
p.status_color = p.has_session ? "green" : "#ddd";
p.status = p.has_session ? "Online" : "Offline";
$(repl('<p><span class="label %(label_status)s">%(status)s</span>\
$(repl('<p>\
<span class="avatar avatar-small" \
style="border: 3px solid %(status_color)s" \
title="%(status)s"><img src="%(image)s"></span>\
<a href="#!messages/%(name)s">%(fullname)s</a>\
</p>', p))
.appendTo($body);

View File

@ -33,15 +33,18 @@ def get_list(arg=None):
# return messages
return webnotes.conn.sql("""select * from `tabComment`
where (owner=%(contact)s or comment_docname=%(user)s)
and comment_doctype in ('My Company', 'Message')
where (owner=%(contact)s
or comment_docname=%(user)s
or (owner=comment_docname and ifnull(parenttype, "")!="Assignment"))
and comment_doctype ='Message'
order by creation desc
limit %(limit_start)s, %(limit_page_length)s""", webnotes.form_dict, as_dict=1)
else:
return webnotes.conn.sql("""select * from `tabComment`
where (owner=%(contact)s and comment_docname=%(user)s)
or (owner=%(user)s and comment_docname=%(contact)s)
and comment_doctype in ('My Company', 'Message')
or (owner=%(contact)s and comment_docname=%(contact)s)
and comment_doctype ='Message'
order by creation desc
limit %(limit_start)s, %(limit_page_length)s""", webnotes.form_dict, as_dict=1)