merged with master
diff --git a/accounts/doctype/account/account.js b/accounts/doctype/account/account.js
index d35d6ce..14e35d3 100644
--- a/accounts/doctype/account/account.js
+++ b/accounts/doctype/account/account.js
@@ -39,8 +39,7 @@
'is_pl_account', 'company'], false);
// read-only for root accounts
- root_acc = doc.parent ? false : true;
- if(in_list(root_acc, doc.account_name)) {
+ if(!doc.parent_account) {
cur_frm.perm = [[1,0,0], [1,0,0]];
cur_frm.set_intro("This is a root account and cannot be edited.");
} else {
diff --git a/accounts/doctype/budget_distribution/budget_distribution.js b/accounts/doctype/budget_distribution/budget_distribution.js
index c8bfe11..5abd525 100644
--- a/accounts/doctype/budget_distribution/budget_distribution.js
+++ b/accounts/doctype/budget_distribution/budget_distribution.js
@@ -21,7 +21,7 @@
}
$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);
}
}
diff --git a/accounts/doctype/cost_center/cost_center.js b/accounts/doctype/cost_center/cost_center.js
index 0825383..3dde661 100644
--- a/accounts/doctype/cost_center/cost_center.js
+++ b/accounts/doctype/cost_center/cost_center.js
@@ -20,7 +20,7 @@
cur_frm.toggle_enable(['group_or_ledger', 'company_name'], doc.__islocal);
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>';
}
diff --git a/accounts/doctype/journal_voucher/journal_voucher.js b/accounts/doctype/journal_voucher/journal_voucher.js
index 784a134..8c60838 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.js
+++ b/accounts/doctype/journal_voucher/journal_voucher.js
@@ -33,14 +33,14 @@
if(!cur_frm.doc.__islocal || !cur_frm.doc.company) { return; }
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); }
fields_to_refresh = null;
var children = getchildren('Journal Voucher Detail', doc.name, 'entries');
if(!children) { return; }
for(var i=0; i<children.length; i++) {
- LocalDB.set_default_values(children[i]);
+ wn.model.set_default_values(children[i]);
}
refresh_field('entries');
}
@@ -193,7 +193,7 @@
if(!children || children.length==0) {
$c('accounts.get_default_bank_account', {company: doc.company }, function(r, rt) {
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);
refresh_field('entries');
}
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.js b/accounts/doctype/purchase_invoice/purchase_invoice.js
index 25b2601..1ab1bce 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.js
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.js
@@ -266,7 +266,7 @@
}
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.voucher_type = 'Bank Voucher';
jv.remark = repl('Payment against voucher %(vn)s for %(rem)s', {vn:doc.name, rem:doc.remarks});
@@ -276,13 +276,13 @@
jv.company = doc.company;
// 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.debit = doc.outstanding_amount;
d1.against_voucher = doc.name;
// 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.credit = doc.outstanding_amount;
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index a15d1d0..7c9b477 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -29,7 +29,7 @@
// On Load
// -------
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.voucher_date) set_multiple(dt,dn,{voucher_date:get_today()});
if(!doc.due_date) set_multiple(dt,dn,{due_date:get_today()});
@@ -322,9 +322,9 @@
cur_frm.cscript['Make Delivery Note'] = function() {
var doc = cur_frm.doc
- n = createLocal('Delivery Note');
+ n = wn.model.make_new_doc_and_get_name('Delivery Note');
$c('dt_map', args={
- 'docs':compress_doclist([locals['Delivery Note'][n]]),
+ 'docs':wn.model.compress([locals['Delivery Note'][n]]),
'from_doctype':doc.doctype,
'to_doctype':'Delivery Note',
'from_docname':doc.name,
@@ -484,7 +484,7 @@
// Make Journal Voucher
// --------------------
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.voucher_type = 'Bank Voucher';
@@ -493,14 +493,14 @@
jv.fiscal_year = doc.fiscal_year;
// 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.credit = doc.outstanding_amount;
d1.against_invoice = doc.name;
// 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.debit = doc.outstanding_amount;
diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py
index b728475..a146e93 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/accounts/doctype/sales_invoice/sales_invoice.py
@@ -174,16 +174,20 @@
def get_customer_account(self):
"""Get Account Head to which amount needs to be Debited based on Customer"""
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`
- 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))
-
- if acc_head and acc_head[0][0]:
- return acc_head[0][0]
- 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))
+ if acc_head and acc_head[0][0]:
+ return acc_head[0][0]
+ 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):
acc_head = self.get_customer_account()
diff --git a/accounts/page/accounts_browser/accounts_browser.py b/accounts/page/accounts_browser/accounts_browser.py
index 8b24394..7c8116c 100644
--- a/accounts/page/accounts_browser/accounts_browser.py
+++ b/accounts/page/accounts_browser/accounts_browser.py
@@ -10,9 +10,10 @@
# check if match permission exists
res = webnotes.conn.sql("""select role, `match` from `tabDocPerm`
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
- 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 and webnotes.user.get_defaults().get("company"):
diff --git a/accounts/page/voucher_import_tool/voucher_import_tool.py b/accounts/page/voucher_import_tool/voucher_import_tool.py
index ab81801..0d3a7f7 100644
--- a/accounts/page/voucher_import_tool/voucher_import_tool.py
+++ b/accounts/page/voucher_import_tool/voucher_import_tool.py
@@ -230,7 +230,7 @@
accounts = [c for c in rows[i+1] if c.endswith(" - " + company_abbr)]
if accounts and (len(columns) != rows[i+1].index(accounts[0])):
- raise Exception, """A non-account column cannot be after an account \
- column. Please rectify it in the file and try again."""
+ raise Exception, """All account columns should be after standard columns and \
+ on the right. Please rectify it in the file and try again."""
return data, start_row_idx
\ No newline at end of file
diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js
index 4905006..f4cfc29 100644
--- a/buying/doctype/purchase_common/purchase_common.js
+++ b/buying/doctype/purchase_common/purchase_common.js
@@ -51,14 +51,14 @@
if(!cur_frm.doc.__islocal) { return; }
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); }
fields_to_refresh = null;
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
if(!children) { return; }
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);
cur_frm.cscript.load_taxes(doc, dt, dn, callback);
diff --git a/buying/doctype/purchase_order/purchase_order.js b/buying/doctype/purchase_order/purchase_order.js
index b3f4dd7..b5a7405 100644
--- a/buying/doctype/purchase_order/purchase_order.js
+++ b/buying/doctype/purchase_order/purchase_order.js
@@ -122,9 +122,9 @@
//========================= Make Purchase Receipt =======================================================
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={
- 'docs':compress_doclist([locals['Purchase Receipt'][n]]),
+ 'docs':wn.model.compress([locals['Purchase Receipt'][n]]),
'from_doctype': cur_frm.doc.doctype,
'to_doctype':'Purchase Receipt',
'from_docname':cur_frm.doc.name,
@@ -137,9 +137,9 @@
//========================== Make Purchase Invoice =====================================================
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', {
- 'docs':compress_doclist([locals['Purchase Invoice'][n]]),
+ 'docs':wn.model.compress([locals['Purchase Invoice'][n]]),
'from_doctype':cur_frm.doc.doctype,
'to_doctype':'Purchase Invoice',
'from_docname': cur_frm.doc.name,
@@ -158,7 +158,7 @@
var check = confirm("Do you really want to STOP " + doc.name);
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();
});
}
@@ -171,7 +171,7 @@
var check = confirm("Do you really want to UNSTOP " + doc.name);
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();
});
}
diff --git a/buying/doctype/purchase_request/purchase_request.js b/buying/doctype/purchase_request/purchase_request.js
index 7a397b5..510762a 100644
--- a/buying/doctype/purchase_request/purchase_request.js
+++ b/buying/doctype/purchase_request/purchase_request.js
@@ -86,9 +86,9 @@
// Make Purchase Order
cur_frm.cscript['Make Purchase Order'] = function() {
var doc = cur_frm.doc;
- n = createLocal('Purchase Order');
+ n = wn.model.make_new_doc_and_get_name('Purchase Order');
$c('dt_map', args={
- 'docs':compress_doclist([locals['Purchase Order'][n]]),
+ 'docs':wn.model.compress([locals['Purchase Order'][n]]),
'from_doctype':doc.doctype,
'to_doctype':'Purchase Order',
'from_docname':doc.name,
@@ -106,7 +106,7 @@
var check = confirm("Do you really want to STOP this Purchase Request?");
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();
});
}
@@ -119,7 +119,7 @@
var check = confirm("Do you really want to UNSTOP this Purchase Request?");
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();
});
@@ -127,9 +127,9 @@
}
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", {
- "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,
"to_doctype": "Supplier Quotation",
"from_docname": cur_frm.doc.name,
diff --git a/buying/doctype/supplier/supplier.js b/buying/doctype/supplier/supplier.js
index 1b7f369..e527dbe 100644
--- a/buying/doctype/supplier/supplier.js
+++ b/buying/doctype/supplier/supplier.js
@@ -79,7 +79,7 @@
page_length: 2,
new_doctype: "Contact",
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.supplier = cur_frm.doc.name;
contact.supplier_name = cur_frm.doc.supplier_name;
diff --git a/buying/doctype/supplier_quotation/supplier_quotation.js b/buying/doctype/supplier_quotation/supplier_quotation.js
index 99ee20c..37bb625 100644
--- a/buying/doctype/supplier_quotation/supplier_quotation.js
+++ b/buying/doctype/supplier_quotation/supplier_quotation.js
@@ -49,9 +49,9 @@
}
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", {
- "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,
"to_doctype": "Purchase Order",
"from_docname": cur_frm.doc.name,
diff --git a/home/page/activity/activity.js b/home/page/activity/activity.js
index 90977be..6746919 100644
--- a/home/page/activity/activity.js
+++ b/home/page/activity/activity.js
@@ -36,7 +36,7 @@
// feedtype
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.onclick = repl('onclick="window.location.href=\'#!List/%(feed_type)s\';"', data)
}
diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js
index 04d366a..f41c547 100644
--- a/home/page/latest_updates/latest_updates.js
+++ b/home/page/latest_updates/latest_updates.js
@@ -1,6 +1,7 @@
erpnext.updates = [
["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).",
+ "Global Defaults: Session Expiry can now be set in Global Defaults.",
]],
["6th December 2012", [
"Rename: Cost Center, Item Group, Customer Group, Supplier Type, Territory, Sales Person can now be renamed.",
diff --git a/hr/doctype/attendance/attendance.txt b/hr/doctype/attendance/attendance.txt
index 1966062..2ef65ac 100644
--- a/hr/doctype/attendance/attendance.txt
+++ b/hr/doctype/attendance/attendance.txt
@@ -2,23 +2,18 @@
{
"owner": "ashwini@webnotestech.com",
"docstatus": 0,
- "creation": "2012-03-27 14:35:53",
+ "creation": "2012-07-03 13:30:41",
"modified_by": "Administrator",
- "modified": "2012-03-27 14:45:46"
+ "modified": "2012-12-13 14:23:24"
},
{
- "section_style": "Simple",
"is_submittable": 1,
+ "autoname": "naming_series:",
+ "name": "__common__",
"search_fields": "employee, employee_name, att_date, status",
"module": "HR",
"doctype": "DocType",
- "server_code_error": " ",
- "document_type": "Master",
- "name": "__common__",
- "colour": "White:FFF",
- "_last_update": "1317365120",
- "show_in_menu": 0,
- "version": 75
+ "document_type": "Master"
},
{
"name": "__common__",
@@ -30,12 +25,11 @@
{
"name": "__common__",
"parent": "Attendance",
- "amend": 0,
+ "read": 1,
"create": 1,
"submit": 1,
"doctype": "DocPerm",
"write": 1,
- "read": 1,
"parenttype": "DocType",
"cancel": 1,
"permlevel": 0,
@@ -46,25 +40,13 @@
"doctype": "DocType"
},
{
- "role": "System Manager",
- "doctype": "DocPerm"
- },
- {
- "role": "HR User",
- "doctype": "DocPerm"
- },
- {
- "role": "HR Manager",
- "doctype": "DocPerm"
- },
- {
"oldfieldtype": "Section Break",
"doctype": "DocField",
"label": "Attendance Details",
- "permlevel": 0,
+ "options": "Simple",
"fieldname": "attendance_details",
"fieldtype": "Section Break",
- "options": "Simple"
+ "permlevel": 0
},
{
"no_copy": 1,
@@ -72,25 +54,23 @@
"doctype": "DocField",
"label": "Naming Series",
"oldfieldname": "naming_series",
- "permlevel": 0,
+ "options": "ATT",
"fieldname": "naming_series",
"fieldtype": "Select",
"reqd": 1,
- "options": "ATT"
+ "permlevel": 0
},
{
"oldfieldtype": "Link",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Employee",
"oldfieldname": "employee",
- "permlevel": 0,
- "trigger": "Client",
+ "options": "Employee",
"fieldname": "employee",
"fieldtype": "Link",
"search_index": 1,
"reqd": 1,
- "options": "Employee",
+ "permlevel": 0,
"in_filter": 1
},
{
@@ -105,7 +85,6 @@
{
"no_copy": 1,
"oldfieldtype": "Select",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Status",
"oldfieldname": "status",
@@ -120,7 +99,6 @@
{
"print_hide": 1,
"oldfieldtype": "Link",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Leave Type",
"oldfieldname": "leave_type",
@@ -140,13 +118,13 @@
"permlevel": 0
},
{
- "search_index": 0,
+ "oldfieldtype": "Date",
"doctype": "DocField",
"label": "Attendance Date",
"oldfieldname": "att_date",
"fieldname": "att_date",
"fieldtype": "Date",
- "oldfieldtype": "Date",
+ "search_index": 0,
"reqd": 1,
"permlevel": 0,
"in_filter": 1
@@ -156,11 +134,11 @@
"doctype": "DocField",
"label": "Fiscal Year",
"oldfieldname": "fiscal_year",
- "permlevel": 0,
+ "options": "\n2012\n2013",
"fieldname": "fiscal_year",
"fieldtype": "Select",
"reqd": 1,
- "options": "link:Fiscal Year",
+ "permlevel": 0,
"in_filter": 1
},
{
@@ -168,11 +146,11 @@
"doctype": "DocField",
"label": "Company",
"oldfieldname": "company",
- "permlevel": 0,
+ "options": "\nAlpha\nBeta\nDemo Company",
"fieldname": "company",
"fieldtype": "Select",
"reqd": 1,
- "options": "link:Company",
+ "permlevel": 0,
"in_filter": 1
},
{
@@ -191,9 +169,21 @@
"no_copy": 1,
"doctype": "DocField",
"label": "Amended From",
- "permlevel": 1,
+ "options": "Attendance",
"fieldname": "amended_from",
"fieldtype": "Link",
- "options": "Sales Invoice"
+ "permlevel": 1
+ },
+ {
+ "role": "HR User",
+ "doctype": "DocPerm"
+ },
+ {
+ "role": "HR Manager",
+ "doctype": "DocPerm"
+ },
+ {
+ "role": "System Manager",
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/hr/doctype/employee/employee.js b/hr/doctype/employee/employee.js
index eab90cb..07cb9c1 100644
--- a/hr/doctype/employee/employee.js
+++ b/hr/doctype/employee/employee.js
@@ -53,7 +53,7 @@
}
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.employee = doc.name;
st.employee_name = doc.employee_name;
diff --git a/hr/doctype/expense_claim/expense_claim.py b/hr/doctype/expense_claim/expense_claim.py
index 9fdb233..9e476e5 100644
--- a/hr/doctype/expense_claim/expense_claim.py
+++ b/hr/doctype/expense_claim/expense_claim.py
@@ -20,6 +20,7 @@
from webnotes.utils import add_days
from webnotes.model.wrapper import getlist
from webnotes import form, msgprint
+from webnotes.model.code import get_obj
sql = webnotes.conn.sql
@@ -36,8 +37,8 @@
def on_submit(self):
if self.doc.approval_status=="Draft":
- webnotes.msgprint("""Please set Approval Status to 'Approved' or 'Rejected' before submitting""",
- raise_exception=1)
+ webnotes.msgprint("""Please set Approval Status to 'Approved' or \
+ 'Rejected' before submitting""", raise_exception=1)
def validate_fiscal_year(self):
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
@@ -57,5 +58,6 @@
roles = [r[0] for r in webnotes.conn.sql("""select distinct parent from `tabUserRole`
where role='Expense Approver'""")]
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
diff --git a/hr/doctype/leave_control_panel/leave_control_panel.js b/hr/doctype/leave_control_panel/leave_control_panel.js
index 67fe9b5..f3a635c 100644
--- a/hr/doctype/leave_control_panel/leave_control_panel.js
+++ b/hr/doctype/leave_control_panel/leave_control_panel.js
@@ -24,7 +24,7 @@
// Validation For To Date
// ================================================================================================
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) {
var doc = locals[cdt][cdn];
if (r.message) {
diff --git a/hr/doctype/salary_manager/salary_manager.js b/hr/doctype/salary_manager/salary_manager.js
index afe7e70..d6dcc5c 100644
--- a/hr/doctype/salary_manager/salary_manager.js
+++ b/hr/doctype/salary_manager/salary_manager.js
@@ -28,7 +28,7 @@
if (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 @@
if (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_jv = function(doc, dt, dn) {
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.voucher_type = 'Bank Voucher';
jv.user_remark = 'Payment of salary for the month: ' + doc.month + 'and fiscal year: ' + doc.fiscal_year;
@@ -68,12 +68,12 @@
jv.posting_date = dateutil.obj_to_str(new Date());
// 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.credit = r.message['amount']
// 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.debit = r.message['amount']
diff --git a/hr/doctype/salary_structure/salary_structure.js b/hr/doctype/salary_structure/salary_structure.js
index 3692fe8..873ba17 100644
--- a/hr/doctype/salary_structure/salary_structure.js
+++ b/hr/doctype/salary_structure/salary_structure.js
@@ -42,9 +42,9 @@
var doc = cur_frm.doc;
var callback = function(r,rt){
ret = r.message;
- n = createLocal("Salary Slip");
+ n = wn.model.make_new_doc_and_get_name("Salary Slip");
$c('dt_map', args={
- 'docs':compress_doclist([locals["Salary Slip"][n]]),
+ 'docs':wn.model.compress([locals["Salary Slip"][n]]),
'from_doctype':'Salary Structure',
'to_doctype':'Salary Slip',
'from_docname':doc.name,
diff --git a/patches/december_2012/file_list_rename.py b/patches/december_2012/file_list_rename.py
new file mode 100644
index 0000000..52657ac
--- /dev/null
+++ b/patches/december_2012/file_list_rename.py
@@ -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
\ No newline at end of file
diff --git a/patches/december_2012/move_recent_to_memcache.py b/patches/december_2012/move_recent_to_memcache.py
new file mode 100644
index 0000000..c92c487
--- /dev/null
+++ b/patches/december_2012/move_recent_to_memcache.py
@@ -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]))
\ No newline at end of file
diff --git a/patches/december_2012/replace_createlocal.py b/patches/december_2012/replace_createlocal.py
new file mode 100644
index 0000000..c6f4bae
--- /dev/null
+++ b/patches/december_2012/replace_createlocal.py
@@ -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'""")
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 902becc..9162f19 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -530,4 +530,12 @@
'patch_module': 'patches.december_2012',
'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',
+ },
]
\ No newline at end of file
diff --git a/projects/doctype/task/task_list.js b/projects/doctype/task/task_list.js
index 724505c..5361686 100644
--- a/projects/doctype/task/task_list.js
+++ b/projects/doctype/task/task_list.js
@@ -5,7 +5,6 @@
this.fields = this.fields.concat([
'`tabTask`.subject',
'`tabTask`.project',
- '`tabTask`.modified',
'`tabTask`.status',
'`tabTask`.opening_date',
'`tabTask`.priority',
diff --git a/public/js/gantt_task.js b/public/js/gantt_task.js
index 066ad34..6b679cf 100644
--- a/public/js/gantt_task.js
+++ b/public/js/gantt_task.js
@@ -79,7 +79,7 @@
$('<button class="btn"><i class="icon icon-plus"></i>\
Create a new Task</button>').click(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)
locals.Task[new_name].project = project;
wn.set_route('Form', 'Task', new_name);
diff --git a/public/js/modules.js b/public/js/modules.js
index bb74884..b1a86ba 100644
--- a/public/js/modules.js
+++ b/public/js/modules.js
@@ -111,7 +111,7 @@
$(wrapper).find('[href*="List/"]').each(function() {
var href = $(this).attr('href');
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);
}
});
@@ -128,7 +128,7 @@
$(wrapper).find('[href*="Form/"]').each(function() {
var href = $(this).attr('href');
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);
}
});
diff --git a/selling/doctype/customer/customer.js b/selling/doctype/customer/customer.js
index d20b0c9..845f543 100644
--- a/selling/doctype/customer/customer.js
+++ b/selling/doctype/customer/customer.js
@@ -35,7 +35,7 @@
doc = locals[doc.doctype][doc.name];
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); }
}
@@ -89,7 +89,7 @@
parent: cur_frm.fields_dict['contact_html'].wrapper,
page_length: 2,
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.customer = cur_frm.doc.name;
contact.customer_name = cur_frm.doc.customer_name;
diff --git a/selling/doctype/lead/lead.js b/selling/doctype/lead/lead.js
index 0c5bf87..9dd64de 100644
--- a/selling/doctype/lead/lead.js
+++ b/selling/doctype/lead/lead.js
@@ -71,7 +71,7 @@
list: wn.model.get("Communication", {"lead": doc.name}),
parent: cur_frm.fields_dict.communication_html.wrapper,
doc: doc,
- email: doc.email_id
+ recipients: doc.email_id
})
}
@@ -83,15 +83,15 @@
cur_frm.cscript['Create Customer'] = function(){
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){
if(r.message == 'Converted'){
msgprint("This lead is already converted to customer");
}
else{
- n = createLocal("Customer");
+ n = wn.model.make_new_doc_and_get_name("Customer");
$c('dt_map', args={
- 'docs':compress_doclist([locals["Customer"][n]]),
+ 'docs':wn.model.compress([locals["Customer"][n]]),
'from_doctype':'Lead',
'to_doctype':'Customer',
'from_docname':doc.name,
@@ -110,15 +110,15 @@
// ===============================================================
cur_frm.cscript['Create Opportunity'] = function(){
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){
if(r.message == 'Converted'){
msgprint("This lead is now converted to customer. Please create enquiry on behalf of customer");
}
else{
- n = createLocal("Opportunity");
+ n = wn.model.make_new_doc_and_get_name("Opportunity");
$c('dt_map', args={
- 'docs':compress_doclist([locals["Opportunity"][n]]),
+ 'docs':wn.model.compress([locals["Opportunity"][n]]),
'from_doctype':'Lead',
'to_doctype':'Opportunity',
'from_docname':doc.name,
diff --git a/selling/doctype/opportunity/opportunity.js b/selling/doctype/opportunity/opportunity.js
index 2bb41b2..cfc546c 100644
--- a/selling/doctype/opportunity/opportunity.js
+++ b/selling/doctype/opportunity/opportunity.js
@@ -51,7 +51,7 @@
list: wn.model.get("Communication", {"opportunity": doc.name}),
parent: cur_frm.fields_dict.communication_html.wrapper,
doc: doc,
- email: doc.contact_email
+ recipients: doc.contact_email
});
}
@@ -156,9 +156,9 @@
// Create New Quotation
cur_frm.cscript['Create Quotation'] = function(){
- n = createLocal("Quotation");
+ n = wn.model.make_new_doc_and_get_name("Quotation");
$c('dt_map', args={
- 'docs':compress_doclist([locals["Quotation"][n]]),
+ 'docs':wn.model.compress([locals["Quotation"][n]]),
'from_doctype':'Opportunity',
'to_doctype':'Quotation',
'from_docname':cur_frm.docname,
@@ -207,6 +207,7 @@
if(r.message == 'true'){
$i('update_enquiry_dialog_response').innerHTML = 'Done';
e_lost_dialog.hide();
+ cur_frm.refresh();
}
}
if(arg) {
diff --git a/selling/doctype/quotation/quotation.js b/selling/doctype/quotation/quotation.js
index 1b03781..1b0a774 100644
--- a/selling/doctype/quotation/quotation.js
+++ b/selling/doctype/quotation/quotation.js
@@ -107,7 +107,7 @@
list: wn.model.get("Communication", {"quotation": doc.name}),
parent: cur_frm.fields_dict.communication_html.wrapper,
doc: doc,
- email: doc.contact_email
+ recipients: doc.contact_email
});
}
}
@@ -180,9 +180,9 @@
var doc = cur_frm.doc;
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={
- 'docs':compress_doclist([locals["Sales Order"][n]]),
+ 'docs':wn.model.compress([locals["Sales Order"][n]]),
'from_doctype':'Quotation',
'to_doctype':'Sales Order',
'from_docname':doc.name,
@@ -250,6 +250,7 @@
if(r.message == 'true'){
$i('update_quotation_dialog_response').innerHTML = 'Done';
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);
diff --git a/selling/doctype/sales_common/sales_common.js b/selling/doctype/sales_common/sales_common.js
index c5eed98..de56a6c 100644
--- a/selling/doctype/sales_common/sales_common.js
+++ b/selling/doctype/sales_common/sales_common.js
@@ -46,14 +46,14 @@
if(!cur_frm.doc.__islocal) { return; }
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); }
fields_to_refresh = null;
var children = getchildren(cur_frm.cscript.tname, doc.name, cur_frm.cscript.fname);
if(!children) { return; }
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);
cur_frm.cscript.load_taxes(doc, dt, dn, callback);
diff --git a/selling/doctype/sales_order/sales_order.js b/selling/doctype/sales_order/sales_order.js
index 8950a55..17c8d09 100644
--- a/selling/doctype/sales_order/sales_order.js
+++ b/selling/doctype/sales_order/sales_order.js
@@ -77,7 +77,7 @@
// indent
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
if(flt(doc.per_billed, 2) < 100)
@@ -147,7 +147,7 @@
cur_frm.cscript.pull_quotation_details = function(doc,dt,dn) {
var callback = function(r,rt){
var doc = locals[cur_frm.doctype][cur_frm.docname];
- if(r.message){
+ if(!r.exc){
doc.quotation_no = r.message;
if(doc.quotation_no) {
unhide_field(['quotation_date', 'customer_address', 'contact_person', 'territory', 'customer_group']);
@@ -163,7 +163,7 @@
//================ create new contact ============================================================================
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;
if(doc.customer) locals['Contact'][tn].customer = doc.customer;
loaddoc('Contact', tn);
@@ -222,9 +222,9 @@
$c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_schedule','',
function(r,rt){
if(r.message == 'No'){
- n = createLocal("Maintenance Schedule");
+ n = wn.model.make_new_doc_and_get_name("Maintenance Schedule");
$c('dt_map', args={
- 'docs':compress_doclist([locals["Maintenance Schedule"][n]]),
+ 'docs':wn.model.compress([locals["Maintenance Schedule"][n]]),
'from_doctype':'Sales Order',
'to_doctype':'Maintenance Schedule',
'from_docname':doc.name,
@@ -251,9 +251,9 @@
$c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_visit','',
function(r,rt){
if(r.message == 'No'){
- n = createLocal("Maintenance Visit");
+ n = wn.model.make_new_doc_and_get_name("Maintenance Visit");
$c('dt_map', args={
- 'docs':compress_doclist([locals["Maintenance Visit"][n]]),
+ 'docs':wn.model.compress([locals["Maintenance Visit"][n]]),
'from_doctype':'Sales Order',
'to_doctype':'Maintenance Visit',
'from_docname':doc.name,
@@ -277,9 +277,9 @@
cur_frm.cscript['Make Purchase Request'] = function() {
var doc = cur_frm.doc;
if (doc.docstatus == 1) {
- n = createLocal("Purchase Request");
+ n = wn.model.make_new_doc_and_get_name("Purchase Request");
$c('dt_map', args={
- 'docs':compress_doclist([locals["Purchase Request"][n]]),
+ 'docs':wn.model.compress([locals["Purchase Request"][n]]),
'from_doctype':'Sales Order',
'to_doctype':'Purchase Request',
'from_docname':doc.name,
@@ -298,9 +298,9 @@
cur_frm.cscript['Make Delivery Note'] = function() {
var doc = cur_frm.doc;
if (doc.docstatus == 1) {
- n = createLocal("Delivery Note");
+ n = wn.model.make_new_doc_and_get_name("Delivery Note");
$c('dt_map', args={
- 'docs':compress_doclist([locals["Delivery Note"][n]]),
+ 'docs':wn.model.compress([locals["Delivery Note"][n]]),
'from_doctype':'Sales Order',
'to_doctype':'Delivery Note',
'from_docname':doc.name,
@@ -319,9 +319,9 @@
cur_frm.cscript['Make Sales Invoice'] = function() {
var doc = cur_frm.doc;
- n = createLocal('Sales Invoice');
+ n = wn.model.make_new_doc_and_get_name('Sales Invoice');
$c('dt_map', args={
- 'docs':compress_doclist([locals['Sales Invoice'][n]]),
+ 'docs':wn.model.compress([locals['Sales Invoice'][n]]),
'from_doctype':doc.doctype,
'to_doctype':'Sales Invoice',
'from_docname':doc.name,
@@ -341,7 +341,7 @@
var check = confirm("Are you sure you want to STOP " + doc.name);
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();
});
}
@@ -355,7 +355,7 @@
var check = confirm("Are you sure you want to UNSTOP " + doc.name);
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();
});
}
diff --git a/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py
index 0a73cac..9d23565 100644
--- a/selling/doctype/sales_order/sales_order.py
+++ b/selling/doctype/sales_order/sales_order.py
@@ -194,11 +194,11 @@
# Validations of Details Table
# -----------------------------
def validate_for_items(self):
- check_list,flag = [],0
+ check_list, flag = [], 0
chk_dupl_itm = []
# Sales Order Items Validations
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
if d.prevdoc_docname:
if self.doc.quotation_date and getdate(self.doc.quotation_date) > getdate(self.doc.transaction_date):
@@ -229,14 +229,13 @@
# used for production plan
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` where item_code = '%s' and warehouse = '%s'" % (d.item_code,d.reserved_warehouse))
+
+ tot_avail_qty = sql("select projected_qty from `tabBin` \
+ 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
- if flag == 0:
- msgprint("There are no items of the quotation selected.")
- raise Exception
+ if getlist(self.doclist, 'sales_order_details') and self.doc.quotation_no and flag == 0:
+ msgprint("There are no items of the quotation selected", raise_exception=1)
# validate sales/ maintenance quotation against order type
#------------------------------------------------------------------
diff --git a/selling/page/sales_browser/sales_browser.js b/selling/page/sales_browser/sales_browser.js
index ce495db..be43e67 100644
--- a/selling/page/sales_browser/sales_browser.js
+++ b/selling/page/sales_browser/sales_browser.js
@@ -24,7 +24,14 @@
wrapper.make_tree = function() {
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();
@@ -42,20 +49,13 @@
};
erpnext.SalesChart = Class.extend({
- init: function(ctype, wrapper) {
- var root_nodes = {
- 'Territory': 'All Territories',
- 'Item Group': 'All Item Groups',
- 'Customer Group': 'All Customer Groups',
- 'Sales Person': 'All Sales Persons'
- }
-
+ init: function(ctype, root, wrapper) {
$(wrapper).find('.tree-area').empty();
var me = this;
me.ctype = ctype;
this.tree = new wn.ui.Tree({
parent: $(wrapper).find('.tree-area'),
- label: root_nodes[ctype],
+ label: root,
args: {ctype: ctype},
method: 'selling.page.sales_browser.sales_browser.get_children',
click: function(link) {
@@ -72,7 +72,7 @@
}
});
this.tree.rootnode.$a
- .data('node-data', {value: root_nodes[ctype], expandable:1})
+ .data('node-data', {value: root, expandable:1})
.click();
},
make_link_toolbar: function(link) {
diff --git a/selling/page/sales_browser/sales_browser.py b/selling/page/sales_browser/sales_browser.py
index 92c75e0..49a05ff 100644
--- a/selling/page/sales_browser/sales_browser.py
+++ b/selling/page/sales_browser/sales_browser.py
@@ -1,11 +1,14 @@
from __future__ import unicode_literals
import webnotes
+
@webnotes.whitelist()
def get_children():
ctype = webnotes.form_dict.get('ctype')
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,
if(is_group='Yes', 1, 0) as expandable
from `tab%(ctype)s`
diff --git a/setup/doctype/authorization_control/authorization_control.py b/setup/doctype/authorization_control/authorization_control.py
index 9e0d979..9455f8a 100644
--- a/setup/doctype/authorization_control/authorization_control.py
+++ b/setup/doctype/authorization_control/authorization_control.py
@@ -60,7 +60,7 @@
if appr_users: add_msg = "Users : "+cstr(appr_users)
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)
- 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
diff --git a/setup/doctype/authorization_rule/authorization_rule.js b/setup/doctype/authorization_rule/authorization_rule.js
index b29d889..184c761 100644
--- a/setup/doctype/authorization_rule/authorization_rule.js
+++ b/setup/doctype/authorization_rule/authorization_rule.js
@@ -26,13 +26,13 @@
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');
if(doc.based_on == 'Not Applicable') hide_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']);
unhide_field(['to_emp','to_designation']);
if(doc.transaction == 'Appraisal') hide_field('value');
@@ -45,7 +45,7 @@
}
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 = '';
refresh_field('master_name');
hide_field('master_name');
@@ -63,24 +63,20 @@
}
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 = '';
refresh_many(['master_name','system_role', 'system_user']);
hide_field(['master_name','system_role', 'system_user']);
unhide_field(['to_emp','to_designation']);
- if(doc.transaction == 'Appraisal') {
- doc.value =0;
- refresh_many('value');
- hide_field('value');
- }
- else unhide_field('value');
+ doc.value =0;
+ refresh_many('value');
+ hide_field('value');
}
else {
unhide_field(['master_name','system_role', 'system_user','value']);
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';
}
diff --git a/setup/doctype/authorization_rule/authorization_rule.py b/setup/doctype/authorization_rule/authorization_rule.py
index a3646c0..be6c0ae 100644
--- a/setup/doctype/authorization_rule/authorization_rule.py
+++ b/setup/doctype/authorization_rule/authorization_rule.py
@@ -8,11 +8,11 @@
#
# This program is distributed in the hope that it will be useful,
# 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.
#
# 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
import webnotes
@@ -27,74 +27,80 @@
class DocType:
- def __init__(self, d, dl):
- self.doc, self.doclist = d, dl
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
- # Duplicate Entry
- # ----------------
- def check_duplicate_entry(self):
- 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))
- auth_exists = exists and exists[0][0] or ''
- if auth_exists:
- if cint(exists[0][1]) == 2:
- msgprint("Duplicate Entry. Please remove from trash Authorization Rule : %s." %(auth_exists))
- raise Exception
- else:
- msgprint("Duplicate Entry. Please check Authorization Rule : %s." % (auth_exists))
- raise Exception
+ def check_duplicate_entry(self):
+ 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))
+ auth_exists = exists and exists[0][0] or ''
+ if auth_exists:
+ 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 not sql("select name from tabCustomer where name = '%s' and docstatus != 2" % (self.doc.master_name)):
- msgprint("Please select valid Customer Name for Customerwise Discount.")
- raise Exception
- elif self.doc.based_on == 'Itemwise Discount' and not sql("select name from tabItem where name = '%s' and docstatus != 2" % (self.doc.master_name)):
- msgprint("Please select valid Item Name for Itemwise Discount.")
- raise Exception
- elif (self.doc.based_on == 'Grand Total' or 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
+ def validate_master_name(self):
+ if self.doc.based_on == 'Customerwise Discount' and \
+ not sql("select name from tabCustomer where name = '%s' and docstatus != 2" % \
+ (self.doc.master_name)):
+ msgprint("Please select valid Customer Name for Customerwise Discount",
+ 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)):
+ msgprint("Please select valid Item Name for Itemwise Discount", raise_exception=1)
+ elif (self.doc.based_on == 'Grand Total' or \
+ 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 not self.doc.transaction == 'Expense Claim' and not self.doc.transaction == 'Appraisal':
- if not self.doc.approving_role and not self.doc.approving_user:
- msgprint("Please enter Approving Role or Approving User")
- raise Exception
- elif self.doc.system_user and self.doc.system_user == self.doc.approving_user:
- msgprint("Approving User cannot be same as user the rule is Applicable To (User).")
- raise Exception
- elif self.doc.system_role and self.doc.system_role == self.doc.approving_role:
- msgprint("Approving Role cannot be same as user the rule is Applicable To (Role).")
- raise Exception
- 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))]):
- msgprint("System User : %s is assigned role : %s. So rule does not make sense." % (self.doc.system_user,self.doc.approving_role))
- raise Exception
- 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'):
- msgprint("You cannot set authorization on basis of Discount for %s." % (self.doc.transaction))
- raise Exception
- elif self.doc.based_on == 'Average Discount' and flt(self.doc.value) > 100.00:
- msgprint("Discount cannot given for more than 100 %s." % ('%'))
- raise Exception
- elif self.doc.based_on == 'Customerwise Discount' and not self.doc.master_name:
- msgprint("Please enter Customer Name for 'Customerwise Discount'")
- raise Exception
- else:
- if self.doc.transaction == 'Appraisal' and self.doc.based_on != 'Not Applicable':
- msgprint("Based on is 'Not Applicable' while setting authorization rule for 'Appraisal'")
- raise Exception
- if self.doc.transaction == 'Expense Claim' and self.doc.based_on != 'Total Claimed Amount':
- msgprint("Authorization rule should be based on 'Total Calimed Amount' while setting authorization rule for 'Expense Claim'")
- raise Exception
+ def validate_rule(self):
+ if self.doc.transaction != 'Appraisal':
+ if not self.doc.approving_role and not self.doc.approving_user:
+ msgprint("Please enter Approving Role or Approving User", raise_exception=1)
+ elif self.doc.system_user and self.doc.system_user == self.doc.approving_user:
+ msgprint("Approving User cannot be same as user the rule is Applicable To (User)",
+ raise_exception=1)
+ elif self.doc.system_role and self.doc.system_role == self.doc.approving_role:
+ msgprint("Approving Role cannot be same as user the rule is \
+ Applicable To (Role).", raise_exception=1)
+ 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))]):
+ msgprint("System User : %s is assigned role : %s. So rule does not make sense" %
+ (self.doc.system_user,self.doc.approving_role), raise_exception=1)
+ elif self.doc.transaction in ['Purchase Order', 'Purchase Receipt', \
+ 'Purchase Invoice', 'Stock Entry'] and self.doc.based_on \
+ in ['Average Discount', 'Customerwise Discount', 'Itemwise Discount']:
+ msgprint("You cannot set authorization on basis of Discount for %s" %
+ self.doc.transaction, raise_exception=1)
+ elif self.doc.based_on == 'Average Discount' and flt(self.doc.value) > 100.00:
+ msgprint("Discount cannot given for more than 100%", raise_exception=1)
+ elif self.doc.based_on == 'Customerwise Discount' and not self.doc.master_name:
+ msgprint("Please enter Customer Name for 'Customerwise Discount'",
+ raise_exception=1)
+ else:
+ if self.doc.transaction == 'Appraisal' and self.doc.based_on != 'Not Applicable':
+ msgprint("Based on should be 'Not Applicable' while setting authorization rule\
+ for 'Appraisal'", raise_exception=1)
- def validate(self):
- self.check_duplicate_entry()
- self.validate_rule()
- self.validate_master_name()
- if not self.doc.value: self.doc.value = flt(0)
\ No newline at end of file
+
+ def validate(self):
+ self.check_duplicate_entry()
+ self.validate_rule()
+ self.validate_master_name()
+ if not self.doc.value: self.doc.value = 0.0
\ No newline at end of file
diff --git a/setup/doctype/authorization_rule/authorization_rule.txt b/setup/doctype/authorization_rule/authorization_rule.txt
index d621558..7061da3 100644
--- a/setup/doctype/authorization_rule/authorization_rule.txt
+++ b/setup/doctype/authorization_rule/authorization_rule.txt
@@ -2,23 +2,17 @@
{
"owner": "Administrator",
"docstatus": 0,
- "creation": "2012-03-27 14:36:18",
+ "creation": "2012-07-03 13:30:00",
"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",
"module": "Setup",
"doctype": "DocType",
- "allow_trash": 1,
- "document_type": "Master",
- "autoname": "AR.####",
- "name": "__common__",
- "colour": "White:FFF",
- "_last_update": "1308741898",
- "server_code_error": " ",
- "version": 58
+ "document_type": "Master"
},
{
"name": "__common__",
@@ -46,19 +40,13 @@
"doctype": "DocType"
},
{
- "doctype": "DocPerm"
- },
- {
- "doctype": "DocPerm"
- },
- {
- "search_index": 0,
+ "oldfieldtype": "Link",
"doctype": "DocField",
"label": "Company",
"oldfieldname": "company",
"fieldname": "company",
"fieldtype": "Link",
- "oldfieldtype": "Link",
+ "search_index": 0,
"reqd": 0,
"options": "Company"
},
@@ -70,27 +58,26 @@
"fieldname": "transaction",
"fieldtype": "Select",
"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",
"doctype": "DocField",
"label": "Based On",
"oldfieldname": "based_on",
- "trigger": "Client",
"fieldname": "based_on",
"fieldtype": "Select",
"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",
"doctype": "DocField",
"label": "Customer / Item Name",
"oldfieldname": "master_name",
- "trigger": "Client",
"fieldname": "master_name",
- "fieldtype": "Link"
+ "fieldtype": "Link",
+ "options": "[Select]"
},
{
"oldfieldtype": "Link",
@@ -103,7 +90,6 @@
},
{
"oldfieldtype": "Link",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Applicable To (User)",
"oldfieldname": "system_user",
@@ -113,26 +99,24 @@
},
{
"description": "This will be used for setting rule in HR module",
- "search_index": 0,
- "colour": "White:FFF",
+ "oldfieldtype": "Link",
"doctype": "DocField",
"label": "Applicable To (Employee)",
"oldfieldname": "to_emp",
"fieldname": "to_emp",
"fieldtype": "Link",
- "oldfieldtype": "Link",
+ "search_index": 0,
"options": "Employee"
},
{
"description": "This will be used for setting rule in HR module",
- "search_index": 0,
- "colour": "White:FFF",
+ "oldfieldtype": "Link",
"doctype": "DocField",
"label": "Applicable To (Designation)",
"oldfieldname": "to_designation",
"fieldname": "to_designation",
"fieldtype": "Link",
- "oldfieldtype": "Link",
+ "search_index": 0,
"options": "Designation"
},
{
@@ -169,5 +153,11 @@
"oldfieldname": "trash_reason",
"fieldname": "trash_reason",
"fieldtype": "Small Text"
+ },
+ {
+ "doctype": "DocPerm"
+ },
+ {
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/setup/doctype/contact_control/contact_control.js b/setup/doctype/contact_control/contact_control.js
index faadc6a..fd08062 100755
--- a/setup/doctype/contact_control/contact_control.js
+++ b/setup/doctype/contact_control/contact_control.js
@@ -55,7 +55,7 @@
// get sates on country trigger
// -----------------------------
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){
if(r.message) {
set_field_options('state', r.message);
@@ -156,7 +156,7 @@
$wrapper.append(repl("\
<h4><a class='link_type'>%(fullname)s</a>%(primary)s</h4>\
<div class='description'>\
- %(description)s\
+ <p>%(description)s</p>\
<p><a class='delete link_type'>delete this %(doctype)s</a></p>\
</div>", data));
diff --git a/setup/doctype/customer_group/customer_group.js b/setup/doctype/customer_group/customer_group.js
index 2b24c11..af0c6f0 100644
--- a/setup/doctype/customer_group/customer_group.js
+++ b/setup/doctype/customer_group/customer_group.js
@@ -20,7 +20,7 @@
cur_frm.cscript.set_root_readonly = function(doc) {
// 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.set_intro("This is a root customer group and cannot be edited.");
} else {
diff --git a/setup/doctype/customer_group/customer_group.py b/setup/doctype/customer_group/customer_group.py
index 0f68521..cf126b8 100644
--- a/setup/doctype/customer_group/customer_group.py
+++ b/setup/doctype/customer_group/customer_group.py
@@ -31,20 +31,29 @@
self.nsm_parent_field = 'parent_customer_group';
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.
- To untrash please go to Setup & click on Trash."""%(self.doc.customer_group_name), raise_exception = 1)
- self.validate_root_details("All Customer Groups", "parent_customer_group")
+ To untrash please go to Setup -> Recycle Bin.""" %
+ (self.doc.customer_group_name), raise_exception = 1)
+
+ super(DocType, self).validate()
+
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]
if cust:
- msgprint("""Customer Group: %s can not be trashed/deleted 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)
+ msgprint("""Customer Group: %s can not be trashed/deleted \
+ 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):
- msgprint("Child customer group exists for this customer group. You can not trash/cancel/delete this customer group.", raise_exception=1)
+ if sql("select name from `tabCustomer Group` where parent_customer_group = %s \
+ 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
- super(DocType, self).on_trash()
+ super(DocType, self).on_trash()
\ No newline at end of file
diff --git a/setup/doctype/global_defaults/global_defaults.py b/setup/doctype/global_defaults/global_defaults.py
index 13a42ed..5aa2c9a 100644
--- a/setup/doctype/global_defaults/global_defaults.py
+++ b/setup/doctype/global_defaults/global_defaults.py
@@ -37,7 +37,8 @@
'currency_format':'default_currency_format',
'account_url':'account_url',
'allow_negative_stock' : 'allow_negative_stock',
- 'maintain_same_rate' : 'maintain_same_rate'
+ 'maintain_same_rate' : 'maintain_same_rate',
+ 'session_expiry': 'session_expiry'
}
class DocType:
@@ -47,6 +48,8 @@
def on_update(self):
"""update defaults"""
+ self.validate_session_expiry()
+
for key in keydict:
webnotes.conn.set_default(key, self.doc.fields.get(keydict[key], ''))
@@ -60,6 +63,15 @@
webnotes.conn.set_default('year_start_date', ysd.strftime('%Y-%m-%d'))
webnotes.conn.set_default('year_end_date', \
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):
return webnotes.conn.get_defaults()
diff --git a/setup/doctype/global_defaults/global_defaults.txt b/setup/doctype/global_defaults/global_defaults.txt
index ece7fac..e4b36a9 100644
--- a/setup/doctype/global_defaults/global_defaults.txt
+++ b/setup/doctype/global_defaults/global_defaults.txt
@@ -2,25 +2,19 @@
{
"owner": "Administrator",
"docstatus": 0,
- "creation": "2012-07-03 13:30:02",
+ "creation": "2012-10-26 16:49:40",
"modified_by": "Administrator",
- "modified": "2012-10-26 16:42:29"
+ "modified": "2012-12-12 14:13:31"
},
{
- "section_style": "Tabbed",
"in_create": 1,
"allow_print": 1,
"module": "Setup",
- "doctype": "DocType",
- "server_code_error": " ",
"read_only": 1,
"allow_email": 1,
"issingle": 1,
"name": "__common__",
- "colour": "White:FFF",
- "_last_update": "1323855502",
- "show_in_menu": 1,
- "version": 1,
+ "doctype": "DocType",
"hide_toolbar": 0,
"allow_copy": 1
},
@@ -46,9 +40,22 @@
},
{
"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",
- "fieldtype": "Section Break",
- "label": "Company"
+ "fieldtype": "Section Break"
},
{
"doctype": "DocField",
@@ -74,10 +81,10 @@
"options": "yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy"
},
{
+ "doctype": "DocField",
"width": "50%",
"fieldname": "column_break1",
- "fieldtype": "Column Break",
- "doctype": "DocField"
+ "fieldtype": "Column Break"
},
{
"default": "INR",
@@ -97,21 +104,21 @@
},
{
"doctype": "DocField",
+ "label": "Default Currency Fraction",
"fieldname": "default_currency_fraction",
- "fieldtype": "Data",
- "label": "Default Currency Fraction"
+ "fieldtype": "Data"
},
{
"doctype": "DocField",
+ "label": "Stock",
"fieldname": "stock",
- "fieldtype": "Section Break",
- "label": "Stock"
+ "fieldtype": "Section Break"
},
{
+ "doctype": "DocField",
"width": "50%",
"fieldname": "column_break2",
- "fieldtype": "Column Break",
- "doctype": "DocField"
+ "fieldtype": "Column Break"
},
{
"doctype": "DocField",
@@ -143,7 +150,6 @@
},
{
"description": "Applicable only if valuation method is moving average",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Allow Negative Stock",
"fieldname": "allow_negative_stock",
@@ -158,9 +164,9 @@
},
{
"doctype": "DocField",
+ "label": "Raise Purchase Request when stock reaches re-order level",
"fieldname": "auto_indent",
- "fieldtype": "Check",
- "label": "Raise Purchase Request when stock reaches re-order level"
+ "fieldtype": "Check"
},
{
"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>",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Allowance Percent",
"fieldname": "tolerance",
@@ -179,7 +184,6 @@
},
{
"description": "Stock level frozen up to this date, nobody can do / modify entry except authorized person",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "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",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Authorized Role (Frozen Entry)",
"fieldname": "stock_auth_role",
@@ -196,13 +199,12 @@
},
{
"doctype": "DocField",
+ "label": "Accounts",
"fieldname": "accounts",
- "fieldtype": "Section Break",
- "label": "Accounts"
+ "fieldtype": "Section Break"
},
{
"description": "Accounting entry frozen up to this date, nobody can do / modify entry except authorized person",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Accounts 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",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Authourized Role (Frozen Entry)",
"fieldname": "bde_auth_role",
@@ -225,9 +226,9 @@
"options": "Role"
},
{
+ "doctype": "DocField",
"fieldname": "column_break4",
- "fieldtype": "Column Break",
- "doctype": "DocField"
+ "fieldtype": "Column Break"
},
{
"doctype": "DocField",
@@ -238,13 +239,12 @@
},
{
"doctype": "DocField",
+ "label": "Selling",
"fieldname": "selling",
- "fieldtype": "Section Break",
- "label": "Selling"
+ "fieldtype": "Section Break"
},
{
"default": "Customer Name",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Customer Master created by ",
"fieldname": "cust_master_name",
@@ -280,10 +280,10 @@
"options": "<a href=\"#!Sales Browser/Territory\">To manage Territory, click here</a>"
},
{
+ "doctype": "DocField",
"width": "50%",
"fieldname": "column_break5",
- "fieldtype": "Column Break",
- "doctype": "DocField"
+ "fieldtype": "Column Break"
},
{
"doctype": "DocField",
@@ -301,7 +301,6 @@
},
{
"default": "No",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Sales Order Required",
"fieldname": "so_required",
@@ -310,7 +309,6 @@
},
{
"default": "No",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Delivery Note Required",
"fieldname": "dn_required",
@@ -319,9 +317,9 @@
},
{
"doctype": "DocField",
+ "label": "Buying",
"fieldname": "buying",
- "fieldtype": "Section Break",
- "label": "Buying"
+ "fieldtype": "Section Break"
},
{
"doctype": "DocField",
@@ -332,7 +330,6 @@
},
{
"default": "Supplier Name",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Supplier Master created by ",
"fieldname": "supp_master_name",
@@ -340,14 +337,13 @@
"options": "Supplier Name\nNaming Series"
},
{
+ "doctype": "DocField",
"width": "50%",
"fieldname": "column_break6",
- "fieldtype": "Column Break",
- "doctype": "DocField"
+ "fieldtype": "Column Break"
},
{
"default": "No",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Purchase Order Required",
"fieldname": "po_required",
@@ -356,7 +352,6 @@
},
{
"default": "No",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Purchase Receipt Required",
"fieldname": "pr_required",
@@ -365,9 +360,9 @@
},
{
"doctype": "DocField",
+ "label": "Maintain same rate throughout purchase cycle",
"fieldname": "maintain_same_rate",
- "fieldtype": "Check",
- "label": "Maintain same rate throughout purchase cycle"
+ "fieldtype": "Check"
},
{
"doctype": "DocField",
@@ -378,7 +373,6 @@
},
{
"description": "Employee record is created using selected field. ",
- "colour": "White:FFF",
"doctype": "DocField",
"label": "Employee Records to be created by ",
"fieldname": "emp_created_by",
@@ -387,15 +381,15 @@
},
{
"doctype": "DocField",
+ "label": "System",
"fieldname": "system",
- "fieldtype": "Section Break",
- "label": "System"
+ "fieldtype": "Section Break"
},
{
"doctype": "DocField",
+ "label": "SMS Sender Name",
"fieldname": "sms_sender_name",
- "fieldtype": "Data",
- "label": "SMS Sender Name"
+ "fieldtype": "Data"
},
{
"amend": 0,
@@ -415,20 +409,20 @@
"permlevel": 0
},
{
+ "doctype": "DocPerm",
+ "write": 1,
+ "role": "System Manager",
+ "permlevel": 1
+ },
+ {
+ "doctype": "DocPerm",
"role": "All",
- "permlevel": 1,
- "doctype": "DocPerm"
+ "permlevel": 1
},
{
+ "doctype": "DocPerm",
"write": 1,
"role": "System Manager",
- "permlevel": 1,
- "doctype": "DocPerm"
- },
- {
- "write": 1,
- "role": "System Manager",
- "permlevel": 2,
- "doctype": "DocPerm"
+ "permlevel": 2
}
]
\ No newline at end of file
diff --git a/setup/doctype/item_group/item_group.js b/setup/doctype/item_group/item_group.js
index 3869eec..db894fa 100644
--- a/setup/doctype/item_group/item_group.js
+++ b/setup/doctype/item_group/item_group.js
@@ -14,6 +14,21 @@
// You should have received a copy of the GNU General Public License
// 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
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';
diff --git a/setup/doctype/sales_partner/sales_partner.js b/setup/doctype/sales_partner/sales_partner.js
index f5c084d..a0f138c 100644
--- a/setup/doctype/sales_partner/sales_partner.js
+++ b/setup/doctype/sales_partner/sales_partner.js
@@ -77,7 +77,7 @@
page_length: 2,
new_doctype: "Contact",
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.sales_partner = cur_frm.doc.name;
wn.set_route("Form", "Contact", contact.name);
diff --git a/setup/doctype/sales_person/sales_person.js b/setup/doctype/sales_person/sales_person.js
index ba1a339..c529488 100644
--- a/setup/doctype/sales_person/sales_person.js
+++ b/setup/doctype/sales_person/sales_person.js
@@ -20,7 +20,7 @@
cur_frm.cscript.set_root_readonly = function(doc) {
// 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.set_intro("This is a root sales person and cannot be edited.");
} else {
diff --git a/setup/doctype/sales_person/sales_person.py b/setup/doctype/sales_person/sales_person.py
index 41d5042..943e724 100644
--- a/setup/doctype/sales_person/sales_person.py
+++ b/setup/doctype/sales_person/sales_person.py
@@ -33,3 +33,6 @@
if not flt(d.target_qty) and not flt(d.target_amount):
webnotes.msgprint("Either target qty or target amount is mandatory.")
raise Exception
+
+ super(DocType, self).validate()
+
\ No newline at end of file
diff --git a/setup/doctype/territory/territory.js b/setup/doctype/territory/territory.js
index a04bea3..2932006 100644
--- a/setup/doctype/territory/territory.js
+++ b/setup/doctype/territory/territory.js
@@ -20,7 +20,7 @@
cur_frm.cscript.set_root_readonly = function(doc) {
// 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.set_intro("This is a root territory and cannot be edited.");
} else {
@@ -28,12 +28,6 @@
}
}
-
-cur_frm.cscript.onload = function(){
-
-}
-
-
//get query select territory
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';
diff --git a/setup/doctype/territory/territory.py b/setup/doctype/territory/territory.py
index 59c0b3a..4b6468e 100644
--- a/setup/doctype/territory/territory.py
+++ b/setup/doctype/territory/territory.py
@@ -33,3 +33,6 @@
if not flt(d.target_qty) and not flt(d.target_amount):
msgprint("Either target qty or target amount is mandatory.")
raise Exception
+
+ super(DocType, self).validate()
+
\ No newline at end of file
diff --git a/setup/doctype/workflow_rule/workflow_rule.js b/setup/doctype/workflow_rule/workflow_rule.js
index 9fb2013..a506101 100644
--- a/setup/doctype/workflow_rule/workflow_rule.js
+++ b/setup/doctype/workflow_rule/workflow_rule.js
@@ -32,7 +32,7 @@
var mydoc = doc
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) {
var doc = locals[mydoc.doctype][mydoc.name];
cur_frm.fields_dict.workflow_action_details.grid.get_field("action_field").df.options = r.message;
@@ -41,7 +41,7 @@
}
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) {
var doc = locals[mydoc.doctype][mydoc.name];
cur_frm.fields_dict.workflow_rule_details.grid.get_field("comparing_field").df.options = r.message;
@@ -50,7 +50,7 @@
);
}
- $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) {
var doc = locals[mydoc.doctype][mydoc.name];
cur_frm.fields_dict.workflow_rule_details.grid.get_field("rule_field").df.options = r.message;
diff --git a/setup/page/permission_engine/permission_engine.html b/setup/page/permission_engine/permission_engine.html
index 7831447..8d98958 100644
--- a/setup/page/permission_engine/permission_engine.html
+++ b/setup/page/permission_engine/permission_engine.html
@@ -5,4 +5,6 @@
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.
</div>
+<hr>
+<div class="well">Note: A document is not accessible to a user if Permission at level 0 is not given.</div>
</div>
diff --git a/startup/event_handlers.py b/startup/event_handlers.py
index 9cd1af9..4808298 100644
--- a/startup/event_handlers.py
+++ b/startup/event_handlers.py
@@ -25,14 +25,10 @@
update login_from and delete parallel sessions
"""
# Clear previous sessions i.e. logout previous log-in attempts
- exception_list = ['demo@erpnext.com', 'Administrator', 'Guest']
- if webnotes.session['user'] not in exception_list:
- sid_list = webnotes.conn.sql("""
- DELETE FROM `tabSessions`
- WHERE
- user=%s AND
- sid!=%s""", \
- (webnotes.session['user'], webnotes.session['sid']), as_list=1)
+ allow_multiple_sessions = ['demo@erpnext.com', 'Administrator', 'Guest']
+ if webnotes.session['user'] not in allow_multiple_sessions:
+ from webnotes.sessions import clear_sessions
+ clear_sessions(webnotes.session.user, keep_current=True)
# check if account is expired
check_if_expired()
@@ -119,7 +115,7 @@
from webnotes.utils import formatdate
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
we will guide you to get your account re-activated."""
else:
diff --git a/startup/startup.py b/startup/startup.py
index 828239e..15ea491 100644
--- a/startup/startup.py
+++ b/startup/startup.py
@@ -48,7 +48,7 @@
incomplete_todos = webnotes.conn.sql("""\
SELECT COUNT(*) FROM `tabToDo`
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
def get_todays_events():
diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js
index 837d52c..a80966a 100644
--- a/stock/doctype/delivery_note/delivery_note.js
+++ b/stock/doctype/delivery_note/delivery_note.js
@@ -128,7 +128,7 @@
//================ create new contact ============================================================================
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;
if(doc.customer) locals['Contact'][tn].customer = doc.customer;
loaddoc('Contact', tn);
@@ -192,9 +192,9 @@
//-----------------------------------Make Sales Invoice----------------------------------------------
cur_frm.cscript['Make Sales Invoice'] = function() {
var doc = cur_frm.doc
- n = createLocal('Sales Invoice');
+ n = wn.model.make_new_doc_and_get_name('Sales Invoice');
$c('dt_map', args={
- 'docs':compress_doclist([locals['Sales Invoice'][n]]),
+ 'docs':wn.model.compress([locals['Sales Invoice'][n]]),
'from_doctype':doc.doctype,
'to_doctype':'Sales Invoice',
'from_docname':doc.name,
@@ -209,9 +209,9 @@
cur_frm.cscript['Make Installation Note'] = function() {
var doc = cur_frm.doc;
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={
- 'docs':compress_doclist([locals['Installation Note'][n]]),
+ 'docs':wn.model.compress([locals['Installation Note'][n]]),
'from_doctype':doc.doctype,
'to_doctype':'Installation Note',
'from_docname':doc.name,
@@ -228,9 +228,9 @@
//-----------------------------------Make Sales Invoice----------------------------------------------
cur_frm.cscript['Make Packing Slip'] = function() {
var doc = cur_frm.doc
- n = createLocal('Packing Slip');
+ n = wn.model.make_new_doc_and_get_name('Packing Slip');
$c('dt_map', args={
- 'docs':compress_doclist([locals['Packing Slip'][n]]),
+ 'docs':wn.model.compress([locals['Packing Slip'][n]]),
'from_doctype':doc.doctype,
'to_doctype':'Packing Slip',
'from_docname':doc.name,
diff --git a/stock/doctype/purchase_receipt/purchase_receipt.js b/stock/doctype/purchase_receipt/purchase_receipt.js
index d26636e..23aa2cc 100644
--- a/stock/doctype/purchase_receipt/purchase_receipt.js
+++ b/stock/doctype/purchase_receipt/purchase_receipt.js
@@ -24,7 +24,7 @@
//========================== On Load ================================================================
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.transaction_date) doc.transaction_date = dateutil.obj_to_str(new Date());
if (!doc.status) doc.status = 'Draft';
@@ -107,7 +107,7 @@
//================ create new contact ============================================================================
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;
if(doc.supplier) locals['Contact'][tn].supplier = doc.supplier;
loaddoc('Contact', tn);
@@ -150,9 +150,10 @@
cur_frm.cscript.received_qty = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
ret = {
- 'qty' : 0,
+ 'qty' : (flt(d.qty) && flt(d.qty) < flt(d.received_qty))
+ ? flt(d.qty) : flt(d.received_qty),
'stock_qty': 0,
- 'rejected_qty' : 0
+ 'rejected_qty' : 0,
}
set_multiple('Purchase Receipt Item', cdn, ret, 'purchase_receipt_details');
cur_frm.cscript.calc_amount(doc, 2);
@@ -240,9 +241,9 @@
// ================================ Make Purchase Invoice ==========================================
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={
- 'docs':compress_doclist([locals['Purchase Invoice'][n]]),
+ 'docs':wn.model.compress([locals['Purchase Invoice'][n]]),
'from_doctype': cur_frm.doc.doctype,
'to_doctype':'Purchase Invoice',
'from_docname': cur_frm.doc.name,
diff --git a/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js b/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js
index d57ff5d..7547b6a 100644
--- a/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js
+++ b/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js
@@ -120,7 +120,7 @@
// map parent fields of stock entry
//----------------------------------
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.posting_date = dateutil.obj_to_str(new Date());
se.transfer_date = dateutil.obj_to_str(new Date());
@@ -148,7 +148,7 @@
cur_frm.cscript.map_child_fields = function(cl, se) {
for(var i = 0; i<cl.length; i++){
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.item_code = cl[i].item_code;
d1.description = cl[i].description;
@@ -167,7 +167,7 @@
// Make excise voucher
//-------------------------------
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.voucher_type = 'Excise Voucher';
loaddoc('Journal Voucher',excise.name);
@@ -203,7 +203,7 @@
// Make JV
//--------------------------------
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.voucher_type = dr_or_cr;
@@ -216,7 +216,7 @@
// Add children
if(children) {
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]);
ch.balance = fmt_money(ch.balance);
}
diff --git a/support/doctype/customer_issue/customer_issue.js b/support/doctype/customer_issue/customer_issue.js
index 81c10d4..835509f 100644
--- a/support/doctype/customer_issue/customer_issue.js
+++ b/support/doctype/customer_issue/customer_issue.js
@@ -71,9 +71,9 @@
$c_obj(make_doclist(doc.doctype, doc.name),'check_maintenance_visit','',
function(r,rt){
if(r.message == 'No'){
- n = createLocal("Maintenance Visit");
+ n = wn.model.make_new_doc_and_get_name("Maintenance Visit");
$c('dt_map', args={
- 'docs':compress_doclist([locals["Maintenance Visit"][n]]),
+ 'docs':wn.model.compress([locals["Maintenance Visit"][n]]),
'from_doctype':'Customer Issue',
'to_doctype':'Maintenance Visit',
'from_docname':doc.name,
diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.js b/support/doctype/maintenance_schedule/maintenance_schedule.js
index 21d2e62..a931327 100644
--- a/support/doctype/maintenance_schedule/maintenance_schedule.js
+++ b/support/doctype/maintenance_schedule/maintenance_schedule.js
@@ -116,7 +116,7 @@
cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {
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){
refresh_field('maintenance_schedule_detail');
}
diff --git a/support/doctype/support_ticket/__init__.py b/support/doctype/support_ticket/__init__.py
index b477b96..a53c76b 100644
--- a/support/doctype/support_ticket/__init__.py
+++ b/support/doctype/support_ticket/__init__.py
@@ -135,7 +135,7 @@
from webnotes.utils.file_manager import save_file, add_file_list
for attachment in attachment_list:
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:
doc.description = doc.description \
+ "\nCould not attach: " + cstr(attachment['filename'])
diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js
index fdfbc1a..3e607fb 100644
--- a/support/doctype/support_ticket/support_ticket.js
+++ b/support/doctype/support_ticket/support_ticket.js
@@ -18,7 +18,6 @@
$.extend(cur_frm.cscript, {
onload: function(doc, dt, dn) {
- cur_frm.last_reload = new Date();
if(in_list(user_roles,'System Manager')) {
cur_frm.page_layout.footer.help_area.innerHTML = '<hr>\
<p><a href="#Form/Email Settings/Email Settings">Email Settings</a><br>\
@@ -27,11 +26,6 @@
},
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();
cur_frm.cscript.make_listing(doc);
if(!doc.__islocal) {
diff --git a/utilities/doctype/contact/contact.js b/utilities/doctype/contact/contact.js
index 3876ca2..97fd8a6 100644
--- a/utilities/doctype/contact/contact.js
+++ b/utilities/doctype/contact/contact.js
@@ -27,7 +27,7 @@
list: wn.model.get("Communication", {"contact": doc.name}),
parent: cur_frm.fields_dict.communication_html.wrapper,
doc: doc,
- email: doc.email_id
+ recipients: doc.email_id
})
}
diff --git a/utilities/doctype/sms_control/sms_control.js b/utilities/doctype/sms_control/sms_control.js
index 9cc152f..4af96b3 100644
--- a/utilities/doctype/sms_control/sms_control.js
+++ b/utilities/doctype/sms_control/sms_control.js
@@ -31,7 +31,6 @@
this.show = function(contact, key, value, mobile_nos, message) {
this.message = message;
if (mobile_nos) {
-
me.number = mobile_nos;
me.show_dialog();
} else if (contact){
@@ -59,7 +58,6 @@
{fieldname:'send', fieldtype:'Button', label:'Send'}
]
})
- d.make();
d.fields_dict.send.input.onclick = function() {
var btn = d.fields_dict.send.input;
var v = me.dialog.get_values();
diff --git a/utilities/page/calendar/calendar.js b/utilities/page/calendar/calendar.js
index e7abbab..d62dc68 100644
--- a/utilities/page/calendar/calendar.js
+++ b/utilities/page/calendar/calendar.js
@@ -85,7 +85,7 @@
,['Text','Description']
,['HTML', 'Ref Link']
,['Check', 'Public Event']
- ,['Check', 'Cancel Event']
+ ,['Check', 'Cancelled Event']
,['HTML', 'Event Link']
,['Button', 'Save']
])
@@ -106,7 +106,7 @@
this.widgets['Description'].value = cstr(this.ev.description);
this.widgets['Public Event'].checked = false;
- this.widgets['Cancel Event'].checked = false;
+ this.widgets['Cancelled Event'].checked = false;
if(this.ev.event_type=='Public')
this.widgets['Public Event'].checked = true;
@@ -134,7 +134,7 @@
// save values
d.ev.description = d.widgets['Description'].value;
- if(d.widgets['Cancel Event'].checked)
+ if(d.widgets['Cancelled Event'].checked)
d.ev.event_type='Cancel';
else if(d.widgets['Public Event'].checked)
d.ev.event_type='Public';
@@ -154,7 +154,8 @@
Calendar.prototype.save_event = function(doc) {
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 cal = erpnext.calendar;
cal.cur_view.refresh();
@@ -162,15 +163,15 @@
// if cancelled, hide
if(doc.event_type=='Cancel') {
$(cal.events_by_name[doc.name].body).toggle(false);
- }
- });
+ }
+ })
}
//------------------------------------------------------
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.event_date = dateutil.obj_to_str(this.selected_date);