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

This commit is contained in:
Rushabh Mehta 2013-07-25 16:05:22 +05:30
commit dd05d5eca0
6 changed files with 20 additions and 20 deletions

View File

@ -91,7 +91,7 @@ class DocType(SellingController):
self.validate_c_form() self.validate_c_form()
self.validate_time_logs_are_submitted() self.validate_time_logs_are_submitted()
self.validate_recurring_invoice() self.validate_recurring_invoice()
self.validate_multiple_billing("Delivered Note", "dn_detail", "export_amount") self.validate_multiple_billing("Delivery Note", "dn_detail", "export_amount")
def on_submit(self): def on_submit(self):
if cint(self.doc.update_stock) == 1: if cint(self.doc.update_stock) == 1:

View File

@ -30,7 +30,7 @@ wn.pages['voucher-import-tool'].onload = function(wrapper) {
args: { args: {
method: "accounts.page.voucher_import_tool.voucher_import_tool.upload" method: "accounts.page.voucher_import_tool.voucher_import_tool.upload"
}, },
callback: function(r) { callback: function(fid, filename, r) {
wrapper.waiting.toggle(false); wrapper.waiting.toggle(false);
$(wrapper).find(".messages").toggle(true).html( $(wrapper).find(".messages").toggle(true).html(
r.join("<div style='margin:4px; border-top:1px solid #aaa;'></div>")) r.join("<div style='margin:4px; border-top:1px solid #aaa;'></div>"))

View File

@ -17,7 +17,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import webnotes import webnotes
from webnotes import _, msgprint from webnotes import _, msgprint
from webnotes.utils import flt, cint, today from webnotes.utils import flt, cint, today, cstr
from setup.utils import get_company_currency, get_price_list_currency from setup.utils import get_company_currency, get_price_list_currency
from accounts.utils import get_fiscal_year, validate_fiscal_year from accounts.utils import get_fiscal_year, validate_fiscal_year
from utilities.transaction_base import TransactionBase, validate_conversion_rate from utilities.transaction_base import TransactionBase, validate_conversion_rate
@ -375,15 +375,15 @@ class AccountsController(TransactionBase):
already_billed = webnotes.conn.sql("""select sum(%s) from `tab%s` already_billed = webnotes.conn.sql("""select sum(%s) from `tab%s`
where %s=%s and docstatus=1""" % (based_on, self.tname, item_ref_dn, '%s'), where %s=%s and docstatus=1""" % (based_on, self.tname, item_ref_dn, '%s'),
item.fields[item_ref_dn])[0][0] item.fields[item_ref_dn])[0][0]
if already_billed:
max_allowed_amt = webnotes.conn.get_value(ref_dt + " Item", max_allowed_amt = webnotes.conn.get_value(ref_dt + " Item",
item.fields[item_ref_dn], based_on) item.fields[item_ref_dn], based_on)
if flt(already_billed) + flt(item.fields[based_on]) > max_allowed_amt: if flt(already_billed) + flt(item.fields[based_on]) > max_allowed_amt:
webnotes.msgprint(_("Row ")+ item.idx + ": " + item.item_code + webnotes.msgprint(_("Row ")+ cstr(item.idx) + ": " + cstr(item.item_code) +
_(" will be over-billed against mentioned ") + ref_dt + _(" will be over-billed against mentioned ") + cstr(ref_dt) +
_(". Max allowed " + based_on + ": " + max_allowed_amt), _(". Max allowed " + cstr(based_on) + ": " + cstr(max_allowed_amt)),
raise_exception=1) raise_exception=1)
def get_company_default(self, fieldname): def get_company_default(self, fieldname):
from accounts.utils import get_company_default from accounts.utils import get_company_default

View File

@ -52,13 +52,13 @@ erpnext.hr.AttendanceControlPanel = wn.ui.form.Controller.extend({
method: 'hr.doctype.upload_attendance.upload_attendance.upload' method: 'hr.doctype.upload_attendance.upload_attendance.upload'
}, },
sample_url: "e.g. http://example.com/somefile.csv", sample_url: "e.g. http://example.com/somefile.csv",
callback: function(r) { callback: function(fid, filename, r) {
var $log_wrapper = $(cur_frm.fields_dict.import_log.wrapper).empty(); var $log_wrapper = $(cur_frm.fields_dict.import_log.wrapper).empty();
if(!r.messages) r.messages = []; if(!r.messages) r.messages = [];
// replace links if error has occured // replace links if error has occured
if(r.exc || r.error) { if(r.exc || r.error) {
r.messages = $.map(r.messages, function(v) { r.messages = $.map(r.message.messages, function(v) {
var msg = v.replace("Inserted", "Valid") var msg = v.replace("Inserted", "Valid")
.replace("Updated", "Valid").split("<"); .replace("Updated", "Valid").split("<");
if (msg.length > 1) { if (msg.length > 1) {
@ -73,7 +73,7 @@ erpnext.hr.AttendanceControlPanel = wn.ui.form.Controller.extend({
.concat(r.messages) .concat(r.messages)
} else { } else {
r.messages = ["<h4 style='color:green'>Import Successful!</h4>"]. r.messages = ["<h4 style='color:green'>Import Successful!</h4>"].
concat(r.messages) concat(r.message.messages)
} }
$.each(r.messages, function(i, v) { $.each(r.messages, function(i, v) {

View File

@ -108,8 +108,8 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
method: 'stock.doctype.stock_reconciliation.stock_reconciliation.upload' method: 'stock.doctype.stock_reconciliation.stock_reconciliation.upload'
}, },
sample_url: "e.g. http://example.com/somefile.csv", sample_url: "e.g. http://example.com/somefile.csv",
callback: function(r) { callback: function(fid, filename, r) {
me.frm.set_value("reconciliation_json", JSON.stringify(r)); me.frm.set_value("reconciliation_json", JSON.stringify(r.message));
me.show_reconciliation_data(); me.show_reconciliation_data();
me.frm.save(); me.frm.save();
} }

View File

@ -28,9 +28,9 @@ cur_frm.cscript.setup_upload = function() {
select_doctype: cur_frm.doc.select_doctype select_doctype: cur_frm.doc.select_doctype
}, },
sample_url: "e.g. http://example.com/somefile.csv", sample_url: "e.g. http://example.com/somefile.csv",
callback: function(r) { callback: function(fid, filename, r) {
$log.empty().html("<hr>"); $log.empty().html("<hr>");
$.each(r, function(i, v) { $.each(r.message, function(i, v) {
$("<div>" + v + "</div>").appendTo($log); $("<div>" + v + "</div>").appendTo($log);
}); });
} }