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

This commit is contained in:
Rushabh Mehta 2012-09-19 16:48:30 +05:30
commit b803cbab3d
8 changed files with 24 additions and 6 deletions

View File

@ -83,7 +83,7 @@ class DocType:
# Account name must be unique
def validate_duplicate_account(self):
if (self.doc.__islocal or (not self.doc.name)) and sql("select name from tabAccount where account_name=%s and company=%s", (self.doc.account_name, self.doc.company)):
if (self.doc.fields.get('__islocal') or (not self.doc.name)) and sql("select name from tabAccount where account_name=%s and company=%s", (self.doc.account_name, self.doc.company)):
msgprint("Account Name already exists, please rename", raise_exception=1)
# validate root details

View File

@ -63,6 +63,13 @@ class DocType:
vouchers = []
for d in getlist(self.doclist, 'entries'):
if d.clearance_date:
if getdate(d.clearance_date) < getdate(d.cheque_date):
msgprint("Clearance Date can not be before Cheque Date (Row #%s)" %
d.idx, raise_exception=1)
if getdate(d.clearance_date) < getdate(d.posting_date):
msgprint("Clearance Date can not be before Posting Date (Row #%s)" %
d.idx, raise_exception=1)
sql("update `tabJournal Voucher` set clearance_date = %s, modified = %s where name=%s", (d.clearance_date, nowdate(), d.voucher_id))
vouchers.append(d.voucher_id)

View File

@ -16,9 +16,8 @@ wn.doclistviews['Purchase Invoice'] = wn.views.ListView.extend({
prepare_data: function(data) {
this._super(data);
data.paid = flt(
((data.grand_total - data.outstanding_amount) / data.grand_total) * 100,
2);
data.paid = data.docstatus == 1 ?
flt(((data.grand_total - data.outstanding_amount) / data.grand_total) * 100, 2) : 0;
},
columns: [

View File

@ -14,7 +14,8 @@ wn.doclistviews['Sales Invoice'] = wn.views.ListView.extend({
},
prepare_data: function(data) {
this._super(data);
data.paid = flt((data.grand_total - data.outstanding_amount) / data.grand_total * 100, 2);
data.paid = (data.docstatus == 1) ?
flt((data.grand_total - data.outstanding_amount) / data.grand_total * 100, 2) : 0;
},
columns: [
{width: '3%', content: 'check'},

View File

@ -3,7 +3,8 @@ import webnotes
def execute():
webnotes.conn.commit()
try:
webnotes.conn.sql("""alter table `tabStock Ledger Entry` add index posting_sort_index(posting_date, posting_time, name)""")webnotes.conn.commit()
webnotes.conn.sql("""alter table `tabStock Ledger Entry` add index posting_sort_index(posting_date, posting_time, name)""")
webnotes.conn.commit()
except Exception, e:
if e.args[0]!=1061: raise e
webnotes.conn.begin()

View File

@ -37,6 +37,11 @@ convert_to_lists = webnotes.conn.convert_to_lists
class DocType:
def __init__(self,d,dl):
self.doc, self.doclist = d,dl
def validate(self):
if self.doc.fields.get('__islocal') and len(self.doc.abbr) > 5:
webnotes.msgprint("Abbreviation cannot have more than 5 characters",
raise_exception=1)
# Create default accounts
# ---------------------------------------------------

View File

@ -18,6 +18,10 @@ cur_frm.cscript.refresh = function(doc) {
// make sensitive fields(has_serial_no, is_stock_item, valuation_method)
// read only if any stock ledger entry exists
if (!doc.__islocal) {
set_field_permlevel("item_code", 1);
}
if ((!doc.__islocal) && (doc.is_stock_item == 'Yes')) {
var callback = function(r, rt) {
if (r.message == 'exists') permlevel = 1;

View File

@ -136,6 +136,7 @@ class DocType(TransactionBase):
def check_if_last_visit(self):
"""check if last maintenance visit against same sales order/ customer issue"""
check_for_docname = check_for_doctype = None
for d in getlist(self.doclist, 'maintenance_visit_details'):
if d.prevdoc_docname:
check_for_docname = d.prevdoc_docname