merged with master
This commit is contained in:
commit
f8de5b9878
@ -39,8 +39,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
'is_pl_account', 'company'], false);
|
'is_pl_account', 'company'], false);
|
||||||
|
|
||||||
// read-only for root accounts
|
// read-only for root accounts
|
||||||
root_acc = doc.parent ? false : true;
|
if(!doc.parent_account) {
|
||||||
if(in_list(root_acc, doc.account_name)) {
|
|
||||||
cur_frm.perm = [[1,0,0], [1,0,0]];
|
cur_frm.perm = [[1,0,0], [1,0,0]];
|
||||||
cur_frm.set_intro("This is a root account and cannot be edited.");
|
cur_frm.set_intro("This is a root account and cannot be edited.");
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,7 +21,7 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
|
|||||||
}
|
}
|
||||||
|
|
||||||
$c('runserverobj',args={'method' : 'get_months', 'docs' :
|
$c('runserverobj',args={'method' : 'get_months', 'docs' :
|
||||||
compress_doclist(make_doclist(doc.doctype, doc.name))},callback1);
|
wn.model.compress(make_doclist(doc.doctype, doc.name))},callback1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
cur_frm.toggle_enable(['group_or_ledger', 'company_name'], doc.__islocal);
|
cur_frm.toggle_enable(['group_or_ledger', 'company_name'], doc.__islocal);
|
||||||
|
|
||||||
if(!doc.__islocal && doc.group_or_ledger=='Group') {
|
if(!doc.__islocal && doc.group_or_ledger=='Group') {
|
||||||
intro_txt += '<p><b>Note:</b> This is Cost Center is a <i>Group</i>, \
|
intro_txt += '<p><b>Note:</b> This Cost Center is a <i>Group</i>, \
|
||||||
Accounting Entries are not allowed against groups.</p>';
|
Accounting Entries are not allowed against groups.</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,14 +33,14 @@ cur_frm.cscript.load_defaults = function(doc, cdt, cdn) {
|
|||||||
if(!cur_frm.doc.__islocal || !cur_frm.doc.company) { return; }
|
if(!cur_frm.doc.__islocal || !cur_frm.doc.company) { return; }
|
||||||
|
|
||||||
doc = locals[doc.doctype][doc.name];
|
doc = locals[doc.doctype][doc.name];
|
||||||
var fields_to_refresh = LocalDB.set_default_values(doc);
|
var fields_to_refresh = wn.model.set_default_values(doc);
|
||||||
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
|
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
|
||||||
|
|
||||||
fields_to_refresh = null;
|
fields_to_refresh = null;
|
||||||
var children = getchildren('Journal Voucher Detail', doc.name, 'entries');
|
var children = getchildren('Journal Voucher Detail', doc.name, 'entries');
|
||||||
if(!children) { return; }
|
if(!children) { return; }
|
||||||
for(var i=0; i<children.length; i++) {
|
for(var i=0; i<children.length; i++) {
|
||||||
LocalDB.set_default_values(children[i]);
|
wn.model.set_default_values(children[i]);
|
||||||
}
|
}
|
||||||
refresh_field('entries');
|
refresh_field('entries');
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
|
|||||||
if(!children || children.length==0) {
|
if(!children || children.length==0) {
|
||||||
$c('accounts.get_default_bank_account', {company: doc.company }, function(r, rt) {
|
$c('accounts.get_default_bank_account', {company: doc.company }, function(r, rt) {
|
||||||
if(!r.exc) {
|
if(!r.exc) {
|
||||||
var jvd = LocalDB.add_child(doc, 'Journal Voucher Detail', 'entries');
|
var jvd = wn.model.add_child(doc, 'Journal Voucher Detail', 'entries');
|
||||||
jvd.account = cstr(r.message);
|
jvd.account = cstr(r.message);
|
||||||
refresh_field('entries');
|
refresh_field('entries');
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ calc_total_advance = function(doc,cdt,cdn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
|
cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
|
||||||
var jv = LocalDB.create('Journal Voucher');
|
var jv = wn.model.make_new_doc_and_get_name('Journal Voucher');
|
||||||
jv = locals['Journal Voucher'][jv];
|
jv = locals['Journal Voucher'][jv];
|
||||||
jv.voucher_type = 'Bank Voucher';
|
jv.voucher_type = 'Bank Voucher';
|
||||||
jv.remark = repl('Payment against voucher %(vn)s for %(rem)s', {vn:doc.name, rem:doc.remarks});
|
jv.remark = repl('Payment against voucher %(vn)s for %(rem)s', {vn:doc.name, rem:doc.remarks});
|
||||||
@ -276,13 +276,13 @@ cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
|
|||||||
jv.company = doc.company;
|
jv.company = doc.company;
|
||||||
|
|
||||||
// debit to creditor
|
// debit to creditor
|
||||||
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
var d1 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||||
d1.account = doc.credit_to;
|
d1.account = doc.credit_to;
|
||||||
d1.debit = doc.outstanding_amount;
|
d1.debit = doc.outstanding_amount;
|
||||||
d1.against_voucher = doc.name;
|
d1.against_voucher = doc.name;
|
||||||
|
|
||||||
// credit to bank
|
// credit to bank
|
||||||
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
var d1 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||||
d1.account = bank_account;
|
d1.account = bank_account;
|
||||||
d1.credit = doc.outstanding_amount;
|
d1.credit = doc.outstanding_amount;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ wn.require('app/utilities/doctype/sms_control/sms_control.js');
|
|||||||
// On Load
|
// On Load
|
||||||
// -------
|
// -------
|
||||||
cur_frm.cscript.onload = function(doc,dt,dn) {
|
cur_frm.cscript.onload = function(doc,dt,dn) {
|
||||||
if(!doc.customer && doc.debit_to) Meta.get_field(dt, 'debit_to', dn).print_hide = 0;
|
if(!doc.customer && doc.debit_to) wn.meta.get_docfield(dt, 'debit_to', dn).print_hide = 0;
|
||||||
if (doc.__islocal) {
|
if (doc.__islocal) {
|
||||||
//if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
|
//if(!doc.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
|
||||||
if(!doc.due_date) set_multiple(dt,dn,{due_date:get_today()});
|
if(!doc.due_date) set_multiple(dt,dn,{due_date:get_today()});
|
||||||
@ -322,9 +322,9 @@ cur_frm.cscript.allocated_amount = function(doc,cdt,cdn){
|
|||||||
cur_frm.cscript['Make Delivery Note'] = function() {
|
cur_frm.cscript['Make Delivery Note'] = function() {
|
||||||
|
|
||||||
var doc = cur_frm.doc
|
var doc = cur_frm.doc
|
||||||
n = createLocal('Delivery Note');
|
n = wn.model.make_new_doc_and_get_name('Delivery Note');
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals['Delivery Note'][n]]),
|
'docs':wn.model.compress([locals['Delivery Note'][n]]),
|
||||||
'from_doctype':doc.doctype,
|
'from_doctype':doc.doctype,
|
||||||
'to_doctype':'Delivery Note',
|
'to_doctype':'Delivery Note',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
@ -484,7 +484,7 @@ cur_frm.cscript.calc_adjustment_amount = function(doc,cdt,cdn) {
|
|||||||
// Make Journal Voucher
|
// Make Journal Voucher
|
||||||
// --------------------
|
// --------------------
|
||||||
cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
|
cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
|
||||||
var jv = LocalDB.create('Journal Voucher');
|
var jv = wn.model.make_new_doc_and_get_name('Journal Voucher');
|
||||||
jv = locals['Journal Voucher'][jv];
|
jv = locals['Journal Voucher'][jv];
|
||||||
jv.voucher_type = 'Bank Voucher';
|
jv.voucher_type = 'Bank Voucher';
|
||||||
|
|
||||||
@ -493,14 +493,14 @@ cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
|
|||||||
jv.fiscal_year = doc.fiscal_year;
|
jv.fiscal_year = doc.fiscal_year;
|
||||||
|
|
||||||
// debit to creditor
|
// debit to creditor
|
||||||
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
var d1 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||||
d1.account = doc.debit_to;
|
d1.account = doc.debit_to;
|
||||||
d1.credit = doc.outstanding_amount;
|
d1.credit = doc.outstanding_amount;
|
||||||
d1.against_invoice = doc.name;
|
d1.against_invoice = doc.name;
|
||||||
|
|
||||||
|
|
||||||
// credit to bank
|
// credit to bank
|
||||||
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
var d1 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||||
d1.account = bank_account;
|
d1.account = bank_account;
|
||||||
d1.debit = doc.outstanding_amount;
|
d1.debit = doc.outstanding_amount;
|
||||||
|
|
||||||
|
@ -174,16 +174,20 @@ class DocType(TransactionBase):
|
|||||||
def get_customer_account(self):
|
def get_customer_account(self):
|
||||||
"""Get Account Head to which amount needs to be Debited based on Customer"""
|
"""Get Account Head to which amount needs to be Debited based on Customer"""
|
||||||
if not self.doc.company:
|
if not self.doc.company:
|
||||||
msgprint("Please select company first and re-select the customer after doing so", raise_exception=1)
|
msgprint("Please select company first and re-select the customer after doing so",
|
||||||
|
raise_exception=1)
|
||||||
|
if self.doc.customer:
|
||||||
|
acc_head = webnotes.conn.sql("""select name from `tabAccount`
|
||||||
|
where (name = %s or (master_name = %s and master_type = 'customer'))
|
||||||
|
and docstatus != 2""",
|
||||||
|
(cstr(self.doc.customer) + " - " + self.get_company_abbr(), self.doc.customer))
|
||||||
|
|
||||||
acc_head = webnotes.conn.sql("""select name from `tabAccount`
|
if acc_head and acc_head[0][0]:
|
||||||
where (name = %s or (master_name = %s and master_type = 'customer')) and docstatus != 2""",
|
return acc_head[0][0]
|
||||||
(cstr(self.doc.customer) + " - " + self.get_company_abbr(),self.doc.customer))
|
else:
|
||||||
|
msgprint("%s does not have an Account Head in %s. \
|
||||||
if acc_head and acc_head[0][0]:
|
You must first create it from the Customer Master" %
|
||||||
return acc_head[0][0]
|
(self.doc.customer, self.doc.company))
|
||||||
else:
|
|
||||||
msgprint("%s does not have an Account Head in %s. You must first create it from the Customer Master" % (self.doc.customer, self.doc.company))
|
|
||||||
|
|
||||||
def get_debit_to(self):
|
def get_debit_to(self):
|
||||||
acc_head = self.get_customer_account()
|
acc_head = self.get_customer_account()
|
||||||
|
@ -10,9 +10,10 @@ def get_companies():
|
|||||||
# check if match permission exists
|
# check if match permission exists
|
||||||
res = webnotes.conn.sql("""select role, `match` from `tabDocPerm`
|
res = webnotes.conn.sql("""select role, `match` from `tabDocPerm`
|
||||||
where parent='Account' and permlevel=0 and `read`=1""", as_dict=1)
|
where parent='Account' and permlevel=0 and `read`=1""", as_dict=1)
|
||||||
|
|
||||||
|
roles = webnotes.user.get_roles()
|
||||||
match = any((r["match"] for r in res
|
match = any((r["match"] for r in res
|
||||||
if r["role"] in webnotes.user.roles and r["match"]=="company"))
|
if r["role"] in roles and r["match"]=="company"))
|
||||||
|
|
||||||
# if match == company is specified and companies are specified in user defaults
|
# if match == company is specified and companies are specified in user defaults
|
||||||
if match and webnotes.user.get_defaults().get("company"):
|
if match and webnotes.user.get_defaults().get("company"):
|
||||||
|
@ -230,7 +230,7 @@ def get_data(rows, company_abbr):
|
|||||||
accounts = [c for c in rows[i+1] if c.endswith(" - " + company_abbr)]
|
accounts = [c for c in rows[i+1] if c.endswith(" - " + company_abbr)]
|
||||||
|
|
||||||
if accounts and (len(columns) != rows[i+1].index(accounts[0])):
|
if accounts and (len(columns) != rows[i+1].index(accounts[0])):
|
||||||
raise Exception, """A non-account column cannot be after an account \
|
raise Exception, """All account columns should be after standard columns and \
|
||||||
column. Please rectify it in the file and try again."""
|
on the right. Please rectify it in the file and try again."""
|
||||||
|
|
||||||
return data, start_row_idx
|
return data, start_row_idx
|
@ -51,14 +51,14 @@ cur_frm.cscript.load_defaults = function(doc, dt, dn, callback) {
|
|||||||
if(!cur_frm.doc.__islocal) { return; }
|
if(!cur_frm.doc.__islocal) { return; }
|
||||||
|
|
||||||
doc = locals[doc.doctype][doc.name];
|
doc = locals[doc.doctype][doc.name];
|
||||||
var fields_to_refresh = LocalDB.set_default_values(doc);
|
var fields_to_refresh = wn.model.set_default_values(doc);
|
||||||
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
|
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
|
||||||
|
|
||||||
fields_to_refresh = null;
|
fields_to_refresh = null;
|
||||||
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
|
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
|
||||||
if(!children) { return; }
|
if(!children) { return; }
|
||||||
for(var i=0; i<children.length; i++) {
|
for(var i=0; i<children.length; i++) {
|
||||||
LocalDB.set_default_values(children[i]);
|
wn.model.set_default_values(children[i]);
|
||||||
}
|
}
|
||||||
refresh_field(cur_frm.cscript.fname);
|
refresh_field(cur_frm.cscript.fname);
|
||||||
cur_frm.cscript.load_taxes(doc, dt, dn, callback);
|
cur_frm.cscript.load_taxes(doc, dt, dn, callback);
|
||||||
|
@ -122,9 +122,9 @@ cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){
|
|||||||
|
|
||||||
//========================= Make Purchase Receipt =======================================================
|
//========================= Make Purchase Receipt =======================================================
|
||||||
cur_frm.cscript['Make Purchase Receipt'] = function() {
|
cur_frm.cscript['Make Purchase Receipt'] = function() {
|
||||||
n = createLocal('Purchase Receipt');
|
n = wn.model.make_new_doc_and_get_name('Purchase Receipt');
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals['Purchase Receipt'][n]]),
|
'docs':wn.model.compress([locals['Purchase Receipt'][n]]),
|
||||||
'from_doctype': cur_frm.doc.doctype,
|
'from_doctype': cur_frm.doc.doctype,
|
||||||
'to_doctype':'Purchase Receipt',
|
'to_doctype':'Purchase Receipt',
|
||||||
'from_docname':cur_frm.doc.name,
|
'from_docname':cur_frm.doc.name,
|
||||||
@ -137,9 +137,9 @@ cur_frm.cscript['Make Purchase Receipt'] = function() {
|
|||||||
|
|
||||||
//========================== Make Purchase Invoice =====================================================
|
//========================== Make Purchase Invoice =====================================================
|
||||||
cur_frm.cscript['Make Purchase Invoice'] = function() {
|
cur_frm.cscript['Make Purchase Invoice'] = function() {
|
||||||
n = createLocal('Purchase Invoice');
|
n = wn.model.make_new_doc_and_get_name('Purchase Invoice');
|
||||||
$c('dt_map', {
|
$c('dt_map', {
|
||||||
'docs':compress_doclist([locals['Purchase Invoice'][n]]),
|
'docs':wn.model.compress([locals['Purchase Invoice'][n]]),
|
||||||
'from_doctype':cur_frm.doc.doctype,
|
'from_doctype':cur_frm.doc.doctype,
|
||||||
'to_doctype':'Purchase Invoice',
|
'to_doctype':'Purchase Invoice',
|
||||||
'from_docname': cur_frm.doc.name,
|
'from_docname': cur_frm.doc.name,
|
||||||
@ -158,7 +158,7 @@ cur_frm.cscript['Stop Purchase Order'] = function() {
|
|||||||
var check = confirm("Do you really want to STOP " + doc.name);
|
var check = confirm("Do you really want to STOP " + doc.name);
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
$c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -171,7 +171,7 @@ cur_frm.cscript['Unstop Purchase Order'] = function() {
|
|||||||
var check = confirm("Do you really want to UNSTOP " + doc.name);
|
var check = confirm("Do you really want to UNSTOP " + doc.name);
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Submitted', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
$c('runserverobj', args={'method':'update_status', 'arg': 'Submitted', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -86,9 +86,9 @@ cur_frm.cscript.qty = function(doc, cdt, cdn) {
|
|||||||
// Make Purchase Order
|
// Make Purchase Order
|
||||||
cur_frm.cscript['Make Purchase Order'] = function() {
|
cur_frm.cscript['Make Purchase Order'] = function() {
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
n = createLocal('Purchase Order');
|
n = wn.model.make_new_doc_and_get_name('Purchase Order');
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals['Purchase Order'][n]]),
|
'docs':wn.model.compress([locals['Purchase Order'][n]]),
|
||||||
'from_doctype':doc.doctype,
|
'from_doctype':doc.doctype,
|
||||||
'to_doctype':'Purchase Order',
|
'to_doctype':'Purchase Order',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
@ -106,7 +106,7 @@ cur_frm.cscript['Stop Purchase Request'] = function() {
|
|||||||
var check = confirm("Do you really want to STOP this Purchase Request?");
|
var check = confirm("Do you really want to STOP this Purchase Request?");
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
$c('runserverobj', args={'method':'update_status', 'arg': 'Stopped', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ cur_frm.cscript['Unstop Purchase Request'] = function(){
|
|||||||
var check = confirm("Do you really want to UNSTOP this Purchase Request?");
|
var check = confirm("Do you really want to UNSTOP this Purchase Request?");
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
$c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
$c('runserverobj', args={'method':'update_status', 'arg': 'Submitted','docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -127,9 +127,9 @@ cur_frm.cscript['Unstop Purchase Request'] = function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_supplier_quotation = function() {
|
cur_frm.cscript.make_supplier_quotation = function() {
|
||||||
var new_sq_name = createLocal("Supplier Quotation");
|
var new_sq_name = wn.model.make_new_doc_and_get_name("Supplier Quotation");
|
||||||
$c("dt_map", {
|
$c("dt_map", {
|
||||||
"docs": compress_doclist([locals['Supplier Quotation'][new_sq_name]]),
|
"docs": wn.model.compress([locals['Supplier Quotation'][new_sq_name]]),
|
||||||
"from_doctype": cur_frm.doc.doctype,
|
"from_doctype": cur_frm.doc.doctype,
|
||||||
"to_doctype": "Supplier Quotation",
|
"to_doctype": "Supplier Quotation",
|
||||||
"from_docname": cur_frm.doc.name,
|
"from_docname": cur_frm.doc.name,
|
||||||
|
@ -79,7 +79,7 @@ cur_frm.cscript.make_contact = function() {
|
|||||||
page_length: 2,
|
page_length: 2,
|
||||||
new_doctype: "Contact",
|
new_doctype: "Contact",
|
||||||
custom_new_doc: function(doctype) {
|
custom_new_doc: function(doctype) {
|
||||||
var contact = LocalDB.create('Contact');
|
var contact = wn.model.make_new_doc_and_get_name('Contact');
|
||||||
contact = locals['Contact'][contact];
|
contact = locals['Contact'][contact];
|
||||||
contact.supplier = cur_frm.doc.name;
|
contact.supplier = cur_frm.doc.name;
|
||||||
contact.supplier_name = cur_frm.doc.supplier_name;
|
contact.supplier_name = cur_frm.doc.supplier_name;
|
||||||
|
@ -49,9 +49,9 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_purchase_order = function() {
|
cur_frm.cscript.make_purchase_order = function() {
|
||||||
var new_po_name = createLocal("Purchase Order");
|
var new_po_name = wn.model.make_new_doc_and_get_name("Purchase Order");
|
||||||
$c("dt_map", {
|
$c("dt_map", {
|
||||||
"docs": compress_doclist([locals['Purchase Order'][new_po_name]]),
|
"docs": wn.model.compress([locals['Purchase Order'][new_po_name]]),
|
||||||
"from_doctype": cur_frm.doc.doctype,
|
"from_doctype": cur_frm.doc.doctype,
|
||||||
"to_doctype": "Purchase Order",
|
"to_doctype": "Purchase Order",
|
||||||
"from_docname": cur_frm.doc.name,
|
"from_docname": cur_frm.doc.name,
|
||||||
|
@ -36,7 +36,7 @@ erpnext.ActivityFeed = Class.extend({
|
|||||||
|
|
||||||
// feedtype
|
// feedtype
|
||||||
if(!data.feed_type) {
|
if(!data.feed_type) {
|
||||||
data.feed_type = get_doctype_label(data.doc_type);
|
data.feed_type = wn._(data.doc_type);
|
||||||
data.add_class = "label-info";
|
data.add_class = "label-info";
|
||||||
data.onclick = repl('onclick="window.location.href=\'#!List/%(feed_type)s\';"', data)
|
data.onclick = repl('onclick="window.location.href=\'#!List/%(feed_type)s\';"', data)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
erpnext.updates = [
|
erpnext.updates = [
|
||||||
["12th December 2012", [
|
["12th December 2012", [
|
||||||
"Attachments: Attachments can be set as URLs or File Uploads. This will help if people want to share documents from Google Docs, Dropbox and other such services (esp for the Product listings on websites).",
|
"Attachments: Attachments can be set as URLs or File Uploads. This will help if people want to share documents from Google Docs, Dropbox and other such services (esp for the Product listings on websites).",
|
||||||
|
"Global Defaults: Session Expiry can now be set in Global Defaults.",
|
||||||
]],
|
]],
|
||||||
["6th December 2012", [
|
["6th December 2012", [
|
||||||
"Rename: Cost Center, Item Group, Customer Group, Supplier Type, Territory, Sales Person can now be renamed.",
|
"Rename: Cost Center, Item Group, Customer Group, Supplier Type, Territory, Sales Person can now be renamed.",
|
||||||
|
@ -2,23 +2,18 @@
|
|||||||
{
|
{
|
||||||
"owner": "ashwini@webnotestech.com",
|
"owner": "ashwini@webnotestech.com",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"creation": "2012-03-27 14:35:53",
|
"creation": "2012-07-03 13:30:41",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"modified": "2012-03-27 14:45:46"
|
"modified": "2012-12-13 14:23:24"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"section_style": "Simple",
|
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
|
"autoname": "naming_series:",
|
||||||
|
"name": "__common__",
|
||||||
"search_fields": "employee, employee_name, att_date, status",
|
"search_fields": "employee, employee_name, att_date, status",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"server_code_error": " ",
|
"document_type": "Master"
|
||||||
"document_type": "Master",
|
|
||||||
"name": "__common__",
|
|
||||||
"colour": "White:FFF",
|
|
||||||
"_last_update": "1317365120",
|
|
||||||
"show_in_menu": 0,
|
|
||||||
"version": 75
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
@ -30,12 +25,11 @@
|
|||||||
{
|
{
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
"parent": "Attendance",
|
"parent": "Attendance",
|
||||||
"amend": 0,
|
"read": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"submit": 1,
|
"submit": 1,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"write": 1,
|
"write": 1,
|
||||||
"read": 1,
|
|
||||||
"parenttype": "DocType",
|
"parenttype": "DocType",
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
@ -45,26 +39,14 @@
|
|||||||
"name": "Attendance",
|
"name": "Attendance",
|
||||||
"doctype": "DocType"
|
"doctype": "DocType"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"role": "System Manager",
|
|
||||||
"doctype": "DocPerm"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"role": "HR User",
|
|
||||||
"doctype": "DocPerm"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"role": "HR Manager",
|
|
||||||
"doctype": "DocPerm"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"oldfieldtype": "Section Break",
|
"oldfieldtype": "Section Break",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Attendance Details",
|
"label": "Attendance Details",
|
||||||
"permlevel": 0,
|
"options": "Simple",
|
||||||
"fieldname": "attendance_details",
|
"fieldname": "attendance_details",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"options": "Simple"
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
@ -72,25 +54,23 @@
|
|||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Naming Series",
|
"label": "Naming Series",
|
||||||
"oldfieldname": "naming_series",
|
"oldfieldname": "naming_series",
|
||||||
"permlevel": 0,
|
"options": "ATT",
|
||||||
"fieldname": "naming_series",
|
"fieldname": "naming_series",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"options": "ATT"
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"oldfieldtype": "Link",
|
"oldfieldtype": "Link",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Employee",
|
"label": "Employee",
|
||||||
"oldfieldname": "employee",
|
"oldfieldname": "employee",
|
||||||
"permlevel": 0,
|
"options": "Employee",
|
||||||
"trigger": "Client",
|
|
||||||
"fieldname": "employee",
|
"fieldname": "employee",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"search_index": 1,
|
"search_index": 1,
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"options": "Employee",
|
"permlevel": 0,
|
||||||
"in_filter": 1
|
"in_filter": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -105,7 +85,6 @@
|
|||||||
{
|
{
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldtype": "Select",
|
"oldfieldtype": "Select",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Status",
|
"label": "Status",
|
||||||
"oldfieldname": "status",
|
"oldfieldname": "status",
|
||||||
@ -120,7 +99,6 @@
|
|||||||
{
|
{
|
||||||
"print_hide": 1,
|
"print_hide": 1,
|
||||||
"oldfieldtype": "Link",
|
"oldfieldtype": "Link",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Leave Type",
|
"label": "Leave Type",
|
||||||
"oldfieldname": "leave_type",
|
"oldfieldname": "leave_type",
|
||||||
@ -140,13 +118,13 @@
|
|||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"search_index": 0,
|
"oldfieldtype": "Date",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Attendance Date",
|
"label": "Attendance Date",
|
||||||
"oldfieldname": "att_date",
|
"oldfieldname": "att_date",
|
||||||
"fieldname": "att_date",
|
"fieldname": "att_date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"oldfieldtype": "Date",
|
"search_index": 0,
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"in_filter": 1
|
"in_filter": 1
|
||||||
@ -156,11 +134,11 @@
|
|||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Fiscal Year",
|
"label": "Fiscal Year",
|
||||||
"oldfieldname": "fiscal_year",
|
"oldfieldname": "fiscal_year",
|
||||||
"permlevel": 0,
|
"options": "\n2012\n2013",
|
||||||
"fieldname": "fiscal_year",
|
"fieldname": "fiscal_year",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"options": "link:Fiscal Year",
|
"permlevel": 0,
|
||||||
"in_filter": 1
|
"in_filter": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -168,11 +146,11 @@
|
|||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Company",
|
"label": "Company",
|
||||||
"oldfieldname": "company",
|
"oldfieldname": "company",
|
||||||
"permlevel": 0,
|
"options": "\nAlpha\nBeta\nDemo Company",
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"options": "link:Company",
|
"permlevel": 0,
|
||||||
"in_filter": 1
|
"in_filter": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -191,9 +169,21 @@
|
|||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Amended From",
|
"label": "Amended From",
|
||||||
"permlevel": 1,
|
"options": "Attendance",
|
||||||
"fieldname": "amended_from",
|
"fieldname": "amended_from",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"options": "Sales Invoice"
|
"permlevel": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "HR User",
|
||||||
|
"doctype": "DocPerm"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "HR Manager",
|
||||||
|
"doctype": "DocPerm"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "System Manager",
|
||||||
|
"doctype": "DocPerm"
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -53,7 +53,7 @@ cur_frm.cscript['Make Salary Structure']=function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.make_salary_structure = function(doc,dt,dn,det){
|
cur_frm.cscript.make_salary_structure = function(doc,dt,dn,det){
|
||||||
var st = LocalDB.create('Salary Structure');
|
var st = wn.model.make_new_doc_and_get_name('Salary Structure');
|
||||||
st = locals['Salary Structure'][st];
|
st = locals['Salary Structure'][st];
|
||||||
st.employee = doc.name;
|
st.employee = doc.name;
|
||||||
st.employee_name = doc.employee_name;
|
st.employee_name = doc.employee_name;
|
||||||
|
@ -20,6 +20,7 @@ import webnotes
|
|||||||
from webnotes.utils import add_days
|
from webnotes.utils import add_days
|
||||||
from webnotes.model.wrapper import getlist
|
from webnotes.model.wrapper import getlist
|
||||||
from webnotes import form, msgprint
|
from webnotes import form, msgprint
|
||||||
|
from webnotes.model.code import get_obj
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
@ -36,8 +37,8 @@ class DocType:
|
|||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
if self.doc.approval_status=="Draft":
|
if self.doc.approval_status=="Draft":
|
||||||
webnotes.msgprint("""Please set Approval Status to 'Approved' or 'Rejected' before submitting""",
|
webnotes.msgprint("""Please set Approval Status to 'Approved' or \
|
||||||
raise_exception=1)
|
'Rejected' before submitting""", raise_exception=1)
|
||||||
|
|
||||||
def validate_fiscal_year(self):
|
def validate_fiscal_year(self):
|
||||||
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
|
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
|
||||||
@ -57,5 +58,6 @@ def get_approver_list():
|
|||||||
roles = [r[0] for r in webnotes.conn.sql("""select distinct parent from `tabUserRole`
|
roles = [r[0] for r in webnotes.conn.sql("""select distinct parent from `tabUserRole`
|
||||||
where role='Expense Approver'""")]
|
where role='Expense Approver'""")]
|
||||||
if not roles:
|
if not roles:
|
||||||
webnotes.msgprint("No Expense Approvers. Please assign 'Expense Approver' Role to atleast one user.")
|
webnotes.msgprint("No Expense Approvers. Please assign 'Expense Approver' \
|
||||||
|
Role to atleast one user.")
|
||||||
return roles
|
return roles
|
||||||
|
@ -24,7 +24,7 @@ cur_frm.cscript.onload = function(doc,dt,dn){
|
|||||||
// Validation For To Date
|
// Validation For To Date
|
||||||
// ================================================================================================
|
// ================================================================================================
|
||||||
cur_frm.cscript.to_date = function(doc, cdt, cdn) {
|
cur_frm.cscript.to_date = function(doc, cdt, cdn) {
|
||||||
$c('runserverobj', args={'method':'to_date_validation','docs':compress_doclist(make_doclist(doc.doctype, doc.name))},
|
$c('runserverobj', args={'method':'to_date_validation','docs':wn.model.compress(make_doclist(doc.doctype, doc.name))},
|
||||||
function(r, rt) {
|
function(r, rt) {
|
||||||
var doc = locals[cdt][cdn];
|
var doc = locals[cdt][cdn];
|
||||||
if (r.message) {
|
if (r.message) {
|
||||||
|
@ -28,7 +28,7 @@ cur_frm.cscript.create_salary_slip = function(doc, cdt, cdn) {
|
|||||||
if (r.message)
|
if (r.message)
|
||||||
display_activity_log(r.message);
|
display_activity_log(r.message);
|
||||||
}
|
}
|
||||||
$c('runserverobj', args={'method':'create_sal_slip','docs':compress_doclist(make_doclist (cdt, cdn))},callback);
|
$c('runserverobj', args={'method':'create_sal_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
|
|||||||
if (r.message)
|
if (r.message)
|
||||||
display_activity_log(r.message);
|
display_activity_log(r.message);
|
||||||
}
|
}
|
||||||
$c('runserverobj', args={'method':'submit_salary_slip','docs':compress_doclist(make_doclist (cdt, cdn))},callback);
|
$c('runserverobj', args={'method':'submit_salary_slip','docs':wn.model.compress(make_doclist (cdt, cdn))},callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ cur_frm.cscript.make_bank_voucher = function(doc,cdt,cdn){
|
|||||||
//-----------------------
|
//-----------------------
|
||||||
cur_frm.cscript.make_jv = function(doc, dt, dn) {
|
cur_frm.cscript.make_jv = function(doc, dt, dn) {
|
||||||
var call_back = function(r,rt){
|
var call_back = function(r,rt){
|
||||||
var jv = LocalDB.create('Journal Voucher');
|
var jv = wn.model.make_new_doc_and_get_name('Journal Voucher');
|
||||||
jv = locals['Journal Voucher'][jv];
|
jv = locals['Journal Voucher'][jv];
|
||||||
jv.voucher_type = 'Bank Voucher';
|
jv.voucher_type = 'Bank Voucher';
|
||||||
jv.user_remark = 'Payment of salary for the month: ' + doc.month + 'and fiscal year: ' + doc.fiscal_year;
|
jv.user_remark = 'Payment of salary for the month: ' + doc.month + 'and fiscal year: ' + doc.fiscal_year;
|
||||||
@ -68,12 +68,12 @@ cur_frm.cscript.make_jv = function(doc, dt, dn) {
|
|||||||
jv.posting_date = dateutil.obj_to_str(new Date());
|
jv.posting_date = dateutil.obj_to_str(new Date());
|
||||||
|
|
||||||
// credit to bank
|
// credit to bank
|
||||||
var d1 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
var d1 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||||
d1.account = r.message['default_bank_account'];
|
d1.account = r.message['default_bank_account'];
|
||||||
d1.credit = r.message['amount']
|
d1.credit = r.message['amount']
|
||||||
|
|
||||||
// debit to salary account
|
// debit to salary account
|
||||||
var d2 = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
var d2 = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||||
d2.account = r.message['default_salary_account'];
|
d2.account = r.message['default_salary_account'];
|
||||||
d2.debit = r.message['amount']
|
d2.debit = r.message['amount']
|
||||||
|
|
||||||
|
@ -42,9 +42,9 @@ cur_frm.cscript['Make Salary Slip'] = function(){
|
|||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
var callback = function(r,rt){
|
var callback = function(r,rt){
|
||||||
ret = r.message;
|
ret = r.message;
|
||||||
n = createLocal("Salary Slip");
|
n = wn.model.make_new_doc_and_get_name("Salary Slip");
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals["Salary Slip"][n]]),
|
'docs':wn.model.compress([locals["Salary Slip"][n]]),
|
||||||
'from_doctype':'Salary Structure',
|
'from_doctype':'Salary Structure',
|
||||||
'to_doctype':'Salary Slip',
|
'to_doctype':'Salary Slip',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
|
10
patches/december_2012/file_list_rename.py
Normal file
10
patches/december_2012/file_list_rename.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import webnotes
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
for dt in webnotes.conn.sql("""select distinct parent from tabDocField
|
||||||
|
where fieldname='file_list'"""):
|
||||||
|
try:
|
||||||
|
webnotes.conn.sql("""update `tab%s` set file_list =
|
||||||
|
replace(file_list, "-", "")""" % dt[0])
|
||||||
|
except Exception, e:
|
||||||
|
if e.args[0]!=1146: raise e
|
9
patches/december_2012/move_recent_to_memcache.py
Normal file
9
patches/december_2012/move_recent_to_memcache.py
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import webnotes, json
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
for p in webnotes.conn.sql("""select name, recent_documents from
|
||||||
|
tabProfile where ifnull(recent_documents,'')!=''"""):
|
||||||
|
if not '~~~' in p[1] and p[1][0]=='[':
|
||||||
|
webnotes.cache().set_value("recent:" + p[0], json.loads(p[1]))
|
5
patches/december_2012/replace_createlocal.py
Normal file
5
patches/december_2012/replace_createlocal.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
def execute():
|
||||||
|
import webnotes
|
||||||
|
webnotes.conn.sql("""update `tabCustom Script`
|
||||||
|
set script = replace(script, 'createLocal', 'wn.model.make_new_doc_and_get_name')
|
||||||
|
where script_type='Client'""")
|
@ -530,4 +530,12 @@ patch_list = [
|
|||||||
'patch_module': 'patches.december_2012',
|
'patch_module': 'patches.december_2012',
|
||||||
'patch_file': 'fix_default_print_format',
|
'patch_file': 'fix_default_print_format',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'patch_module': 'patches.december_2012',
|
||||||
|
'patch_file': 'file_list_rename',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'patch_module': 'patches.december_2012',
|
||||||
|
'patch_file': 'replace_createlocal',
|
||||||
|
},
|
||||||
]
|
]
|
@ -5,7 +5,6 @@ wn.doclistviews['Task'] = wn.views.ListView.extend({
|
|||||||
this.fields = this.fields.concat([
|
this.fields = this.fields.concat([
|
||||||
'`tabTask`.subject',
|
'`tabTask`.subject',
|
||||||
'`tabTask`.project',
|
'`tabTask`.project',
|
||||||
'`tabTask`.modified',
|
|
||||||
'`tabTask`.status',
|
'`tabTask`.status',
|
||||||
'`tabTask`.opening_date',
|
'`tabTask`.opening_date',
|
||||||
'`tabTask`.priority',
|
'`tabTask`.priority',
|
||||||
|
@ -79,7 +79,7 @@ erpnext.show_task_gantt = function(parent, project) {
|
|||||||
$('<button class="btn"><i class="icon icon-plus"></i>\
|
$('<button class="btn"><i class="icon icon-plus"></i>\
|
||||||
Create a new Task</button>').click(function() {
|
Create a new Task</button>').click(function() {
|
||||||
wn.model.with_doctype('Task', function() {
|
wn.model.with_doctype('Task', function() {
|
||||||
var new_name = LocalDB.create('Task');
|
var new_name = wn.model.make_new_doc_and_get_name('Task');
|
||||||
if(project)
|
if(project)
|
||||||
locals.Task[new_name].project = project;
|
locals.Task[new_name].project = project;
|
||||||
wn.set_route('Form', 'Task', new_name);
|
wn.set_route('Form', 'Task', new_name);
|
||||||
|
@ -111,7 +111,7 @@ erpnext.module_page.hide_links = function(wrapper) {
|
|||||||
$(wrapper).find('[href*="List/"]').each(function() {
|
$(wrapper).find('[href*="List/"]').each(function() {
|
||||||
var href = $(this).attr('href');
|
var href = $(this).attr('href');
|
||||||
var dt = href.split('/')[1];
|
var dt = href.split('/')[1];
|
||||||
if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1) {
|
if(wn.boot.profile.all_read.indexOf(dt)==-1) {
|
||||||
replace_link(this);
|
replace_link(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -128,7 +128,7 @@ erpnext.module_page.hide_links = function(wrapper) {
|
|||||||
$(wrapper).find('[href*="Form/"]').each(function() {
|
$(wrapper).find('[href*="Form/"]').each(function() {
|
||||||
var href = $(this).attr('href');
|
var href = $(this).attr('href');
|
||||||
var dt = href.split('/')[1];
|
var dt = href.split('/')[1];
|
||||||
if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1) {
|
if(wn.boot.profile.all_read.indexOf(dt)==-1) {
|
||||||
replace_link(this);
|
replace_link(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -35,7 +35,7 @@ cur_frm.cscript.load_defaults = function(doc, dt, dn) {
|
|||||||
doc = locals[doc.doctype][doc.name];
|
doc = locals[doc.doctype][doc.name];
|
||||||
if(!(doc.__islocal && doc.lead_name)) { return; }
|
if(!(doc.__islocal && doc.lead_name)) { return; }
|
||||||
|
|
||||||
var fields_to_refresh = LocalDB.set_default_values(doc);
|
var fields_to_refresh = wn.model.set_default_values(doc);
|
||||||
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
|
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ cur_frm.cscript.make_contact = function() {
|
|||||||
parent: cur_frm.fields_dict['contact_html'].wrapper,
|
parent: cur_frm.fields_dict['contact_html'].wrapper,
|
||||||
page_length: 2,
|
page_length: 2,
|
||||||
custom_new_doc: function(doctype) {
|
custom_new_doc: function(doctype) {
|
||||||
var contact = LocalDB.create('Contact');
|
var contact = wn.model.make_new_doc_and_get_name('Contact');
|
||||||
contact = locals['Contact'][contact];
|
contact = locals['Contact'][contact];
|
||||||
contact.customer = cur_frm.doc.name;
|
contact.customer = cur_frm.doc.name;
|
||||||
contact.customer_name = cur_frm.doc.customer_name;
|
contact.customer_name = cur_frm.doc.customer_name;
|
||||||
|
@ -71,7 +71,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
list: wn.model.get("Communication", {"lead": doc.name}),
|
list: wn.model.get("Communication", {"lead": doc.name}),
|
||||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||||
doc: doc,
|
doc: doc,
|
||||||
email: doc.email_id
|
recipients: doc.email_id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,15 +83,15 @@ cur_frm.cscript.status = function(doc, cdt, cdn){
|
|||||||
|
|
||||||
cur_frm.cscript['Create Customer'] = function(){
|
cur_frm.cscript['Create Customer'] = function(){
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
$c('runserverobj',args={ 'method':'check_status', 'docs':compress_doclist(make_doclist(doc.doctype, doc.name))},
|
$c('runserverobj',args={ 'method':'check_status', 'docs':wn.model.compress(make_doclist(doc.doctype, doc.name))},
|
||||||
function(r,rt){
|
function(r,rt){
|
||||||
if(r.message == 'Converted'){
|
if(r.message == 'Converted'){
|
||||||
msgprint("This lead is already converted to customer");
|
msgprint("This lead is already converted to customer");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
n = createLocal("Customer");
|
n = wn.model.make_new_doc_and_get_name("Customer");
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals["Customer"][n]]),
|
'docs':wn.model.compress([locals["Customer"][n]]),
|
||||||
'from_doctype':'Lead',
|
'from_doctype':'Lead',
|
||||||
'to_doctype':'Customer',
|
'to_doctype':'Customer',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
@ -110,15 +110,15 @@ cur_frm.cscript['Create Customer'] = function(){
|
|||||||
// ===============================================================
|
// ===============================================================
|
||||||
cur_frm.cscript['Create Opportunity'] = function(){
|
cur_frm.cscript['Create Opportunity'] = function(){
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
$c('runserverobj',args={ 'method':'check_status', 'docs':compress_doclist(make_doclist(doc.doctype, doc.name))},
|
$c('runserverobj',args={ 'method':'check_status', 'docs':wn.model.compress(make_doclist(doc.doctype, doc.name))},
|
||||||
function(r,rt){
|
function(r,rt){
|
||||||
if(r.message == 'Converted'){
|
if(r.message == 'Converted'){
|
||||||
msgprint("This lead is now converted to customer. Please create enquiry on behalf of customer");
|
msgprint("This lead is now converted to customer. Please create enquiry on behalf of customer");
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
n = createLocal("Opportunity");
|
n = wn.model.make_new_doc_and_get_name("Opportunity");
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals["Opportunity"][n]]),
|
'docs':wn.model.compress([locals["Opportunity"][n]]),
|
||||||
'from_doctype':'Lead',
|
'from_doctype':'Lead',
|
||||||
'to_doctype':'Opportunity',
|
'to_doctype':'Opportunity',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
|
@ -51,7 +51,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
list: wn.model.get("Communication", {"opportunity": doc.name}),
|
list: wn.model.get("Communication", {"opportunity": doc.name}),
|
||||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||||
doc: doc,
|
doc: doc,
|
||||||
email: doc.contact_email
|
recipients: doc.contact_email
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,9 +156,9 @@ cur_frm.fields_dict['enquiry_details'].grid.get_field('item_code').get_query = f
|
|||||||
|
|
||||||
// Create New Quotation
|
// Create New Quotation
|
||||||
cur_frm.cscript['Create Quotation'] = function(){
|
cur_frm.cscript['Create Quotation'] = function(){
|
||||||
n = createLocal("Quotation");
|
n = wn.model.make_new_doc_and_get_name("Quotation");
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals["Quotation"][n]]),
|
'docs':wn.model.compress([locals["Quotation"][n]]),
|
||||||
'from_doctype':'Opportunity',
|
'from_doctype':'Opportunity',
|
||||||
'to_doctype':'Quotation',
|
'to_doctype':'Quotation',
|
||||||
'from_docname':cur_frm.docname,
|
'from_docname':cur_frm.docname,
|
||||||
@ -207,6 +207,7 @@ cur_frm.cscript['Declare Opportunity Lost'] = function(){
|
|||||||
if(r.message == 'true'){
|
if(r.message == 'true'){
|
||||||
$i('update_enquiry_dialog_response').innerHTML = 'Done';
|
$i('update_enquiry_dialog_response').innerHTML = 'Done';
|
||||||
e_lost_dialog.hide();
|
e_lost_dialog.hide();
|
||||||
|
cur_frm.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(arg) {
|
if(arg) {
|
||||||
|
@ -107,7 +107,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
list: wn.model.get("Communication", {"quotation": doc.name}),
|
list: wn.model.get("Communication", {"quotation": doc.name}),
|
||||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||||
doc: doc,
|
doc: doc,
|
||||||
email: doc.contact_email
|
recipients: doc.contact_email
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,9 +180,9 @@ cur_frm.cscript['Make Sales Order'] = function() {
|
|||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
|
|
||||||
if (doc.docstatus == 1) {
|
if (doc.docstatus == 1) {
|
||||||
var n = createLocal("Sales Order");
|
var n = wn.model.make_new_doc_and_get_name("Sales Order");
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals["Sales Order"][n]]),
|
'docs':wn.model.compress([locals["Sales Order"][n]]),
|
||||||
'from_doctype':'Quotation',
|
'from_doctype':'Quotation',
|
||||||
'to_doctype':'Sales Order',
|
'to_doctype':'Sales Order',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
@ -250,6 +250,7 @@ cur_frm.cscript['Declare Order Lost'] = function(){
|
|||||||
if(r.message == 'true'){
|
if(r.message == 'true'){
|
||||||
$i('update_quotation_dialog_response').innerHTML = 'Done';
|
$i('update_quotation_dialog_response').innerHTML = 'Done';
|
||||||
qtn_lost_dialog.hide();
|
qtn_lost_dialog.hide();
|
||||||
|
cur_frm.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(arg) $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_order_lost',arg,call_back);
|
if(arg) $c_obj(make_doclist(cur_frm.doc.doctype, cur_frm.doc.name),'declare_order_lost',arg,call_back);
|
||||||
|
@ -46,14 +46,14 @@ cur_frm.cscript.load_defaults = function(doc, dt, dn, callback) {
|
|||||||
if(!cur_frm.doc.__islocal) { return; }
|
if(!cur_frm.doc.__islocal) { return; }
|
||||||
|
|
||||||
doc = locals[doc.doctype][doc.name];
|
doc = locals[doc.doctype][doc.name];
|
||||||
var fields_to_refresh = LocalDB.set_default_values(doc);
|
var fields_to_refresh = wn.model.set_default_values(doc);
|
||||||
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
|
if(fields_to_refresh) { refresh_many(fields_to_refresh); }
|
||||||
|
|
||||||
fields_to_refresh = null;
|
fields_to_refresh = null;
|
||||||
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
|
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
|
||||||
if(!children) { return; }
|
if(!children) { return; }
|
||||||
for(var i=0; i<children.length; i++) {
|
for(var i=0; i<children.length; i++) {
|
||||||
LocalDB.set_default_values(children[i]);
|
wn.model.set_default_values(children[i]);
|
||||||
}
|
}
|
||||||
refresh_field(cur_frm.cscript.fname);
|
refresh_field(cur_frm.cscript.fname);
|
||||||
cur_frm.cscript.load_taxes(doc, dt, dn, callback);
|
cur_frm.cscript.load_taxes(doc, dt, dn, callback);
|
||||||
|
@ -77,7 +77,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
// indent
|
// indent
|
||||||
if(!doc.order_type || (doc.order_type == 'Sales'))
|
if(!doc.order_type || (doc.order_type == 'Sales'))
|
||||||
cur_frm.add_custom_button('Make ' + get_doctype_label('Purchase Request'), cur_frm.cscript['Make Purchase Request']);
|
cur_frm.add_custom_button('Make ' + wn._('Purchase Request'), cur_frm.cscript['Make Purchase Request']);
|
||||||
|
|
||||||
// sales invoice
|
// sales invoice
|
||||||
if(flt(doc.per_billed, 2) < 100)
|
if(flt(doc.per_billed, 2) < 100)
|
||||||
@ -147,7 +147,7 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
|||||||
cur_frm.cscript.pull_quotation_details = function(doc,dt,dn) {
|
cur_frm.cscript.pull_quotation_details = function(doc,dt,dn) {
|
||||||
var callback = function(r,rt){
|
var callback = function(r,rt){
|
||||||
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
var doc = locals[cur_frm.doctype][cur_frm.docname];
|
||||||
if(r.message){
|
if(!r.exc){
|
||||||
doc.quotation_no = r.message;
|
doc.quotation_no = r.message;
|
||||||
if(doc.quotation_no) {
|
if(doc.quotation_no) {
|
||||||
unhide_field(['quotation_date', 'customer_address', 'contact_person', 'territory', 'customer_group']);
|
unhide_field(['quotation_date', 'customer_address', 'contact_person', 'territory', 'customer_group']);
|
||||||
@ -163,7 +163,7 @@ cur_frm.cscript.pull_quotation_details = function(doc,dt,dn) {
|
|||||||
|
|
||||||
//================ create new contact ============================================================================
|
//================ create new contact ============================================================================
|
||||||
cur_frm.cscript.new_contact = function(){
|
cur_frm.cscript.new_contact = function(){
|
||||||
tn = createLocal('Contact');
|
tn = wn.model.make_new_doc_and_get_name('Contact');
|
||||||
locals['Contact'][tn].is_customer = 1;
|
locals['Contact'][tn].is_customer = 1;
|
||||||
if(doc.customer) locals['Contact'][tn].customer = doc.customer;
|
if(doc.customer) locals['Contact'][tn].customer = doc.customer;
|
||||||
loaddoc('Contact', tn);
|
loaddoc('Contact', tn);
|
||||||
@ -222,9 +222,9 @@ cur_frm.cscript['Make Maintenance Schedule'] = function() {
|
|||||||
$c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_schedule','',
|
$c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_schedule','',
|
||||||
function(r,rt){
|
function(r,rt){
|
||||||
if(r.message == 'No'){
|
if(r.message == 'No'){
|
||||||
n = createLocal("Maintenance Schedule");
|
n = wn.model.make_new_doc_and_get_name("Maintenance Schedule");
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals["Maintenance Schedule"][n]]),
|
'docs':wn.model.compress([locals["Maintenance Schedule"][n]]),
|
||||||
'from_doctype':'Sales Order',
|
'from_doctype':'Sales Order',
|
||||||
'to_doctype':'Maintenance Schedule',
|
'to_doctype':'Maintenance Schedule',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
@ -251,9 +251,9 @@ cur_frm.cscript.make_maintenance_visit = function() {
|
|||||||
$c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_visit','',
|
$c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_visit','',
|
||||||
function(r,rt){
|
function(r,rt){
|
||||||
if(r.message == 'No'){
|
if(r.message == 'No'){
|
||||||
n = createLocal("Maintenance Visit");
|
n = wn.model.make_new_doc_and_get_name("Maintenance Visit");
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals["Maintenance Visit"][n]]),
|
'docs':wn.model.compress([locals["Maintenance Visit"][n]]),
|
||||||
'from_doctype':'Sales Order',
|
'from_doctype':'Sales Order',
|
||||||
'to_doctype':'Maintenance Visit',
|
'to_doctype':'Maintenance Visit',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
@ -277,9 +277,9 @@ cur_frm.cscript.make_maintenance_visit = function() {
|
|||||||
cur_frm.cscript['Make Purchase Request'] = function() {
|
cur_frm.cscript['Make Purchase Request'] = function() {
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
if (doc.docstatus == 1) {
|
if (doc.docstatus == 1) {
|
||||||
n = createLocal("Purchase Request");
|
n = wn.model.make_new_doc_and_get_name("Purchase Request");
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals["Purchase Request"][n]]),
|
'docs':wn.model.compress([locals["Purchase Request"][n]]),
|
||||||
'from_doctype':'Sales Order',
|
'from_doctype':'Sales Order',
|
||||||
'to_doctype':'Purchase Request',
|
'to_doctype':'Purchase Request',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
@ -298,9 +298,9 @@ cur_frm.cscript['Make Purchase Request'] = function() {
|
|||||||
cur_frm.cscript['Make Delivery Note'] = function() {
|
cur_frm.cscript['Make Delivery Note'] = function() {
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
if (doc.docstatus == 1) {
|
if (doc.docstatus == 1) {
|
||||||
n = createLocal("Delivery Note");
|
n = wn.model.make_new_doc_and_get_name("Delivery Note");
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals["Delivery Note"][n]]),
|
'docs':wn.model.compress([locals["Delivery Note"][n]]),
|
||||||
'from_doctype':'Sales Order',
|
'from_doctype':'Sales Order',
|
||||||
'to_doctype':'Delivery Note',
|
'to_doctype':'Delivery Note',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
@ -319,9 +319,9 @@ cur_frm.cscript['Make Delivery Note'] = function() {
|
|||||||
cur_frm.cscript['Make Sales Invoice'] = function() {
|
cur_frm.cscript['Make Sales Invoice'] = function() {
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
|
|
||||||
n = createLocal('Sales Invoice');
|
n = wn.model.make_new_doc_and_get_name('Sales Invoice');
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals['Sales Invoice'][n]]),
|
'docs':wn.model.compress([locals['Sales Invoice'][n]]),
|
||||||
'from_doctype':doc.doctype,
|
'from_doctype':doc.doctype,
|
||||||
'to_doctype':'Sales Invoice',
|
'to_doctype':'Sales Invoice',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
@ -341,7 +341,7 @@ cur_frm.cscript['Stop Sales Order'] = function() {
|
|||||||
var check = confirm("Are you sure you want to STOP " + doc.name);
|
var check = confirm("Are you sure you want to STOP " + doc.name);
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
$c('runserverobj', args={'method':'stop_sales_order', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
$c('runserverobj', args={'method':'stop_sales_order', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -355,7 +355,7 @@ cur_frm.cscript['Unstop Sales Order'] = function() {
|
|||||||
var check = confirm("Are you sure you want to UNSTOP " + doc.name);
|
var check = confirm("Are you sure you want to UNSTOP " + doc.name);
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
$c('runserverobj', args={'method':'unstop_sales_order', 'docs': compress_doclist(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
$c('runserverobj', args={'method':'unstop_sales_order', 'docs': wn.model.compress(make_doclist(doc.doctype, doc.name))}, function(r,rt) {
|
||||||
cur_frm.refresh();
|
cur_frm.refresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -194,11 +194,11 @@ class DocType(TransactionBase):
|
|||||||
# Validations of Details Table
|
# Validations of Details Table
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
def validate_for_items(self):
|
def validate_for_items(self):
|
||||||
check_list,flag = [],0
|
check_list, flag = [], 0
|
||||||
chk_dupl_itm = []
|
chk_dupl_itm = []
|
||||||
# Sales Order Items Validations
|
# Sales Order Items Validations
|
||||||
for d in getlist(self.doclist, 'sales_order_details'):
|
for d in getlist(self.doclist, 'sales_order_details'):
|
||||||
if cstr(self.doc.quotation_no) == cstr(d.prevdoc_docname):
|
if self.doc.quotation_no and cstr(self.doc.quotation_no) == cstr(d.prevdoc_docname):
|
||||||
flag = 1
|
flag = 1
|
||||||
if d.prevdoc_docname:
|
if d.prevdoc_docname:
|
||||||
if self.doc.quotation_date and getdate(self.doc.quotation_date) > getdate(self.doc.transaction_date):
|
if self.doc.quotation_date and getdate(self.doc.quotation_date) > getdate(self.doc.transaction_date):
|
||||||
@ -229,14 +229,13 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
# used for production plan
|
# used for production plan
|
||||||
d.transaction_date = self.doc.transaction_date
|
d.transaction_date = self.doc.transaction_date
|
||||||
|
|
||||||
# gets total projected qty of item in warehouse selected (this case arises when warehouse is selected b4 item)
|
tot_avail_qty = sql("select projected_qty from `tabBin` \
|
||||||
tot_avail_qty = sql("select projected_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (d.item_code,d.reserved_warehouse))
|
where item_code = '%s' and warehouse = '%s'" % (d.item_code,d.reserved_warehouse))
|
||||||
d.projected_qty = tot_avail_qty and flt(tot_avail_qty[0][0]) or 0
|
d.projected_qty = tot_avail_qty and flt(tot_avail_qty[0][0]) or 0
|
||||||
|
|
||||||
if flag == 0:
|
if getlist(self.doclist, 'sales_order_details') and self.doc.quotation_no and flag == 0:
|
||||||
msgprint("There are no items of the quotation selected.")
|
msgprint("There are no items of the quotation selected", raise_exception=1)
|
||||||
raise Exception
|
|
||||||
|
|
||||||
# validate sales/ maintenance quotation against order type
|
# validate sales/ maintenance quotation against order type
|
||||||
#------------------------------------------------------------------
|
#------------------------------------------------------------------
|
||||||
|
@ -24,7 +24,14 @@ pscript['onload_Sales Browser'] = function(wrapper){
|
|||||||
|
|
||||||
wrapper.make_tree = function() {
|
wrapper.make_tree = function() {
|
||||||
var ctype = wn.get_route()[1] || 'Territory';
|
var ctype = wn.get_route()[1] || 'Territory';
|
||||||
erpnext.sales_chart = new erpnext.SalesChart(ctype, wrapper);
|
wn.call({
|
||||||
|
method: 'selling.page.sales_browser.sales_browser.get_children',
|
||||||
|
args: {ctype: ctype},
|
||||||
|
callback: function(r) {
|
||||||
|
var root = r.message[0]["value"];
|
||||||
|
erpnext.sales_chart = new erpnext.SalesChart(ctype, root, wrapper);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapper.make_tree();
|
wrapper.make_tree();
|
||||||
@ -42,20 +49,13 @@ pscript['onshow_Sales Browser'] = function(wrapper){
|
|||||||
};
|
};
|
||||||
|
|
||||||
erpnext.SalesChart = Class.extend({
|
erpnext.SalesChart = Class.extend({
|
||||||
init: function(ctype, wrapper) {
|
init: function(ctype, root, wrapper) {
|
||||||
var root_nodes = {
|
|
||||||
'Territory': 'All Territories',
|
|
||||||
'Item Group': 'All Item Groups',
|
|
||||||
'Customer Group': 'All Customer Groups',
|
|
||||||
'Sales Person': 'All Sales Persons'
|
|
||||||
}
|
|
||||||
|
|
||||||
$(wrapper).find('.tree-area').empty();
|
$(wrapper).find('.tree-area').empty();
|
||||||
var me = this;
|
var me = this;
|
||||||
me.ctype = ctype;
|
me.ctype = ctype;
|
||||||
this.tree = new wn.ui.Tree({
|
this.tree = new wn.ui.Tree({
|
||||||
parent: $(wrapper).find('.tree-area'),
|
parent: $(wrapper).find('.tree-area'),
|
||||||
label: root_nodes[ctype],
|
label: root,
|
||||||
args: {ctype: ctype},
|
args: {ctype: ctype},
|
||||||
method: 'selling.page.sales_browser.sales_browser.get_children',
|
method: 'selling.page.sales_browser.sales_browser.get_children',
|
||||||
click: function(link) {
|
click: function(link) {
|
||||||
@ -72,7 +72,7 @@ erpnext.SalesChart = Class.extend({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.tree.rootnode.$a
|
this.tree.rootnode.$a
|
||||||
.data('node-data', {value: root_nodes[ctype], expandable:1})
|
.data('node-data', {value: root, expandable:1})
|
||||||
.click();
|
.click();
|
||||||
},
|
},
|
||||||
make_link_toolbar: function(link) {
|
make_link_toolbar: function(link) {
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
|
|
||||||
@webnotes.whitelist()
|
@webnotes.whitelist()
|
||||||
def get_children():
|
def get_children():
|
||||||
ctype = webnotes.form_dict.get('ctype')
|
ctype = webnotes.form_dict.get('ctype')
|
||||||
webnotes.form_dict['parent_field'] = 'parent_' + ctype.lower().replace(' ', '_')
|
webnotes.form_dict['parent_field'] = 'parent_' + ctype.lower().replace(' ', '_')
|
||||||
|
if not webnotes.form_dict.get('parent'):
|
||||||
|
webnotes.form_dict['parent'] = ''
|
||||||
|
|
||||||
return webnotes.conn.sql("""select name as value,
|
return webnotes.conn.sql("""select name as value,
|
||||||
if(is_group='Yes', 1, 0) as expandable
|
if(is_group='Yes', 1, 0) as expandable
|
||||||
from `tab%(ctype)s`
|
from `tab%(ctype)s`
|
||||||
|
@ -60,7 +60,7 @@ class DocType(TransactionBase):
|
|||||||
if appr_users: add_msg = "Users : "+cstr(appr_users)
|
if appr_users: add_msg = "Users : "+cstr(appr_users)
|
||||||
if appr_roles: add_msg = "Roles : "+cstr(appr_roles)
|
if appr_roles: add_msg = "Roles : "+cstr(appr_roles)
|
||||||
if appr_users and appr_roles: add_msg = "Users : "+cstr(appr_users)+" or "+"Roles : "+cstr(appr_roles)
|
if appr_users and appr_roles: add_msg = "Users : "+cstr(appr_users)+" or "+"Roles : "+cstr(appr_roles)
|
||||||
msgprint("You do not have an authority to submit this %s %s. Please send for approval to %s" % (doctype_name, msg, add_msg))
|
msgprint("You are not authorize to submit this %s %s. Please send for approval to %s" % (doctype_name, msg, add_msg))
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
|||||||
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
||||||
|
|
||||||
|
|
||||||
if(doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Total Claimed Amount' || doc.based_on == 'Not Applicable') hide_field('master_name');
|
if(doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Not Applicable') hide_field('master_name');
|
||||||
else unhide_field('master_name');
|
else unhide_field('master_name');
|
||||||
|
|
||||||
if(doc.based_on == 'Not Applicable') hide_field('value');
|
if(doc.based_on == 'Not Applicable') hide_field('value');
|
||||||
else unhide_field('value');
|
else unhide_field('value');
|
||||||
|
|
||||||
if(doc.transaction == 'Expense Claim' || doc.transaction == 'Appraisal'){
|
if(doc.transaction == 'Appraisal'){
|
||||||
hide_field(['master_name','system_role', 'system_user']);
|
hide_field(['master_name','system_role', 'system_user']);
|
||||||
unhide_field(['to_emp','to_designation']);
|
unhide_field(['to_emp','to_designation']);
|
||||||
if(doc.transaction == 'Appraisal') hide_field('value');
|
if(doc.transaction == 'Appraisal') hide_field('value');
|
||||||
@ -45,7 +45,7 @@ cur_frm.cscript.refresh = function(doc,cdt,cdn){
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.based_on = function(doc){
|
cur_frm.cscript.based_on = function(doc){
|
||||||
if(doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Total Claimed Amount' || doc.based_on == 'Not Applicable'){
|
if(doc.based_on == 'Grand Total' || doc.based_on == 'Average Discount' || doc.based_on == 'Not Applicable'){
|
||||||
doc.master_name = '';
|
doc.master_name = '';
|
||||||
refresh_field('master_name');
|
refresh_field('master_name');
|
||||||
hide_field('master_name');
|
hide_field('master_name');
|
||||||
@ -63,24 +63,20 @@ cur_frm.cscript.based_on = function(doc){
|
|||||||
}
|
}
|
||||||
|
|
||||||
cur_frm.cscript.transaction = function(doc,cdt,cdn){
|
cur_frm.cscript.transaction = function(doc,cdt,cdn){
|
||||||
if(doc.transaction == 'Expense Claim' || doc.transaction == 'Appraisal'){
|
if (doc.transaction == 'Appraisal'){
|
||||||
doc.master_name = doc.system_role = doc.system_user = '';
|
doc.master_name = doc.system_role = doc.system_user = '';
|
||||||
refresh_many(['master_name','system_role', 'system_user']);
|
refresh_many(['master_name','system_role', 'system_user']);
|
||||||
hide_field(['master_name','system_role', 'system_user']);
|
hide_field(['master_name','system_role', 'system_user']);
|
||||||
unhide_field(['to_emp','to_designation']);
|
unhide_field(['to_emp','to_designation']);
|
||||||
if(doc.transaction == 'Appraisal') {
|
doc.value =0;
|
||||||
doc.value =0;
|
refresh_many('value');
|
||||||
refresh_many('value');
|
hide_field('value');
|
||||||
hide_field('value');
|
|
||||||
}
|
|
||||||
else unhide_field('value');
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
unhide_field(['master_name','system_role', 'system_user','value']);
|
unhide_field(['master_name','system_role', 'system_user','value']);
|
||||||
hide_field(['to_emp','to_designation']);
|
hide_field(['to_emp','to_designation']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doc.transaction == 'Expense Claim') doc.based_on = 'Total Claimed Amount';
|
|
||||||
if(doc.transaction == 'Appraisal') doc.based_on == 'Not Applicable';
|
if(doc.transaction == 'Appraisal') doc.based_on == 'Not Applicable';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
@ -27,74 +27,80 @@ sql = webnotes.conn.sql
|
|||||||
|
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self, d, dl):
|
def __init__(self, d, dl):
|
||||||
self.doc, self.doclist = d, dl
|
self.doc, self.doclist = d, dl
|
||||||
|
|
||||||
|
|
||||||
# Duplicate Entry
|
def check_duplicate_entry(self):
|
||||||
# ----------------
|
exists = sql("""select name, docstatus from `tabAuthorization Rule`
|
||||||
def check_duplicate_entry(self):
|
where transaction = %s and based_on = %s and system_user = %s
|
||||||
exists = sql("select name, docstatus from `tabAuthorization Rule` where transaction = %s and based_on = %s and system_user = %s and system_role = %s and approving_user = %s and approving_role = %s and to_emp =%s and to_designation=%s and name != %s", (self.doc.transaction, self.doc.based_on, cstr(self.doc.system_user), cstr(self.doc.system_role), cstr(self.doc.approving_user), cstr(self.doc.approving_role), cstr(self.doc.to_emp), cstr(self.doc.to_designation), self.doc.name))
|
and system_role = %s and approving_user = %s and approving_role = %s
|
||||||
auth_exists = exists and exists[0][0] or ''
|
and to_emp =%s and to_designation=%s and name != %s""",
|
||||||
if auth_exists:
|
(self.doc.transaction, self.doc.based_on, cstr(self.doc.system_user),
|
||||||
if cint(exists[0][1]) == 2:
|
cstr(self.doc.system_role), cstr(self.doc.approving_user),
|
||||||
msgprint("Duplicate Entry. Please remove from trash Authorization Rule : %s." %(auth_exists))
|
cstr(self.doc.approving_role), cstr(self.doc.to_emp),
|
||||||
raise Exception
|
cstr(self.doc.to_designation), self.doc.name))
|
||||||
else:
|
auth_exists = exists and exists[0][0] or ''
|
||||||
msgprint("Duplicate Entry. Please check Authorization Rule : %s." % (auth_exists))
|
if auth_exists:
|
||||||
raise Exception
|
if cint(exists[0][1]) == 2:
|
||||||
|
msgprint("""Duplicate Entry. Please untrash Authorization Rule : %s \
|
||||||
|
from Recycle Bin""" % (auth_exists), raise_exception=1)
|
||||||
|
else:
|
||||||
|
msgprint("Duplicate Entry. Please check Authorization Rule : %s" %
|
||||||
|
(auth_exists), raise_exception=1)
|
||||||
|
|
||||||
|
|
||||||
# Validate Master Name
|
def validate_master_name(self):
|
||||||
# ---------------------
|
if self.doc.based_on == 'Customerwise Discount' and \
|
||||||
def validate_master_name(self):
|
not sql("select name from tabCustomer where name = '%s' and docstatus != 2" % \
|
||||||
if self.doc.based_on == 'Customerwise Discount' and not sql("select name from tabCustomer where name = '%s' and docstatus != 2" % (self.doc.master_name)):
|
(self.doc.master_name)):
|
||||||
msgprint("Please select valid Customer Name for Customerwise Discount.")
|
msgprint("Please select valid Customer Name for Customerwise Discount",
|
||||||
raise Exception
|
raise_exception=1)
|
||||||
elif self.doc.based_on == 'Itemwise Discount' and not sql("select name from tabItem where name = '%s' and docstatus != 2" % (self.doc.master_name)):
|
elif self.doc.based_on == 'Itemwise Discount' and \
|
||||||
msgprint("Please select valid Item Name for Itemwise Discount.")
|
not sql("select name from tabItem where name = '%s' and docstatus != 2" % \
|
||||||
raise Exception
|
(self.doc.master_name)):
|
||||||
elif (self.doc.based_on == 'Grand Total' or self.doc.based_on == 'Average Discount') and self.doc.master_name:
|
msgprint("Please select valid Item Name for Itemwise Discount", raise_exception=1)
|
||||||
msgprint("Please remove Customer / Item Name for %s." % (self.doc.based_on))
|
elif (self.doc.based_on == 'Grand Total' or \
|
||||||
raise Exception
|
self.doc.based_on == 'Average Discount') and self.doc.master_name:
|
||||||
|
msgprint("Please remove Customer/Item Name for %s." %
|
||||||
|
self.doc.based_on, raise_exception=1)
|
||||||
|
|
||||||
|
|
||||||
# Validate Rule
|
def validate_rule(self):
|
||||||
# --------------
|
if self.doc.transaction != 'Appraisal':
|
||||||
def validate_rule(self):
|
if not self.doc.approving_role and not self.doc.approving_user:
|
||||||
if not self.doc.transaction == 'Expense Claim' and not self.doc.transaction == 'Appraisal':
|
msgprint("Please enter Approving Role or Approving User", raise_exception=1)
|
||||||
if not self.doc.approving_role and not self.doc.approving_user:
|
elif self.doc.system_user and self.doc.system_user == self.doc.approving_user:
|
||||||
msgprint("Please enter Approving Role or Approving User")
|
msgprint("Approving User cannot be same as user the rule is Applicable To (User)",
|
||||||
raise Exception
|
raise_exception=1)
|
||||||
elif self.doc.system_user and self.doc.system_user == self.doc.approving_user:
|
elif self.doc.system_role and self.doc.system_role == self.doc.approving_role:
|
||||||
msgprint("Approving User cannot be same as user the rule is Applicable To (User).")
|
msgprint("Approving Role cannot be same as user the rule is \
|
||||||
raise Exception
|
Applicable To (Role).", raise_exception=1)
|
||||||
elif self.doc.system_role and self.doc.system_role == self.doc.approving_role:
|
elif self.doc.system_user and self.doc.approving_role and \
|
||||||
msgprint("Approving Role cannot be same as user the rule is Applicable To (Role).")
|
has_common([self.doc.approving_role], [x[0] for x in \
|
||||||
raise Exception
|
sql("select role from `tabUserRole` where parent = '%s'" % \
|
||||||
elif self.doc.system_user and self.doc.approving_role and has_common([self.doc.approving_role],[x[0] for x in sql("select role from `tabUserRole` where parent = '%s'" % (self.doc.system_user))]):
|
(self.doc.system_user))]):
|
||||||
msgprint("System User : %s is assigned role : %s. So rule does not make sense." % (self.doc.system_user,self.doc.approving_role))
|
msgprint("System User : %s is assigned role : %s. So rule does not make sense" %
|
||||||
raise Exception
|
(self.doc.system_user,self.doc.approving_role), raise_exception=1)
|
||||||
elif (self.doc.transaction == 'Purchase Order' or self.doc.transaction == 'Purchase Receipt' or self.doc.transaction == 'Purchase Invoice' or self.doc.transaction == 'Stock Entry') and (self.doc.based_on == 'Average Discount' or self.doc.based_on == 'Customerwise Discount' or self.doc.based_on == 'Itemwise Discount'):
|
elif self.doc.transaction in ['Purchase Order', 'Purchase Receipt', \
|
||||||
msgprint("You cannot set authorization on basis of Discount for %s." % (self.doc.transaction))
|
'Purchase Invoice', 'Stock Entry'] and self.doc.based_on \
|
||||||
raise Exception
|
in ['Average Discount', 'Customerwise Discount', 'Itemwise Discount']:
|
||||||
elif self.doc.based_on == 'Average Discount' and flt(self.doc.value) > 100.00:
|
msgprint("You cannot set authorization on basis of Discount for %s" %
|
||||||
msgprint("Discount cannot given for more than 100 %s." % ('%'))
|
self.doc.transaction, raise_exception=1)
|
||||||
raise Exception
|
elif self.doc.based_on == 'Average Discount' and flt(self.doc.value) > 100.00:
|
||||||
elif self.doc.based_on == 'Customerwise Discount' and not self.doc.master_name:
|
msgprint("Discount cannot given for more than 100%", raise_exception=1)
|
||||||
msgprint("Please enter Customer Name for 'Customerwise Discount'")
|
elif self.doc.based_on == 'Customerwise Discount' and not self.doc.master_name:
|
||||||
raise Exception
|
msgprint("Please enter Customer Name for 'Customerwise Discount'",
|
||||||
else:
|
raise_exception=1)
|
||||||
if self.doc.transaction == 'Appraisal' and self.doc.based_on != 'Not Applicable':
|
else:
|
||||||
msgprint("Based on is 'Not Applicable' while setting authorization rule for 'Appraisal'")
|
if self.doc.transaction == 'Appraisal' and self.doc.based_on != 'Not Applicable':
|
||||||
raise Exception
|
msgprint("Based on should be 'Not Applicable' while setting authorization rule\
|
||||||
if self.doc.transaction == 'Expense Claim' and self.doc.based_on != 'Total Claimed Amount':
|
for 'Appraisal'", raise_exception=1)
|
||||||
msgprint("Authorization rule should be based on 'Total Calimed Amount' while setting authorization rule for 'Expense Claim'")
|
|
||||||
raise Exception
|
|
||||||
|
|
||||||
|
|
||||||
def validate(self):
|
|
||||||
self.check_duplicate_entry()
|
def validate(self):
|
||||||
self.validate_rule()
|
self.check_duplicate_entry()
|
||||||
self.validate_master_name()
|
self.validate_rule()
|
||||||
if not self.doc.value: self.doc.value = flt(0)
|
self.validate_master_name()
|
||||||
|
if not self.doc.value: self.doc.value = 0.0
|
@ -2,23 +2,17 @@
|
|||||||
{
|
{
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"creation": "2012-03-27 14:36:18",
|
"creation": "2012-07-03 13:30:00",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"modified": "2012-03-27 14:36:18"
|
"modified": "2012-12-12 10:42:42"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"section_style": "Simple",
|
"autoname": "AR.####",
|
||||||
|
"name": "__common__",
|
||||||
"search_fields": "transaction,based_on,system_user,system_role,approving_user,approving_role",
|
"search_fields": "transaction,based_on,system_user,system_role,approving_user,approving_role",
|
||||||
"module": "Setup",
|
"module": "Setup",
|
||||||
"doctype": "DocType",
|
"doctype": "DocType",
|
||||||
"allow_trash": 1,
|
"document_type": "Master"
|
||||||
"document_type": "Master",
|
|
||||||
"autoname": "AR.####",
|
|
||||||
"name": "__common__",
|
|
||||||
"colour": "White:FFF",
|
|
||||||
"_last_update": "1308741898",
|
|
||||||
"server_code_error": " ",
|
|
||||||
"version": 58
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
@ -46,19 +40,13 @@
|
|||||||
"doctype": "DocType"
|
"doctype": "DocType"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocPerm"
|
"oldfieldtype": "Link",
|
||||||
},
|
|
||||||
{
|
|
||||||
"doctype": "DocPerm"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"search_index": 0,
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Company",
|
"label": "Company",
|
||||||
"oldfieldname": "company",
|
"oldfieldname": "company",
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"oldfieldtype": "Link",
|
"search_index": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"options": "Company"
|
"options": "Company"
|
||||||
},
|
},
|
||||||
@ -70,27 +58,26 @@
|
|||||||
"fieldname": "transaction",
|
"fieldname": "transaction",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"options": "\nDelivery Note\nPurchase Invoice\nPurchase Order\nPurchase Receipt\nQuotation\nSales Invoice\nSales Order\nStock Entry\nExpense Claim\nAppraisal"
|
"options": "\nDelivery Note\nPurchase Invoice\nPurchase Order\nPurchase Receipt\nQuotation\nSales Invoice\nSales Order\nStock Entry\nAppraisal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"oldfieldtype": "Select",
|
"oldfieldtype": "Select",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Based On",
|
"label": "Based On",
|
||||||
"oldfieldname": "based_on",
|
"oldfieldname": "based_on",
|
||||||
"trigger": "Client",
|
|
||||||
"fieldname": "based_on",
|
"fieldname": "based_on",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"options": "\nGrand Total\nAverage Discount\nCustomerwise Discount\nItemwise Discount\nTotal Claimed Amount\nNot Applicable"
|
"options": "\nGrand Total\nAverage Discount\nCustomerwise Discount\nItemwise Discount\nNot Applicable"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"oldfieldtype": "Link",
|
"oldfieldtype": "Link",
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Customer / Item Name",
|
"label": "Customer / Item Name",
|
||||||
"oldfieldname": "master_name",
|
"oldfieldname": "master_name",
|
||||||
"trigger": "Client",
|
|
||||||
"fieldname": "master_name",
|
"fieldname": "master_name",
|
||||||
"fieldtype": "Link"
|
"fieldtype": "Link",
|
||||||
|
"options": "[Select]"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"oldfieldtype": "Link",
|
"oldfieldtype": "Link",
|
||||||
@ -103,7 +90,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"oldfieldtype": "Link",
|
"oldfieldtype": "Link",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Applicable To (User)",
|
"label": "Applicable To (User)",
|
||||||
"oldfieldname": "system_user",
|
"oldfieldname": "system_user",
|
||||||
@ -113,26 +99,24 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "This will be used for setting rule in HR module",
|
"description": "This will be used for setting rule in HR module",
|
||||||
"search_index": 0,
|
"oldfieldtype": "Link",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Applicable To (Employee)",
|
"label": "Applicable To (Employee)",
|
||||||
"oldfieldname": "to_emp",
|
"oldfieldname": "to_emp",
|
||||||
"fieldname": "to_emp",
|
"fieldname": "to_emp",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"oldfieldtype": "Link",
|
"search_index": 0,
|
||||||
"options": "Employee"
|
"options": "Employee"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "This will be used for setting rule in HR module",
|
"description": "This will be used for setting rule in HR module",
|
||||||
"search_index": 0,
|
"oldfieldtype": "Link",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Applicable To (Designation)",
|
"label": "Applicable To (Designation)",
|
||||||
"oldfieldname": "to_designation",
|
"oldfieldname": "to_designation",
|
||||||
"fieldname": "to_designation",
|
"fieldname": "to_designation",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"oldfieldtype": "Link",
|
"search_index": 0,
|
||||||
"options": "Designation"
|
"options": "Designation"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -169,5 +153,11 @@
|
|||||||
"oldfieldname": "trash_reason",
|
"oldfieldname": "trash_reason",
|
||||||
"fieldname": "trash_reason",
|
"fieldname": "trash_reason",
|
||||||
"fieldtype": "Small Text"
|
"fieldtype": "Small Text"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocPerm"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocPerm"
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -55,7 +55,7 @@ cur_frm.cscript.make_history_list = function(parent,doc){
|
|||||||
// get sates on country trigger
|
// get sates on country trigger
|
||||||
// -----------------------------
|
// -----------------------------
|
||||||
cur_frm.cscript.get_states=function(doc,dt,dn){
|
cur_frm.cscript.get_states=function(doc,dt,dn){
|
||||||
$c('runserverobj', args={'method':'check_state', 'docs':compress_doclist(make_doclist(doc.doctype, doc.name))},
|
$c('runserverobj', args={'method':'check_state', 'docs':wn.model.compress(make_doclist(doc.doctype, doc.name))},
|
||||||
function(r,rt){
|
function(r,rt){
|
||||||
if(r.message) {
|
if(r.message) {
|
||||||
set_field_options('state', r.message);
|
set_field_options('state', r.message);
|
||||||
@ -156,7 +156,7 @@ cur_frm.cscript.render_row_in_wrapper = function(wrapper, data, doctype) {
|
|||||||
$wrapper.append(repl("\
|
$wrapper.append(repl("\
|
||||||
<h4><a class='link_type'>%(fullname)s</a>%(primary)s</h4>\
|
<h4><a class='link_type'>%(fullname)s</a>%(primary)s</h4>\
|
||||||
<div class='description'>\
|
<div class='description'>\
|
||||||
%(description)s\
|
<p>%(description)s</p>\
|
||||||
<p><a class='delete link_type'>delete this %(doctype)s</a></p>\
|
<p><a class='delete link_type'>delete this %(doctype)s</a></p>\
|
||||||
</div>", data));
|
</div>", data));
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
cur_frm.cscript.set_root_readonly = function(doc) {
|
cur_frm.cscript.set_root_readonly = function(doc) {
|
||||||
// read-only for root customer group
|
// read-only for root customer group
|
||||||
if(doc.name==='All Customer Groups') {
|
if(!doc.parent_customer_group) {
|
||||||
cur_frm.perm = [[1,0,0], [1,0,0]];
|
cur_frm.perm = [[1,0,0], [1,0,0]];
|
||||||
cur_frm.set_intro("This is a root customer group and cannot be edited.");
|
cur_frm.set_intro("This is a root customer group and cannot be edited.");
|
||||||
} else {
|
} else {
|
||||||
|
@ -31,20 +31,29 @@ class DocType(DocTypeNestedSet):
|
|||||||
self.nsm_parent_field = 'parent_customer_group';
|
self.nsm_parent_field = 'parent_customer_group';
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if sql("select name from `tabCustomer Group` where name = %s and docstatus = 2", (self.doc.customer_group_name)):
|
if sql("select name from `tabCustomer Group` where name = %s and docstatus = 2",
|
||||||
|
(self.doc.customer_group_name)):
|
||||||
msgprint("""Another %s record is trashed.
|
msgprint("""Another %s record is trashed.
|
||||||
To untrash please go to Setup & click on Trash."""%(self.doc.customer_group_name), raise_exception = 1)
|
To untrash please go to Setup -> Recycle Bin.""" %
|
||||||
self.validate_root_details("All Customer Groups", "parent_customer_group")
|
(self.doc.customer_group_name), raise_exception = 1)
|
||||||
|
|
||||||
|
super(DocType, self).validate()
|
||||||
|
|
||||||
|
|
||||||
def on_trash(self):
|
def on_trash(self):
|
||||||
cust = sql("select name from `tabCustomer` where ifnull(customer_group, '') = %s", self.doc.name)
|
cust = sql("select name from `tabCustomer` where ifnull(customer_group, '') = %s",
|
||||||
|
self.doc.name)
|
||||||
cust = [d[0] for d in cust]
|
cust = [d[0] for d in cust]
|
||||||
if cust:
|
if cust:
|
||||||
msgprint("""Customer Group: %s can not be trashed/deleted because it is used in customer: %s.
|
msgprint("""Customer Group: %s can not be trashed/deleted \
|
||||||
To trash/delete this, remove/change customer group in customer master""" % (self.doc.name, cust or ''), raise_exception=1)
|
because it is used in customer: %s.
|
||||||
|
To trash/delete this, remove/change customer group in customer master""" %
|
||||||
|
(self.doc.name, cust or ''), raise_exception=1)
|
||||||
|
|
||||||
if sql("select name from `tabCustomer Group` where parent_customer_group = %s and docstatus != 2", self.doc.name):
|
if sql("select name from `tabCustomer Group` where parent_customer_group = %s \
|
||||||
msgprint("Child customer group exists for this customer group. You can not trash/cancel/delete this customer group.", raise_exception=1)
|
and docstatus != 2", self.doc.name):
|
||||||
|
msgprint("Child customer group exists for this customer group. \
|
||||||
|
You can not trash/cancel/delete this customer group.", raise_exception=1)
|
||||||
|
|
||||||
# rebuild tree
|
# rebuild tree
|
||||||
super(DocType, self).on_trash()
|
super(DocType, self).on_trash()
|
@ -37,7 +37,8 @@ keydict = {
|
|||||||
'currency_format':'default_currency_format',
|
'currency_format':'default_currency_format',
|
||||||
'account_url':'account_url',
|
'account_url':'account_url',
|
||||||
'allow_negative_stock' : 'allow_negative_stock',
|
'allow_negative_stock' : 'allow_negative_stock',
|
||||||
'maintain_same_rate' : 'maintain_same_rate'
|
'maintain_same_rate' : 'maintain_same_rate',
|
||||||
|
'session_expiry': 'session_expiry'
|
||||||
}
|
}
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
@ -47,6 +48,8 @@ class DocType:
|
|||||||
def on_update(self):
|
def on_update(self):
|
||||||
"""update defaults"""
|
"""update defaults"""
|
||||||
|
|
||||||
|
self.validate_session_expiry()
|
||||||
|
|
||||||
for key in keydict:
|
for key in keydict:
|
||||||
webnotes.conn.set_default(key, self.doc.fields.get(keydict[key], ''))
|
webnotes.conn.set_default(key, self.doc.fields.get(keydict[key], ''))
|
||||||
|
|
||||||
@ -60,6 +63,15 @@ class DocType:
|
|||||||
webnotes.conn.set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
|
webnotes.conn.set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
|
||||||
webnotes.conn.set_default('year_end_date', \
|
webnotes.conn.set_default('year_end_date', \
|
||||||
get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d'))
|
get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d'))
|
||||||
|
|
||||||
|
def validate_session_expiry(self):
|
||||||
|
if self.doc.session_expiry:
|
||||||
|
from datetime import datetime
|
||||||
|
try:
|
||||||
|
datetime.strptime(self.doc.session_expiry, "%H:%M")
|
||||||
|
except ValueError:
|
||||||
|
webnotes.msgprint("""Session Expiry must be in format hh:mm""",
|
||||||
|
raise_exception=1)
|
||||||
|
|
||||||
def get_defaults(self):
|
def get_defaults(self):
|
||||||
return webnotes.conn.get_defaults()
|
return webnotes.conn.get_defaults()
|
||||||
|
@ -2,25 +2,19 @@
|
|||||||
{
|
{
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"creation": "2012-07-03 13:30:02",
|
"creation": "2012-10-26 16:49:40",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"modified": "2012-10-26 16:42:29"
|
"modified": "2012-12-12 14:13:31"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"section_style": "Tabbed",
|
|
||||||
"in_create": 1,
|
"in_create": 1,
|
||||||
"allow_print": 1,
|
"allow_print": 1,
|
||||||
"module": "Setup",
|
"module": "Setup",
|
||||||
"doctype": "DocType",
|
|
||||||
"server_code_error": " ",
|
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"allow_email": 1,
|
"allow_email": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
"colour": "White:FFF",
|
"doctype": "DocType",
|
||||||
"_last_update": "1323855502",
|
|
||||||
"show_in_menu": 1,
|
|
||||||
"version": 1,
|
|
||||||
"hide_toolbar": 0,
|
"hide_toolbar": 0,
|
||||||
"allow_copy": 1
|
"allow_copy": 1
|
||||||
},
|
},
|
||||||
@ -46,9 +40,22 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
"label": "General",
|
||||||
|
"fieldname": "general",
|
||||||
|
"fieldtype": "Section Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Session Expiry in Hours e.g. 06:00",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"label": "Session Expiry",
|
||||||
|
"fieldname": "session_expiry",
|
||||||
|
"fieldtype": "Data"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
|
"label": "Company",
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break"
|
||||||
"label": "Company"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -74,10 +81,10 @@
|
|||||||
"options": "yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy"
|
"options": "yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
"width": "50%",
|
"width": "50%",
|
||||||
"fieldname": "column_break1",
|
"fieldname": "column_break1",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break"
|
||||||
"doctype": "DocField"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "INR",
|
"default": "INR",
|
||||||
@ -97,21 +104,21 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
"label": "Default Currency Fraction",
|
||||||
"fieldname": "default_currency_fraction",
|
"fieldname": "default_currency_fraction",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data"
|
||||||
"label": "Default Currency Fraction"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
"label": "Stock",
|
||||||
"fieldname": "stock",
|
"fieldname": "stock",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break"
|
||||||
"label": "Stock"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
"width": "50%",
|
"width": "50%",
|
||||||
"fieldname": "column_break2",
|
"fieldname": "column_break2",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break"
|
||||||
"doctype": "DocField"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -143,7 +150,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Applicable only if valuation method is moving average",
|
"description": "Applicable only if valuation method is moving average",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Allow Negative Stock",
|
"label": "Allow Negative Stock",
|
||||||
"fieldname": "allow_negative_stock",
|
"fieldname": "allow_negative_stock",
|
||||||
@ -158,9 +164,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
"label": "Raise Purchase Request when stock reaches re-order level",
|
||||||
"fieldname": "auto_indent",
|
"fieldname": "auto_indent",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check"
|
||||||
"label": "Raise Purchase Request when stock reaches re-order level"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "1",
|
"default": "1",
|
||||||
@ -171,7 +177,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Percentage you are allowed to receive or deliver more against the quantity ordered. <p>For example: If you have ordered 100 units. and your Allowance is 10% then you are allowed to receive 110 units</p>",
|
"description": "Percentage you are allowed to receive or deliver more against the quantity ordered. <p>For example: If you have ordered 100 units. and your Allowance is 10% then you are allowed to receive 110 units</p>",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Allowance Percent",
|
"label": "Allowance Percent",
|
||||||
"fieldname": "tolerance",
|
"fieldname": "tolerance",
|
||||||
@ -179,7 +184,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Stock level frozen up to this date, nobody can do / modify entry except authorized person",
|
"description": "Stock level frozen up to this date, nobody can do / modify entry except authorized person",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Stock Frozen Upto",
|
"label": "Stock Frozen Upto",
|
||||||
"fieldname": "stock_frozen_upto",
|
"fieldname": "stock_frozen_upto",
|
||||||
@ -187,7 +191,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Users with this role are allowed to do / modify stock entry before frozen date",
|
"description": "Users with this role are allowed to do / modify stock entry before frozen date",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Authorized Role (Frozen Entry)",
|
"label": "Authorized Role (Frozen Entry)",
|
||||||
"fieldname": "stock_auth_role",
|
"fieldname": "stock_auth_role",
|
||||||
@ -196,13 +199,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
"label": "Accounts",
|
||||||
"fieldname": "accounts",
|
"fieldname": "accounts",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break"
|
||||||
"label": "Accounts"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Accounting entry frozen up to this date, nobody can do / modify entry except authorized person",
|
"description": "Accounting entry frozen up to this date, nobody can do / modify entry except authorized person",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Accounts Frozen Upto",
|
"label": "Accounts Frozen Upto",
|
||||||
"fieldname": "acc_frozen_upto",
|
"fieldname": "acc_frozen_upto",
|
||||||
@ -210,7 +212,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Users with this role are allowed to do / modify accounting entry before frozen date",
|
"description": "Users with this role are allowed to do / modify accounting entry before frozen date",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Authourized Role (Frozen Entry)",
|
"label": "Authourized Role (Frozen Entry)",
|
||||||
"fieldname": "bde_auth_role",
|
"fieldname": "bde_auth_role",
|
||||||
@ -225,9 +226,9 @@
|
|||||||
"options": "Role"
|
"options": "Role"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
"fieldname": "column_break4",
|
"fieldname": "column_break4",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break"
|
||||||
"doctype": "DocField"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -238,13 +239,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
"label": "Selling",
|
||||||
"fieldname": "selling",
|
"fieldname": "selling",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break"
|
||||||
"label": "Selling"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "Customer Name",
|
"default": "Customer Name",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Customer Master created by ",
|
"label": "Customer Master created by ",
|
||||||
"fieldname": "cust_master_name",
|
"fieldname": "cust_master_name",
|
||||||
@ -280,10 +280,10 @@
|
|||||||
"options": "<a href=\"#!Sales Browser/Territory\">To manage Territory, click here</a>"
|
"options": "<a href=\"#!Sales Browser/Territory\">To manage Territory, click here</a>"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
"width": "50%",
|
"width": "50%",
|
||||||
"fieldname": "column_break5",
|
"fieldname": "column_break5",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break"
|
||||||
"doctype": "DocField"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -301,7 +301,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "No",
|
"default": "No",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Sales Order Required",
|
"label": "Sales Order Required",
|
||||||
"fieldname": "so_required",
|
"fieldname": "so_required",
|
||||||
@ -310,7 +309,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "No",
|
"default": "No",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Delivery Note Required",
|
"label": "Delivery Note Required",
|
||||||
"fieldname": "dn_required",
|
"fieldname": "dn_required",
|
||||||
@ -319,9 +317,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
"label": "Buying",
|
||||||
"fieldname": "buying",
|
"fieldname": "buying",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break"
|
||||||
"label": "Buying"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -332,7 +330,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "Supplier Name",
|
"default": "Supplier Name",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Supplier Master created by ",
|
"label": "Supplier Master created by ",
|
||||||
"fieldname": "supp_master_name",
|
"fieldname": "supp_master_name",
|
||||||
@ -340,14 +337,13 @@
|
|||||||
"options": "Supplier Name\nNaming Series"
|
"options": "Supplier Name\nNaming Series"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"doctype": "DocField",
|
||||||
"width": "50%",
|
"width": "50%",
|
||||||
"fieldname": "column_break6",
|
"fieldname": "column_break6",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break"
|
||||||
"doctype": "DocField"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "No",
|
"default": "No",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Purchase Order Required",
|
"label": "Purchase Order Required",
|
||||||
"fieldname": "po_required",
|
"fieldname": "po_required",
|
||||||
@ -356,7 +352,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "No",
|
"default": "No",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Purchase Receipt Required",
|
"label": "Purchase Receipt Required",
|
||||||
"fieldname": "pr_required",
|
"fieldname": "pr_required",
|
||||||
@ -365,9 +360,9 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
"label": "Maintain same rate throughout purchase cycle",
|
||||||
"fieldname": "maintain_same_rate",
|
"fieldname": "maintain_same_rate",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check"
|
||||||
"label": "Maintain same rate throughout purchase cycle"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
@ -378,7 +373,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Employee record is created using selected field. ",
|
"description": "Employee record is created using selected field. ",
|
||||||
"colour": "White:FFF",
|
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"label": "Employee Records to be created by ",
|
"label": "Employee Records to be created by ",
|
||||||
"fieldname": "emp_created_by",
|
"fieldname": "emp_created_by",
|
||||||
@ -387,15 +381,15 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
"label": "System",
|
||||||
"fieldname": "system",
|
"fieldname": "system",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break"
|
||||||
"label": "System"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
|
"label": "SMS Sender Name",
|
||||||
"fieldname": "sms_sender_name",
|
"fieldname": "sms_sender_name",
|
||||||
"fieldtype": "Data",
|
"fieldtype": "Data"
|
||||||
"label": "SMS Sender Name"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 0,
|
"amend": 0,
|
||||||
@ -415,20 +409,20 @@
|
|||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"doctype": "DocPerm",
|
||||||
|
"write": 1,
|
||||||
|
"role": "System Manager",
|
||||||
|
"permlevel": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "DocPerm",
|
||||||
"role": "All",
|
"role": "All",
|
||||||
"permlevel": 1,
|
"permlevel": 1
|
||||||
"doctype": "DocPerm"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"doctype": "DocPerm",
|
||||||
"write": 1,
|
"write": 1,
|
||||||
"role": "System Manager",
|
"role": "System Manager",
|
||||||
"permlevel": 1,
|
"permlevel": 2
|
||||||
"doctype": "DocPerm"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"write": 1,
|
|
||||||
"role": "System Manager",
|
|
||||||
"permlevel": 2,
|
|
||||||
"doctype": "DocPerm"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -14,6 +14,21 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||||
|
cur_frm.cscript.set_root_readonly(doc);
|
||||||
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.set_root_readonly = function(doc) {
|
||||||
|
// read-only for root item group
|
||||||
|
if(!doc.parent_item_group) {
|
||||||
|
cur_frm.perm = [[1,0,0], [1,0,0]];
|
||||||
|
cur_frm.set_intro("This is a root item group and cannot be edited.");
|
||||||
|
} else {
|
||||||
|
cur_frm.set_intro(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//get query select item group
|
//get query select item group
|
||||||
cur_frm.fields_dict['parent_item_group'].get_query = function(doc,cdt,cdn) {
|
cur_frm.fields_dict['parent_item_group'].get_query = function(doc,cdt,cdn) {
|
||||||
return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "Yes" AND `tabItem Group`.`docstatus`!= 2 AND `tabItem Group`.`name` !="'+doc.item_group_name+'" AND `tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` ASC LIMIT 50';
|
return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` FROM `tabItem Group` WHERE `tabItem Group`.`is_group` = "Yes" AND `tabItem Group`.`docstatus`!= 2 AND `tabItem Group`.`name` !="'+doc.item_group_name+'" AND `tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` ASC LIMIT 50';
|
||||||
|
@ -77,7 +77,7 @@ cur_frm.cscript.make_contact = function() {
|
|||||||
page_length: 2,
|
page_length: 2,
|
||||||
new_doctype: "Contact",
|
new_doctype: "Contact",
|
||||||
custom_new_doc: function(doctype) {
|
custom_new_doc: function(doctype) {
|
||||||
var contact = LocalDB.create('Contact');
|
var contact = wn.model.make_new_doc_and_get_name('Contact');
|
||||||
contact = locals['Contact'][contact];
|
contact = locals['Contact'][contact];
|
||||||
contact.sales_partner = cur_frm.doc.name;
|
contact.sales_partner = cur_frm.doc.name;
|
||||||
wn.set_route("Form", "Contact", contact.name);
|
wn.set_route("Form", "Contact", contact.name);
|
||||||
|
@ -20,7 +20,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
cur_frm.cscript.set_root_readonly = function(doc) {
|
cur_frm.cscript.set_root_readonly = function(doc) {
|
||||||
// read-only for root
|
// read-only for root
|
||||||
if(doc.name==='All Sales Persons') {
|
if(!doc.parent_sales_person) {
|
||||||
cur_frm.perm = [[1,0,0], [1,0,0]];
|
cur_frm.perm = [[1,0,0], [1,0,0]];
|
||||||
cur_frm.set_intro("This is a root sales person and cannot be edited.");
|
cur_frm.set_intro("This is a root sales person and cannot be edited.");
|
||||||
} else {
|
} else {
|
||||||
|
@ -33,3 +33,6 @@ class DocType(DocTypeNestedSet):
|
|||||||
if not flt(d.target_qty) and not flt(d.target_amount):
|
if not flt(d.target_qty) and not flt(d.target_amount):
|
||||||
webnotes.msgprint("Either target qty or target amount is mandatory.")
|
webnotes.msgprint("Either target qty or target amount is mandatory.")
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
|
super(DocType, self).validate()
|
||||||
|
|
@ -20,7 +20,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
|||||||
|
|
||||||
cur_frm.cscript.set_root_readonly = function(doc) {
|
cur_frm.cscript.set_root_readonly = function(doc) {
|
||||||
// read-only for root territory
|
// read-only for root territory
|
||||||
if(doc.name==='All Territories') {
|
if(!doc.parent_territory) {
|
||||||
cur_frm.perm = [[1,0,0], [1,0,0]];
|
cur_frm.perm = [[1,0,0], [1,0,0]];
|
||||||
cur_frm.set_intro("This is a root territory and cannot be edited.");
|
cur_frm.set_intro("This is a root territory and cannot be edited.");
|
||||||
} else {
|
} else {
|
||||||
@ -28,12 +28,6 @@ cur_frm.cscript.set_root_readonly = function(doc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(){
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//get query select territory
|
//get query select territory
|
||||||
cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) {
|
cur_frm.fields_dict['parent_territory'].get_query = function(doc,cdt,cdn) {
|
||||||
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "Yes" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.`name` !="'+doc.territory_name+'" AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "Yes" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.`name` !="'+doc.territory_name+'" AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
||||||
|
@ -33,3 +33,6 @@ class DocType(DocTypeNestedSet):
|
|||||||
if not flt(d.target_qty) and not flt(d.target_amount):
|
if not flt(d.target_qty) and not flt(d.target_amount):
|
||||||
msgprint("Either target qty or target amount is mandatory.")
|
msgprint("Either target qty or target amount is mandatory.")
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
|
super(DocType, self).validate()
|
||||||
|
|
@ -32,7 +32,7 @@ cur_frm.cscript.select_form = function(doc, cdt, cdn){
|
|||||||
var mydoc = doc
|
var mydoc = doc
|
||||||
|
|
||||||
var call_back_action = function(mydoc){
|
var call_back_action = function(mydoc){
|
||||||
$c('runserverobj', args={'method':'field_label_list', 'docs':compress_doclist (make_doclist (mydoc.doctype,mydoc.name))},
|
$c('runserverobj', args={'method':'field_label_list', 'docs':wn.model.compress (make_doclist (mydoc.doctype,mydoc.name))},
|
||||||
function(r, rt) {
|
function(r, rt) {
|
||||||
var doc = locals[mydoc.doctype][mydoc.name];
|
var doc = locals[mydoc.doctype][mydoc.name];
|
||||||
cur_frm.fields_dict.workflow_action_details.grid.get_field("action_field").df.options = r.message;
|
cur_frm.fields_dict.workflow_action_details.grid.get_field("action_field").df.options = r.message;
|
||||||
@ -41,7 +41,7 @@ cur_frm.cscript.select_form = function(doc, cdt, cdn){
|
|||||||
}
|
}
|
||||||
|
|
||||||
var call_back_rule = function(mydoc){
|
var call_back_rule = function(mydoc){
|
||||||
$c('runserverobj', args={'method':'compare_field', 'docs':compress_doclist (make_doclist (mydoc.doctype,mydoc.name))},
|
$c('runserverobj', args={'method':'compare_field', 'docs':wn.model.compress (make_doclist (mydoc.doctype,mydoc.name))},
|
||||||
function(r, rt) {
|
function(r, rt) {
|
||||||
var doc = locals[mydoc.doctype][mydoc.name];
|
var doc = locals[mydoc.doctype][mydoc.name];
|
||||||
cur_frm.fields_dict.workflow_rule_details.grid.get_field("comparing_field").df.options = r.message;
|
cur_frm.fields_dict.workflow_rule_details.grid.get_field("comparing_field").df.options = r.message;
|
||||||
@ -50,7 +50,7 @@ cur_frm.cscript.select_form = function(doc, cdt, cdn){
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$c('runserverobj', args={'method':'maindoc_field', 'docs':compress_doclist (make_doclist (doc.doctype,doc.name))},
|
$c('runserverobj', args={'method':'maindoc_field', 'docs':wn.model.compress (make_doclist (doc.doctype,doc.name))},
|
||||||
function(r, rt) {
|
function(r, rt) {
|
||||||
var doc = locals[mydoc.doctype][mydoc.name];
|
var doc = locals[mydoc.doctype][mydoc.name];
|
||||||
cur_frm.fields_dict.workflow_rule_details.grid.get_field("rule_field").df.options = r.message;
|
cur_frm.fields_dict.workflow_rule_details.grid.get_field("rule_field").df.options = r.message;
|
||||||
|
@ -5,4 +5,6 @@
|
|||||||
One of the Roles has <b>Submit</b> permission.
|
One of the Roles has <b>Submit</b> permission.
|
||||||
You will have to <b>Cancel</b> and then <b>Amend</b> a submitted Document for making changes.
|
You will have to <b>Cancel</b> and then <b>Amend</b> a submitted Document for making changes.
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="well">Note: A document is not accessible to a user if Permission at level 0 is not given.</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,14 +25,10 @@ def on_login_post_session(login_manager):
|
|||||||
update login_from and delete parallel sessions
|
update login_from and delete parallel sessions
|
||||||
"""
|
"""
|
||||||
# Clear previous sessions i.e. logout previous log-in attempts
|
# Clear previous sessions i.e. logout previous log-in attempts
|
||||||
exception_list = ['demo@erpnext.com', 'Administrator', 'Guest']
|
allow_multiple_sessions = ['demo@erpnext.com', 'Administrator', 'Guest']
|
||||||
if webnotes.session['user'] not in exception_list:
|
if webnotes.session['user'] not in allow_multiple_sessions:
|
||||||
sid_list = webnotes.conn.sql("""
|
from webnotes.sessions import clear_sessions
|
||||||
DELETE FROM `tabSessions`
|
clear_sessions(webnotes.session.user, keep_current=True)
|
||||||
WHERE
|
|
||||||
user=%s AND
|
|
||||||
sid!=%s""", \
|
|
||||||
(webnotes.session['user'], webnotes.session['sid']), as_list=1)
|
|
||||||
|
|
||||||
# check if account is expired
|
# check if account is expired
|
||||||
check_if_expired()
|
check_if_expired()
|
||||||
@ -119,7 +115,7 @@ def check_if_expired():
|
|||||||
from webnotes.utils import formatdate
|
from webnotes.utils import formatdate
|
||||||
msg = """Oops! Your subscription expired on <b>%s</b>.<br>""" % formatdate(conf.expires_on)
|
msg = """Oops! Your subscription expired on <b>%s</b>.<br>""" % formatdate(conf.expires_on)
|
||||||
|
|
||||||
if 'System Manager' in webnotes.user.roles:
|
if 'System Manager' in webnotes.user.get_roles():
|
||||||
msg += """Just drop in a mail at <b>support@erpnext.com</b> and
|
msg += """Just drop in a mail at <b>support@erpnext.com</b> and
|
||||||
we will guide you to get your account re-activated."""
|
we will guide you to get your account re-activated."""
|
||||||
else:
|
else:
|
||||||
|
@ -48,7 +48,7 @@ def get_things_todo():
|
|||||||
incomplete_todos = webnotes.conn.sql("""\
|
incomplete_todos = webnotes.conn.sql("""\
|
||||||
SELECT COUNT(*) FROM `tabToDo`
|
SELECT COUNT(*) FROM `tabToDo`
|
||||||
WHERE IFNULL(checked, 0) = 0
|
WHERE IFNULL(checked, 0) = 0
|
||||||
AND owner = %s""", webnotes.session.get('user'))
|
AND (owner = %s or assigned_by=%s)""", (webnotes.session.user, webnotes.session.user))
|
||||||
return incomplete_todos and cint(incomplete_todos[0][0]) or 0
|
return incomplete_todos and cint(incomplete_todos[0][0]) or 0
|
||||||
|
|
||||||
def get_todays_events():
|
def get_todays_events():
|
||||||
|
@ -128,7 +128,7 @@ cur_frm.cscript.get_items = function(doc,dt,dn) {
|
|||||||
|
|
||||||
//================ create new contact ============================================================================
|
//================ create new contact ============================================================================
|
||||||
cur_frm.cscript.new_contact = function(){
|
cur_frm.cscript.new_contact = function(){
|
||||||
tn = createLocal('Contact');
|
tn = wn.model.make_new_doc_and_get_name('Contact');
|
||||||
locals['Contact'][tn].is_customer = 1;
|
locals['Contact'][tn].is_customer = 1;
|
||||||
if(doc.customer) locals['Contact'][tn].customer = doc.customer;
|
if(doc.customer) locals['Contact'][tn].customer = doc.customer;
|
||||||
loaddoc('Contact', tn);
|
loaddoc('Contact', tn);
|
||||||
@ -192,9 +192,9 @@ cur_frm.fields_dict['transporter_name'].get_query = function(doc) {
|
|||||||
//-----------------------------------Make Sales Invoice----------------------------------------------
|
//-----------------------------------Make Sales Invoice----------------------------------------------
|
||||||
cur_frm.cscript['Make Sales Invoice'] = function() {
|
cur_frm.cscript['Make Sales Invoice'] = function() {
|
||||||
var doc = cur_frm.doc
|
var doc = cur_frm.doc
|
||||||
n = createLocal('Sales Invoice');
|
n = wn.model.make_new_doc_and_get_name('Sales Invoice');
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals['Sales Invoice'][n]]),
|
'docs':wn.model.compress([locals['Sales Invoice'][n]]),
|
||||||
'from_doctype':doc.doctype,
|
'from_doctype':doc.doctype,
|
||||||
'to_doctype':'Sales Invoice',
|
'to_doctype':'Sales Invoice',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
@ -209,9 +209,9 @@ cur_frm.cscript['Make Sales Invoice'] = function() {
|
|||||||
cur_frm.cscript['Make Installation Note'] = function() {
|
cur_frm.cscript['Make Installation Note'] = function() {
|
||||||
var doc = cur_frm.doc;
|
var doc = cur_frm.doc;
|
||||||
if(doc.per_installed < 99.99){
|
if(doc.per_installed < 99.99){
|
||||||
n = createLocal('Installation Note');
|
n = wn.model.make_new_doc_and_get_name('Installation Note');
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals['Installation Note'][n]]),
|
'docs':wn.model.compress([locals['Installation Note'][n]]),
|
||||||
'from_doctype':doc.doctype,
|
'from_doctype':doc.doctype,
|
||||||
'to_doctype':'Installation Note',
|
'to_doctype':'Installation Note',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
@ -228,9 +228,9 @@ cur_frm.cscript['Make Installation Note'] = function() {
|
|||||||
//-----------------------------------Make Sales Invoice----------------------------------------------
|
//-----------------------------------Make Sales Invoice----------------------------------------------
|
||||||
cur_frm.cscript['Make Packing Slip'] = function() {
|
cur_frm.cscript['Make Packing Slip'] = function() {
|
||||||
var doc = cur_frm.doc
|
var doc = cur_frm.doc
|
||||||
n = createLocal('Packing Slip');
|
n = wn.model.make_new_doc_and_get_name('Packing Slip');
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals['Packing Slip'][n]]),
|
'docs':wn.model.compress([locals['Packing Slip'][n]]),
|
||||||
'from_doctype':doc.doctype,
|
'from_doctype':doc.doctype,
|
||||||
'to_doctype':'Packing Slip',
|
'to_doctype':'Packing Slip',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
|
@ -24,7 +24,7 @@ wn.require('app/utilities/doctype/sms_control/sms_control.js');
|
|||||||
|
|
||||||
//========================== On Load ================================================================
|
//========================== On Load ================================================================
|
||||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||||
if(!doc.fiscal_year && doc.__islocal){ set_default_values(doc);}
|
if(!doc.fiscal_year && doc.__islocal){ wn.model.set_default_values(doc);}
|
||||||
if (!doc.posting_date) doc.posting_date = dateutil.obj_to_str(new Date());
|
if (!doc.posting_date) doc.posting_date = dateutil.obj_to_str(new Date());
|
||||||
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
|
if (!doc.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
|
||||||
if (!doc.status) doc.status = 'Draft';
|
if (!doc.status) doc.status = 'Draft';
|
||||||
@ -107,7 +107,7 @@ cur_frm.cscript.pull_purchase_order_details = function(doc, dt, dn) {
|
|||||||
|
|
||||||
//================ create new contact ============================================================================
|
//================ create new contact ============================================================================
|
||||||
cur_frm.cscript.new_contact = function(){
|
cur_frm.cscript.new_contact = function(){
|
||||||
tn = createLocal('Contact');
|
tn = wn.model.make_new_doc_and_get_name('Contact');
|
||||||
locals['Contact'][tn].is_supplier = 1;
|
locals['Contact'][tn].is_supplier = 1;
|
||||||
if(doc.supplier) locals['Contact'][tn].supplier = doc.supplier;
|
if(doc.supplier) locals['Contact'][tn].supplier = doc.supplier;
|
||||||
loaddoc('Contact', tn);
|
loaddoc('Contact', tn);
|
||||||
@ -150,9 +150,10 @@ cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn)
|
|||||||
cur_frm.cscript.received_qty = function(doc, cdt, cdn) {
|
cur_frm.cscript.received_qty = function(doc, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
ret = {
|
ret = {
|
||||||
'qty' : 0,
|
'qty' : (flt(d.qty) && flt(d.qty) < flt(d.received_qty))
|
||||||
|
? flt(d.qty) : flt(d.received_qty),
|
||||||
'stock_qty': 0,
|
'stock_qty': 0,
|
||||||
'rejected_qty' : 0
|
'rejected_qty' : 0,
|
||||||
}
|
}
|
||||||
set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
|
set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
|
||||||
cur_frm.cscript.calc_amount(doc, 2);
|
cur_frm.cscript.calc_amount(doc, 2);
|
||||||
@ -240,9 +241,9 @@ cur_frm.fields_dict.purchase_receipt_details.grid.get_field("qa_no").get_query =
|
|||||||
|
|
||||||
// ================================ Make Purchase Invoice ==========================================
|
// ================================ Make Purchase Invoice ==========================================
|
||||||
cur_frm.cscript['Make Purchase Invoice'] = function() {
|
cur_frm.cscript['Make Purchase Invoice'] = function() {
|
||||||
n = createLocal('Purchase Invoice');
|
n = wn.model.make_new_doc_and_get_name('Purchase Invoice');
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals['Purchase Invoice'][n]]),
|
'docs':wn.model.compress([locals['Purchase Invoice'][n]]),
|
||||||
'from_doctype': cur_frm.doc.doctype,
|
'from_doctype': cur_frm.doc.doctype,
|
||||||
'to_doctype':'Purchase Invoice',
|
'to_doctype':'Purchase Invoice',
|
||||||
'from_docname': cur_frm.doc.name,
|
'from_docname': cur_frm.doc.name,
|
||||||
|
@ -120,7 +120,7 @@ cur_frm.cscript.validate_returned_qty = function(cl) {
|
|||||||
// map parent fields of stock entry
|
// map parent fields of stock entry
|
||||||
//----------------------------------
|
//----------------------------------
|
||||||
cur_frm.cscript.map_parent_fields = function(doc, cdt, cdn) {
|
cur_frm.cscript.map_parent_fields = function(doc, cdt, cdn) {
|
||||||
var se = LocalDB.create('Stock Entry');
|
var se = wn.model.make_new_doc_and_get_name('Stock Entry');
|
||||||
se = locals['Stock Entry'][se];
|
se = locals['Stock Entry'][se];
|
||||||
se.posting_date = dateutil.obj_to_str(new Date());
|
se.posting_date = dateutil.obj_to_str(new Date());
|
||||||
se.transfer_date = dateutil.obj_to_str(new Date());
|
se.transfer_date = dateutil.obj_to_str(new Date());
|
||||||
@ -148,7 +148,7 @@ cur_frm.cscript.map_parent_fields = function(doc, cdt, cdn) {
|
|||||||
cur_frm.cscript.map_child_fields = function(cl, se) {
|
cur_frm.cscript.map_child_fields = function(cl, se) {
|
||||||
for(var i = 0; i<cl.length; i++){
|
for(var i = 0; i<cl.length; i++){
|
||||||
if (cl[i].returned_qty) {
|
if (cl[i].returned_qty) {
|
||||||
var d1 = LocalDB.add_child(se, 'Stock Entry Detail', 'mtn_details');
|
var d1 = wn.model.add_child(se, 'Stock Entry Detail', 'mtn_details');
|
||||||
d1.detail_name = cl[i].detail_name;
|
d1.detail_name = cl[i].detail_name;
|
||||||
d1.item_code = cl[i].item_code;
|
d1.item_code = cl[i].item_code;
|
||||||
d1.description = cl[i].description;
|
d1.description = cl[i].description;
|
||||||
@ -167,7 +167,7 @@ cur_frm.cscript.map_child_fields = function(cl, se) {
|
|||||||
// Make excise voucher
|
// Make excise voucher
|
||||||
//-------------------------------
|
//-------------------------------
|
||||||
cur_frm.cscript.make_excise_invoice = function(doc) {
|
cur_frm.cscript.make_excise_invoice = function(doc) {
|
||||||
var excise = LocalDB.create('Journal Voucher');
|
var excise = wn.model.make_new_doc_and_get_name('Journal Voucher');
|
||||||
excise = locals['Journal Voucher'][excise];
|
excise = locals['Journal Voucher'][excise];
|
||||||
excise.voucher_type = 'Excise Voucher';
|
excise.voucher_type = 'Excise Voucher';
|
||||||
loaddoc('Journal Voucher',excise.name);
|
loaddoc('Journal Voucher',excise.name);
|
||||||
@ -203,7 +203,7 @@ cur_frm.cscript.make_credit_note = function(doc) {
|
|||||||
// Make JV
|
// Make JV
|
||||||
//--------------------------------
|
//--------------------------------
|
||||||
cur_frm.cscript.make_jv = function(doc, dr_or_cr, children) {
|
cur_frm.cscript.make_jv = function(doc, dr_or_cr, children) {
|
||||||
var jv = LocalDB.create('Journal Voucher');
|
var jv = wn.model.make_new_doc_and_get_name('Journal Voucher');
|
||||||
jv = locals['Journal Voucher'][jv];
|
jv = locals['Journal Voucher'][jv];
|
||||||
|
|
||||||
jv.voucher_type = dr_or_cr;
|
jv.voucher_type = dr_or_cr;
|
||||||
@ -216,7 +216,7 @@ cur_frm.cscript.make_jv = function(doc, dr_or_cr, children) {
|
|||||||
// Add children
|
// Add children
|
||||||
if(children) {
|
if(children) {
|
||||||
for(var i=0; i<children.length; i++) {
|
for(var i=0; i<children.length; i++) {
|
||||||
var ch = LocalDB.add_child(jv, 'Journal Voucher Detail', 'entries');
|
var ch = wn.model.add_child(jv, 'Journal Voucher Detail', 'entries');
|
||||||
$.extend(ch, children[i]);
|
$.extend(ch, children[i]);
|
||||||
ch.balance = fmt_money(ch.balance);
|
ch.balance = fmt_money(ch.balance);
|
||||||
}
|
}
|
||||||
|
@ -71,9 +71,9 @@ cur_frm.cscript['Make Maintenance Visit'] = function() {
|
|||||||
$c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_visit','',
|
$c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_visit','',
|
||||||
function(r,rt){
|
function(r,rt){
|
||||||
if(r.message == 'No'){
|
if(r.message == 'No'){
|
||||||
n = createLocal("Maintenance Visit");
|
n = wn.model.make_new_doc_and_get_name("Maintenance Visit");
|
||||||
$c('dt_map', args={
|
$c('dt_map', args={
|
||||||
'docs':compress_doclist([locals["Maintenance Visit"][n]]),
|
'docs':wn.model.compress([locals["Maintenance Visit"][n]]),
|
||||||
'from_doctype':'Customer Issue',
|
'from_doctype':'Customer Issue',
|
||||||
'to_doctype':'Maintenance Visit',
|
'to_doctype':'Maintenance Visit',
|
||||||
'from_docname':doc.name,
|
'from_docname':doc.name,
|
||||||
|
@ -116,7 +116,7 @@ cur_frm.cscript.periodicity = function(doc, cdt, cdn){
|
|||||||
|
|
||||||
cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
|
cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
|
||||||
if (!doc.__islocal) {
|
if (!doc.__islocal) {
|
||||||
$c('runserverobj', args={'method':'generate_schedule', 'docs':compress_doclist(make_doclist(cdt,cdn))},
|
$c('runserverobj', args={'method':'generate_schedule', 'docs':wn.model.compress(make_doclist(cdt,cdn))},
|
||||||
function(r,rt){
|
function(r,rt){
|
||||||
refresh_field('maintenance_schedule_detail');
|
refresh_field('maintenance_schedule_detail');
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ class SupportMailbox(POP3Mailbox):
|
|||||||
from webnotes.utils.file_manager import save_file, add_file_list
|
from webnotes.utils.file_manager import save_file, add_file_list
|
||||||
for attachment in attachment_list:
|
for attachment in attachment_list:
|
||||||
fid = save_file(attachment['filename'], attachment['content'], 'Support')
|
fid = save_file(attachment['filename'], attachment['content'], 'Support')
|
||||||
status = add_file_list('Support Ticket', doc.name, attachment['filename'], fid)
|
status = add_file_list('Support Ticket', doc.name, fid, fid)
|
||||||
if not status:
|
if not status:
|
||||||
doc.description = doc.description \
|
doc.description = doc.description \
|
||||||
+ "\nCould not attach: " + cstr(attachment['filename'])
|
+ "\nCould not attach: " + cstr(attachment['filename'])
|
||||||
|
@ -18,7 +18,6 @@ cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
|||||||
|
|
||||||
$.extend(cur_frm.cscript, {
|
$.extend(cur_frm.cscript, {
|
||||||
onload: function(doc, dt, dn) {
|
onload: function(doc, dt, dn) {
|
||||||
cur_frm.last_reload = new Date();
|
|
||||||
if(in_list(user_roles,'System Manager')) {
|
if(in_list(user_roles,'System Manager')) {
|
||||||
cur_frm.page_layout.footer.help_area.innerHTML = '<hr>\
|
cur_frm.page_layout.footer.help_area.innerHTML = '<hr>\
|
||||||
<p><a href="#Form/Email Settings/Email Settings">Email Settings</a><br>\
|
<p><a href="#Form/Email Settings/Email Settings">Email Settings</a><br>\
|
||||||
@ -27,11 +26,6 @@ $.extend(cur_frm.cscript, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(doc) {
|
refresh: function(doc) {
|
||||||
if(new Date() - cur_frm.last_reload > 20000) {
|
|
||||||
cur_frm.last_reload = new Date();
|
|
||||||
cur_frm.reload_doc();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
erpnext.hide_naming_series();
|
erpnext.hide_naming_series();
|
||||||
cur_frm.cscript.make_listing(doc);
|
cur_frm.cscript.make_listing(doc);
|
||||||
if(!doc.__islocal) {
|
if(!doc.__islocal) {
|
||||||
|
@ -27,7 +27,7 @@ cur_frm.cscript.refresh = function() {
|
|||||||
list: wn.model.get("Communication", {"contact": doc.name}),
|
list: wn.model.get("Communication", {"contact": doc.name}),
|
||||||
parent: cur_frm.fields_dict.communication_html.wrapper,
|
parent: cur_frm.fields_dict.communication_html.wrapper,
|
||||||
doc: doc,
|
doc: doc,
|
||||||
email: doc.email_id
|
recipients: doc.email_id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ function SMSManager() {
|
|||||||
this.show = function(contact, key, value, mobile_nos, message) {
|
this.show = function(contact, key, value, mobile_nos, message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
if (mobile_nos) {
|
if (mobile_nos) {
|
||||||
|
|
||||||
me.number = mobile_nos;
|
me.number = mobile_nos;
|
||||||
me.show_dialog();
|
me.show_dialog();
|
||||||
} else if (contact){
|
} else if (contact){
|
||||||
@ -59,7 +58,6 @@ function SMSManager() {
|
|||||||
{fieldname:'send', fieldtype:'Button', label:'Send'}
|
{fieldname:'send', fieldtype:'Button', label:'Send'}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
d.make();
|
|
||||||
d.fields_dict.send.input.onclick = function() {
|
d.fields_dict.send.input.onclick = function() {
|
||||||
var btn = d.fields_dict.send.input;
|
var btn = d.fields_dict.send.input;
|
||||||
var v = me.dialog.get_values();
|
var v = me.dialog.get_values();
|
||||||
|
@ -85,7 +85,7 @@ Calendar.prototype.show_event = function(ev, cal_ev) {
|
|||||||
,['Text','Description']
|
,['Text','Description']
|
||||||
,['HTML', 'Ref Link']
|
,['HTML', 'Ref Link']
|
||||||
,['Check', 'Public Event']
|
,['Check', 'Public Event']
|
||||||
,['Check', 'Cancel Event']
|
,['Check', 'Cancelled Event']
|
||||||
,['HTML', 'Event Link']
|
,['HTML', 'Event Link']
|
||||||
,['Button', 'Save']
|
,['Button', 'Save']
|
||||||
])
|
])
|
||||||
@ -106,7 +106,7 @@ Calendar.prototype.show_event = function(ev, cal_ev) {
|
|||||||
this.widgets['Description'].value = cstr(this.ev.description);
|
this.widgets['Description'].value = cstr(this.ev.description);
|
||||||
|
|
||||||
this.widgets['Public Event'].checked = false;
|
this.widgets['Public Event'].checked = false;
|
||||||
this.widgets['Cancel Event'].checked = false;
|
this.widgets['Cancelled Event'].checked = false;
|
||||||
|
|
||||||
if(this.ev.event_type=='Public')
|
if(this.ev.event_type=='Public')
|
||||||
this.widgets['Public Event'].checked = true;
|
this.widgets['Public Event'].checked = true;
|
||||||
@ -134,7 +134,7 @@ Calendar.prototype.show_event = function(ev, cal_ev) {
|
|||||||
|
|
||||||
// save values
|
// save values
|
||||||
d.ev.description = d.widgets['Description'].value;
|
d.ev.description = d.widgets['Description'].value;
|
||||||
if(d.widgets['Cancel Event'].checked)
|
if(d.widgets['Cancelled Event'].checked)
|
||||||
d.ev.event_type='Cancel';
|
d.ev.event_type='Cancel';
|
||||||
else if(d.widgets['Public Event'].checked)
|
else if(d.widgets['Public Event'].checked)
|
||||||
d.ev.event_type='Public';
|
d.ev.event_type='Public';
|
||||||
@ -154,7 +154,8 @@ Calendar.prototype.show_event = function(ev, cal_ev) {
|
|||||||
|
|
||||||
Calendar.prototype.save_event = function(doc) {
|
Calendar.prototype.save_event = function(doc) {
|
||||||
var me = this;
|
var me = this;
|
||||||
save_doclist('Event', doc.name, 'Save', function(r) {
|
var doclist = new wn.model.DocList("Event", doc.name);
|
||||||
|
doclist.save("Save", function(r) {
|
||||||
var doc = locals['Event'][r.docname];
|
var doc = locals['Event'][r.docname];
|
||||||
var cal = erpnext.calendar;
|
var cal = erpnext.calendar;
|
||||||
cal.cur_view.refresh();
|
cal.cur_view.refresh();
|
||||||
@ -162,15 +163,15 @@ Calendar.prototype.save_event = function(doc) {
|
|||||||
// if cancelled, hide
|
// if cancelled, hide
|
||||||
if(doc.event_type=='Cancel') {
|
if(doc.event_type=='Cancel') {
|
||||||
$(cal.events_by_name[doc.name].body).toggle(false);
|
$(cal.events_by_name[doc.name].body).toggle(false);
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|
||||||
Calendar.prototype.add_event = function() {
|
Calendar.prototype.add_event = function() {
|
||||||
|
|
||||||
var ev = LocalDB.create('Event');
|
var ev = wn.model.make_new_doc_and_get_name('Event');
|
||||||
ev = locals['Event'][ev];
|
ev = locals['Event'][ev];
|
||||||
|
|
||||||
ev.event_date = dateutil.obj_to_str(this.selected_date);
|
ev.event_date = dateutil.obj_to_str(this.selected_date);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user