From b3ab90a01a577a60a238e05fceaf40907c7d547e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 13 Apr 2012 12:38:34 +0530 Subject: [PATCH 1/7] field changes in sp return tool --- .../sales_and_purchase_return_tool.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js index 771cb8272c..19cec92a2e 100644 --- a/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js +++ b/erpnext/stock/doctype/sales_and_purchase_return_tool/sales_and_purchase_return_tool.js @@ -44,17 +44,17 @@ cur_frm.fields_dict.purchase_receipt_no.get_query = function(doc) { cur_frm.cscript.return_type = function(doc, cdt, cdn) { var cp = wn.control_panel; hide_field(['purchase_receipt_no', 'delivery_note_no', 'sales_invoice_no', - 'return_details', 'Get Items', 'Make Excise Invoice', 'Make Stock Entry', + 'return_details', 'get_items', 'Make Excise Invoice', 'Make Stock Entry', 'Make Debit Note', 'Make Credit Note']); if(doc.return_type == 'Sales Return') { - unhide_field(['delivery_note_no', 'sales_invoice_no', 'Get Items', + unhide_field(['delivery_note_no', 'sales_invoice_no', 'get_items', 'return_details', 'Make Credit Note', 'Make Stock Entry']); if(cp.country == 'India') { unhide_field(['Make Excise Invoice']); } } else if(doc.return_type == 'Purchase Return') { - unhide_field(['purchase_receipt_no', 'Get Items', 'return_details', + unhide_field(['purchase_receipt_no', 'get_items', 'return_details', 'Make Debit Note', 'Make Stock Entry']); if(cp.country == 'India') { unhide_field(['Make Excise Invoice']); } From a202f00dc0c66958dc5906626734859d713ea3d5 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 13 Apr 2012 16:03:27 +0530 Subject: [PATCH 2/7] fixes in accounts --- css/all-app.css | 4 ++-- .../doctype/purchase_invoice/purchase_invoice.js | 3 +-- .../accounts/doctype/sales_invoice/sales_invoice.py | 11 ++++++++--- erpnext/startup/js/feature_setup.js | 6 +++--- js/all-app.js | 4 ++-- js/all-web.js | 2 +- version.num | 2 +- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/css/all-app.css b/css/all-app.css index 71c83340d9..f13ef93997 100644 --- a/css/all-app.css +++ b/css/all-app.css @@ -334,7 +334,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; } @@ -342,7 +342,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 { diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js index 11239d595d..f880eb7ecf 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.js @@ -334,10 +334,9 @@ cur_frm.cscript.tax_code = function(doc, dt, dn) { } /* ***************************** UTILITY FUNCTIONS ************************ */ - // Calculate Advance // ------------------ -var calc_total_advance = function(doc,cdt,cdn) { +calc_total_advance = function(doc,cdt,cdn) { var doc = locals[doc.doctype][doc.name]; var el = getchildren('Purchase Invoice Advance',doc.name,'advance_allocation_details') var tot_tds=0; diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 6c956a0dae..1878526b61 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -193,9 +193,14 @@ class DocType(TransactionBase): item = webnotes.conn.sql("select default_income_account, default_sales_cost_center, default_warehouse from tabItem where name = '%s'" %(args['item_code']), as_dict=1) - ret['income_account'] = item and item[0]['default_income_account'] or dtl and dtl[0]['income_account'] or args['income_account'] - ret['cost_center'] = item and item[0]['default_sales_cost_center'] or dtl and dtl[0]['cost_center'] or args['cost_center'] - ret['warehouse'] = item and item[0]['default_warehouse'] or dtl and dtl[0]['warehouse'] or args['warehouse'] + ret['income_account'] = item and item[0].get('default_income_account') \ + or (dtl and dtl[0].get('income_account') or args.get('income_account')) + + ret['cost_center'] = item and item[0].get('default_sales_cost_center') \ + or (dtl and dtl[0].get('cost_center') or args.get('cost_center')) + + ret['warehouse'] = item and item[0].get('default_warehouse') \ + or (dtl and dtl[0].get('warehouse') or args.get('warehouse')) if ret['warehouse']: actual_qty = webnotes.conn.sql("select actual_qty from `tabBin` where item_code = '%s' and warehouse = '%s'" % (args['item_code'], ret['warehouse'])) diff --git a/erpnext/startup/js/feature_setup.js b/erpnext/startup/js/feature_setup.js index b929a7cec6..f7fdb26d50 100644 --- a/erpnext/startup/js/feature_setup.js +++ b/erpnext/startup/js/feature_setup.js @@ -30,10 +30,10 @@ pscript.feature_dict = { 'fs_projects': { 'BOM': {'fields':['project_name']}, 'Delivery Note': {'fields':['project_name']}, - 'Purchase Invoice': {'fields':['project_name']}, + 'Purchase Invoice': {'entries':['project_name']}, 'Production Order': {'fields':['project_name']}, - 'Purchase Order': {'fields':['project_name']}, - 'Purchase Receipt': {'fields':['project_name']}, + 'Purchase Order': {'po_details':['project_name']}, + 'Purchase Receipt': {'purchase_receipt_details':['project_name']}, 'Sales Invoice': {'fields':['project_name']}, 'Sales Order': {'fields':['project_name']}, 'Stock Entry': {'fields':['project_name']}, diff --git a/js/all-app.js b/js/all-app.js index f715dc09b6..8a68431997 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -1283,7 +1283,7 @@ all_clear=tmp;}} var _save=function(){$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;} if(r.saved){if(onsave)onsave(r);}else{if(onerr)onerr(r);}},function(){if(f){f.savingflag=false;}},0,(f?'Saving...':''));} if(doc.__islocal&&(doctype&&doctype.autoname&&doctype.autoname.toLowerCase()=='prompt')){var newname=prompt('Enter the name of the new '+dt,'');if(newname){doc.__newname=strip(newname);_save();}else{msgprint('Not Saved');onerr();}}else{_save();}} -function check_required(dt,dn,parent_dt){var doc=locals[dt][dn];if(doc.docstatus>1)return true;var fl=fields_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i1)return true;var fl=fields_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;iMandatory fields required in '+ (doc.parenttype?(fields[doc.parenttype][doc.parentfield].label+' (Table)'):get_doctype_label(doc.doctype))+':\n'+errfld.join('\n'));return all_clear;} @@ -2234,7 +2234,7 @@ if(user_roles.indexOf("System Manager")!=-1){$('.navbar .modules').append('
  • 1)return true;var fl=fields_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i1)return true;var fl=fields_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;iMandatory fields required in '+ (doc.parenttype?(fields[doc.parenttype][doc.parentfield].label+' (Table)'):get_doctype_label(doc.doctype))+':\n'+errfld.join('\n'));return all_clear;} diff --git a/version.num b/version.num index d32d224a22..1291917b26 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -1684 \ No newline at end of file +1694 \ No newline at end of file From 8c0dcd383bc4440f6e07fa02683ff687ae58a887 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 16 Apr 2012 18:47:20 +0530 Subject: [PATCH 3/7] some more fixes in support --- erpnext/patches/jan_mar_2012/rename_dt.py | 3 ++- erpnext/projects/doctype/project/project.js | 2 +- erpnext/projects/doctype/task/task.js | 2 +- erpnext/projects/doctype/task/task.py | 4 ++-- js/all-app.js | 2 +- js/all-web.js | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/erpnext/patches/jan_mar_2012/rename_dt.py b/erpnext/patches/jan_mar_2012/rename_dt.py index 693fd77d0e..7847ee1d6b 100644 --- a/erpnext/patches/jan_mar_2012/rename_dt.py +++ b/erpnext/patches/jan_mar_2012/rename_dt.py @@ -129,7 +129,8 @@ def delete_search_criteria(): 'periodic_sales_summary', 'monthly_despatched_trend', 'sales', 'sales_order', 'sales_order1', 'sales_agentwise_commission', 'test_report', 'territory_wise_sales_-_target_vs_actual_', - 'pending_po_items_to_bill1', 'pending_po_items_to_receive1', 'expense_vouchers', 'pending_expense_vouchers')""") + 'pending_po_items_to_bill1', 'pending_po_items_to_receive1', + 'expense_vouchers', 'pending_expense_vouchers', 'shortage_to_indent')""") webnotes.conn.sql(""" DELETE FROM `tabSearch Criteria` diff --git a/erpnext/projects/doctype/project/project.js b/erpnext/projects/doctype/project/project.js index 801ba56881..faa175fded 100644 --- a/erpnext/projects/doctype/project/project.js +++ b/erpnext/projects/doctype/project/project.js @@ -52,4 +52,4 @@ cur_frm.cscript.project_value = function(doc, cdt, cdn){ //--------- calculate gross profit -------------------------------- cur_frm.cscript.est_material_cost = function(doc, cdt, cdn){ get_server_fields('get_gross_profit','','',doc, cdt, cdn, 1); -} \ No newline at end of file +} diff --git a/erpnext/projects/doctype/task/task.js b/erpnext/projects/doctype/task/task.js index c88382bf08..af4864bc44 100644 --- a/erpnext/projects/doctype/task/task.js +++ b/erpnext/projects/doctype/task/task.js @@ -119,4 +119,4 @@ cur_frm.cscript.declare_completed = function(){ cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name); } }); -} \ No newline at end of file +} diff --git a/erpnext/projects/doctype/task/task.py b/erpnext/projects/doctype/task/task.py index 51a9875183..9cca9a71e7 100644 --- a/erpnext/projects/doctype/task/task.py +++ b/erpnext/projects/doctype/task/task.py @@ -51,7 +51,7 @@ class DocType: def get_allocated_to_name(self): as_em = sql("select first_name, last_name from `tabProfile` where name=%s",str(self.doc.allocated_to)) - ret = { 'allocated_to_name' : as_em and (as_em[0][0] + ' ' + as_em[0][1]) or ''} + ret = { 'allocated_to_name' : as_em and (cstr(as_em[0][0]) + ' ' + cstr(as_em[0][1])) or ''} return ret # validate @@ -95,7 +95,7 @@ class DocType: sql("delete from tabEvent where ref_type='Task' and ref_name=%s", self.doc.name) self.add_calendar_event() else: - msgprint("An Expeted start date has not been set for this task.Please set a, 'Expected Start date'\ + msgprint("An Expeted start date has not been set for this task.Please set 'Expected Start date'\ to add an event to allocated persons calender.You can save a task without this also.") diff --git a/js/all-app.js b/js/all-app.js index c53302a49d..6f5c6688b5 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -379,7 +379,7 @@ this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.wid %(description)s\
    \

    \

    ',{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;} diff --git a/js/all-web.js b/js/all-web.js index 8a39b46bc9..8ad6625fa8 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -266,7 +266,7 @@ this.listview.parent=this;},init_list:function(){this.make({method:'webnotes.wid %(description)s\
    \

    \

    ',{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;} From acb3d56e0232612994c2841f50a2cf932175eb2d Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 17 Apr 2012 11:39:18 +0530 Subject: [PATCH 4/7] fix in install docs --- erpnext/setup/__init__.py | 4 ++-- erpnext/support/__init__.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/setup/__init__.py b/erpnext/setup/__init__.py index dad187308d..c4b3773744 100644 --- a/erpnext/setup/__init__.py +++ b/erpnext/setup/__init__.py @@ -1,3 +1,3 @@ install_docs = [ - {'doctype':'Role', 'name': 'System Manager'} -] \ No newline at end of file + {'doctype':'Role', 'role_name': 'System Manager', 'name': 'System Manager'} +] diff --git a/erpnext/support/__init__.py b/erpnext/support/__init__.py index b94538b23f..71ef684bb1 100644 --- a/erpnext/support/__init__.py +++ b/erpnext/support/__init__.py @@ -1,6 +1,6 @@ install_docs = [ - {'doctype':'Role', 'name':'Support Team'}, - {'doctype':'Role', 'name':'Support Manager'}, - {'doctype':'Role', 'name':'Maintenance User'}, - {'doctype':'Role', 'name':'Maintenance Manager'} -] \ No newline at end of file + {'doctype':'Role', 'role_name':'Support Team', 'name':'Support Team'}, + {'doctype':'Role', 'role_name':'Support Manager', 'name':'Support Manager'}, + {'doctype':'Role', 'role_name':'Maintenance User', 'name':'Maintenance User'}, + {'doctype':'Role', 'role_name':'Maintenance Manager', 'name':'Maintenance Manager'} +] From 24e18569d9a9f0b7aed2e961c220d8d035d167bb Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 17 Apr 2012 11:45:35 +0530 Subject: [PATCH 5/7] fixes in install docs for roles --- erpnext/accounts/__init__.py | 4 ++-- erpnext/buying/__init__.py | 10 +++++----- erpnext/hr/__init__.py | 6 +++--- erpnext/production/__init__.py | 4 ++-- erpnext/projects/__init__.py | 2 +- erpnext/selling/__init__.py | 10 +++++----- erpnext/stock/__init__.py | 8 ++++---- erpnext/website/__init__.py | 6 +++--- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/erpnext/accounts/__init__.py b/erpnext/accounts/__init__.py index 6934003957..c750d25462 100644 --- a/erpnext/accounts/__init__.py +++ b/erpnext/accounts/__init__.py @@ -19,8 +19,8 @@ from webnotes.utils import flt from webnotes.model.code import get_obj install_docs = [ - {"doctype":"Role", "name":"Accounts Manager"}, - {"doctype":"Role", "name":"Accounts User"} + {"doctype":"Role", "role_name":"Accounts Manager", "name":"Accounts Manager"}, + {"doctype":"Role", "role_name":"Accounts User", "name":"Accounts User"} ] @webnotes.whitelist() diff --git a/erpnext/buying/__init__.py b/erpnext/buying/__init__.py index 8e18bc5a54..1bcab3d99c 100644 --- a/erpnext/buying/__init__.py +++ b/erpnext/buying/__init__.py @@ -1,6 +1,6 @@ install_docs = [ - {"doctype":"Role", "name":"Purchase Manager"}, - {"doctype":"Role", "name":"Purchase User"}, - {"doctype":"Role", "name":"Purchase Master Manager"}, - {"doctype":"Role", "name":"Supplier"} -] \ No newline at end of file + {"doctype":"Role", "role_name":"Purchase Manager", "name":"Purchase Manager"}, + {"doctype":"Role", "role_name":"Purchase User", "name":"Purchase User"}, + {"doctype":"Role", "role_name":"Purchase Master Manager", "name":"Purchase Master Manager"}, + {"doctype":"Role", "role_name":"Supplier", "name":"Supplier"} +] diff --git a/erpnext/hr/__init__.py b/erpnext/hr/__init__.py index ab2d1976b1..930b9eeeec 100644 --- a/erpnext/hr/__init__.py +++ b/erpnext/hr/__init__.py @@ -1,5 +1,5 @@ install_docs = [ - {"doctype":"Role", "name":"Employee"}, - {"doctype":"Role", "name":"HR Manager"}, - {"doctype":"Role", "name":"HR User"}, + {"doctype":"Role", "role_name":"Employee", "name":"Employee"}, + {"doctype":"Role", "role_name":"HR Manager", "name":"HR Manager"}, + {"doctype":"Role", "role_name":"HR User", "name":"HR User"}, ] diff --git a/erpnext/production/__init__.py b/erpnext/production/__init__.py index 4da0c58ae9..4fb00a34be 100644 --- a/erpnext/production/__init__.py +++ b/erpnext/production/__init__.py @@ -1,4 +1,4 @@ install_docs = [ - {"doctype":"Role", "name":"Production Manager"}, - {"doctype":"Role", "name":"Production User"}, + {"doctype":"Role", "role_name":"Production Manager", "name":"Production Manager"}, + {"doctype":"Role", "role_name":"Production User", "name":"Production User"}, ] diff --git a/erpnext/projects/__init__.py b/erpnext/projects/__init__.py index 636248f51f..61a6eb6a1a 100644 --- a/erpnext/projects/__init__.py +++ b/erpnext/projects/__init__.py @@ -1,3 +1,3 @@ install_docs = [ - {"doctype":"Role", "name":"Projects User"}, + {"doctype":"Role", "role_name":"Projects User", "name":"Projects User"}, ] diff --git a/erpnext/selling/__init__.py b/erpnext/selling/__init__.py index c61f23cc04..f8a457a4cf 100644 --- a/erpnext/selling/__init__.py +++ b/erpnext/selling/__init__.py @@ -1,7 +1,7 @@ install_docs = [ - {"doctype":"Role", "name":"Customer"}, - {"doctype":"Role", "name":"Partner"}, - {"doctype":"Role", "name":"Sales Manager"}, - {"doctype":"Role", "name":"Sales Master Manager"}, - {"doctype":"Role", "name":"Sales User"}, + {"doctype":"Role", "role_name":"Customer", "name":"Customer"}, + {"doctype":"Role", "role_name":"Partner", "name":"Partner"}, + {"doctype":"Role", "role_name":"Sales Manager", "name":"Sales Manager"}, + {"doctype":"Role", "role_name":"Sales Master Manager", "name":"Sales Master Manager"}, + {"doctype":"Role", "role_name":"Sales User", "name":"Sales User"}, ] diff --git a/erpnext/stock/__init__.py b/erpnext/stock/__init__.py index ee2b061cdc..f171425006 100644 --- a/erpnext/stock/__init__.py +++ b/erpnext/stock/__init__.py @@ -1,6 +1,6 @@ install_docs = [ - {"doctype":"Role", "name":"Material Manager"}, - {"doctype":"Role", "name":"Material Master Manager"}, - {"doctype":"Role", "name":"Material User"}, - {"doctype":"Role", "name":"Quality Manager"}, + {"doctype":"Role", "role_name":"Material Manager", "name":"Material Manager"}, + {"doctype":"Role", "role_name":"Material Master Manager", "name":"Material Master Manager"}, + {"doctype":"Role", "role_name":"Material User", "name":"Material User"}, + {"doctype":"Role", "role_name":"Quality Manager", "name":"Quality Manager"}, ] diff --git a/erpnext/website/__init__.py b/erpnext/website/__init__.py index 1ed1cf1818..97062cffc3 100644 --- a/erpnext/website/__init__.py +++ b/erpnext/website/__init__.py @@ -1,4 +1,4 @@ install_docs = [ - {"doctype":"Role", "name":"Blogger"}, - {"doctype":"Role", "name":"Website Manager"}, -] \ No newline at end of file + {"doctype":"Role", "role_name":"Blogger", "name":"Blogger"}, + {"doctype":"Role", "role_name":"Website Manager", "name":"Website Manager"}, +] From b2974e8e59a4d7c09f23c96ba6530b5d9e2121ec Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 17 Apr 2012 11:57:50 +0530 Subject: [PATCH 6/7] fix in delete check --- erpnext/support/doctype/support_ticket/listview.js | 4 +++- js/all-app.js | 4 ++-- js/all-web.js | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/erpnext/support/doctype/support_ticket/listview.js b/erpnext/support/doctype/support_ticket/listview.js index 67ba9ea457..944c08fb4f 100644 --- a/erpnext/support/doctype/support_ticket/listview.js +++ b/erpnext/support/doctype/support_ticket/listview.js @@ -10,6 +10,7 @@ wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({ "`tabSupport Ticket`.description" ]); this.stats = this.stats.concat(['status']); + this.show_hide_check_column(); }, prepare_data: function(data) { @@ -43,9 +44,10 @@ wn.doclistviews['Support Ticket'] = wn.views.ListView.extend({ }, columns: [ + {width: '3%', content:'check'}, {width: '20%', content:'name'}, {width: '10%', content:'status_html'}, - {width: '56%', content:'tags+description', css: {color:'#aaa'}}, + {width: '53%', content:'tags+description', css: {color:'#aaa'}}, {width: '14%', content:'modified', css: {'text-align': 'right', 'color':'#777'}} ] diff --git a/js/all-app.js b/js/all-app.js index d2a3c4b6e4..69980ded3d 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -402,7 +402,7 @@ args.label=v[0];args.width=flt(v[1])/max*100;args.count=v[1];args.field=field;$i %(label)s \ (%(count)s)\ ',args));this.setup_stat_item_click($item);return $item;},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}} -this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#777'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});} +this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];this.show_hide_check_column();},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#777'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});} if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;} if(typeof opts.content=='function'){opts.content(parent,data);} else if(opts.content=='name'){$(parent).append(repl('%(name)s',data));} @@ -423,7 +423,7 @@ else if(data[opts.content]){$(parent).append(' '+data[opts.content]);}},render:f if(diff==1){data.when='Yesterday'} if(diff==2){data.when='2 days ago'} if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('' -+strip(t)+'').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}}}) ++strip(t)+'').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}},show_hide_check_column:function(){if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}}}) /* * lib/js/wn/views/pageview.js */ diff --git a/js/all-web.js b/js/all-web.js index 8a39b46bc9..2c07d91304 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -289,7 +289,7 @@ args.label=v[0];args.width=flt(v[1])/max*100;args.count=v[1];args.field=field;$i %(label)s \ (%(count)s)\ ',args));this.setup_stat_item_click($item);return $item;},setup_stat_item_click:function($item){var me=this;$item.find('a').click(function(){var fieldname=$(this).attr('data-field');var label=$(this).attr('data-label');me.set_filter(fieldname,label);return false;});},set_filter:function(fieldname,label){var filter=this.filter_list.get_filter(fieldname);if(filter){var v=filter.field.get_value();if(v.indexOf(label)!=-1){return false;}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{filter.set_values(fieldname,'in',v+', '+label);}}}else{if(fieldname=='_user_tags'){this.filter_list.add_filter(fieldname,'like','%'+label);}else{this.filter_list.add_filter(fieldname,'=',label);}} -this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#777'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});} +this.run();}});wn.views.ListView=Class.extend({init:function(doclistview){this.doclistview=doclistview;this.doctype=doclistview.doctype;var t="`tab"+this.doctype+"`.";this.fields=[t+'name',t+'owner',t+'docstatus',t+'_user_tags',t+'modified'];this.stats=['_user_tags'];this.show_hide_check_column();},columns:[{width:'3%',content:'check'},{width:'4%',content:'avatar'},{width:'3%',content:'docstatus',css:{"text-align":"center"}},{width:'35%',content:'name'},{width:'40%',content:'tags',css:{'color':'#aaa'}},{width:'15%',content:'modified',css:{'text-align':'right','color':'#777'}}],render_column:function(data,parent,opts){var me=this;if(opts.css){$.each(opts.css,function(k,v){$(parent).css(k,v)});} if(opts.content.indexOf&&opts.content.indexOf('+')!=-1){$.map(opts.content.split('+'),function(v){me.render_column(data,parent,{content:v});});return;} if(typeof opts.content=='function'){opts.content(parent,data);} else if(opts.content=='name'){$(parent).append(repl('%(name)s',data));} @@ -310,7 +310,7 @@ else if(data[opts.content]){$(parent).append(' '+data[opts.content]);}},render:f if(diff==1){data.when='Yesterday'} if(diff==2){data.when='2 days ago'} if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';data.docstatus_title='Editable';}else if(data.docstatus==1){data.docstatus_icon='icon-lock';data.docstatus_title='Submitted';}else if(data.docstatus==2){data.docstatus_icon='icon-remove';data.docstatus_title='Cancelled';}},add_user_tags:function(parent,data){var me=this;if(data._user_tags){$.each(data._user_tags.split(','),function(i,t){if(t){$('' -+strip(t)+'').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}}}) ++strip(t)+'').click(function(){me.doclistview.set_filter('_user_tags',$(this).text())}).appendTo(parent);}});}},show_hide_check_column:function(){if(!this.doclistview.can_delete){this.columns=$.map(this.columns,function(v,i){if(v.content!='check')return v});}}}) /* * lib/js/wn/views/pageview.js */ From 04cfaa0e1ef12fdbb8cb9499316ff8b1a74fda10 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 17 Apr 2012 12:11:15 +0530 Subject: [PATCH 7/7] fix in listing's create new button --- js/all-app.js | 2 +- js/all-web.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/all-app.js b/js/all-app.js index 69980ded3d..769d6caf70 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -290,7 +290,7 @@ if(this.show_filters){this.make_filters();}},add_button:function(label,click,ico if(icon){$('').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(){wn.views.formview.create(me.new_doctype)},'icon-plus');} +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');} if(me.no_toolbar||me.hide_toolbar){me.$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.onrun=a0;if(a0&&a0.callback) diff --git a/js/all-web.js b/js/all-web.js index 2c07d91304..6b036bffad 100644 --- a/js/all-web.js +++ b/js/all-web.js @@ -177,7 +177,7 @@ if(this.show_filters){this.make_filters();}},add_button:function(label,click,ico if(icon){$('').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(){wn.views.formview.create(me.new_doctype)},'icon-plus');} +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');} if(me.no_toolbar||me.hide_toolbar){me.$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.onrun=a0;if(a0&&a0.callback) @@ -686,7 +686,7 @@ if(this.show_filters){this.make_filters();}},add_button:function(label,click,ico if(icon){$('').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(){wn.views.formview.create(me.new_doctype)},'icon-plus');} +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');} if(me.no_toolbar||me.hide_toolbar){me.$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.onrun=a0;if(a0&&a0.callback)