Merge branch 'shf_rename' of github.com:webnotes/erpnext into shf_rename

This commit is contained in:
Nabin Hait 2012-04-13 11:53:35 +05:30
commit b176e94b92
39 changed files with 381 additions and 431 deletions

View File

@ -97,6 +97,7 @@
"lib/js/legacy/utils/dom.js",
"lib/js/legacy/utils/handler.js",
"lib/js/legacy/utils/msgprint.js",
"lib/js/wn/ui/appframe.js",
"lib/js/wn/ui/dialog.js",
"lib/js/legacy/widgets/dialog.js",
"lib/js/wn/ui/listing.js",
@ -131,7 +132,7 @@
"lib/js/legacy/utils/msgprint.js",
"lib/js/legacy/utils/printElement.js",
"lib/js/legacy/widgets/form/fields.js",
"lib/js/wn/views/appframe.js",
"lib/js/wn/ui/appframe.js",
"lib/js/wn/ui/dialog.js",
"lib/js/wn/ui/button.js",
"lib/js/legacy/widgets/dialog.js",

View File

@ -330,7 +330,7 @@ div.notice {
div.form-title {
/*background-color: #e0eeff;*/
padding: 5px 11px 15px 11px;
padding: 5px 19px 15px 19px;
margin: -15px -15px 0px -15px;
border-bottom: 1px solid #eee;
}
@ -338,7 +338,7 @@ div.form-title {
div.form-section-head {
margin: 11px -15px 3px -15px;
border-top: 1px solid #ccc;
padding: 11px 15px 0px 15px;
padding: 11px 23px 0px 23px;
}
div.form-layout-row:first-child .form-section-head {

View File

@ -450,43 +450,6 @@ class DocType:
if not ret:
msgprint("Payment Entry has been modified after you pulled it. Please pull it again.", raise_exception=1)
######################################################################################################################
# Repair Outstanding Amount
#---------------------------------
def repair_voucher_outstanding(self, voucher_obj):
msg = []
# Get Balance from GL Entries
bal = webnotes.conn.sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s", (voucher_obj.doc.name , voucher_obj.doc.doctype))
bal = bal and flt(bal[0][0]) or 0.0
if cstr(voucher_obj.doc.doctype) == 'Purchase Invoice':
bal = -bal
# Check outstanding Amount
if flt(voucher_obj.doc.outstanding_amount) != flt(bal):
msgprint('<div style="color: RED"> Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s) </div>' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal))
msg.append('<div style="color: RED"> Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s) </div>' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal))
# set voucher balance
#webnotes.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" % (voucher_obj.doc.doctype, bal, voucher_obj.doc.name))
webnotes.conn.set(voucher_obj.doc, 'outstanding_amount', flt(bal))
# Send Mail
if msg:
email_msg = """ Dear Administrator,
In Account := %s User := %s has Repaired Outstanding Amount For %s : %s and following was found:-
%s
""" % (webnotes.conn.get_value('Control Panel', None,'account_id'), session['user'], voucher_obj.doc.doctype, voucher_obj.doc.name, '\n'.join(msg))
sendmail(['support@iwebnotes.com'], subject='Repair Outstanding Amount', parts = [('text/plain', email_msg)])
# Acknowledge User
msgprint(cstr(voucher_obj.doc.doctype) + " : " + cstr(voucher_obj.doc.name) + " has been checked" + cstr(msg and " and repaired successfully." or ". No changes Found."))
def repost_illegal_cancelled(self, after_date='2011-01-01'):
"""

View File

@ -558,8 +558,3 @@ class DocType(TransactionBase):
def on_update(self):
pass
########################################################################
# Repair Outstanding
#######################################################################
def repair_pv_outstanding(self):
get_obj(dt = 'GL Control').repair_voucher_outstanding(self)

View File

@ -79,7 +79,7 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
'source', 'cancel_reason', 'total_advance', 'gross_profit',
'gross_profit_percent', 'get_advances_received',
'advance_adjustment_details', 'sales_partner', 'commission_rate',
'total_commission', 'repair_outstanding_amt'];
'total_commission'];
item_flds_normal = ['sales_order', 'delivery_note']
item_flds_pos = ['warehouse', 'serial_no', 'batch_no', 'actual_qty', 'delivered_qty']
@ -115,7 +115,6 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
if(doc.docstatus==1) {
cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry);
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
unhide_field('repair_outstanding_amt');
if(doc.is_pos==1 && doc.update_stock!=1)
cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']);
@ -123,8 +122,6 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
if(doc.outstanding_amount!=0)
cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher);
}
else
hide_field('repair_outstanding_amt');
}
//fetch retail transaction related fields

View File

@ -679,13 +679,6 @@ class DocType(TransactionBase):
webnotes.conn.set(self.doc,'outstanding_amount',flt(self.doc.grand_total) - flt(self.doc.total_advance) - flt(self.doc.paid_amount) - flt(self.doc.write_off_amount))
########################################################################
# Repair Outstanding
def repair_rv_outstanding(self):
get_obj(dt = 'GL Control').repair_voucher_outstanding(self)
#-------------------------------------------------------------------------------------
def on_update_after_submit(self):
self.convert_into_recurring()

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:35:47',
'creation': '2012-04-11 13:17:25',
'docstatus': 0,
'modified': '2012-03-27 18:44:28',
'modified': '2012-04-13 11:26:44',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -13,6 +13,7 @@
# These values are common for all DocType
{
'_last_update': u'1330671142',
'allow_attach': 1,
'change_log': u'1. Change in pull_details method dt.-26-06-2009',
'colour': u'White:FFF',
'default_print_format': u'Standard',
@ -26,7 +27,7 @@
'server_code_error': u' ',
'show_in_menu': 0,
'subject': u'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
'version': 417
'version': 418
},
# These values are common for all DocField
@ -54,6 +55,30 @@
'name': u'Sales Invoice'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Accounts Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Accounts Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
@ -80,38 +105,10 @@
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'match': u'customer',
'permlevel': 0,
'role': u'Customer',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Accounts Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Accounts Manager',
'submit': 1,
'write': 1
'role': u'Customer'
},
# DocField
@ -1503,13 +1500,12 @@
# DocField
{
'allow_on_submit': 1,
'doctype': u'DocField',
'fieldname': u'repair_outstanding_amt',
'fieldtype': u'Button',
'label': u'Repair Outstanding Amt',
'oldfieldtype': u'Button',
'options': u'repair_rv_outstanding',
'fieldname': u'file_list',
'fieldtype': u'Text',
'hidden': 1,
'label': u'File List',
'no_copy': 1,
'permlevel': 0,
'print_hide': 1
}

View File

@ -1,19 +1,22 @@
<div class="layout-wrapper layout-wrapper-background">
<div class="appframe-area"></div>
<div class="layout-main-section">
<a class="close" onclick="window.history.back();">&times;</a>
<h1>Accounts</h1>
<hr>
<div style="width: 48%; float: left;">
<h4><a href="#!List/Journal Voucher">Journal Voucher</a></h4>
<p class="help">General Ledger Entries</p>
<br>
<h4><a href="#!List/Sales Invoice">Sales Invoice</a></h4>
<p class="help">Bills raised to Customers</p>
<br>
<h4><a href="#!List/Purchase Invoice">Purchase Invoice</a></h4>
<p class="help">Bills raised by Suppliers</p>
</div>
<div style="width: 48%; float: right;">
<h4><a href="#!Accounts Browser/Account">Chart of Accounts</a></h4>
<p class="help">Structure of books of accounts</p>
<br>
<h4><a href="#!Accounts Browser/Cost Center">Chart of Cost Centers</a></h4>
<p class="help">Structure cost centers</p>
</div>

View File

@ -16,6 +16,8 @@
pscript['onload_accounts-home'] = function(wrapper) {
erpnext.module_page.setup_page('Accounts', wrapper);
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
if(wn.control_panel.country!='India') {
$('.india-specific').toggle(false);
}

View File

@ -60,13 +60,13 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
}
if(!is_closed) {
cur_frm.add_custom_button('Make Purchase Order', cur_frm.cscript['Make Purchase Order'])
cur_frm.add_custom_button('Stop Purchase Request', cur_frm.cscript['Stop Purchase Requisition'])
cur_frm.add_custom_button('Stop Purchase Request', cur_frm.cscript['Stop Purchase Request'])
}
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
}
if(doc.docstatus == 1 && doc.status == 'Stopped')
cur_frm.add_custom_button('Unstop Purchase Request', cur_frm.cscript['Unstop Purchase Requisition'])
cur_frm.add_custom_button('Unstop Purchase Request', cur_frm.cscript['Unstop Purchase Request'])
}
//======================= validation ===================================
@ -108,7 +108,7 @@ cur_frm.cscript['Make Purchase Order'] = function() {
// Stop INDENT
// ==================================================================================================
cur_frm.cscript['Stop Purchase Requisition'] = function() {
cur_frm.cscript['Stop Purchase Request'] = function() {
var doc = cur_frm.doc;
var check = confirm("Do you really want to STOP this Purchase Request?");
@ -121,7 +121,7 @@ cur_frm.cscript['Stop Purchase Requisition'] = function() {
// Un Stop INDENT
//====================================================================================================
cur_frm.cscript['Unstop Purchase Requisition'] = function(){
cur_frm.cscript['Unstop Purchase Request'] = function(){
var doc = cur_frm.doc
var check = confirm("Do you really want to UNSTOP this Purchase Request?");

View File

@ -1,17 +1,19 @@
<div class="layout-wrapper layout-wrapper-background">
<div class="appframe-area"></div>
<div class="layout-main-section">
<a class="close" onclick="window.history.back();">&times;</a>
<h1>Buying</h1>
<hr>
<div style="width: 48%; float: left;">
<h4><a href="#!List/Purchase Request">Purchase Request</a></h4>
<p class="help">Request for purchase</p>
<br>
<h4><a href="#!List/Purchase Order">Purchase Order</a></h4>
<p class="help">Purchase Orders given to Suppliers</p>
</div>
<div style="width: 48%; float: right;">
<h4><a href="#!List/Supplier">Supplier</a></h4>
<p class="help">Supplier Master</p>
<br>
<h4><a href="#!List/Item">Item</a></h4>
<p class="help">Item Master</p>
</div>

View File

@ -15,5 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pscript['onload_buying-home'] = function(wrapper) {
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
erpnext.module_page.setup_page('Buying', wrapper);
}

View File

@ -1,17 +1,21 @@
<div class="layout-wrapper layout-wrapper-background">
<div class="appframe-area"></div>
<div class="layout-main-section">
<a class="close" onclick="window.history.back();">&times;</a>
<h1>Human Resources</h1>
<hr>
<div style="width: 48%; float: left;">
<h4><a href="#!List/Attendance">Attendance</a></h4>
<p class="help">Attendance Mark</p>
<br>
<h4><a href="#!List/Leave Application">Leave Application</a></h4>
<p class="help">Applications for leave</p>
<br>
<h4><a href="#!List/Expense Claim">Expense Claim</a></h4>
<p class="help">Claims for expenses</p>
<br>
<h4><a href="#!List/Salary Slip">Salary Slip</a></h4>
<p class="help">Monthly salary statement</p>
<br>
<h4><a href="#!List/Appraisal">Appraisal</a></h4>
<p class="help">Performance appraisal</p>
</div>

View File

@ -15,5 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pscript['onload_hr-home'] = function(wrapper) {
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
erpnext.module_page.setup_page('HR', wrapper);
}

View File

@ -1,17 +1,19 @@
<div class="layout-wrapper layout-wrapper-background">
<div class="appframe-area"></div>
<div class="layout-main-section">
<a class="close" onclick="window.history.back();">&times;</a>
<h1>Production</h1>
<hr>
<div style="width: 48%; float: left;">
<h4><a href="#!List/Production Order">Production Order</a></h4>
<p class="help">Orders for manufacturing</p>
<br>
<h4><a href="#!Form/Production Planning Tool/Production Planning Tool">Production Plan</a></h4>
<p class="help">Generate Purchase Requisition (MRP) and Production Orders</p>
</div>
<div style="width: 48%; float: right;">
<h4><a href="#!List/BOM">Bill of Materials</a></h4>
<p class="help">Bill of Materials (BOM) Master</p>
<br>
<h4><a href="#!List/Item">Item</a></h4>
<p class="help">Item Master</p>
</div>

View File

@ -15,5 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pscript['onload_production-home'] = function(wrapper) {
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
erpnext.module_page.setup_page('Production', wrapper);
}

View File

@ -1,13 +1,15 @@
<div class="layout-wrapper layout-wrapper-background">
<div class="appframe-area"></div>
<div class="layout-main-section">
<a class="close" onclick="window.history.back();">&times;</a>
<h1>Projects</h1>
<hr>
<div style="width: 48%; float: left;">
<h4><a href="#!List/Project">Project</a></h4>
<p class="help">Project master</p>
<br>
<h4><a href="#!List/Task">Task</a></h4>
<p class="help">Project activity / task</p>
<br>
<h4><a href="#!List/Timesheet">Timesheet</a></h4>
<p class="help">Timesheet for tasks</p>
</div>

View File

@ -15,5 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pscript['onload_projects-home'] = function(wrapper) {
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
erpnext.module_page.setup_page('Projects', wrapper);
}

View File

@ -77,7 +77,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
// indent
if(doc.order_type != 'Maintenance')
cur_frm.add_custom_button('Make ' + get_doctype_label('Purchase Request'), cur_frm.cscript['Make Purchase Requisition']);
cur_frm.add_custom_button('Make ' + get_doctype_label('Purchase Request'), cur_frm.cscript['Make Purchase Request']);
// sales invoice
if(doc.per_billed < 100)
@ -92,9 +92,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']);
}
unhide_field(['repair_sales_order', 'Send SMS', 'message', 'customer_mobile_no'])
unhide_field(['Send SMS', 'message', 'customer_mobile_no'])
} else {
hide_field(['repair_sales_order', 'Send SMS', 'message', 'customer_mobile_no'])
hide_field(['Send SMS', 'message', 'customer_mobile_no'])
}
}
@ -263,7 +263,7 @@ cur_frm.cscript.make_maintenance_visit = function() {
// make indent
// ================================================================================================
cur_frm.cscript['Make Purchase Requisition'] = function() {
cur_frm.cscript['Make Purchase Request'] = function() {
var doc = cur_frm.doc;
if (doc.docstatus == 1) {
n = createLocal("Purchase Request");

View File

@ -509,7 +509,3 @@ class DocType(TransactionBase):
def on_update(self):
pass
# Repair Sales Order
# ===========================================
def repair_sales_order(self):
get_obj('Sales Common', 'Sales Common').repair_curr_doctype_details(self)

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:36:14',
'creation': '2012-04-11 13:18:19',
'docstatus': 0,
'modified': '2012-03-27 18:49:05',
'modified': '2012-04-13 11:32:08',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -13,7 +13,7 @@
# These values are common for all DocType
{
'_last_update': u'1330670942',
'allow_attach': 0,
'allow_attach': 1,
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
@ -30,7 +30,7 @@
'show_in_menu': 0,
'subject': u'From %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s | %(per_delivered)s% delivered | %(per_billed)s% billed',
'tag_fields': u'delivery_status,billing_status',
'version': 632
'version': 633
},
# These values are common for all DocField
@ -58,6 +58,30 @@
'name': u'Sales Order'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 1,
@ -70,18 +94,6 @@
'write': 1
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Maintenance User',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
@ -89,93 +101,63 @@
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Maintenance Manager',
'role': u'Sales User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'match': u'customer_name',
'permlevel': 0,
'role': u'Maintenance Manager',
'submit': 1,
'write': 1
'role': u'Customer'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 2,
'role': u'Accounts User',
'submit': 0,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Customer',
'submit': 0,
'write': 0
'role': u'Maintenance Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User',
'submit': 0,
'write': 0
'role': u'Maintenance Manager'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 1,
'permlevel': 0,
'role': u'Maintenance User',
'submit': 0,
'write': 0
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Maintenance User'
},
# DocField
@ -1335,13 +1317,12 @@
# DocField
{
'allow_on_submit': 1,
'doctype': u'DocField',
'fieldname': u'repair_sales_order',
'fieldtype': u'Button',
'label': u'Repair Sales Order',
'oldfieldtype': u'Button',
'options': u'repair_sales_order',
'fieldname': u'file_list',
'fieldtype': u'Text',
'hidden': 1,
'label': u'File List',
'no_copy': 1,
'permlevel': 0,
'print_hide': 1
}

View File

@ -1,21 +1,25 @@
<div class="layout-wrapper layout-wrapper-background">
<div class="appframe-area"></div>
<div class="layout-main-section">
<a class="close" onclick="window.history.back();">&times;</a>
<h1>Selling</h1>
<hr>
<div style="width: 48%; float: left;">
<h4><a href="#!List/Lead">Lead</a></h4>
<p class="help">Prospective customers</p>
<br>
<h4><a href="#!List/Opportunity">Opportunity</a></h4>
<p class="help">Business opportunities</p>
<br>
<h4><a href="#!List/Quotation">Quotation</a></h4>
<p class="help">Quotes sent to Leads / Customers</p>
<br>
<h4><a href="#!List/Sales Order">Sales Order</a></h4>
<p class="help">Confirmed orders from Customers</p>
</div>
<div style="width: 48%; float: right;">
<h4><a href="#!List/Customer">Customer</a></h4>
<p class="help">Customer Master</p>
<br>
<h4><a href="#!List/Item">Item</a></h4>
<p class="help">Item Master</p>
</div>

View File

@ -15,5 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pscript['onload_selling-home'] = function(wrapper) {
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
erpnext.module_page.setup_page('Selling', wrapper);
}

View File

@ -64,10 +64,10 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
if(doc.per_installed < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Installation Note', cur_frm.cscript['Make Installation Note']);
if (doc.docstatus!=1) {
hide_field(['SMS', 'Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']);
hide_field(['Send SMS', 'message', 'customer_mobile_no');
} else {
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
unhide_field(['SMS','Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']);
unhide_field(['Send SMS', 'message', 'customer_mobile_no');
}
if(doc.docstatus==0 && !doc.__islocal) {

View File

@ -487,8 +487,4 @@ class DocType(TransactionBase):
self.set_actual_qty()
get_obj('Stock Ledger').scrub_serial_nos(self)
# Repair Delivery Note
# ===========================================
def repair_delivery_note(self):
get_obj('Sales Common', 'Sales Common').repair_curr_doctype_details(self)

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:36:28',
'creation': '2012-04-11 13:18:36',
'docstatus': 0,
'modified': '2012-03-27 18:50:57',
'modified': '2012-04-13 11:02:43',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -13,6 +13,7 @@
# These values are common for all DocType
{
'_last_update': u'1330593645',
'allow_attach': 1,
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
@ -29,7 +30,7 @@
'show_in_menu': 0,
'subject': u'To %(customer_name)s on %(posting_date)s | %(per_billed)s% billed',
'tag_fields': u'billing_status',
'version': 476
'version': 477
},
# These values are common for all DocField
@ -57,6 +58,78 @@
'name': u'Delivery Note'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material User',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales User',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User',
'submit': 0,
'write': 0
},
# DocPerm
{
'cancel': 0,
@ -75,30 +148,6 @@
'role': u'Accounts User'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales User',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User',
'submit': 0,
'write': 0
},
# DocPerm
{
'doctype': u'DocPerm',
@ -115,54 +164,6 @@
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material User',
'submit': 1,
'write': 1
},
# DocField
{
'colour': u'White:FFF',
@ -1368,13 +1369,12 @@
# DocField
{
'allow_on_submit': 1,
'doctype': u'DocField',
'fieldname': u'repair_delivery_note',
'fieldtype': u'Button',
'label': u'Repair Delivery Note',
'oldfieldtype': u'Button',
'options': u'repair_delivery_note',
'fieldname': u'file_list',
'fieldtype': u'Text',
'hidden': 1,
'label': u'File List',
'no_copy': 1,
'permlevel': 0,
'print_hide': 1
}

View File

@ -26,8 +26,8 @@ var cfn_set_fields = function(doc, cdt, cdn) {
hide_field(lst);
if (doc.purpose == 'Production Order' || doc.purpose == 'Other'){
unhide_field('Get Items');
hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no','delivery_note_no', 'sales_invoice_no','Warehouse HTML', 'transporter', 'is_excisable_goods', 'excisable_goods']);
unhide_field('get_items');
hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no','delivery_note_no', 'sales_invoice_no','warehouse_html', 'transporter', 'is_excisable_goods', 'excisable_goods']);
if (doc.purpose=='Production Order') unhide_field(['production_order', 'process']);
doc.from_warehouse = '';
@ -42,7 +42,7 @@ var cfn_set_fields = function(doc, cdt, cdn) {
}
else{
unhide_field(['from_warehouse', 'to_warehouse']);
hide_field(['production_order', 'process', 'Get Items', 'fg_completed_qty','purchase_receipt_no','delivery_note_no', 'sales_invoice_no']);
hide_field(['production_order', 'process', 'get_items', 'fg_completed_qty','purchase_receipt_no','delivery_note_no', 'sales_invoice_no']);
doc.production_order = '';
doc.process = '';
doc.fg_completed_qty = 0;

View File

@ -15,7 +15,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
cur_frm.cscript.refresh = function(doc) {
if (doc.docstatus) hide_field('Steps');
if (doc.docstatus) hide_field('steps');
}
cur_frm.cscript.download_template = function(doc, cdt, cdn) {

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
'creation': '2012-03-27 14:36:40',
'creation': '2012-04-11 13:18:57',
'docstatus': 0,
'modified': '2012-03-27 14:36:40',
'modified': '2012-04-11 17:47:35',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -25,7 +25,7 @@
'section_style': u'Tabbed',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 58
'version': 59
},
# These values are common for all DocField
@ -53,6 +53,78 @@
'name': u'Warehouse'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 2,
'role': u'Material User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 2,
'role': u'Material Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'doctype': u'DocPerm',
@ -81,91 +153,19 @@
# DocPerm
{
'create': 0,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 2,
'permlevel': 0,
'role': u'System Manager',
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 2,
'role': u'Material Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 2,
'role': u'Material User',
'submit': 0,
'write': 0
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'System Manager',
'write': 1
},
@ -268,7 +268,7 @@
{
'doctype': u'DocField',
'fieldname': u'phone_no',
'fieldtype': u'Int',
'fieldtype': u'Data',
'label': u'Phone No',
'oldfieldname': u'phone_no',
'oldfieldtype': u'Int',
@ -280,7 +280,7 @@
{
'doctype': u'DocField',
'fieldname': u'mobile_no',
'fieldtype': u'Int',
'fieldtype': u'Data',
'label': u'Mobile No',
'oldfieldname': u'mobile_no',
'oldfieldtype': u'Int',

View File

@ -1,23 +1,28 @@
<div class="layout-wrapper layout-wrapper-background">
<div class="appframe-area"></div>
<div class="layout-main-section">
<a class="close" onclick="window.history.back();">&times;</a>
<h1>Stock</h1>
<hr>
<div style="width: 48%; float: left;">
<h4><a href="#!List/Stock Entry">Stock Entry</a></h4>
<p class="help">Transfer stock from one warehouse to another</p>
<br>
<h4><a href="#!List/Delivery Note">Delivery Note</a></h4>
<p class="help">Delivery (shipment) to customers</p>
<br>
<h4><a href="#!List/Purchase Receipt">Purchase Receipt</a></h4>
<p class="help">Goods received from Suppliers</p>
</div>
<div style="width: 48%; float: right;">
<h4><a href="#!List/Item">Item</a></h4>
<p class="help">Item Master</p>
<br>
<h4><a href="#!List/Serial No">Serial No</a></h4>
<p class="help">Single unit of an Item</p>
<br>
<h4><a href="#!List/Batch">Batch</a></h4>
<p class="help">Batch of units of an Item</p>
<br>
<h4><a href="#!List/Warehouse">Warehouse</a></h4>
<p class="help">Warehouse is where items are stored</p>
</div>

View File

@ -15,5 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pscript['onload_stock-home'] = function(wrapper) {
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
erpnext.module_page.setup_page('Stock', wrapper);
}

View File

@ -22,8 +22,8 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
}
cur_frm.cscript.refresh = function(doc,ct,cdn){
if(!doc.docstatus) hide_field('Make Maintenance Visit');
else if(doc.docstatus && (doc.status == 'Open' || doc.status == 'Work In Progress')) unhide_field('Make Maintenance Visit');
if(!doc.docstatus) hide_field('make_maintenance_visit');
else if(doc.docstatus && (doc.status == 'Open' || doc.status == 'Work In Progress')) unhide_field('make_maintenance_visit');
}

View File

@ -1,15 +1,18 @@
<div class="layout-wrapper layout-wrapper-background">
<div class="appframe-area"></div>
<div class="layout-main-section">
<a class="close" onclick="window.history.back();">&times;</a>
<h1>Support</h1>
<hr>
<div style="width: 48%; float: left;">
<h4><a href="#!List/Support Ticket">Support Ticket</a></h4>
<p class="help">Support queries from customers via email or website</p>
<br>
<h4><a href="#!List/Customer Issue">Customer Issue</a></h4>
<p class="help">Customer Issue against a Serial No (warranty)</p>
<br>
<h4><a href="#!List/Maintenance Schedule">Maintenance Schedule</a></h4>
<p class="help">Plan for scheduled maintenance contracts</p>
<br>
<h4><a href="#!List/Maintenance Visit">Maintenance Visit</a></h4>
<p class="help">Visit report for maintenance visit</p>
</div>

View File

@ -15,5 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pscript['onload_support-home'] = function(wrapper) {
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
erpnext.module_page.setup_page('Support', wrapper);
}

View File

@ -1,25 +1,25 @@
<div class="layout-wrapper layout-wrapper-background">
<div class="appframe-area"></div>
<div class="layout-main-section">
<a class="close" onclick="window.history.back();">&times;</a>
<h1>Website</h1>
<hr>
<div style="width: 48%; float: left;">
<h4><a href="#!List/Web Page">Web Page</a></h4>
<p class="help">Static (content) web page</p>
<br>
<h4><a href="#!List/Product">Product</a></h4>
<p class="help">Product listed in catolog</p>
<br>
<h4><a href="#!List/Blog">Blog</a></h4>
<p class="help">Weblog (blog) entry</p>
</div>
<div style="width: 48%; float: right;">
<h4><a href="#!Form/Website Settings/Website Settings">Website Settings</a></h4>
<p class="help">Setup of top navigation bar, footer and logo</p>
</div>
<div style="width: 48%; float: right;">
<br>
<h4><a href="#!Form/Style Settings/Style Settings">Style Settings</a></h4>
<p class="help">Setup of fonts and background</p>
</div>
<div style="width: 48%; float: right;">
<br>
<h4><a href="#!Form/Products Settings/Products Settings">Products Settings</a></h4>
<p class="help">Setup product categories</p>
</div>

View File

@ -15,5 +15,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
pscript['onload_website-home'] = function(wrapper) {
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
erpnext.module_page.setup_page('Website', wrapper);
}

View File

@ -263,13 +263,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
</div>\
\
<div style="height: 37px; margin-bottom:9px" class="list-toolbar-wrapper">\
<div class="list-toolbar btn-group" style="display:inline-block; margin-right: 10px;">\
<a class="btn btn-small btn-refresh btn-info">\
<i class="icon-refresh icon-white"></i> Refresh</a>\
<a class="btn btn-small btn-new">\
<i class="icon-plus"></i> New</a>\
<a class="btn btn-small btn-filter">\
<i class="icon-search"></i> Filter</a>\
<div class="list-toolbar" style="display:inline-block; margin-right: 10px;">\
</div>\
<div style="display:inline-block; width: 24px; margin-left: 4px">\
<img src="lib/images/ui/button-load.gif" \
@ -289,11 +283,13 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
<button class="btn btn-small btn-more hide">More...</div>\
</div>\
</div>\
',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.show_filters){this.make_filters();}},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').remove();}
if(!me.show_filters){this.$w.find('.btn-filter').remove();}
if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').remove();}
this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns==0){this.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.appframe){this.$w.find('.list-toolbar-wrapper').toggle(false);}
if(this.show_filters){this.make_filters();}},add_button:function(label,click,icon){if(this.appframe){return this.appframe.add_button(label,click,icon)}else{$button=$('<button class="btn btn-small"></button>').appendTo(this.$w.find('.list-toolbar'))
if(icon){$('<i>').addClass(icon).appendTo($button);}
$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');}
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype)},'icon-plus');}
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
this.onrun=a0;if(a0&&a0.callback)
this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
@ -304,8 +300,8 @@ if(this.get_args){$.extend(args,this.get_args());}
return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}}
if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i<m;i++){this.render_row(this.add_row(),values[i],this,i);}
this.start+=m;if(values.length>=this.page_length)
this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('<div class="list-row">').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.listobj.$w.find('.btn-filter').bind('click',function(){me.$w.find('.show_filters').slideToggle();if(!me.filters.length)
me.add_filter();});this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field)
this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('<div class="list-row">').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').slideToggle();if(!this.filters.length)
this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field)
values.push(f.get_value());})
return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);})
this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname)
@ -374,7 +370,7 @@ wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doct
</div>\
</div>\
<div style="clear: both"></div>\
</div>',{label:this.label}));this.appframe=new wn.views.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('<span>').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1
</div>',{label:this.label}));this.appframe=new wn.ui.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('<span>').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1
else return null;}).length;if(this.can_submit){this.$page.find('.show-docstatus').removeClass('hide');this.$page.find('.show-docstatus input').click(function(){me.run();})}},setup_listview:function(){if(this.meta.__listjs){eval(this.meta.__listjs);this.listview=new wn.doclistviews[this.doctype](this);}else{this.listview=new wn.views.ListView(this);}
this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:this.$page.find('.wnlist-area'),start:0,page_length:20,show_filters:true,show_grid:true,new_doctype:this.doctype,allow_delete:true,no_result_message:this.make_no_result(),columns:this.listview.fields});this.run();},make_no_result:function(){return repl('<div class="well"><p>No %(doctype_label)s found</p>\
%(description)s\
@ -382,8 +378,7 @@ this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.wid
<p><button class="btn btn-info btn-small"\
onclick="wn.set_route(\'Form\', \'%(doctype)s\', \'New %(doctype)s\');"\
>Make a new %(doctype_label)s</button>\
</p></div>',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('<a class="btn btn-small btn-delete">\
<i class="icon-remove"></i> Delete</a>',function(){me.delete_items();},'.btn-filter')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length)
</p></div>',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length)
return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;}
me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this
wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('<div class="stat-wrapper"><h4>Tags</h4>\
@ -913,15 +908,15 @@ if(frm){f.frm=frm;if(parent)
f.layout_cell=parent.parentNode;}
if(f.init)f.init();f.make_body();return f;}
/*
* lib/js/wn/views/appframe.js
* lib/js/wn/ui/appframe.js
*/
wn.views.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('<div></div>').appendTo(parent);this.$titlebar=$('<div class="appframe-titlebar">\
wn.ui.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('<div></div>').appendTo(parent);this.$titlebar=$('<div class="appframe-titlebar">\
<span class="appframe-title"></span>\
<span class="close">&times;</span>\
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
this.$w.append('<div class="appframe-toolbar"></div>');args={label:label,icon:''};if(icon){args.icon='<i class="'+icon+'"></i>';}
this.buttons[label]=$(repl('<button class="btn btn-small">\
%(icon)s %(label)s</button>',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}})
%(icon)s %(label)s</button>',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}})
/*
* lib/js/wn/ui/dialog.js
*/
@ -939,7 +934,7 @@ wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=fun
this.opts=opts;if(!this.opts.width)this.opts.width=480;this.wrapper=$a(popup_cont,'div','dialog_wrapper');if(this.opts.width)
this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields)
this.make_fields(this.body,this.opts.fields);}
this.make_head=function(){var me=this;this.appframe=new wn.views.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);}
this.make_head=function(){var me=this;this.appframe=new wn.ui.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);}
this.set_title=function(t){this.appframe.$titlebar.find('.appframe-title').html(t||'');}
this.set_postion=function(){var d=get_screen_dims();this.wrapper.style.left=((d.w-cint(this.wrapper.style.width))/2)+'px';this.wrapper.style.top=(get_scroll_top()+60)+'px';top_index++;$y(this.wrapper,{zIndex:top_index});}
this.show=function(){if(this.display)return;this.set_postion()
@ -1612,7 +1607,7 @@ d.cur_frm=f;d.dn=dn;d.table_form=f.meta.istable;f.refresh(dn);$(f.page_layout.wr
/*
* lib/js/legacy/widgets/form/form_header.js
*/
_f.FrmHeader=Class.extend({init:function(parent,frm){this.appframe=new wn.views.AppFrame(parent)
_f.FrmHeader=Class.extend({init:function(parent,frm){this.appframe=new wn.ui.AppFrame(parent)
this.appframe.$titlebar.append('<span class="label-area"></span>\
<span class="breadcrumb-area"></span>');this.$w=this.appframe.$w;},refresh:function(){wn.views.breadcrumbs($(this.$w.find('.breadcrumb-area')),cur_frm.meta.module,cur_frm.meta.name,cur_frm.docname);this.refresh_labels();this.refresh_toolbar();},refresh_labels:function(){var labinfo={0:['Draft',''],1:['Submitted','label-info'],2:['Cancelled','label-important']}[cint(cur_frm.doc.docstatus)];if(cur_frm.doc.__unsaved){labinfo[1]='label-warning'}
this.$w.find('.label-area').html(repl('<span class="label %(lab_class)s">\
@ -1781,8 +1776,7 @@ this.section_collapse=function(){$(me.row.main_head).find('.head').html('<i clas
this.section_expand=function(no_animation){$(me.row.main_head).find('.head').html('<h3><i class="icon-chevron-down" style="vertical-align: middle; margin-bottom: 2px"></i> '
+me.df.label+'</h3>');if(no_animation)
$(me.row.main_body).toggle(true);else
$(me.row.main_body).slideDown();}
$y(this.row.body,{marginLeft:'17px'});}
$(me.row.main_body).slideDown();}}
_f.SectionBreak.prototype.has_data=function(){var me=this;for(var i in me.fields){var f=me.fields[i];var v=f.get_value?f.get_value():null;defaultval=f.df['default']||sys_defaults[f.fieldname]||user_defaults[f.fieldname];if(v&&v!=defaultval){return true;}
if(f.df.reqd&&!v){return true;}
if(f.df.fieldtype=='Table'){if(f.grid.get_children().length||f.df.reqd){return true;}}}
@ -1891,7 +1885,7 @@ _f.FormGrid.prototype.set_column_label=function(fieldname,label){for(var i=0;i<t
_f.FormGrid.prototype.get_children=function(){return getchildren(this.doctype,this.field.frm.docname,this.field.df.fieldname,this.field.frm.doctype);}
_f.FormGrid.prototype.refresh=function(){var docset=this.get_children();var data=[];for(var i=0;i<docset.length;i++){locals[this.doctype][docset[i].name].idx=i+1;data[data.length]=docset[i].name;}
this.set_data(data);if(_f.frm_dialog&&_f.frm_dialog.dialog.display&&_f.frm_dialog.cur_frm){_f.frm_dialog.cur_frm.refresh();}}
_f.FormGrid.prototype.set_unsaved=function(){locals[cur_frm.doctype][cur_frm.docname].__unsaved=1;cur_frm.set_heading();}
_f.FormGrid.prototype.set_unsaved=function(){locals[cur_frm.doctype][cur_frm.docname].__unsaved=1;cur_frm.frm_head&&cur_frm.frm_head.refresh_labels();}
_f.FormGrid.prototype.insert_row=function(){var d=this.new_row_doc();var ci=_f.cur_grid_cell.cellIndex;var row_idx=_f.cur_grid_cell.row.rowIndex;d.idx=row_idx+1;for(var ri=row_idx;ri<this.tab.rows.length;ri++){var r=this.tab.rows[ri];if(r.docname)
locals[this.doctype][r.docname].idx++;}
this.refresh();this.cell_select('',row_idx,ci);this.set_unsaved();}
@ -2031,9 +2025,11 @@ _f.frm_dialog.cur_frm.fields_dict[n].refresh();}else{var g=_f.cur_grid_cell;if(g
cur_frm.fields_dict[n].refresh();}}
set_field_options=function(n,txt){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df)df.options=txt;refresh_field(n);}
set_field_permlevel=function(n,level){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df)df.permlevel=level;refresh_field(n);}
hide_field=function(n){function _hide_field(n,hidden){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df)df.hidden=hidden;refresh_field(n);}
hide_field=function(n){function _hide_field(n,hidden){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df){df.hidden=hidden;refresh_field(n);}
else{console.log("hide_field cannot find field "+n);}}
if(cur_frm){if(n.substr)_hide_field(n,1);else{for(var i in n)_hide_field(n[i],1)}}}
unhide_field=function(n){function _hide_field(n,hidden){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df)df.hidden=hidden;refresh_field(n);}
unhide_field=function(n){function _hide_field(n,hidden){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df){df.hidden=hidden;refresh_field(n);}
else{console.log("unhide_field cannot find field "+n);}}
if(cur_frm){if(n.substr)_hide_field(n,0);else{for(var i in n)_hide_field(n[i],0)}}}
get_field_obj=function(fn){return cur_frm.fields_dict[fn];}
/*

View File

@ -150,13 +150,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
</div>\
\
<div style="height: 37px; margin-bottom:9px" class="list-toolbar-wrapper">\
<div class="list-toolbar btn-group" style="display:inline-block; margin-right: 10px;">\
<a class="btn btn-small btn-refresh btn-info">\
<i class="icon-refresh icon-white"></i> Refresh</a>\
<a class="btn btn-small btn-new">\
<i class="icon-plus"></i> New</a>\
<a class="btn btn-small btn-filter">\
<i class="icon-search"></i> Filter</a>\
<div class="list-toolbar" style="display:inline-block; margin-right: 10px;">\
</div>\
<div style="display:inline-block; width: 24px; margin-left: 4px">\
<img src="lib/images/ui/button-load.gif" \
@ -176,11 +170,13 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
<button class="btn btn-small btn-more hide">More...</div>\
</div>\
</div>\
',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.show_filters){this.make_filters();}},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').remove();}
if(!me.show_filters){this.$w.find('.btn-filter').remove();}
if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').remove();}
this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns==0){this.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.appframe){this.$w.find('.list-toolbar-wrapper').toggle(false);}
if(this.show_filters){this.make_filters();}},add_button:function(label,click,icon){if(this.appframe){return this.appframe.add_button(label,click,icon)}else{$button=$('<button class="btn btn-small"></button>').appendTo(this.$w.find('.list-toolbar'))
if(icon){$('<i>').addClass(icon).appendTo($button);}
$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');}
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype)},'icon-plus');}
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
this.onrun=a0;if(a0&&a0.callback)
this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
@ -191,8 +187,8 @@ if(this.get_args){$.extend(args,this.get_args());}
return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}}
if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i<m;i++){this.render_row(this.add_row(),values[i],this,i);}
this.start+=m;if(values.length>=this.page_length)
this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('<div class="list-row">').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.listobj.$w.find('.btn-filter').bind('click',function(){me.$w.find('.show_filters').slideToggle();if(!me.filters.length)
me.add_filter();});this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field)
this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('<div class="list-row">').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').slideToggle();if(!this.filters.length)
this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field)
values.push(f.get_value());})
return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);})
this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname)
@ -261,7 +257,7 @@ wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doct
</div>\
</div>\
<div style="clear: both"></div>\
</div>',{label:this.label}));this.appframe=new wn.views.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('<span>').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1
</div>',{label:this.label}));this.appframe=new wn.ui.AppFrame(this.$page.find('.appframe-area'));wn.views.breadcrumbs($('<span>').appendTo(this.appframe.$titlebar),locals.DocType[this.doctype].module);},setup:function(){var me=this;me.can_delete=wn.model.can_delete(me.doctype);me.meta=locals.DocType[me.doctype];me.$page.find('.wnlist-area').empty(),me.setup_docstatus_filter();me.setup_listview();me.init_list();me.init_stats();me.add_delete_option();},setup_docstatus_filter:function(){var me=this;this.can_submit=$.map(locals.DocPerm,function(d){if(d.parent==me.meta.name&&d.submit)return 1
else return null;}).length;if(this.can_submit){this.$page.find('.show-docstatus').removeClass('hide');this.$page.find('.show-docstatus input').click(function(){me.run();})}},setup_listview:function(){if(this.meta.__listjs){eval(this.meta.__listjs);this.listview=new wn.doclistviews[this.doctype](this);}else{this.listview=new wn.views.ListView(this);}
this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.widgets.doclistview.get',get_args:this.get_args,parent:this.$page.find('.wnlist-area'),start:0,page_length:20,show_filters:true,show_grid:true,new_doctype:this.doctype,allow_delete:true,no_result_message:this.make_no_result(),columns:this.listview.fields});this.run();},make_no_result:function(){return repl('<div class="well"><p>No %(doctype_label)s found</p>\
%(description)s\
@ -269,8 +265,7 @@ this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.wid
<p><button class="btn btn-info btn-small"\
onclick="wn.set_route(\'Form\', \'%(doctype)s\', \'New %(doctype)s\');"\
>Make a new %(doctype_label)s</button>\
</p></div>',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('<a class="btn btn-small btn-delete">\
<i class="icon-remove"></i> Delete</a>',function(){me.delete_items();},'.btn-filter')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length)
</p></div>',{doctype_label:get_doctype_label(this.doctype),doctype:this.doctype,description:wn.markdown(locals.DocType[this.doctype].description||'')});},render_row:function(row,data){data.doctype=this.doctype;this.listview.render(row,data,this);},get_query_fields:function(){return this.listview.fields;},get_args:function(){return{doctype:this.doctype,fields:this.get_query_fields(),filters:this.filter_list.get_filters(),docstatus:this.can_submit?$.map(this.$page.find('.show-docstatus :checked'),function(inp){return $(inp).attr('data-docstatus')}):[]}},add_delete_option:function(){var me=this;if(this.can_delete){this.add_button('Delete',function(){me.delete_items();},'icon-remove')}},delete_items:function(){var me=this;var dl=$.map(me.$page.find('.list-delete:checked'),function(e){return $(e).data('name');});if(!dl.length)
return;if(!confirm('This is PERMANENT action and you cannot undo. Continue?')){return;}
me.set_working(true);wn.call({method:'webnotes.widgets.doclistview.delete_items',args:{items:dl,doctype:me.doctype},callback:function(){me.set_working(false);me.refresh();}})},init_stats:function(){var me=this
wn.call({method:'webnotes.widgets.doclistview.get_stats',args:{stats:me.listview.stats,doctype:me.doctype},callback:function(r){$.each(me.listview.stats,function(i,v){me.render_stat(v,r.message[v]);});}});},render_stat:function(field,stat){var me=this;if(!stat||!stat.length){if(field=='_user_tags'){this.$page.find('.layout-side-section').append('<div class="stat-wrapper"><h4>Tags</h4>\
@ -572,6 +567,16 @@ msg_dialog.custom_onhide=callback;}
var growl_area;function show_alert(txt,id){if(!growl_area){growl_area=$a(popup_cont,'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});}
var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'i','icon-remove-sign',{cssFloat:'right',cursor:'pointer'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);if(id){$(t).attr('id',id);}
$(wrapper).hide().fadeIn(1000);}
/*
* lib/js/wn/ui/appframe.js
*/
wn.ui.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('<div></div>').appendTo(parent);this.$titlebar=$('<div class="appframe-titlebar">\
<span class="appframe-title"></span>\
<span class="close">&times;</span>\
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
this.$w.append('<div class="appframe-toolbar"></div>');args={label:label,icon:''};if(icon){args.icon='<i class="'+icon+'"></i>';}
this.buttons[label]=$(repl('<button class="btn btn-small">\
%(icon)s %(label)s</button>',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}})
/*
* lib/js/wn/ui/dialog.js
*/
@ -589,7 +594,7 @@ wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=fun
this.opts=opts;if(!this.opts.width)this.opts.width=480;this.wrapper=$a(popup_cont,'div','dialog_wrapper');if(this.opts.width)
this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields)
this.make_fields(this.body,this.opts.fields);}
this.make_head=function(){var me=this;this.appframe=new wn.views.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);}
this.make_head=function(){var me=this;this.appframe=new wn.ui.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);}
this.set_title=function(t){this.appframe.$titlebar.find('.appframe-title').html(t||'');}
this.set_postion=function(){var d=get_screen_dims();this.wrapper.style.left=((d.w-cint(this.wrapper.style.width))/2)+'px';this.wrapper.style.top=(get_scroll_top()+60)+'px';top_index++;$y(this.wrapper,{zIndex:top_index});}
this.show=function(){if(this.display)return;this.set_postion()
@ -639,13 +644,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
</div>\
\
<div style="height: 37px; margin-bottom:9px" class="list-toolbar-wrapper">\
<div class="list-toolbar btn-group" style="display:inline-block; margin-right: 10px;">\
<a class="btn btn-small btn-refresh btn-info">\
<i class="icon-refresh icon-white"></i> Refresh</a>\
<a class="btn btn-small btn-new">\
<i class="icon-plus"></i> New</a>\
<a class="btn btn-small btn-filter">\
<i class="icon-search"></i> Filter</a>\
<div class="list-toolbar" style="display:inline-block; margin-right: 10px;">\
</div>\
<div style="display:inline-block; width: 24px; margin-left: 4px">\
<img src="lib/images/ui/button-load.gif" \
@ -665,11 +664,13 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
<button class="btn btn-small btn-more hide">More...</div>\
</div>\
</div>\
',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.show_filters){this.make_filters();}},add_button:function(html,onclick,before){$(html).click(onclick).insertBefore(this.$w.find('.list-toolbar '+before));this.btn_groupify();},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-refresh').click(function(){me.run();});this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
if(this.new_doctype){this.$w.find('.btn-new').toggle(true).click(function(){newdoc(me.new_doctype);})}else{this.$w.find('.btn-new').remove();}
if(!me.show_filters){this.$w.find('.btn-filter').remove();}
if(this.hide_refresh||this.no_refresh){this.$w.find('.btn-refresh').remove();}
this.btn_groupify();},btn_groupify:function(){var nbtns=this.$w.find('.list-toolbar a').length;if(nbtns==0){this.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
',this.opts));this.$w=$(this.parent).find('.wnlist');this.set_events();if(this.appframe){this.$w.find('.list-toolbar-wrapper').toggle(false);}
if(this.show_filters){this.make_filters();}},add_button:function(label,click,icon){if(this.appframe){return this.appframe.add_button(label,click,icon)}else{$button=$('<button class="btn btn-small"></button>').appendTo(this.$w.find('.list-toolbar'))
if(icon){$('<i>').addClass(icon).appendTo($button);}
$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');}
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype)},'icon-plus');}
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
this.onrun=a0;if(a0&&a0.callback)
this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
@ -680,8 +681,8 @@ if(this.get_args){$.extend(args,this.get_args());}
return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}}
if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i<m;i++){this.render_row(this.add_row(),values[i],this,i);}
this.start+=m;if(values.length>=this.page_length)
this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('<div class="list-row">').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.listobj.$w.find('.btn-filter').bind('click',function(){me.$w.find('.show_filters').slideToggle();if(!me.filters.length)
me.add_filter();});this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field)
this.$w.find('.btn-more').toggle(true);},add_row:function(){return this.$w.find('.result-list').append('<div class="list-row">').find('.list-row:last').get(0);},refresh:function(){this.run();},add_limits:function(){this.query+=' LIMIT '+this.start+','+(this.page_length+1);}});wn.ui.FilterList=Class.extend({init:function(opts){wn.require('lib/js/legacy/widgets/form/fields.js');$.extend(this,opts);this.filters=[];this.$w=this.$parent;this.set_events();},set_events:function(){var me=this;this.$w.find('.add-filter-btn').bind('click',function(){me.add_filter();});},show_filters:function(){this.$w.find('.show_filters').slideToggle();if(!this.filters.length)
this.add_filter();},add_filter:function(fieldname,condition,value){this.filters.push(new wn.ui.Filter({flist:this,fieldname:fieldname,condition:condition,value:value}));if(fieldname){this.$w.find('.show_filters').slideDown();}},get_filters:function(){var values=[];$.each(this.filters,function(i,f){if(f.field)
values.push(f.get_value());})
return values;},update_filters:function(){var fl=[];$.each(this.filters,function(i,f){if(f.field)fl.push(f);})
this.filters=fl;},get_filter:function(fieldname){for(var i in this.filters){if(this.filters[i].field.df.fieldname==fieldname)

View File

@ -1 +1 @@
1671
1683