From 7854f81ca091449e94d28c8295cf38ef1a11fd80 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 14 Mar 2012 12:01:13 +0530 Subject: [PATCH 01/59] show todo, calendar and support desktop notifications --- erpnext/home/page/desktop/desktop.css | 27 +++++----- erpnext/home/page/desktop/desktop.js | 34 +++++++++++-- .../home/page/event_updates/event_updates.js | 2 +- .../home/page/event_updates/event_updates.py | 49 +++++++++++++++++-- erpnext/startup/startup.js | 29 +++++++---- js/all-app.js | 6 +-- js/all-web.js | 4 +- version.num | 2 +- wnf.py | 10 ++++ 9 files changed, 129 insertions(+), 34 deletions(-) diff --git a/erpnext/home/page/desktop/desktop.css b/erpnext/home/page/desktop/desktop.css index e460c11607..cc6126e200 100644 --- a/erpnext/home/page/desktop/desktop.css +++ b/erpnext/home/page/desktop/desktop.css @@ -69,14 +69,14 @@ } /* Hover and click effects */ -.case-border:hover, .circle:hover { - box-shadow: 0 0 2px 0px black, 0 0 10px 1px white; - -moz-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white; - -webkit-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white; - -o-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white; +.case-border:hover, .circle:hover, .hover-effect { + box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important; + -moz-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important; + -webkit-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important; + -o-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white !important; } -.case-border:active, .case-border:focus, .circle:active, .circle:focus { +.case-border:active, .case-border:focus, .case-border-click { transform: scale(0.98, 0.98); -ms-transform: scale(0.98, 0.98); /* IE 9 */ -webkit-transform: scale(0.98, 0.98); /* Safari and Chrome */ @@ -84,6 +84,14 @@ -moz-transform: scale(0.98, 0.98); /* Firefox */ } +.circle:active, .circle:focus, .circle-click { + transform: scale(1, 1); + -ms-transform: scale(1, 1); /* IE 9 */ + -webkit-transform: scale(1, 1); /* Safari and Chrome */ + -o-transform: scale(1, 1); /* Opera */ + -moz-transform: scale(1, 1); /* Firefox */ +} + .circle { border-radius: 30px; -moz-border-radius: 30px; @@ -93,9 +101,8 @@ min-width: 15px; background: #B00D07; padding: 3px; - z-index: 2; float: right; - margin-top: -10px; + margin-top: -74px; margin-right: 10px; border: 2px solid white; box-shadow: 0 0 10px 1px black; @@ -106,10 +113,8 @@ .circle-text { color: white; - vertical-align: middle; text-align: center; display: inline-block; - margin-top: -3px; - text-shadow: 1px 1px 5px #000; + margin-top: 1px; } diff --git a/erpnext/home/page/desktop/desktop.js b/erpnext/home/page/desktop/desktop.js index dab1e761b0..7852ab23fa 100644 --- a/erpnext/home/page/desktop/desktop.js +++ b/erpnext/home/page/desktop/desktop.js @@ -95,9 +95,37 @@ erpnext.desktop.render = function() { } erpnext.desktop.show_pending_notifications = function() { - $('#messages a:first').prepend('
\ -
'); - $('#msg_count').toggle(false); + var add_circle = function(str_module, id, title) { + var module = $('#'+str_module); + module.find('a:first').append( + repl('', {id: id, title: title})); + + var case_border = module.find('.case-border'); + var circle = module.find('.circle'); + + var add_hover_and_click = function(primary, secondary, hover_class, click_class) { + primary + .hover( + function() { secondary.addClass(hover_class); }, + function() { secondary.removeClass(hover_class); }) + .mousedown(function() { secondary.addClass(click_class); }) + .mouseup(function() { secondary.removeClass(click_class); }) + .focusin(function() { $(this).mousedown(); }) + .focusout(function() { $(this).mouseup(); }) + } + + add_hover_and_click(case_border, circle, 'hover-effect', 'circle-click'); + add_hover_and_click(circle, case_border, 'hover-effect', 'case-border-click'); + + } + + add_circle('messages', 'unread_messages', 'Unread Messages'); + add_circle('support', 'open_support_tickets', 'Open Support Tickets'); + add_circle('todo', 'things_todo', 'Things To Do'); + add_circle('calendar', 'todays_events', 'Todays Events'); + update_messages(); } diff --git a/erpnext/home/page/event_updates/event_updates.js b/erpnext/home/page/event_updates/event_updates.js index d86a1d869c..b2825f31be 100644 --- a/erpnext/home/page/event_updates/event_updates.js +++ b/erpnext/home/page/event_updates/event_updates.js @@ -600,7 +600,7 @@ pscript.home_make_status = function() { // get values $c_page('home', 'event_updates', 'get_status_details', user, function(r,rt) { - page_body.wntoolbar.set_new_comments(r.message.unread_messages); + //page_body.wntoolbar.set_new_comments(r.message.unread_messages); // render online users pscript.online_users_obj.render(r.message.online_users); diff --git a/erpnext/home/page/event_updates/event_updates.py b/erpnext/home/page/event_updates/event_updates.py index 05f1cfc609..32d6756e8c 100644 --- a/erpnext/home/page/event_updates/event_updates.py +++ b/erpnext/home/page/event_updates/event_updates.py @@ -26,8 +26,7 @@ def get_online_users(arg=None): and t1.user not in ('Guest','Administrator') and TIMESTAMPDIFF(HOUR,t1.lastupdate,NOW()) <= 1""", as_list=1) or [] -@webnotes.whitelist() -def get_unread_messages(arg=None): +def get_unread_messages(): "returns unread (docstatus-0 messages for a user)" return webnotes.conn.sql("""\ SELECT name, comment @@ -37,6 +36,49 @@ def get_unread_messages(arg=None): AND ifnull(docstatus,0)=0 """, webnotes.user.name, as_list=1) +def get_open_support_tickets(): + """ + Returns a count of open support tickets + """ + from webnotes.utils import cint + open_support_tickets = webnotes.conn.sql("""\ + SELECT COUNT(*) FROM `tabSupport Ticket` + WHERE status = 'Open'""") + return open_support_tickets and cint(open_support_tickets[0][0]) or 0 + +def get_things_todo(): + """ + Returns a count of incomplete todos + """ + from webnotes.utils import cint + incomplete_todos = webnotes.conn.sql("""\ + SELECT COUNT(*) FROM `tabToDo Item` + WHERE IFNULL(checked, 0) = 0 + AND owner = %s""", webnotes.session.get('user')) + return incomplete_todos and cint(incomplete_todos[0][0]) or 0 + +def get_todays_events(): + """ + Returns a count of todays events in calendar + """ + from webnotes.utils import nowdate, cint + todays_events = webnotes.conn.sql("""\ + SELECT COUNT(*) FROM `tabEvent` + WHERE owner = %s + AND event_type != 'Cancel' + AND event_date = %s""", ( + webnotes.session.get('user'), nowdate())) + return todays_events and cint(todays_events[0][0]) or 0 + +@webnotes.whitelist() +def get_global_status_messages(arg=None): + return { + 'unread_messages': get_unread_messages(), + 'open_support_tickets': get_open_support_tickets(), + 'things_todo': get_things_todo(), + 'todays_events': get_todays_events(), + } + @webnotes.whitelist() def get_status_details(arg=None): """get toolbar items""" @@ -47,7 +89,8 @@ def get_status_details(arg=None): # system messages ret = { 'user_count': len(online) or 0, - 'unread_messages': get_unread_messages(), + #'unread_messages': get_unread_messages(), + #'open_support_tickets': get_open_support_tickets(), 'online_users': online or [], 'setup_status': get_setup_status(), 'registration_complete': cint(get_defaults('registration_complete')) and 'Yes' or 'No', diff --git a/erpnext/startup/startup.js b/erpnext/startup/startup.js index 0a2ac23e1d..c00770c4d9 100644 --- a/erpnext/startup/startup.js +++ b/erpnext/startup/startup.js @@ -110,20 +110,29 @@ var update_messages = function(reset) { if(inList(['Guest'], user)) { return; } if(!reset) { - $c_page('home', 'event_updates', 'get_unread_messages', null, + $c_page('home', 'event_updates', 'get_global_status_messages', null, function(r,rt) { if(!r.exc) { // This function is defined in toolbar.js - page_body.wntoolbar.set_new_comments(r.message); - var circle = $('#msg_count') - if(circle) { - if(r.message.length) { - circle.find('span:first').text(r.message.length); - circle.toggle(true); - } else { - circle.toggle(false); + page_body.wntoolbar.set_new_comments(r.message.unread_messages); + + var show_in_circle = function(parent_id, msg) { + var parent = $('#'+parent_id); + if(parent) { + if(msg) { + parent.find('span:first').text(msg); + parent.toggle(true); + } else { + parent.toggle(false); + } } } + + show_in_circle('unread_messages', r.message.unread_messages.length); + show_in_circle('open_support_tickets', r.message.open_support_tickets); + show_in_circle('things_todo', r.message.things_todo); + show_in_circle('todays_events', r.message.todays_events); + } else { clearInterval(wn.updates.id); } @@ -131,7 +140,7 @@ var update_messages = function(reset) { ); } else { page_body.wntoolbar.set_new_comments(0); - $('#msg_count').toggle(false); + $('#unread_messages').toggle(false); } } diff --git a/js/all-app.js b/js/all-app.js index 686b0b846e..612e78c748 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -2229,8 +2229,8 @@ else if(nm=='Accounts Browser') pscript.make_chart(chart_type);} loadpage(nm,call_back);} var update_messages=function(reset){if(inList(['Guest'],user)){return;} -if(!reset){$c_page('home','event_updates','get_unread_messages',null,function(r,rt){if(!r.exc){page_body.wntoolbar.set_new_comments(r.message);var circle=$('#msg_count') -if(circle){if(r.message.length){circle.find('span:first').text(r.message.length);circle.toggle(true);}else{circle.toggle(false);}}}else{clearInterval(wn.updates.id);}});}else{page_body.wntoolbar.set_new_comments(0);$('#msg_count').toggle(false);}} +if(!reset){$c_page('home','event_updates','get_global_status_messages',null,function(r,rt){if(!r.exc){page_body.wntoolbar.set_new_comments(r.message.unread_messages);var show_in_circle=function(parent_id,msg){var parent=$('#'+parent_id);if(parent){if(msg){parent.find('span:first').text(msg);parent.toggle(true);}else{parent.toggle(false);}}} +show_in_circle('unread_messages',r.message.unread_messages.length);show_in_circle('open_support_tickets',r.message.open_support_tickets);show_in_circle('things_todo',r.message.things_todo);show_in_circle('todays_events',r.message.todays_events);}else{clearInterval(wn.updates.id);}});}else{page_body.wntoolbar.set_new_comments(0);$('#unread_messages').toggle(false);}} erpnext.startup.set_periodic_updates=function(){wn.updates={};if(wn.updates.id){clearInterval(wn.updates.id);} wn.updates.id=setInterval(update_messages,60000);} erpnext.set_user_background=function(src){set_style(repl('body { background: url("files/%(src)s") repeat;}',{src:src}))} @@ -2279,7 +2279,7 @@ if(user_roles.indexOf("System Manager")!=-1){$('.navbar .modules').append('
  • Date: Wed, 14 Mar 2012 12:19:40 +0530 Subject: [PATCH 02/59] desktop notifications --- version.num | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.num b/version.num index 2f9aa03afc..8eb7bc41bd 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -829 \ No newline at end of file +830 \ No newline at end of file From 0e2461fa7c99d309b650bb7d7a9b6523c1c4b213 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 14 Mar 2012 17:53:53 +0530 Subject: [PATCH 03/59] fix in qa inspection report link --- erpnext/stock/page/stock_home/stock_home.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/stock/page/stock_home/stock_home.html b/erpnext/stock/page/stock_home/stock_home.html index ae677de296..03c5fabd43 100644 --- a/erpnext/stock/page/stock_home/stock_home.html +++ b/erpnext/stock/page/stock_home/stock_home.html @@ -49,7 +49,7 @@
    Incoming Inspection + href="#!List/QA Inspection Report">Incoming Inspection
    -
    From 92da889d32392a285259128a6dcf1d732b79c961 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 15 Mar 2012 11:50:26 +0530 Subject: [PATCH 04/59] fix in report builder saving --- erpnext/startup/event_handlers.py | 1 + js/all-app.js | 4 ++-- js/all-web.js | 2 +- version.num | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/startup/event_handlers.py b/erpnext/startup/event_handlers.py index 7db56bdb53..703399aaa1 100644 --- a/erpnext/startup/event_handlers.py +++ b/erpnext/startup/event_handlers.py @@ -87,6 +87,7 @@ def boot_session(bootinfo): import webnotes.model.doctype bootinfo['docs'] += webnotes.model.doctype.get('Event') + bootinfo['docs'] += webnotes.model.doctype.get('Search Criteria') bootinfo['modules_list'] = webnotes.conn.get_global('modules_list') diff --git a/js/all-app.js b/js/all-app.js index 612e78c748..abb3c085aa 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -686,7 +686,7 @@ var v=_f.get_value(this.doctype,this.docname,this.df.fieldname);else{if(this.opt var v=this.options_list[0];else var v=null;} this.input.set_input(v);} -this.input.set_input=function(v){if(!v){if(!me.input.multiple){if(me.docname){if(me.options_list&&me.options_list.length){me.set(me.options_list[0]);me.input.value=me.options_list[0];}else{me.input.value='';}}}}else{if(me.options_list){if(me.input.multiple){for(var i=0;i Date: Fri, 16 Mar 2012 15:11:02 +0530 Subject: [PATCH 05/59] cost center will be fetched from other charges master --- erpnext/selling/doctype/sales_common/sales_common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py index 9186bb831b..33a1d1d57d 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.py +++ b/erpnext/selling/doctype/sales_common/sales_common.py @@ -209,13 +209,14 @@ class DocType(TransactionBase): if default: add_cond = 'ifnull(t2.is_default,0) = 1' else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"' idx = 0 - other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate from `tabRV Tax Detail` t1, `tabOther Charges` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1) + other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate, t1.cost_center from `tabRV Tax Detail` t1, `tabOther Charges` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1) for other in other_charge: d = addchild(obj.doc, 'other_charges', 'RV Tax Detail', 1, obj.doclist) d.charge_type = other['charge_type'] d.row_id = other['row_id'] d.description = other['description'] d.account_head = other['account_head'] + d.cost_center = other['cost_center'] d.rate = flt(other['rate']) d.tax_amount = flt(other['tax_amount']) d.included_in_print_rate = cint(other['included_in_print_rate']) From deac31fd2dd3b5c636038042ee40ac674c37a095 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 16 Mar 2012 15:14:27 +0530 Subject: [PATCH 06/59] Update erpnext/selling/doctype/sales_common/sales_common.py --- erpnext/selling/doctype/sales_common/sales_common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py index 33a1d1d57d..63f53eab7b 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.py +++ b/erpnext/selling/doctype/sales_common/sales_common.py @@ -209,14 +209,14 @@ class DocType(TransactionBase): if default: add_cond = 'ifnull(t2.is_default,0) = 1' else: add_cond = 't1.parent = "'+cstr(obj.doc.charge)+'"' idx = 0 - other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate, t1.cost_center from `tabRV Tax Detail` t1, `tabOther Charges` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1) + other_charge = webnotes.conn.sql("select t1.charge_type,t1.row_id,t1.description,t1.account_head,t1.rate,t1.tax_amount,t1.included_in_print_rate, t1.cost_center_other_charges from `tabRV Tax Detail` t1, `tabOther Charges` t2 where t1.parent = t2.name and t2.company = '%s' and %s order by t1.idx" % (obj.doc.company, add_cond), as_dict = 1) for other in other_charge: d = addchild(obj.doc, 'other_charges', 'RV Tax Detail', 1, obj.doclist) d.charge_type = other['charge_type'] d.row_id = other['row_id'] d.description = other['description'] d.account_head = other['account_head'] - d.cost_center = other['cost_center'] + d.cost_center_other_charges = other['cost_center_other_charges'] d.rate = flt(other['rate']) d.tax_amount = flt(other['tax_amount']) d.included_in_print_rate = cint(other['included_in_print_rate']) From 9f5b2cd8d94458458752577fe2165e27292a36c0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Mar 2012 10:20:22 +0530 Subject: [PATCH 07/59] Update erpnext/stock/doctype/delivery_note/delivery_note.txt --- erpnext/stock/doctype/delivery_note/delivery_note.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.txt b/erpnext/stock/doctype/delivery_note/delivery_note.txt index 314d0d9481..4878c36bad 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.txt +++ b/erpnext/stock/doctype/delivery_note/delivery_note.txt @@ -31,11 +31,11 @@ 'module': u'Stock', 'name': '__common__', 'read_only_onload': 1, - 'search_fields': u'status,transaction_date,customer,customer_name, territory,grand_total', + 'search_fields': u'status,customer,customer_name, territory,grand_total', 'section_style': u'Tabbed', 'server_code_error': u' ', 'show_in_menu': 0, - 'subject': u'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed', + 'subject': u'To %(customer_name)s on %(posting_date)s | %(per_billed)s% billed', 'tag_fields': u'billing_status', 'version': 475 }, From 15a02715573d36991c3b8532523bb8d5841d6dde Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Mar 2012 10:22:32 +0530 Subject: [PATCH 08/59] Update erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt --- erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt index 525bcfcef2..6724b694ef 100755 --- a/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt +++ b/erpnext/stock/doctype/purchase_receipt/purchase_receipt.txt @@ -21,11 +21,11 @@ 'module': u'Stock', 'name': '__common__', 'read_only_onload': 1, - 'search_fields': u'status, transaction_date, supplier', + 'search_fields': u'status, posting_date, supplier', 'section_style': u'Tabbed', 'server_code_error': u' ', 'show_in_menu': 0, - 'subject': u'From %(supplier_name)s against %(purchase_order)s on %(transaction_date)s', + 'subject': u'From %(supplier_name)s against %(purchase_order)s on %(posting_date)s', 'version': 325 }, From f02c9e7b6c14210b6234663186f9e8b59464a5ae Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 19 Mar 2012 11:43:24 +0530 Subject: [PATCH 09/59] fix in due_date fetching for receivable voucher --- .../receivable_voucher/receivable_voucher.js | 14 ++++++++++++-- version.num | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js index 391bbcd8ae..7b3c6eff1f 100644 --- a/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js +++ b/erpnext/accounts/doctype/receivable_voucher/receivable_voucher.js @@ -162,14 +162,24 @@ cur_frm.cscript.warehouse = function(doc, cdt , cdn) { cur_frm.cscript.customer = function(doc,dt,dn,onload) { var callback = function(r,rt) { + var callback2 = function(doc, dt, dn) { + doc = locals[dt][dn]; + if(doc.debit_to && doc.posting_date){ + get_server_fields('get_cust_and_due_date','','',doc,dt,dn,1, + function(doc, dt, dn) { + cur_frm.refresh(); + }); + + } + } var doc = locals[cur_frm.doctype][cur_frm.docname]; - get_server_fields('get_debit_to','','',doc, dt, dn, 0); - cur_frm.refresh(); + get_server_fields('get_debit_to','','',doc, dt, dn, 0, callback2); } var args = onload ? 'onload':'' if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', args, callback); if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']); + } diff --git a/version.num b/version.num index e7fd4bfbe1..f08bce7b1c 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -838 \ No newline at end of file +841 \ No newline at end of file From b6cd3316c4e9c41bf05aa4557ea9b499120da9bc Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Mar 2012 13:27:06 +0530 Subject: [PATCH 10/59] error fixed in lease receipts client wise --- .../lease_receipts_client_wise/lease_receipts_client_wise.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql b/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql index f951388aaf..af49c813f1 100644 --- a/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql +++ b/erpnext/accounts/search_criteria/lease_receipts_client_wise/lease_receipts_client_wise.sql @@ -1,5 +1,5 @@ SELECT gl.account,sum(gl.credit) as amount FROM `tabGL Entry` gl, `tabAccount` a -WHERE gl.account=a.name and a.master_type='Customer' and gl.posting_date between '%(date)s' and '%(date1)s' +WHERE gl.account=a.name and a.master_type='Customer' and gl.posting_date between '%(date)s' and '%(date1)s' and ifnull(gl.is_cancelled, 'No') = 'No' GROUP BY gl.account ORDER BY posting_date From e5d99f5ed1bc98418e254ef3e65225f7e681495e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Mar 2012 15:15:20 +0530 Subject: [PATCH 11/59] Update erpnext/setup/doctype/manage_account/manage_account.txt --- erpnext/setup/doctype/manage_account/manage_account.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/manage_account/manage_account.txt b/erpnext/setup/doctype/manage_account/manage_account.txt index 18a9872d1c..1ff58ca525 100644 --- a/erpnext/setup/doctype/manage_account/manage_account.txt +++ b/erpnext/setup/doctype/manage_account/manage_account.txt @@ -231,7 +231,7 @@ 'doctype': 'DocField', 'fieldtype': 'HTML', 'label': 'IGHelp', - 'options': 'To manage Item Groups, click here' + 'options': 'To manage Item Groups, click here' }, # DocField From 9aa3777ba6c0fb9eb5cd7e9fc3ae6c601dae1a74 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Mar 2012 15:21:30 +0530 Subject: [PATCH 12/59] Update erpnext/setup/doctype/sales_person/sales_person.txt --- erpnext/setup/doctype/sales_person/sales_person.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/sales_person/sales_person.txt b/erpnext/setup/doctype/sales_person/sales_person.txt index 0680c3886f..9ae96bfc33 100644 --- a/erpnext/setup/doctype/sales_person/sales_person.txt +++ b/erpnext/setup/doctype/sales_person/sales_person.txt @@ -183,7 +183,7 @@ 'idx': 5, 'label': 'SPHelp', 'oldfieldtype': 'HTML', - 'options': 'To manage Sales Person, click here', + 'options': 'To manage Sales Person, click here', 'permlevel': 0 }, From 422f7e99db2e8953e8b97e3cac2a3e0028143e40 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Mar 2012 15:37:03 +0530 Subject: [PATCH 13/59] Update erpnext/selling/doctype/customer/customer.txt --- erpnext/selling/doctype/customer/customer.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/doctype/customer/customer.txt b/erpnext/selling/doctype/customer/customer.txt index 346b4d1029..993dc29f5e 100644 --- a/erpnext/selling/doctype/customer/customer.txt +++ b/erpnext/selling/doctype/customer/customer.txt @@ -203,7 +203,7 @@ # DocField { 'colour': u'White:FFF', - 'description': u'To manage Customer Groups, click here', + 'description': u'To manage Customer Groups, click here', 'doctype': u'DocField', 'fieldname': u'customer_group', 'fieldtype': u'Link', @@ -223,7 +223,7 @@ # DocField { 'colour': u'White:FFF', - 'description': u'To manage Territory, click here', + 'description': u'To manage Territory, click here', 'doctype': u'DocField', 'fieldname': u'territory', 'fieldtype': u'Link', From 16d9f4942a781c6383677f4fe5096f0bf45940fe Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Mar 2012 15:48:08 +0530 Subject: [PATCH 14/59] Update erpnext/setup/doctype/manage_account/manage_account.txt --- erpnext/setup/doctype/manage_account/manage_account.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/doctype/manage_account/manage_account.txt b/erpnext/setup/doctype/manage_account/manage_account.txt index 1ff58ca525..4077afe76e 100644 --- a/erpnext/setup/doctype/manage_account/manage_account.txt +++ b/erpnext/setup/doctype/manage_account/manage_account.txt @@ -391,7 +391,7 @@ 'doctype': 'DocField', 'fieldtype': 'HTML', 'label': 'CGHelp', - 'options': 'To manage Customer Groups, click here' + 'options': 'To manage Customer Groups, click here' }, # DocField @@ -408,7 +408,7 @@ 'doctype': 'DocField', 'fieldtype': 'HTML', 'label': 'TerritoryHelp', - 'options': 'To manage Territory, click here' + 'options': 'To manage Territory, click here' }, # DocField From 65ad3b1a0fd65f6b44a05a092fb7ff3683bfb622 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Mar 2012 17:09:14 +0530 Subject: [PATCH 15/59] Update erpnext/accounts/search_criteria/trial_balance/trial_balance.py --- .../accounts/search_criteria/trial_balance/trial_balance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/search_criteria/trial_balance/trial_balance.py b/erpnext/accounts/search_criteria/trial_balance/trial_balance.py index 34a828a5a2..d9f00d19ec 100644 --- a/erpnext/accounts/search_criteria/trial_balance/trial_balance.py +++ b/erpnext/accounts/search_criteria/trial_balance/trial_balance.py @@ -114,8 +114,8 @@ for r in res: r.append(flt(opening<0 and -opening or 0)) r.append(flt(debit)) r.append(flt(credit)) - r.append(flt(closing>0 and closing or 0)) - r.append(flt(closing<0 and -closing or 0)) + r.append(flt(closing>0.01 and closing or 0)) + r.append(flt(closing<-0.01 and -closing or 0)) out =[] From b7dce7da31fdbb2f91c78bac38b80c7b1c692a7a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Mar 2012 18:35:57 +0530 Subject: [PATCH 16/59] Update erpnext/stock/doctype/delivery_note/delivery_note.js --- erpnext/stock/doctype/delivery_note/delivery_note.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index 1f5170be96..d2b58f8fd6 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -81,11 +81,11 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.cscript.customer = function(doc,dt,dn,onload) { var callback = function(r,rt) { var doc = locals[cur_frm.doctype][cur_frm.docname]; + if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']); cur_frm.refresh(); } var args = onload ? 'onload':'' if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_shipping_address', args, callback); - if(doc.customer) unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']); } cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) { From fdab48672014cc9c4e2a88aa4b24b1ec79743439 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Mar 2012 18:43:07 +0530 Subject: [PATCH 17/59] Update erpnext/selling/doctype/sales_order/sales_order.js --- erpnext/selling/doctype/sales_order/sales_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index a04423dd25..ba899f9659 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -102,11 +102,11 @@ cur_frm.cscript.customer = function(doc,dt,dn) { var callback = function(r,rt) { var doc = locals[cur_frm.doctype][cur_frm.docname]; get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0); + if(doc.customer) unhide_field(['customer_address', 'contact_person', 'customer_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory','customer_group','shipping_address']); cur_frm.refresh(); } if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback); - if(doc.customer) unhide_field(['customer_address', 'contact_person', 'customer_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory','customer_group','shipping_address']); } cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) { From 31e0eacb7a15825fbe22dba127fb44209ede449e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 19 Mar 2012 18:54:11 +0530 Subject: [PATCH 18/59] Update erpnext/selling/doctype/sales_order/sales_order.js --- erpnext/selling/doctype/sales_order/sales_order.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index ba899f9659..3e0d783621 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -35,7 +35,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { if(!doc.price_list_currency) set_multiple(cdt, cdn, {price_list_currency: doc.currency, plc_conversion_rate: 1}); // load default charges - if(doc.__islocal){ + if(doc.__islocal && !doc.customer){ hide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','shipping_address']); } } @@ -100,10 +100,13 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { //customer cur_frm.cscript.customer = function(doc,dt,dn) { var callback = function(r,rt) { - var doc = locals[cur_frm.doctype][cur_frm.docname]; - get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0); + var callback2 = function(r, rt) { if(doc.customer) unhide_field(['customer_address', 'contact_person', 'customer_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory','customer_group','shipping_address']); cur_frm.refresh(); + } + var doc = locals[cur_frm.doctype][cur_frm.docname]; + get_server_fields('get_shipping_address',doc.customer,'',doc, dt, dn, 0, callback2); + } if(doc.customer) $c_obj(make_doclist(doc.doctype, doc.name), 'get_default_customer_address', '', callback); From 3401086d668f9adc649ebd11039dff9249c7c5c0 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 20 Mar 2012 12:07:18 +0530 Subject: [PATCH 19/59] POS Invoice fix --- .../Print Format/POS Invoice/POS Invoice.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt index 6a7e83589f..fdc64921ba 100644 --- a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt +++ b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt @@ -3,25 +3,26 @@ # These values are common in all dictionaries { - 'creation': '2011-10-19 14:27:47', + 'creation': '2011-12-21 11:08:55', 'docstatus': 0, - 'modified': '2011-10-19 14:29:45', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-03-20 12:00:05', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all Print Format { + 'doc_type': u'Receivable Voucher', 'doctype': 'Print Format', - 'html': '\n\n\n\n\n\n\n
    \n\n\n\n\n\n\n\n\n
    NO: DATE:
    M/s
    \n\n
    \n \n\n
    \n\n\n
    \n \n
    \n\n
    \n\n\n\n\n\n
    For
     
    Signatory
    \n\n', - 'module': 'Accounts', + 'html': u'\n\n\n\n\n\n\n\n\n\n \n \n\n\n \n\n
    NO: DATE:
    M/s
    \n\n
    \n\n
    \n\n

    \n\n \n \n \n \n
    For
     
    Signatory
    \n\n\n', + 'module': u'Accounts', 'name': '__common__', - 'standard': 'Yes' + 'standard': u'Yes' }, # Print Format, POS Invoice { 'doctype': 'Print Format', - 'name': 'POS Invoice' + 'name': u'POS Invoice' } ] \ No newline at end of file From 547ce9f9c81ff2e7c2129f0ba502b7c9206dcec3 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 20 Mar 2012 12:11:38 +0530 Subject: [PATCH 20/59] POS Invoice fix --- erpnext/patches/mar_2012/__init__.py | 0 erpnext/patches/mar_2012/pos_invoice_fix.py | 5 +++++ 2 files changed, 5 insertions(+) create mode 100644 erpnext/patches/mar_2012/__init__.py create mode 100644 erpnext/patches/mar_2012/pos_invoice_fix.py diff --git a/erpnext/patches/mar_2012/__init__.py b/erpnext/patches/mar_2012/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/erpnext/patches/mar_2012/pos_invoice_fix.py b/erpnext/patches/mar_2012/pos_invoice_fix.py new file mode 100644 index 0000000000..9905f00617 --- /dev/null +++ b/erpnext/patches/mar_2012/pos_invoice_fix.py @@ -0,0 +1,5 @@ +def execute(): + import webnotes + webnotes.conn.sql("DELETE FROM `tabDocFormat` WHERE format='POS Invoice'") + from webnotes.modules.modules_manager import reload_doc + reload_doc('accounts', 'Print Format', 'POS Invoice') From 6ba51ca693b8af27d533ba78841d2385e9a28227 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 20 Mar 2012 12:24:51 +0530 Subject: [PATCH 21/59] POS Invoice fix --- erpnext/patches/mar_2012/pos_invoice_fix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/mar_2012/pos_invoice_fix.py b/erpnext/patches/mar_2012/pos_invoice_fix.py index 9905f00617..77ebcb4e4c 100644 --- a/erpnext/patches/mar_2012/pos_invoice_fix.py +++ b/erpnext/patches/mar_2012/pos_invoice_fix.py @@ -1,5 +1,5 @@ def execute(): import webnotes webnotes.conn.sql("DELETE FROM `tabDocFormat` WHERE format='POS Invoice'") - from webnotes.modules.modules_manager import reload_doc + from webnotes.modules.module_manager import reload_doc reload_doc('accounts', 'Print Format', 'POS Invoice') From d05aad647447e826ca9cbe533a858d4287a13e73 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Tue, 20 Mar 2012 12:33:02 +0530 Subject: [PATCH 22/59] fix in POS invoice --- erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt index fdc64921ba..8664b3882b 100644 --- a/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt +++ b/erpnext/accounts/Print Format/POS Invoice/POS Invoice.txt @@ -5,7 +5,7 @@ { 'creation': '2011-12-21 11:08:55', 'docstatus': 0, - 'modified': '2012-03-20 12:00:05', + 'modified': '2012-03-20 12:29:49', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -14,7 +14,7 @@ { 'doc_type': u'Receivable Voucher', 'doctype': 'Print Format', - 'html': u'\n\n\n\n\n\n\n\n\n\n \n \n\n\n \n\n
    NO: DATE:
    M/s
    \n\n
    \n\n
    \n\n

    \n\n \n \n \n \n
    For
     
    Signatory
    \n\n\n', + 'html': u'\n\n\n\n\n\n\n\n\n\n \n \n\n\n \n\n
    NO: DATE:
    M/s
    \n\n
    \n\n
    \n\n

    \n\n \n \n \n \n
    For
     
    Signatory
    \n\n\n', 'module': u'Accounts', 'name': '__common__', 'standard': u'Yes' From 547478f973634b1ef34b1388d082aeaa5aff0ebe Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 20 Mar 2012 14:26:14 +0530 Subject: [PATCH 23/59] stock entry: new purpose others added in stock entry --- erpnext/patches/jan_mar_2012/stock_entry_others_patch.py | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 erpnext/patches/jan_mar_2012/stock_entry_others_patch.py diff --git a/erpnext/patches/jan_mar_2012/stock_entry_others_patch.py b/erpnext/patches/jan_mar_2012/stock_entry_others_patch.py new file mode 100644 index 0000000000..3a9441964c --- /dev/null +++ b/erpnext/patches/jan_mar_2012/stock_entry_others_patch.py @@ -0,0 +1,6 @@ +def execute(): + import webnotes + from webnotes.modules.module_manager import reload_doc + reload_doc('stock', 'doctype', 'stock_entry') + + webnotes.conn.sql("update `tabDocField` set options = concat(options, '\nOthers') where fieldname = 'purpose' and parent = 'Stock Entry'") From 594ee37d26094c410a4fbd771ac7317803986ec1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 20 Mar 2012 14:26:32 +0530 Subject: [PATCH 24/59] patch list updated --- erpnext/patches/patch_list.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 2bfaf08e15..dbf62f7b1f 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -187,5 +187,10 @@ patch_list = [ 'patch_file': 'update_stockreco_perm', 'description': 'Update stock reco permission' }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'stock_entry_others_patch', + 'description': 'new purpose others in stock entry' + }, ] From 93654a3e049400cc61cef29785c171732ec5afe4 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 20 Mar 2012 14:31:14 +0530 Subject: [PATCH 25/59] stock entry: new purpose others added --- .../Purchase Order-Purchase Receipt.txt | 2 +- .../stock/doctype/stock_entry/stock_entry.js | 19 +- .../stock/doctype/stock_entry/stock_entry.py | 76 +- .../stock/doctype/stock_entry/stock_entry.txt | 766 +++++++++--------- 4 files changed, 455 insertions(+), 408 deletions(-) diff --git a/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt b/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt index e3f0dc9adf..d62849590e 100644 --- a/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt +++ b/erpnext/stock/DocType Mapper/Purchase Order-Purchase Receipt/Purchase Order-Purchase Receipt.txt @@ -5,7 +5,7 @@ { 'creation': '2010-08-08 17:09:35', 'docstatus': 0, - 'modified': '2012-03-01 17:58:16', + 'modified': '2012-03-20 14:24:12', 'modified_by': u'Administrator', 'owner': u'Administrator' }, diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 1e558c9441..99eab91e82 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -22,13 +22,17 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { var cfn_set_fields = function(doc, cdt, cdn) { - lst = ['supplier','supplier_name','supplier_address','customer','customer_name','customer_address']; - if (doc.purpose == 'Production Order'){ - unhide_field(['production_order', 'process', 'Get Items']); - hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no','delivery_note_no', 'sales_invoice_no','Warehouse HTML']); - doc.from_warehouse = ''; + lst = ['supplier','supplier_name','supplier_address','customer','customer_name','customer_address']; + hide_field(lst); + + if (doc.purpose == 'Production Order' || doc.purpose == 'Others'){ + 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 = ''; doc.to_warehosue = ''; - if (doc.process == 'Backflush'){ + if (doc.process == 'Backflush' || doc.purpose == 'Others'){ unhide_field('fg_completed_qty'); } else{ @@ -39,7 +43,6 @@ 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(lst); doc.production_order = ''; doc.process = ''; doc.fg_completed_qty = 0; @@ -48,12 +51,10 @@ var cfn_set_fields = function(doc, cdt, cdn) { if(doc.purpose == 'Purchase Return'){ doc.customer=doc.customer_name = doc.customer_address=doc.delivery_note_no=doc.sales_invoice_no=''; - hide_field(lst); unhide_field(['supplier','supplier_name','supplier_address','purchase_receipt_no']); } else if(doc.purpose == 'Sales Return'){ doc.supplier=doc.supplier_name = doc.supplier_address=doc.purchase_receipt_no=''; - hide_field(lst); unhide_field(['customer','customer_name','customer_address','delivery_note_no', 'sales_invoice_no']); } else{ doc.customer=doc.customer_name=doc.customer_address=doc.delivery_note_no=doc.sales_invoice_no=doc.supplier=doc.supplier_name = doc.supplier_address=doc.purchase_receipt_no=''; diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 530c5e615e..c50a31b785 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -157,13 +157,13 @@ class DocType: - def get_raw_materials(self,pro_obj): + def get_raw_materials(self, bom_no, fg_qty, consider_sa_items_as_rm): """ get all items from flat bom except child items of sub-contracted and sub assembly items and sub assembly items itself. """ - if pro_obj.doc.consider_sa_items == 'Yes': + if consider_sa_items_as_rm == 'Yes': # Get all raw materials considering SA items as raw materials, # so no childs of SA items fl_bom_sa_items = sql(""" @@ -171,8 +171,7 @@ class DocType: from `tabBOM Material` where parent = '%s' and docstatus < 2 group by item_code - """ % ((self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) \ - or flt(pro_obj.doc.qty), cstr(pro_obj.doc.bom_no))) + """ % (fg_qty, bom_no)) self.make_items_dict(fl_bom_sa_items) @@ -189,8 +188,7 @@ class DocType: and ifnull(it.is_sub_contracted_item, 'No') = 'No' and fb.docstatus<2 and fb.parent=%s ) a group by item_code,stock_uom - """ , ((self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) \ - or flt(pro_obj.doc.qty), cstr(pro_obj.doc.bom_no))) + """ , (fg_qty, bom_no)) self.make_items_dict(fl_bom_sa_child_item) # Update only qty remaining to be issued for production @@ -199,17 +197,11 @@ class DocType: - def add_to_stock_entry_detail(self, pro_obj, item_dict, fg_item = 0): - sw, tw = '', '' - if self.doc.process == 'Material Transfer': - tw = cstr(pro_obj.doc.wip_warehouse) - if self.doc.process == 'Backflush': - tw = fg_item and cstr(pro_obj.doc.fg_warehouse) or '' - if not fg_item: sw = cstr(pro_obj.doc.wip_warehouse) + def add_to_stock_entry_detail(self, source_wh, target_wh, item_dict, fg_item = 0, bom_no = ''): for d in item_dict: se_child = addchild(self.doc, 'mtn_details', 'Stock Entry Detail', 0, self.doclist) - se_child.s_warehouse = sw - se_child.t_warehouse = tw + se_child.s_warehouse = source_wh + se_child.t_warehouse = target_wh se_child.fg_item = fg_item se_child.item_code = cstr(d) se_child.description = item_dict[d][1] @@ -219,24 +211,52 @@ class DocType: se_child.qty = flt(item_dict[d][0]) se_child.transfer_qty = flt(item_dict[d][0]) se_child.conversion_factor = 1.00 - if fg_item: se_child.bom_no = pro_obj.doc.bom_no + if fg_item: se_child.bom_no = bom_no + + def validate_bom_no(self): + if self.doc.bom_no: + if not self.doc.fg_completed_qty: + msgprint("Please enter FG Completed Qty", raise_exception=1) + if not self.doc.consider_sa_items_as_raw_materials: + msgprint("Please confirm whether you want to consider sub assembly item as raw materials", raise_exception=1) # get items #------------------ def get_items(self): - pro_obj = self.doc.production_order and get_obj('Production Order', self.doc.production_order) or '' - - self.validate_for_production_order(pro_obj) - self.get_raw_materials(pro_obj) - + if self.doc.purpose == 'Production Order': + pro_obj = self.doc.production_order and get_obj('Production Order', self.doc.production_order) or '' + self.validate_for_production_order(pro_obj) + + bom_no = pro_obj.doc.bom_no + fg_qty = (self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) or flt(pro_obj.doc.qty) + consider_sa_items_as_rm = pro_obj.doc.consider_sa_items + elif self.doc.purpose == 'Others': + self.validate_bom_no() + bom_no = self.doc.bom_no + fg_qty = self.doc.fg_completed_qty + consider_sa_items_as_rm = self.doc.consider_sa_items_as_raw_materials + + self.get_raw_materials(bom_no, fg_qty, consider_sa_items_as_rm) self.doc.clear_table(self.doclist, 'mtn_details', 1) - self.add_to_stock_entry_detail(pro_obj, self.item_dict) - + sw = (self.doc.process == 'Backflush') and cstr(pro_obj.doc.wip_warehouse) or '' + tw = (self.doc.process == 'Material Transfer') and cstr(pro_obj.doc.wip_warehouse) or '' + self.add_to_stock_entry_detail(sw, tw, self.item_dict) + + fg_item_dict = {} if self.doc.process == 'Backflush': - item_dict = {cstr(pro_obj.doc.production_item) : [self.doc.fg_completed_qty, pro_obj.doc.description, pro_obj.doc.stock_uom]} - self.add_to_stock_entry_detail(pro_obj, item_dict, fg_item = 1) + sw = '' + tw = cstr(pro_obj.doc.fg_warehouse) + fg_item_dict = {cstr(pro_obj.doc.production_item) : [self.doc.fg_completed_qty, pro_obj.doc.description, pro_obj.doc.stock_uom]} + elif self.doc.purpose == 'Others' and self.doc.bom_no: + sw, tw = '', '' + item = sql("select item, description, uom from `tabBill Of Materials` where name = %s", self.doc.bom_no, as_dict=1) + fg_item_dict = {item[0]['item'] : [self.doc.fg_completed_qty, item[0]['description'], item[0]['uom']]} + + if fg_item_dict: + self.add_to_stock_entry_detail(sw, tw, fg_item_dict, fg_item = 1, bom_no = bom_no) + def validate_transfer_qty(self): @@ -289,7 +309,7 @@ class DocType: def validate_for_production_order(self, pro_obj): - if self.doc.purpose == 'Production Order' or self.doc.process or self.doc.production_order or flt(self.doc.fg_completed_qty): + if self.doc.purpose == 'Production Order' or self.doc.process or self.doc.production_order: if self.doc.purpose != 'Production Order': msgprint("Purpose should be 'Production Order'.") raise Exception @@ -394,7 +414,6 @@ class DocType: if cstr(pro_obj.doc.production_item) != cstr(d.item_code): msgprint("Item %s in Stock Entry Detail as Row No %s do not match with Item %s in Production Order %s" % (cstr(d.item_code), cstr(d.idx), cstr(pro_obj.doc.production_item), cstr(pro_obj.doc.name))) raise Exception - fg_qty = flt(fg_qty) + flt(d.transfer_qty) if cstr(d.t_warehouse) != cstr(pro_obj.doc.fg_warehouse): msgprint("As Item %s is FG Item. Target Warehouse should be same as FG Warehouse %s in Production Order %s, at Row No %s. " % ( cstr(d.item_code), cstr(pro_obj.doc.fg_warehouse), cstr(pro_obj.doc.name), cstr(d.idx))) raise Exception @@ -408,6 +427,9 @@ class DocType: if cstr(d.s_warehouse) != cstr(pro_obj.doc.wip_warehouse): msgprint("As Item %s is Raw Material. Source Warehouse should be same as WIP Warehouse %s in Production Order %s, at Row No %s. " % ( cstr(d.item_code), cstr(pro_obj.doc.wip_warehouse), cstr(pro_obj.doc.name), cstr(d.idx))) raise Exception + if d.fg_item and (self.doc.purpose == 'Others' or self.doc.process == 'Backflush'): + fg_qty = flt(fg_qty) + flt(d.transfer_qty) + d.save() if self.doc.fg_completed_qty and flt(self.doc.fg_completed_qty) != flt(fg_qty): msgprint("The Total of FG Qty %s in Stock Entry Detail do not match with FG Completed Qty %s" % (flt(fg_qty), flt(self.doc.fg_completed_qty))) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.txt b/erpnext/stock/doctype/stock_entry/stock_entry.txt index 395082f5d3..4fc2495e69 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.txt +++ b/erpnext/stock/doctype/stock_entry/stock_entry.txt @@ -5,22 +5,22 @@ { 'creation': '2010-08-08 17:09:25', 'docstatus': 0, - 'modified': '2012-01-24 19:47:47', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-03-20 14:28:17', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { - '_last_update': '1325570647', + '_last_update': u'1332225743', 'allow_attach': 0, 'allow_copy': 0, 'allow_email': 0, 'allow_print': 0, 'allow_rename': 0, 'allow_trash': 0, - 'colour': 'White:FFF', - 'default_print_format': 'Standard', + 'colour': u'White:FFF', + 'default_print_format': u'Standard', 'doctype': 'DocType', 'hide_heading': 0, 'hide_toolbar': 0, @@ -29,44 +29,44 @@ 'is_transaction_doc': 0, 'issingle': 0, 'max_attachments': 0, - 'module': 'Stock', + 'module': u'Stock', 'name': '__common__', - 'print_outline': 'No', + 'print_outline': u'No', 'read_only': 0, 'read_only_onload': 0, - 'search_fields': 'transfer_date, from_warehouse, to_warehouse, purpose, remarks', - 'section_style': 'Tabbed', - 'server_code_error': ' ', + 'search_fields': u'transfer_date, from_warehouse, to_warehouse, purpose, remarks', + 'section_style': u'Tabbed', + 'server_code_error': u' ', 'show_in_menu': 0, - 'subject': '%(remarks)s', - 'tag_fields': 'purpose', + 'subject': u'%(remarks)s', + 'tag_fields': u'purpose', 'use_template': 0, - 'version': 248 + 'version': 258 }, # These values are common for all DocField { - 'doctype': 'DocField', + 'doctype': u'DocField', 'name': '__common__', - 'parent': 'Stock Entry', - 'parentfield': 'fields', - 'parenttype': 'DocType' + 'parent': u'Stock Entry', + 'parentfield': u'fields', + 'parenttype': u'DocType' }, # These values are common for all DocPerm { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'name': '__common__', - 'parent': 'Stock Entry', - 'parentfield': 'permissions', - 'parenttype': 'DocType', + 'parent': u'Stock Entry', + 'parentfield': u'permissions', + 'parenttype': u'DocType', 'read': 1 }, # DocType, Stock Entry { 'doctype': 'DocType', - 'name': 'Stock Entry' + 'name': u'Stock Entry' }, # DocPerm @@ -74,9 +74,9 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 1, - 'role': 'Material Manager', + 'role': u'Material Manager', 'submit': 0, 'write': 0 }, @@ -86,9 +86,9 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 1, - 'role': 'Material User', + 'role': u'Material User', 'submit': 0, 'write': 0 }, @@ -98,9 +98,9 @@ 'amend': 1, 'cancel': 1, 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'Production User', + 'role': u'Production User', 'submit': 1, 'write': 1 }, @@ -110,9 +110,9 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 1, - 'role': 'Production User', + 'role': u'Production User', 'submit': 0, 'write': 0 }, @@ -122,9 +122,9 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 2, - 'role': 'Production User', + 'role': u'Production User', 'submit': 0, 'write': 1 }, @@ -134,9 +134,9 @@ 'amend': 1, 'cancel': 1, 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'Production Manager', + 'role': u'Production Manager', 'submit': 1, 'write': 1 }, @@ -146,9 +146,9 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 1, - 'role': 'Production Manager', + 'role': u'Production Manager', 'submit': 0, 'write': 0 }, @@ -158,45 +158,45 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 2, - 'role': 'Production Manager', + 'role': u'Production Manager', 'submit': 0, 'write': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Warehouse', - 'oldfieldtype': 'Section Break', + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Warehouse', + 'oldfieldtype': u'Section Break', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', - 'oldfieldtype': 'Column Break', + 'doctype': u'DocField', + 'fieldtype': u'Column Break', + 'oldfieldtype': u'Column Break', 'permlevel': 0, - 'width': '50%' + 'width': u'50%' }, # DocField { 'allow_on_submit': 0, - 'colour': 'White:FFF', - 'description': 'To manage multiple series please go to Setup > Manage Series', - 'doctype': 'DocField', - 'fieldname': 'naming_series', - 'fieldtype': 'Select', + 'colour': u'White:FFF', + 'description': u'To manage multiple series please go to Setup > Manage Series', + 'doctype': u'DocField', + 'fieldname': u'naming_series', + 'fieldtype': u'Select', 'in_filter': 0, - 'label': 'Series', + 'label': u'Series', 'no_copy': 1, - 'oldfieldname': 'naming_series', - 'oldfieldtype': 'Select', - 'options': 'STE', + 'oldfieldname': u'naming_series', + 'oldfieldtype': u'Select', + 'options': u'STE', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -207,15 +207,15 @@ # DocField { 'allow_on_submit': 0, - 'description': 'The date at which current entry is corrected in the system.', - 'doctype': 'DocField', - 'fieldname': 'amendment_date', - 'fieldtype': 'Date', + 'description': u'The date at which current entry is corrected in the system.', + 'doctype': u'DocField', + 'fieldname': u'amendment_date', + 'fieldtype': u'Date', 'in_filter': 0, - 'label': 'Amendment Date', + 'label': u'Amendment Date', 'no_copy': 1, - 'oldfieldname': 'amendment_date', - 'oldfieldtype': 'Date', + 'oldfieldname': u'amendment_date', + 'oldfieldtype': u'Date', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -225,73 +225,73 @@ # DocField { 'allow_on_submit': 0, - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'purpose', - 'fieldtype': 'Select', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'purpose', + 'fieldtype': u'Select', 'in_filter': 1, - 'label': 'Purpose', + 'label': u'Purpose', 'no_copy': 0, - 'oldfieldname': 'purpose', - 'oldfieldtype': 'Select', - 'options': 'Material Issue\nMaterial Receipt\nMaterial Transfer\nSales Return\nPurchase Return\nSubcontracting\nProduction Order', + 'oldfieldname': u'purpose', + 'oldfieldtype': u'Select', + 'options': u'Material Issue\nMaterial Receipt\nMaterial Transfer\nSales Return\nPurchase Return\nSubcontracting\nProduction Order\nOthers', 'permlevel': 0, 'report_hide': 0, 'reqd': 1, 'search_index': 0, - 'trigger': 'Client' + 'trigger': u'Client' }, # DocField { 'allow_on_submit': 0, - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'delivery_note_no', - 'fieldtype': 'Link', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'delivery_note_no', + 'fieldtype': u'Link', 'hidden': 1, 'in_filter': 0, - 'label': 'Delivery Note No', + 'label': u'Delivery Note No', 'no_copy': 0, - 'oldfieldname': 'delivery_note_no', - 'oldfieldtype': 'Link', - 'options': 'Delivery Note', + 'oldfieldname': u'delivery_note_no', + 'oldfieldtype': u'Link', + 'options': u'Delivery Note', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, 'search_index': 1, - 'trigger': 'Client' + 'trigger': u'Client' }, # DocField { 'allow_on_submit': 0, - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'purchase_receipt_no', - 'fieldtype': 'Link', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'purchase_receipt_no', + 'fieldtype': u'Link', 'hidden': 1, 'in_filter': 0, - 'label': 'Purchase Receipt No', + 'label': u'Purchase Receipt No', 'no_copy': 0, - 'oldfieldname': 'purchase_receipt_no', - 'oldfieldtype': 'Link', - 'options': 'Purchase Receipt', + 'oldfieldname': u'purchase_receipt_no', + 'oldfieldtype': u'Link', + 'options': u'Purchase Receipt', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, 'search_index': 1, - 'trigger': 'Client' + 'trigger': u'Client' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'sales_invoice_no', - 'fieldtype': 'Link', + 'doctype': u'DocField', + 'fieldname': u'sales_invoice_no', + 'fieldtype': u'Link', 'hidden': 1, - 'label': 'Sales Invoice No', - 'options': 'Receivable Voucher', + 'label': u'Sales Invoice No', + 'options': u'Receivable Voucher', 'permlevel': 0, 'print_hide': 1 }, @@ -299,35 +299,35 @@ # DocField { 'allow_on_submit': 0, - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'supplier', - 'fieldtype': 'Link', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'supplier', + 'fieldtype': u'Link', 'hidden': 1, 'in_filter': 0, - 'label': 'Supplier', + 'label': u'Supplier', 'no_copy': 0, - 'oldfieldname': 'supplier', - 'oldfieldtype': 'Link', - 'options': 'Supplier', + 'oldfieldname': u'supplier', + 'oldfieldtype': u'Link', + 'options': u'Supplier', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, 'search_index': 0, - 'trigger': 'Client' + 'trigger': u'Client' }, # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'supplier_name', - 'fieldtype': 'Data', + 'doctype': u'DocField', + 'fieldname': u'supplier_name', + 'fieldtype': u'Data', 'in_filter': 0, - 'label': 'Supplier Name', + 'label': u'Supplier Name', 'no_copy': 0, - 'oldfieldname': 'supplier_name', - 'oldfieldtype': 'Data', + 'oldfieldname': u'supplier_name', + 'oldfieldtype': u'Data', 'permlevel': 1, 'report_hide': 0, 'search_index': 0 @@ -336,55 +336,55 @@ # DocField { 'allow_on_submit': 0, - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'supplier_address', - 'fieldtype': 'Small Text', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'supplier_address', + 'fieldtype': u'Small Text', 'hidden': 1, 'in_filter': 0, - 'label': 'Supplier Address', + 'label': u'Supplier Address', 'no_copy': 0, - 'oldfieldname': 'supplier_address', - 'oldfieldtype': 'Small Text', + 'oldfieldname': u'supplier_address', + 'oldfieldtype': u'Small Text', 'permlevel': 0, 'report_hide': 0, 'search_index': 0, - 'trigger': 'Client' + 'trigger': u'Client' }, # DocField { 'allow_on_submit': 0, - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'customer', - 'fieldtype': 'Link', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'customer', + 'fieldtype': u'Link', 'hidden': 1, 'in_filter': 0, - 'label': 'Customer', + 'label': u'Customer', 'no_copy': 0, - 'oldfieldname': 'customer', - 'oldfieldtype': 'Link', - 'options': 'Customer', + 'oldfieldname': u'customer', + 'oldfieldtype': u'Link', + 'options': u'Customer', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, 'search_index': 0, - 'trigger': 'Client' + 'trigger': u'Client' }, # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'customer_name', - 'fieldtype': 'Data', + 'doctype': u'DocField', + 'fieldname': u'customer_name', + 'fieldtype': u'Data', 'hidden': 1, 'in_filter': 0, - 'label': 'Customer Name', + 'label': u'Customer Name', 'no_copy': 0, - 'oldfieldname': 'customer_name', - 'oldfieldtype': 'Data', + 'oldfieldname': u'customer_name', + 'oldfieldtype': u'Data', 'permlevel': 1, 'report_hide': 0, 'search_index': 0 @@ -393,15 +393,15 @@ # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'customer_address', - 'fieldtype': 'Small Text', + 'doctype': u'DocField', + 'fieldname': u'customer_address', + 'fieldtype': u'Small Text', 'hidden': 1, 'in_filter': 0, - 'label': 'Customer Address', + 'label': u'Customer Address', 'no_copy': 0, - 'oldfieldname': 'customer_address', - 'oldfieldtype': 'Small Text', + 'oldfieldname': u'customer_address', + 'oldfieldtype': u'Small Text', 'permlevel': 0, 'report_hide': 0, 'search_index': 0 @@ -410,153 +410,177 @@ # DocField { 'allow_on_submit': 0, - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'process', - 'fieldtype': 'Select', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'process', + 'fieldtype': u'Select', 'hidden': 1, 'in_filter': 1, - 'label': 'Process', + 'label': u'Process', 'no_copy': 0, - 'oldfieldname': 'process', - 'oldfieldtype': 'Select', - 'options': '\nMaterial Transfer\nBackflush', + 'oldfieldname': u'process', + 'oldfieldtype': u'Select', + 'options': u'\nMaterial Transfer\nBackflush', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, 'search_index': 0, - 'trigger': 'Client' + 'trigger': u'Client' }, # DocField { 'allow_on_submit': 0, - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'production_order', - 'fieldtype': 'Link', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'production_order', + 'fieldtype': u'Link', 'hidden': 1, 'in_filter': 1, - 'label': 'Production Order', + 'label': u'Production Order', 'no_copy': 0, - 'oldfieldname': 'production_order', - 'oldfieldtype': 'Link', - 'options': 'Production Order', + 'oldfieldname': u'production_order', + 'oldfieldtype': u'Link', + 'options': u'Production Order', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, 'search_index': 1, - 'trigger': 'Client' + 'trigger': u'Client' }, # DocField { - 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'fg_completed_qty', - 'fieldtype': 'Currency', - 'in_filter': 0, - 'label': 'FG Completed Qty', - 'no_copy': 0, - 'oldfieldname': 'fg_completed_qty', - 'oldfieldtype': 'Currency', - 'permlevel': 0, - 'print_hide': 1, - 'report_hide': 0, - 'search_index': 0, - 'trigger': 'Client' - }, - - # DocField - { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldtype': 'HTML', - 'label': 'Warehouse HTML', - 'no_copy': 0, - 'oldfieldtype': 'HTML', - 'options': "
    Warehouse
    ", - 'permlevel': 0, - 'print_hide': 1 - }, - - # DocField - { - 'allow_on_submit': 0, - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'from_warehouse', - 'fieldtype': 'Link', - 'in_filter': 0, - 'label': 'Source Warehouse', - 'no_copy': 0, - 'oldfieldname': 'from_warehouse', - 'oldfieldtype': 'Link', - 'options': 'Warehouse', - 'permlevel': 0, - 'print_hide': 1, - 'report_hide': 0, - 'reqd': 0, - 'search_index': 0, - 'trigger': 'Client' - }, - - # DocField - { - 'allow_on_submit': 0, - 'colour': 'White:FFF', - 'description': 'Notes: Either Source or Target is Mandatory', - 'doctype': 'DocField', - 'fieldname': 'to_warehouse', - 'fieldtype': 'Link', - 'in_filter': 0, - 'label': 'Target Warehouse', - 'no_copy': 0, - 'oldfieldname': 'to_warehouse', - 'oldfieldtype': 'Link', - 'options': 'Warehouse', - 'permlevel': 0, - 'print_hide': 1, - 'report_hide': 0, - 'reqd': 0, - 'search_index': 0, - 'trigger': 'Client' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'project_name', - 'fieldtype': 'Link', - 'in_filter': 1, - 'label': 'Project Name', - 'oldfieldname': 'project_name', - 'oldfieldtype': 'Link', - 'options': 'Project', + 'depends_on': u"eval:doc.purpose == 'Others'", + 'doctype': u'DocField', + 'fieldname': u'bom_no', + 'fieldtype': u'Link', + 'label': u'BOM No', + 'options': u'Bill of Materials', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', - 'oldfieldtype': 'Column Break', - 'permlevel': 0, - 'width': '50%' + 'colour': u'White:FFF', + 'depends_on': u"eval:doc.purpose == 'Others'", + 'description': u'Select "Yes" if stock is maintained and tracked for sub-assembly items. Select "No" if you want child items of sub-assembly for material transfer.', + 'doctype': u'DocField', + 'fieldname': u'consider_sa_items_as_raw_materials', + 'fieldtype': u'Select', + 'label': u'Consider SA Items as Raw Materials', + 'options': u'\nNo\nYes', + 'permlevel': 0 }, # DocField { 'allow_on_submit': 0, - 'default': 'Today', - 'doctype': 'DocField', - 'fieldname': 'transfer_date', - 'fieldtype': 'Date', + 'doctype': u'DocField', + 'fieldname': u'fg_completed_qty', + 'fieldtype': u'Currency', + 'in_filter': 0, + 'label': u'FG Completed Qty', + 'no_copy': 0, + 'oldfieldname': u'fg_completed_qty', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'print_hide': 1, + 'report_hide': 0, + 'search_index': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldtype': u'HTML', + 'label': u'Warehouse HTML', + 'no_copy': 0, + 'oldfieldtype': u'HTML', + 'options': u"
    Warehouse
    ", + 'permlevel': 0, + 'print_hide': 1 + }, + + # DocField + { + 'allow_on_submit': 0, + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'from_warehouse', + 'fieldtype': u'Link', + 'in_filter': 0, + 'label': u'Source Warehouse', + 'no_copy': 0, + 'oldfieldname': u'from_warehouse', + 'oldfieldtype': u'Link', + 'options': u'Warehouse', + 'permlevel': 0, + 'print_hide': 1, + 'report_hide': 0, + 'reqd': 0, + 'search_index': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'allow_on_submit': 0, + 'colour': u'White:FFF', + 'description': u'Notes: Either Source or Target is Mandatory', + 'doctype': u'DocField', + 'fieldname': u'to_warehouse', + 'fieldtype': u'Link', + 'in_filter': 0, + 'label': u'Target Warehouse', + 'no_copy': 0, + 'oldfieldname': u'to_warehouse', + 'oldfieldtype': u'Link', + 'options': u'Warehouse', + 'permlevel': 0, + 'print_hide': 1, + 'report_hide': 0, + 'reqd': 0, + 'search_index': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'project_name', + 'fieldtype': u'Link', 'in_filter': 1, - 'label': 'Transfer Date', + 'label': u'Project Name', + 'oldfieldname': u'project_name', + 'oldfieldtype': u'Link', + 'options': u'Project', + 'permlevel': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldtype': u'Column Break', + 'oldfieldtype': u'Column Break', + 'permlevel': 0, + 'width': u'50%' + }, + + # DocField + { + 'allow_on_submit': 0, + 'default': u'Today', + 'doctype': u'DocField', + 'fieldname': u'transfer_date', + 'fieldtype': u'Date', + 'in_filter': 1, + 'label': u'Transfer Date', 'no_copy': 1, - 'oldfieldname': 'transfer_date', - 'oldfieldtype': 'Date', + 'oldfieldname': u'transfer_date', + 'oldfieldtype': u'Date', 'permlevel': 0, 'print_hide': 0, 'report_hide': 0, @@ -567,15 +591,15 @@ # DocField { 'allow_on_submit': 0, - 'description': 'The date at which current entry will get or has actually executed.', - 'doctype': 'DocField', - 'fieldname': 'posting_date', - 'fieldtype': 'Date', + 'description': u'The date at which current entry will get or has actually executed.', + 'doctype': u'DocField', + 'fieldname': u'posting_date', + 'fieldtype': u'Date', 'in_filter': 1, - 'label': 'Posting Date', + 'label': u'Posting Date', 'no_copy': 1, - 'oldfieldname': 'posting_date', - 'oldfieldtype': 'Date', + 'oldfieldname': u'posting_date', + 'oldfieldtype': u'Date', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -586,14 +610,14 @@ # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'posting_time', - 'fieldtype': 'Time', + 'doctype': u'DocField', + 'fieldname': u'posting_time', + 'fieldtype': u'Time', 'in_filter': 0, - 'label': 'Posting Time', + 'label': u'Posting Time', 'no_copy': 1, - 'oldfieldname': 'posting_time', - 'oldfieldtype': 'Time', + 'oldfieldname': u'posting_time', + 'oldfieldtype': u'Time', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -604,15 +628,15 @@ # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'amended_from', - 'fieldtype': 'Link', + 'doctype': u'DocField', + 'fieldname': u'amended_from', + 'fieldtype': u'Link', 'in_filter': 0, - 'label': 'Amended From', + 'label': u'Amended From', 'no_copy': 1, - 'oldfieldname': 'amended_from', - 'oldfieldtype': 'Link', - 'options': 'Stock Entry', + 'oldfieldname': u'amended_from', + 'oldfieldtype': u'Link', + 'options': u'Stock Entry', 'permlevel': 1, 'print_hide': 1, 'report_hide': 0, @@ -622,14 +646,14 @@ # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'transporter', - 'fieldtype': 'Data', + 'doctype': u'DocField', + 'fieldname': u'transporter', + 'fieldtype': u'Data', 'in_filter': 0, - 'label': 'Transporter', + 'label': u'Transporter', 'no_copy': 0, - 'oldfieldname': 'transporter', - 'oldfieldtype': 'Data', + 'oldfieldname': u'transporter', + 'oldfieldtype': u'Data', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -639,15 +663,15 @@ # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'is_excisable_goods', - 'fieldtype': 'Select', + 'doctype': u'DocField', + 'fieldname': u'is_excisable_goods', + 'fieldtype': u'Select', 'in_filter': 0, - 'label': 'Is Excisable Goods', + 'label': u'Is Excisable Goods', 'no_copy': 0, - 'oldfieldname': 'is_excisable_goods', - 'oldfieldtype': 'Select', - 'options': '\nYes\nNo', + 'oldfieldname': u'is_excisable_goods', + 'oldfieldtype': u'Select', + 'options': u'\nYes\nNo', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -657,15 +681,15 @@ # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'excisable_goods', - 'fieldtype': 'Select', + 'doctype': u'DocField', + 'fieldname': u'excisable_goods', + 'fieldtype': u'Select', 'in_filter': 0, - 'label': 'Excisable Goods', + 'label': u'Excisable Goods', 'no_copy': 0, - 'oldfieldname': 'excisable_goods', - 'oldfieldtype': 'Select', - 'options': '\nReturnable\nNon-Returnable', + 'oldfieldname': u'excisable_goods', + 'oldfieldtype': u'Select', + 'options': u'\nReturnable\nNon-Returnable', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -675,16 +699,16 @@ # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'under_rule', - 'fieldtype': 'Select', + 'doctype': u'DocField', + 'fieldname': u'under_rule', + 'fieldtype': u'Select', 'hidden': 1, 'in_filter': 0, - 'label': 'Under Rule', + 'label': u'Under Rule', 'no_copy': 0, - 'oldfieldname': 'under_rule', - 'oldfieldtype': 'Select', - 'options': '\nOrdinary\n57 AC (5) a\n57 F (2) Non-Exc.', + 'oldfieldname': u'under_rule', + 'oldfieldtype': u'Select', + 'options': u'\nOrdinary\n57 AC (5) a\n57 F (2) Non-Exc.', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -694,14 +718,14 @@ # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'remarks', - 'fieldtype': 'Text', + 'doctype': u'DocField', + 'fieldname': u'remarks', + 'fieldtype': u'Text', 'in_filter': 0, - 'label': 'Remarks', + 'label': u'Remarks', 'no_copy': 1, - 'oldfieldname': 'remarks', - 'oldfieldtype': 'Text', + 'oldfieldname': u'remarks', + 'oldfieldtype': u'Text', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -712,15 +736,15 @@ # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'cancel_reason', - 'fieldtype': 'Data', + 'doctype': u'DocField', + 'fieldname': u'cancel_reason', + 'fieldtype': u'Data', 'hidden': 1, 'in_filter': 0, - 'label': 'Cancel Reason', + 'label': u'Cancel Reason', 'no_copy': 1, - 'oldfieldname': 'cancel_reason', - 'oldfieldtype': 'Data', + 'oldfieldname': u'cancel_reason', + 'oldfieldtype': u'Data', 'permlevel': 1, 'print_hide': 1, 'report_hide': 0, @@ -730,44 +754,44 @@ # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Items', - 'oldfieldtype': 'Section Break', + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Items', + 'oldfieldtype': u'Section Break', 'permlevel': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Button', - 'label': 'Get Stock and Rate', - 'oldfieldtype': 'Button', - 'options': 'get_stock_and_rate', + 'doctype': u'DocField', + 'fieldtype': u'Button', + 'label': u'Get Stock and Rate', + 'oldfieldtype': u'Button', + 'options': u'get_stock_and_rate', 'permlevel': 0, 'print_hide': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', - 'oldfieldtype': 'Column Break', + 'doctype': u'DocField', + 'fieldtype': u'Column Break', + 'oldfieldtype': u'Column Break', 'permlevel': 0 }, # DocField { 'allow_on_submit': 0, - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldtype': 'Button', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldtype': u'Button', 'hidden': 0, 'in_filter': 0, - 'label': 'Get Items', + 'label': u'Get Items', 'no_copy': 0, - 'oldfieldtype': 'Button', - 'options': 'get_items', + 'oldfieldtype': u'Button', + 'options': u'get_items', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -776,26 +800,26 @@ # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'oldfieldtype': 'Section Break', - 'options': 'Simple', + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'oldfieldtype': u'Section Break', + 'options': u'Simple', 'permlevel': 0 }, # DocField { 'allow_on_submit': 0, - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'mtn_details', - 'fieldtype': 'Table', + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'mtn_details', + 'fieldtype': u'Table', 'in_filter': 0, - 'label': 'MTN Details', + 'label': u'MTN Details', 'no_copy': 0, - 'oldfieldname': 'mtn_details', - 'oldfieldtype': 'Table', - 'options': 'Stock Entry Detail', + 'oldfieldname': u'mtn_details', + 'oldfieldtype': u'Table', + 'options': u'Stock Entry Detail', 'permlevel': 0, 'print_hide': 0, 'report_hide': 0, @@ -805,14 +829,14 @@ # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'total_amount', - 'fieldtype': 'Currency', + 'doctype': u'DocField', + 'fieldname': u'total_amount', + 'fieldtype': u'Currency', 'in_filter': 0, - 'label': 'Total Amount', + 'label': u'Total Amount', 'no_copy': 0, - 'oldfieldname': 'total_amount', - 'oldfieldtype': 'Currency', + 'oldfieldname': u'total_amount', + 'oldfieldtype': u'Currency', 'permlevel': 1, 'print_hide': 1, 'report_hide': 0, @@ -821,25 +845,25 @@ # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Other Details', - 'oldfieldtype': 'Section Break', + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Other Details', + 'oldfieldtype': u'Section Break', 'permlevel': 0 }, # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'company', - 'fieldtype': 'Link', + 'doctype': u'DocField', + 'fieldname': u'company', + 'fieldtype': u'Link', 'in_filter': 1, - 'label': 'Company', + 'label': u'Company', 'no_copy': 0, - 'oldfieldname': 'company', - 'oldfieldtype': 'Link', - 'options': 'Company', + 'oldfieldname': u'company', + 'oldfieldtype': u'Link', + 'options': u'Company', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -850,15 +874,15 @@ # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'fiscal_year', - 'fieldtype': 'Select', + 'doctype': u'DocField', + 'fieldname': u'fiscal_year', + 'fieldtype': u'Select', 'in_filter': 0, - 'label': 'Fiscal Year', + 'label': u'Fiscal Year', 'no_copy': 0, - 'oldfieldname': 'fiscal_year', - 'oldfieldtype': 'Select', - 'options': 'link:Fiscal Year', + 'oldfieldname': u'fiscal_year', + 'oldfieldtype': u'Select', + 'options': u'link:Fiscal Year', 'permlevel': 0, 'print_hide': 1, 'report_hide': 0, @@ -869,15 +893,15 @@ # DocField { 'allow_on_submit': 0, - 'doctype': 'DocField', - 'fieldname': 'select_print_heading', - 'fieldtype': 'Link', + 'doctype': u'DocField', + 'fieldname': u'select_print_heading', + 'fieldtype': u'Link', 'in_filter': 0, - 'label': 'Select Print Heading', + 'label': u'Select Print Heading', 'no_copy': 0, - 'oldfieldname': 'select_print_heading', - 'oldfieldtype': 'Link', - 'options': 'Print Heading', + 'oldfieldname': u'select_print_heading', + 'oldfieldtype': u'Link', + 'options': u'Print Heading', 'permlevel': 0, 'report_hide': 0, 'search_index': 0 From 9ff92369ade985e13051427a9643fbff8abbbc21 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 20 Mar 2012 16:44:15 +0530 Subject: [PATCH 26/59] lead organization fld added in quotation for printing --- .../selling/doctype/quotation/quotation.js | 19 +++++++----------- .../selling/doctype/quotation/quotation.py | 20 +------------------ .../selling/doctype/quotation/quotation.txt | 17 ++++++++++++---- erpnext/utilities/transaction_base.py | 5 +++-- 4 files changed, 24 insertions(+), 37 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.js b/erpnext/selling/doctype/quotation/quotation.js index 7f40782d0c..910f54e06f 100644 --- a/erpnext/selling/doctype/quotation/quotation.js +++ b/erpnext/selling/doctype/quotation/quotation.js @@ -41,7 +41,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { if(doc.quotation_to) { if(doc.quotation_to == 'Customer') { - hide_field(['lead', 'lead_name']); + hide_field(['lead', 'lead_name', 'organization']); } else if (doc.quotation_to == 'Lead') { hide_field(['customer','customer_address','contact_person', 'customer_name','contact_display', 'customer_group']); @@ -60,16 +60,11 @@ cur_frm.cscript.onload_post_render = function(doc, dt, dn) { // hide - unhide fields based on lead or customer.. // ======================================================================================================================= cur_frm.cscript.lead_cust_show = function(doc,cdt,cdn){ - if(doc.quotation_to == 'Lead'){ - unhide_field(['lead']); - hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']); - doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = ""; - } - else if(doc.quotation_to == 'Customer'){ - unhide_field(['customer']); - hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']); - doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = ""; - } + hide_field(['lead', 'lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group', 'organization']); + if(doc.quotation_to == 'Lead') unhide_field(['lead']); + else if(doc.quotation_to == 'Customer') unhide_field(['customer']); + + doc.lead = doc.lead_name = doc.customer = doc.customer_address = doc.contact_person = doc.address_display = doc.contact_display = doc.contact_mobile = doc.contact_email = doc.territory = doc.customer_group = doc.organization = ""; } @@ -140,7 +135,7 @@ cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){ cur_frm.cscript.lead = function(doc, cdt, cdn) { if(doc.lead) get_server_fields('get_lead_details', doc.lead,'', doc, cdt, cdn, 1); - if(doc.lead) unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']); + if(doc.lead) unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory', 'organization']); } diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index de4056d2d6..27206b2d49 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -116,26 +116,8 @@ class DocType(TransactionBase): # Pull details from other charges master (Get Other Charges) # ---------------------------------------------------------- def get_other_charges(self): - return get_obj('Sales Common').get_other_charges(self) + return get_obj('Sales Common').get_other_charges(self) - # Get Lead Details along with its details - # ============================================================== - def get_lead_details1(self, name): - details = sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id from `tabLead` where name = '%s'" %(name), as_dict = 1) - ret = { - 'lead_name' : details and details[0]['lead_name'] or '', - 'address_display' : (details and details[0]['address_line1'] - + (details[0]['address_line2'] and '\n' + details[0]['address_line2'] or '') + '\n' - + details[0]['city'] - + (details[0]['pincode'] and ', ' + details[0]['pincode'] or '') + '\n' - + (details[0]['state'] and details[0]['state']+', ' or '') - + details[0]['country'] + '\nTel: ' + details[0]['contact_no'] + '\n' or '-'), - 'territory' : details and details[0]['territory'] or '', - 'contact_mobile' : details and details[0]['mobile_no'] or '-', - 'contact_email' : details and details[0]['email_id'] or '-' - } - return ret - # GET TERMS AND CONDITIONS # ==================================================================================== diff --git a/erpnext/selling/doctype/quotation/quotation.txt b/erpnext/selling/doctype/quotation/quotation.txt index 32784a8dcb..c8e3ecb37f 100644 --- a/erpnext/selling/doctype/quotation/quotation.txt +++ b/erpnext/selling/doctype/quotation/quotation.txt @@ -5,7 +5,7 @@ { 'creation': '2010-08-08 17:09:17', 'docstatus': 0, - 'modified': '2012-03-02 12:20:40', + 'modified': '2012-03-20 14:56:28', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -21,7 +21,7 @@ # These values are common for all DocType { - '_last_update': u'1330069750', + '_last_update': u'1332235370', 'allow_attach': 1, 'allow_email': 0, 'allow_trash': 1, @@ -41,7 +41,7 @@ 'show_in_menu': 0, 'subject': u'To %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s', 'tag_fields': u'status', - 'version': 618 + 'version': 621 }, # These values are common for all DocFormat @@ -292,6 +292,15 @@ 'permlevel': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'organization', + 'fieldtype': u'Data', + 'label': u'Organization', + 'permlevel': 1 + }, + # DocField { 'colour': u'White:FFF', @@ -385,7 +394,7 @@ 'oldfieldtype': u'Select', 'options': u'\nSales\nMaintenance', 'permlevel': 0, - 'print_hide': 0, + 'print_hide': 1, 'reqd': 1, 'search_index': 0 }, diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index b78bed1c0c..ee23c75fc9 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -145,7 +145,7 @@ class TransactionBase: # Get Lead Details # ----------------------- def get_lead_details(self, name): - details = webnotes.conn.sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id from `tabLead` where name = '%s'" %(name), as_dict = 1) + details = webnotes.conn.sql("select name, lead_name, address_line1, address_line2, city, country, state, pincode, territory, contact_no, mobile_no, email_id, company_name from `tabLead` where name = '%s'" %(name), as_dict = 1) extract = lambda x: details and details[0] and details[0].get(x,'') or '' address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','contact_no')] @@ -157,7 +157,8 @@ class TransactionBase: 'address_display' : address_display, 'territory' : extract('territory'), 'contact_mobile' : extract('mobile_no'), - 'contact_email' : extract('email_id') + 'contact_email' : extract('email_id'), + 'organization' : extract('company_name') } return ret From de51040763a0401926626ffa9b73b98a7337cfee Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 20 Mar 2012 16:47:03 +0530 Subject: [PATCH 27/59] lead organization fld added in quotation for printing --- erpnext/patches/patch_list.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index dbf62f7b1f..89d3fa91c9 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -192,5 +192,10 @@ patch_list = [ 'patch_file': 'stock_entry_others_patch', 'description': 'new purpose others in stock entry' }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'reload_quote', + 'description': 'reload quote: organization fld added' + }, ] From ceb9f41f15c20a40865c87189834161e121d9592 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 20 Mar 2012 17:04:32 +0530 Subject: [PATCH 28/59] lead organization fld added in quotation for printing: patch --- .../doctype/payable_voucher/payable_voucher.py | 11 +++++++++-- erpnext/patches/jan_mar_2012/reload_quote.py | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 erpnext/patches/jan_mar_2012/reload_quote.py diff --git a/erpnext/accounts/doctype/payable_voucher/payable_voucher.py b/erpnext/accounts/doctype/payable_voucher/payable_voucher.py index 1a09a451c7..d930583536 100644 --- a/erpnext/accounts/doctype/payable_voucher/payable_voucher.py +++ b/erpnext/accounts/doctype/payable_voucher/payable_voucher.py @@ -123,7 +123,10 @@ class DocType(TransactionBase): def get_pv_details(self, arg): import json - item_det = sql("select item_name, brand, description, item_group,purchase_account,cost_center from tabItem where name=%s",arg,as_dict=1) + item_det = sql("select item_name, brand, description, item_group,purchase_account,cost_center, last_purchase_rate from tabItem where name=%s",arg,as_dict=1) + lpr = item_det and flt(item_det[0]['last_purchase_rate']) or 0 + import_lpr = lpr / flt(self.doc.conversion_rate) or 1 + tax = sql("select tax_type, tax_rate from `tabItem Tax` where parent = %s" , arg) t = {} for x in tax: t[x[0]] = flt(x[1]) @@ -132,13 +135,17 @@ class DocType(TransactionBase): 'brand' : item_det and item_det[0]['brand'] or '', 'description' : item_det and item_det[0]['description'] or '', 'item_group' : item_det and item_det[0]['item_group'] or '', - 'rate' : 0.00, + 'rate' : lpr, + 'purchase_ref_rate' : lpr, + 'import_ref_rate' : import_lpr, + 'import_rate' : import_lpr, 'qty' : 0.00, 'amount' : 0.00, 'expense_head' : item_det and item_det[0]['purchase_account'] or '', 'cost_center' : item_det and item_det[0]['cost_center'] or '', 'item_tax_rate' : json.dumps(t) } + return ret diff --git a/erpnext/patches/jan_mar_2012/reload_quote.py b/erpnext/patches/jan_mar_2012/reload_quote.py new file mode 100644 index 0000000000..5715bb4efb --- /dev/null +++ b/erpnext/patches/jan_mar_2012/reload_quote.py @@ -0,0 +1,4 @@ +def execute(): + import webnotes + from webnotes.modules.module_manager import reload_doc + reload_doc('selling', 'doctype', 'quotation') From 39c26f458057f75fa3b466bbe23e38bc0791d810 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 20 Mar 2012 17:39:48 +0530 Subject: [PATCH 29/59] billing period in recurring sales invoice mail --- erpnext/accounts/doctype/gl_control/gl_control.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py index 93bef5de76..21b768024e 100644 --- a/erpnext/accounts/doctype/gl_control/gl_control.py +++ b/erpnext/accounts/doctype/gl_control/gl_control.py @@ -560,10 +560,10 @@ def send_notification(new_rv): - +
    Customer
    %s
    %s
    Invoice Date: %s
    Due Date: %s
    Invoice Date: %s
    Period: %s to %s
    Due Date: %s
    - ''' % (com, new_rv.doc.name, new_rv.doc.customer, new_rv.doc.address_display, new_rv.doc.posting_date, new_rv.doc.due_date) + ''' % (com, new_rv.doc.name, new_rv.doc.customer, new_rv.doc.address_display, new_rv.doc.posting_date, add_days(add_months(new_rv.doc.posting_date, -1), 1), new_rv.doc.posting_date, new_rv.doc.due_date) tbl = ''' @@ -603,6 +603,7 @@ def send_notification(new_rv): msg = hd + tbl + totals + msgprint(msg) from webnotes.utils.email_lib import sendmail - sendmail(recipients = new_rv.doc.notification_email_address.split(", "), \ - sender=new_rv.doc.owner, subject=subject, parts=[['text/plain', msg]]) + #sendmail(recipients = new_rv.doc.notification_email_address.split(", "), \ + # sender=new_rv.doc.owner, subject=subject, parts=[['text/plain', msg]]) From 39a24794eb8b59fa74f18ea79deb285b8cf57d7d Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Mar 2012 11:02:50 +0530 Subject: [PATCH 30/59] Purpose others to other --- erpnext/patches/jan_mar_2012/update_purpose_se.py | 3 +++ erpnext/patches/patch_list.py | 5 +++++ erpnext/stock/doctype/stock_entry/stock_entry.txt | 8 ++++---- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 erpnext/patches/jan_mar_2012/update_purpose_se.py diff --git a/erpnext/patches/jan_mar_2012/update_purpose_se.py b/erpnext/patches/jan_mar_2012/update_purpose_se.py new file mode 100644 index 0000000000..e2b7d9fc50 --- /dev/null +++ b/erpnext/patches/jan_mar_2012/update_purpose_se.py @@ -0,0 +1,3 @@ +def execute(): + import webnotes + webnotes.conn.sql("update `tabDocField` set options = replace(options, 'Others', 'Other') where fieldname = 'purpose' and parent = 'Stock Entry'") diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 89d3fa91c9..db1daf1f00 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -197,5 +197,10 @@ patch_list = [ 'patch_file': 'reload_quote', 'description': 'reload quote: organization fld added' }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'update_purpose_se', + 'description': 'Purpose SE: Others to Other' + }, ] diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.txt b/erpnext/stock/doctype/stock_entry/stock_entry.txt index 4fc2495e69..4f524aa5f1 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.txt +++ b/erpnext/stock/doctype/stock_entry/stock_entry.txt @@ -5,14 +5,14 @@ { 'creation': '2010-08-08 17:09:25', 'docstatus': 0, - 'modified': '2012-03-20 14:28:17', + 'modified': '2012-03-21 11:00:48', 'modified_by': u'Administrator', 'owner': u'Administrator' }, # These values are common for all DocType { - '_last_update': u'1332225743', + '_last_update': u'1332233897', 'allow_attach': 0, 'allow_copy': 0, 'allow_email': 0, @@ -41,7 +41,7 @@ 'subject': u'%(remarks)s', 'tag_fields': u'purpose', 'use_template': 0, - 'version': 258 + 'version': 259 }, # These values are common for all DocField @@ -234,7 +234,7 @@ 'no_copy': 0, 'oldfieldname': u'purpose', 'oldfieldtype': u'Select', - 'options': u'Material Issue\nMaterial Receipt\nMaterial Transfer\nSales Return\nPurchase Return\nSubcontracting\nProduction Order\nOthers', + 'options': u'Material Issue\nMaterial Receipt\nMaterial Transfer\nSales Return\nPurchase Return\nSubcontracting\nProduction Order\nOther', 'permlevel': 0, 'report_hide': 0, 'reqd': 1, From 5f0406129125ae538d88f98f4c3bbdc842b4e161 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Mar 2012 11:47:00 +0530 Subject: [PATCH 31/59] changes in recurring invoice print format --- erpnext/accounts/doctype/gl_control/gl_control.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py index 21b768024e..fa98441258 100644 --- a/erpnext/accounts/doctype/gl_control/gl_control.py +++ b/erpnext/accounts/doctype/gl_control/gl_control.py @@ -560,10 +560,12 @@ def send_notification(new_rv):
    - +
    Customer
    %s
    %s
    Invoice Date: %s
    Period: %s to %s
    Due Date: %s
    Invoice Date : %s
    Invoice Period : %s to %s
    Due Date : %s
    - ''' % (com, new_rv.doc.name, new_rv.doc.customer, new_rv.doc.address_display, new_rv.doc.posting_date, add_days(add_months(new_rv.doc.posting_date, -1), 1), new_rv.doc.posting_date, new_rv.doc.due_date) + ''' % (com, new_rv.doc.name, new_rv.doc.customer, new_rv.doc.address_display, getdate(new_rv.doc.posting_date).strftime("%d-%m-%Y"), \ + getdate(add_days(add_months(new_rv.doc.posting_date, -1), 1)).strftime("%d-%m-%Y"), getdate(new_rv.doc.posting_date).strftime("%d-%m-%Y"),\ + getdate(new_rv.doc.due_date).strftime("%d-%m-%Y")) tbl = ''' @@ -596,14 +598,13 @@ def send_notification(new_rv):
    - Terms: + Terms and Conditions: %s - ''' % (new_rv.doc.net_total, new_rv.doc.total_tax,new_rv.doc.grand_total, new_rv.doc.in_words,new_rv.doc.terms) + ''' % (new_rv.doc.net_total, new_rv.doc.other_charges_total,new_rv.doc.grand_total, new_rv.doc.in_words,new_rv.doc.terms) msg = hd + tbl + totals - msgprint(msg) from webnotes.utils.email_lib import sendmail - #sendmail(recipients = new_rv.doc.notification_email_address.split(", "), \ - # sender=new_rv.doc.owner, subject=subject, parts=[['text/plain', msg]]) + sendmail(recipients = new_rv.doc.notification_email_address.split(", "), \ + sender=new_rv.doc.owner, subject=subject, parts=[['text/plain', msg]]) From 7ff14ede3c1d48efdc5ee28c43d60907c65e8ebc Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Mar 2012 15:33:50 +0530 Subject: [PATCH 32/59] Update erpnext/stock/doctype/stock_entry/stock_entry.txt --- erpnext/stock/doctype/stock_entry/stock_entry.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.txt b/erpnext/stock/doctype/stock_entry/stock_entry.txt index 4f524aa5f1..b7790f7a54 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.txt +++ b/erpnext/stock/doctype/stock_entry/stock_entry.txt @@ -451,7 +451,7 @@ # DocField { - 'depends_on': u"eval:doc.purpose == 'Others'", + 'depends_on': u"eval:doc.purpose == 'Other'", 'doctype': u'DocField', 'fieldname': u'bom_no', 'fieldtype': u'Link', @@ -463,7 +463,7 @@ # DocField { 'colour': u'White:FFF', - 'depends_on': u"eval:doc.purpose == 'Others'", + 'depends_on': u"eval:doc.purpose == 'Other'", 'description': u'Select "Yes" if stock is maintained and tracked for sub-assembly items. Select "No" if you want child items of sub-assembly for material transfer.', 'doctype': u'DocField', 'fieldname': u'consider_sa_items_as_raw_materials', From ac9adff1bbb33abc5a9de517e9717f26a18b234f Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Mar 2012 15:35:04 +0530 Subject: [PATCH 33/59] Update erpnext/stock/doctype/stock_entry/stock_entry.py --- erpnext/stock/doctype/stock_entry/stock_entry.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index c50a31b785..96642d0dc2 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -231,7 +231,7 @@ class DocType: bom_no = pro_obj.doc.bom_no fg_qty = (self.doc.process == 'Backflush') and flt(self.doc.fg_completed_qty) or flt(pro_obj.doc.qty) consider_sa_items_as_rm = pro_obj.doc.consider_sa_items - elif self.doc.purpose == 'Others': + elif self.doc.purpose == 'Other': self.validate_bom_no() bom_no = self.doc.bom_no fg_qty = self.doc.fg_completed_qty @@ -249,7 +249,7 @@ class DocType: sw = '' tw = cstr(pro_obj.doc.fg_warehouse) fg_item_dict = {cstr(pro_obj.doc.production_item) : [self.doc.fg_completed_qty, pro_obj.doc.description, pro_obj.doc.stock_uom]} - elif self.doc.purpose == 'Others' and self.doc.bom_no: + elif self.doc.purpose == 'Other' and self.doc.bom_no: sw, tw = '', '' item = sql("select item, description, uom from `tabBill Of Materials` where name = %s", self.doc.bom_no, as_dict=1) fg_item_dict = {item[0]['item'] : [self.doc.fg_completed_qty, item[0]['description'], item[0]['uom']]} @@ -427,7 +427,7 @@ class DocType: if cstr(d.s_warehouse) != cstr(pro_obj.doc.wip_warehouse): msgprint("As Item %s is Raw Material. Source Warehouse should be same as WIP Warehouse %s in Production Order %s, at Row No %s. " % ( cstr(d.item_code), cstr(pro_obj.doc.wip_warehouse), cstr(pro_obj.doc.name), cstr(d.idx))) raise Exception - if d.fg_item and (self.doc.purpose == 'Others' or self.doc.process == 'Backflush'): + if d.fg_item and (self.doc.purpose == 'Other' or self.doc.process == 'Backflush'): fg_qty = flt(fg_qty) + flt(d.transfer_qty) d.save() From c37cb4d7c33b0274bf025cbd5aee82a4dde4764b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Mar 2012 15:35:41 +0530 Subject: [PATCH 34/59] Update erpnext/stock/doctype/stock_entry/stock_entry.js --- erpnext/stock/doctype/stock_entry/stock_entry.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 99eab91e82..3593fa0c3c 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -25,14 +25,14 @@ var cfn_set_fields = function(doc, cdt, cdn) { lst = ['supplier','supplier_name','supplier_address','customer','customer_name','customer_address']; hide_field(lst); - if (doc.purpose == 'Production Order' || doc.purpose == 'Others'){ + 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']); if (doc.purpose=='Production Order') unhide_field(['production_order', 'process']); doc.from_warehouse = ''; doc.to_warehosue = ''; - if (doc.process == 'Backflush' || doc.purpose == 'Others'){ + if (doc.process == 'Backflush' || doc.purpose == 'Other'){ unhide_field('fg_completed_qty'); } else{ From 2a68bdf23139760f5d911c168f9dc7a1ea0bf1b6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Mar 2012 15:50:14 +0530 Subject: [PATCH 35/59] Update erpnext/stock/doctype/stock_entry/stock_entry.txt --- erpnext/stock/doctype/stock_entry/stock_entry.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.txt b/erpnext/stock/doctype/stock_entry/stock_entry.txt index b7790f7a54..9792fc91c5 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.txt +++ b/erpnext/stock/doctype/stock_entry/stock_entry.txt @@ -456,7 +456,7 @@ 'fieldname': u'bom_no', 'fieldtype': u'Link', 'label': u'BOM No', - 'options': u'Bill of Materials', + 'options': u'Bill Of Materials', 'permlevel': 0 }, From 830b8baa9dadcbac9a49b92be5daf02bfafad387 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Mar 2012 15:56:22 +0530 Subject: [PATCH 36/59] update bom no options in stock entry --- erpnext/patches/jan_mar_2012/update_se_fld_options.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 erpnext/patches/jan_mar_2012/update_se_fld_options.py diff --git a/erpnext/patches/jan_mar_2012/update_se_fld_options.py b/erpnext/patches/jan_mar_2012/update_se_fld_options.py new file mode 100644 index 0000000000..8e25237f92 --- /dev/null +++ b/erpnext/patches/jan_mar_2012/update_se_fld_options.py @@ -0,0 +1,3 @@ +def execute(): + import webnotes + webnotes.conn.sql("update `tabDocField` set options = 'Bill Of Materials' where fieldname = 'bom_no' and parent = 'Stock Entry'") From 93162f603d64907879abb5715dd816f1ead27dc6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Mar 2012 16:02:44 +0530 Subject: [PATCH 37/59] update bom no options in stock entry --- erpnext/patches/jan_mar_2012/update_se_fld_options.py | 3 +++ erpnext/patches/patch_list.py | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/erpnext/patches/jan_mar_2012/update_se_fld_options.py b/erpnext/patches/jan_mar_2012/update_se_fld_options.py index 8e25237f92..fab0b19827 100644 --- a/erpnext/patches/jan_mar_2012/update_se_fld_options.py +++ b/erpnext/patches/jan_mar_2012/update_se_fld_options.py @@ -1,3 +1,6 @@ def execute(): import webnotes webnotes.conn.sql("update `tabDocField` set options = 'Bill Of Materials' where fieldname = 'bom_no' and parent = 'Stock Entry'") + + from webnotes.modules.module_manager import reload_doc + reload_doc('stock', 'doctype', 'stock_entry') diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index db1daf1f00..3bf4b6a3ae 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -202,5 +202,10 @@ patch_list = [ 'patch_file': 'update_purpose_se', 'description': 'Purpose SE: Others to Other' }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'update_se_fld_options', + 'description': 'Purpose SE: Others to Other' + }, ] From d551281cbe45ace3c5eb6cb3f5070ebab2c14e05 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Mar 2012 16:57:08 +0530 Subject: [PATCH 38/59] cdt not defined fixed --- erpnext/accounts/doctype/payable_voucher/payable_voucher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js index 99bd24c6b8..f8ef91ec3e 100644 --- a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js +++ b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js @@ -162,7 +162,7 @@ cur_frm.cscript.is_opening = function(doc, dt, dn) { // Recalculate Button // ------------------- -cur_frm.cscript['Recalculate'] = function(doc, dt, dn) { +cur_frm.cscript['Recalculate'] = function(doc, cdt, cdn) { cur_frm.cscript['Calculate Tax'](doc,cdt,cdn); calc_total_advance(doc,cdt,cdn); } From 653536596d698747578e5ca79808917e12be7a8e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 21 Mar 2012 17:07:42 +0530 Subject: [PATCH 39/59] fax added in address display --- erpnext/utilities/transaction_base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/utilities/transaction_base.py b/erpnext/utilities/transaction_base.py index ee23c75fc9..032b52faa6 100644 --- a/erpnext/utilities/transaction_base.py +++ b/erpnext/utilities/transaction_base.py @@ -81,12 +81,12 @@ class TransactionBase: cond = 'name="%s"' % address_name if is_shipping_address: - details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where %s and docstatus != 2 order by is_shipping_address desc limit 1" % cond, as_dict = 1) + details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone, fax from `tabAddress` where %s and docstatus != 2 order by is_shipping_address desc limit 1" % cond, as_dict = 1) else: - details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone from `tabAddress` where %s and docstatus != 2 order by is_primary_address desc limit 1" % cond, as_dict = 1) + details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone, fax from `tabAddress` where %s and docstatus != 2 order by is_primary_address desc limit 1" % cond, as_dict = 1) extract = lambda x: details and details[0] and details[0].get(x,'') or '' - address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','phone')] + address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),(' ','pincode'),('\n','state'),('\n','country'),('\nPhone: ','phone'),('\nFax: ', 'fax')] address_display = ''.join([a[0]+extract(a[1]) for a in address_fields if extract(a[1])]) if address_display.startswith('\n'): address_display = address_display[1:] From 29ed95ba22e7da8ef3b336798c99b51d228b572a Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 21 Mar 2012 18:02:17 +0530 Subject: [PATCH 40/59] simple fixes in todo --- erpnext/utilities/page/todo/todo.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/utilities/page/todo/todo.js b/erpnext/utilities/page/todo/todo.js index dfaa7cdecf..0f1aa5c65d 100644 --- a/erpnext/utilities/page/todo/todo.js +++ b/erpnext/utilities/page/todo/todo.js @@ -45,10 +45,10 @@ erpnext.todo.ToDoItem = Class.extend({ 'Low':'' } todo.labelclass = label_map[todo.priority]; - todo.userdate = dateutil.str_to_user(todo.date); + todo.userdate = dateutil.str_to_user(todo.date) || ''; if(todo.reference_name && todo.reference_type) { todo.link = repl('\ - %(reference_name)s', todo); + %(reference_type)s: %(reference_name)s', todo); } else if(todo.reference_type) { todo.link = repl('\ %(reference_type)s', todo); @@ -60,7 +60,7 @@ erpnext.todo.ToDoItem = Class.extend({ %(priority)s\ %(userdate)s\ %(description)s\ - →\ + →  \ %(link)s\ ×\
    ', todo)); From bad13149b23fbc4b2971928137d6bc690ebba324 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 22 Mar 2012 10:24:26 +0530 Subject: [PATCH 41/59] item query changes in stock entry --- erpnext/stock/doctype/stock_entry/stock_entry.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 3593fa0c3c..b75538de8c 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -111,6 +111,7 @@ fld.get_query = function(doc, cdt, cdn) { +'AND ifnull(`tabBin`.`actual_qty`,0) > 0 ' +'AND tabBin.warehouse="'+ d.s_warehouse +'" ' +'AND tabItem.docstatus < 2 ' + +'(ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00")' +'AND tabItem.%(key)s LIKE "%s" ' +'ORDER BY tabItem.name ASC ' +'LIMIT 50' @@ -118,6 +119,7 @@ fld.get_query = function(doc, cdt, cdn) { return 'SELECT tabItem.name, tabItem.description ' +'FROM tabItem ' +'WHERE tabItem.docstatus < 2 ' + +'(ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00")' +'AND tabItem.%(key)s LIKE "%s" ' +'ORDER BY tabItem.name ASC ' +'LIMIT 50' From 2f82219fd0e7ec6962966ff102bc38b56aa80537 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 22 Mar 2012 10:32:06 +0530 Subject: [PATCH 42/59] item query changes in stock entry --- erpnext/stock/doctype/stock_entry/stock_entry.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index b75538de8c..07e83edc14 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -111,7 +111,7 @@ fld.get_query = function(doc, cdt, cdn) { +'AND ifnull(`tabBin`.`actual_qty`,0) > 0 ' +'AND tabBin.warehouse="'+ d.s_warehouse +'" ' +'AND tabItem.docstatus < 2 ' - +'(ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00")' + +'AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") ' +'AND tabItem.%(key)s LIKE "%s" ' +'ORDER BY tabItem.name ASC ' +'LIMIT 50' @@ -119,7 +119,7 @@ fld.get_query = function(doc, cdt, cdn) { return 'SELECT tabItem.name, tabItem.description ' +'FROM tabItem ' +'WHERE tabItem.docstatus < 2 ' - +'(ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00")' + +'AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") ' +'AND tabItem.%(key)s LIKE "%s" ' +'ORDER BY tabItem.name ASC ' +'LIMIT 50' From 06fcfdfcdebed1cd3bca1de72642f50cc612f519 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 22 Mar 2012 11:01:38 +0530 Subject: [PATCH 43/59] assign to - allow comments --- erpnext/utilities/page/todo/todo.css | 4 ++-- erpnext/utilities/page/todo/todo.js | 7 ++++++- js/all-app.js | 2 +- version.num | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/erpnext/utilities/page/todo/todo.css b/erpnext/utilities/page/todo/todo.css index 4ac49d621c..01a4d243a9 100644 --- a/erpnext/utilities/page/todo/todo.css +++ b/erpnext/utilities/page/todo/todo.css @@ -20,7 +20,7 @@ .todoitem .ref_link { float: left; - margin-left: 14px; + margin-left: 10px; display: inline-block; line-height: 18px; } @@ -28,4 +28,4 @@ .todoitem .description { cursor: pointer; float: left; -} \ No newline at end of file +} diff --git a/erpnext/utilities/page/todo/todo.js b/erpnext/utilities/page/todo/todo.js index 0f1aa5c65d..d9fd7a7db4 100644 --- a/erpnext/utilities/page/todo/todo.js +++ b/erpnext/utilities/page/todo/todo.js @@ -46,6 +46,11 @@ erpnext.todo.ToDoItem = Class.extend({ } todo.labelclass = label_map[todo.priority]; todo.userdate = dateutil.str_to_user(todo.date) || ''; + if(todo.assigned_by) { + todo.fullname = repl("[By %(fullname)s] ", { + fullname: wn.boot.user_info[todo.assigned_by].fullname + }) + } if(todo.reference_name && todo.reference_type) { todo.link = repl('\ %(reference_type)s: %(reference_name)s', todo); @@ -59,7 +64,7 @@ erpnext.todo.ToDoItem = Class.extend({ \ %(priority)s\ %(userdate)s\ - %(description)s\ + %(fullname)s%(description)s\ →  \ %(link)s\ ×\ diff --git a/js/all-app.js b/js/all-app.js index abb3c085aa..6987da6e57 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -2170,7 +2170,7 @@ wn.widgets.form.sidebar.AssignTo=Class.extend({init:function(parent,sidebar,doct this.refresh();},refresh:function(){var me=this;$c('webnotes.widgets.form.assign_to.get',{doctype:me.doctype,name:me.name},function(r,rt){me.render(r.message)})},render:function(d){var me=this;$(this.body).empty();if(this.dialog){this.dialog.hide();} for(var i=0;i%(owner)s \ ×',d[i]))} -$(this.body).find('a.close').click(function(){$c('webnotes.widgets.form.assign_to.remove',{doctype:me.doctype,name:me.name,assign_to:$(this).attr('data-owner')},function(r,rt){me.render(r.message);});return false;});},add:function(){var me=this;if(!me.dialog){me.dialog=new wn.widgets.Dialog({title:'Add to To Do',width:350,fields:[{fieldtype:'Link',fieldname:'assign_to',options:'Profile',label:'Assign To',description:'Add to To Do List of',reqd:true},{fieldtype:'Data',fieldname:'description',label:'Comment','default':'Assigned by '+user},{fieldtype:'Date',fieldname:'date',label:'Complete By'},{fieldtype:'Select',fieldname:'priority',label:'Priority',options:'Low\nMedium\nHigh','default':'Medium'},{fieldtype:'Check',fieldname:'notify',label:'Notify By Email'},{fieldtype:'Button',label:'Add',fieldname:'add_btn'}]});me.dialog.fields_dict.add_btn.input.onclick=function(){var assign_to=me.dialog.fields_dict.assign_to.get_value();if(assign_to){$c('webnotes.widgets.form.assign_to.add',{doctype:me.doctype,name:me.name,assign_to:assign_to,description:me.dialog.fields_dict.description.get_value(),priority:me.dialog.fields_dict.priority.get_value(),date:me.dialog.fields_dict.date.get_value(),notify:me.dialog.fields_dict.notify.get_value()},function(r,rt){me.render(r.message);});}}} +$(this.body).find('a.close').click(function(){$c('webnotes.widgets.form.assign_to.remove',{doctype:me.doctype,name:me.name,assign_to:$(this).attr('data-owner')},function(r,rt){me.render(r.message);});return false;});},add:function(){var me=this;if(!me.dialog){me.dialog=new wn.widgets.Dialog({title:'Add to To Do',width:350,fields:[{fieldtype:'Link',fieldname:'assign_to',options:'Profile',label:'Assign To',description:'Add to To Do List of',reqd:true},{fieldtype:'Data',fieldname:'description',label:'Comment'},{fieldtype:'Date',fieldname:'date',label:'Complete By'},{fieldtype:'Select',fieldname:'priority',label:'Priority',options:'Low\nMedium\nHigh','default':'Medium'},{fieldtype:'Check',fieldname:'notify',label:'Notify By Email'},{fieldtype:'Button',label:'Add',fieldname:'add_btn'}]});me.dialog.fields_dict.add_btn.input.onclick=function(){var assign_to=me.dialog.fields_dict.assign_to.get_value();if(assign_to){$c('webnotes.widgets.form.assign_to.add',{doctype:me.doctype,name:me.name,assign_to:assign_to,description:me.dialog.fields_dict.description.get_value(),priority:me.dialog.fields_dict.priority.get_value(),date:me.dialog.fields_dict.date.get_value(),notify:me.dialog.fields_dict.notify.get_value()},function(r,rt){me.render(r.message);});}}} me.dialog.clear();me.dialog.show();}}); /* * lib/js/legacy/app.js diff --git a/version.num b/version.num index f08bce7b1c..3f986b9191 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -841 \ No newline at end of file +842 \ No newline at end of file From 98f847c01f03b25fbd4bce636639036295e8fc72 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 22 Mar 2012 11:18:28 +0530 Subject: [PATCH 44/59] fix in todo --- erpnext/utilities/page/todo/todo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/utilities/page/todo/todo.js b/erpnext/utilities/page/todo/todo.js index d9fd7a7db4..dcdf50aa9d 100644 --- a/erpnext/utilities/page/todo/todo.js +++ b/erpnext/utilities/page/todo/todo.js @@ -50,7 +50,7 @@ erpnext.todo.ToDoItem = Class.extend({ todo.fullname = repl("[By %(fullname)s] ", { fullname: wn.boot.user_info[todo.assigned_by].fullname }) - } + } else { todo.fullname = ''; } if(todo.reference_name && todo.reference_type) { todo.link = repl('\ %(reference_type)s: %(reference_name)s', todo); From 358304d21657537a4e969ac05cb0face0a95d699 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 23 Mar 2012 11:12:03 +0530 Subject: [PATCH 45/59] fix in sales common regarding date formatting --- erpnext/selling/doctype/sales_common/sales_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/sales_common/sales_common.py b/erpnext/selling/doctype/sales_common/sales_common.py index 63f53eab7b..5c1a8e451f 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.py +++ b/erpnext/selling/doctype/sales_common/sales_common.py @@ -515,7 +515,7 @@ class DocType(TransactionBase): dt = webnotes.conn.sql("select posting_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname)) else: dt = webnotes.conn.sql("select transaction_date from `tab%s` where name = '%s'" % (d.prevdoc_doctype, d.prevdoc_docname)) - d.prevdoc_date = dt and dt[0][0].strftime('%Y-%m-%d') or '' + d.prevdoc_date = (dt and dt[0][0]) and dt[0][0].strftime('%Y-%m-%d') or '' def update_prevdoc_detail(self, is_submit, obj): StatusUpdater(obj, is_submit).update() From f23d18316ac093cbdadccd45ead8b6d391b51ee9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 26 Mar 2012 10:53:45 +0530 Subject: [PATCH 46/59] modified item code get_query in purchase cycle --- erpnext/buying/doctype/purchase_common/purchase_common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index f0f24a0eca..f258f110ed 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -162,7 +162,7 @@ cur_frm.cscript.conversion_rate = function(doc,cdt,cdn) { //==================== Item Code Get Query ======================================================= // Only Is Purchase Item = 'Yes' and Items not moved to trash are allowed. cur_frm.fields_dict[fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { - return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE (ifnull(tabItem.is_purchase_item, "No")="Yes" or ifnull(tabItem.is_sub_contracted_item, "No")="Yes") AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.%(key)s LIKE "%s" LIMIT 50' + return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE (ifnull(tabItem.is_purchase_item, "No")="Yes" or ifnull(tabItem.is_sub_contracted_item, "No")="Yes") AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' } //==================== Get Item Code Details ===================================================== From 964dee9f18f6be0b2d58ae5391eedd20805f90d3 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 26 Mar 2012 10:54:05 +0530 Subject: [PATCH 47/59] fix in stock reconciliation --- .../stock/doctype/stock_reconciliation/stock_reconciliation.py | 3 +-- erpnext/stock/doctype/warehouse/warehouse.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 8ea8273e95..08ef1bcac9 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -59,8 +59,7 @@ class DocType: self.validate_item(s[0], count) self.validate_warehouse(s[1], count) - # encode as ascii - self.data.append([d.encode("ascii") for d in s]) + self.data.append(s) count += 1 if not self.validated: diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py index 8b08fab098..f04f4eec4c 100644 --- a/erpnext/stock/doctype/warehouse/warehouse.py +++ b/erpnext/stock/doctype/warehouse/warehouse.py @@ -39,7 +39,8 @@ class DocType: self.doclist = doclist def get_bin(self, item_code): - bin = sql("select name from tabBin where item_code = '%s' and warehouse = '%s'" % (item_code, self.doc.name)) + bin = sql("select name from tabBin where item_code = %s and \ + warehouse = %s", (item_code, self.doc.name)) bin = bin and bin[0][0] or '' if not bin: if not self.doc.warehouse_type : From 68764ce775a0c0c9f7b89fe50b7f0ba9ef323e68 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 26 Mar 2012 11:16:41 +0530 Subject: [PATCH 48/59] modified item code get_query in purchase cycle --- erpnext/buying/doctype/purchase_common/purchase_common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index f258f110ed..b1c88f6626 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -162,7 +162,7 @@ cur_frm.cscript.conversion_rate = function(doc,cdt,cdn) { //==================== Item Code Get Query ======================================================= // Only Is Purchase Item = 'Yes' and Items not moved to trash are allowed. cur_frm.fields_dict[fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { - return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE (ifnull(tabItem.is_purchase_item, "No")="Yes" or ifnull(tabItem.is_sub_contracted_item, "No")="Yes") AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' + return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE (ifnull(tabItem.is_purchase_item, "No")="Yes" or ifnull(tabItem.is_sub_contracted_item, "No")="' + (doc.is_subcontracted=="Yes"?"Yes":"No") + '") AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' } //==================== Get Item Code Details ===================================================== From 2bd086f1c346f4e39c799377a94eefa7da78c252 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 26 Mar 2012 11:25:31 +0530 Subject: [PATCH 49/59] modified item code get_query in purchase cycle --- erpnext/buying/doctype/purchase_common/purchase_common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index b1c88f6626..f258f110ed 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -162,7 +162,7 @@ cur_frm.cscript.conversion_rate = function(doc,cdt,cdn) { //==================== Item Code Get Query ======================================================= // Only Is Purchase Item = 'Yes' and Items not moved to trash are allowed. cur_frm.fields_dict[fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { - return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE (ifnull(tabItem.is_purchase_item, "No")="Yes" or ifnull(tabItem.is_sub_contracted_item, "No")="' + (doc.is_subcontracted=="Yes"?"Yes":"No") + '") AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' + return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE (ifnull(tabItem.is_purchase_item, "No")="Yes" or ifnull(tabItem.is_sub_contracted_item, "No")="Yes") AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' } //==================== Get Item Code Details ===================================================== From ea36202fbf8130d9a640413c78fe104fc95c7929 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 26 Mar 2012 11:33:03 +0530 Subject: [PATCH 50/59] modified item code get_query in purchase cycle --- erpnext/buying/doctype/purchase_common/purchase_common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index f258f110ed..ad822b5ab0 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -162,7 +162,7 @@ cur_frm.cscript.conversion_rate = function(doc,cdt,cdn) { //==================== Item Code Get Query ======================================================= // Only Is Purchase Item = 'Yes' and Items not moved to trash are allowed. cur_frm.fields_dict[fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { - return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE (ifnull(tabItem.is_purchase_item, "No")="Yes" or ifnull(tabItem.is_sub_contracted_item, "No")="Yes") AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' + return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE (ifnull(tabItem.is_purchase_item, "No")="Yes"'+ (doc.is_sucontracted=="Yes" ? ' AND ifnull(tabItem.is_sub_contracted_item, "No")="Yes"' : '') + ' AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' } //==================== Get Item Code Details ===================================================== From 9329b5a461bb49200b2a1cbca0c8d13692b609ba Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 26 Mar 2012 11:52:16 +0530 Subject: [PATCH 51/59] modified item code get_query in purchase cycle --- erpnext/buying/doctype/purchase_common/purchase_common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index ad822b5ab0..8c3bb3ba35 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -162,7 +162,7 @@ cur_frm.cscript.conversion_rate = function(doc,cdt,cdn) { //==================== Item Code Get Query ======================================================= // Only Is Purchase Item = 'Yes' and Items not moved to trash are allowed. cur_frm.fields_dict[fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { - return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE (ifnull(tabItem.is_purchase_item, "No")="Yes"'+ (doc.is_sucontracted=="Yes" ? ' AND ifnull(tabItem.is_sub_contracted_item, "No")="Yes"' : '') + ' AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' + return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE ifnull(tabItem.is_purchase_item, "No")="Yes"'+ (doc.is_subcontracted=="Yes" ? ' AND ifnull(tabItem.is_sub _contracted_item, "No")="Yes"' : '') + ' AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.do cstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' } //==================== Get Item Code Details ===================================================== From eecea8ef194bd524f0d49e4a9710f67ae086674e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 26 Mar 2012 13:11:15 +0530 Subject: [PATCH 52/59] modified item code get_query in purchase cycle --- erpnext/buying/doctype/purchase_common/purchase_common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index 8c3bb3ba35..9adb08a8ae 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -162,7 +162,7 @@ cur_frm.cscript.conversion_rate = function(doc,cdt,cdn) { //==================== Item Code Get Query ======================================================= // Only Is Purchase Item = 'Yes' and Items not moved to trash are allowed. cur_frm.fields_dict[fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { - return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE ifnull(tabItem.is_purchase_item, "No")="Yes"'+ (doc.is_subcontracted=="Yes" ? ' AND ifnull(tabItem.is_sub _contracted_item, "No")="Yes"' : '') + ' AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.do cstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' + return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE ifnull(tabItem.is_purchase_item, "No")="Yes"'+ (doc.is_subcontracted=="Yes" ? ' AND ifnull(tabItem.is_sub_contracted_item, "No")="Yes"' : '') + ' AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' } //==================== Get Item Code Details ===================================================== From b66ade11e0974347731b09b8ab24f6f27f8f4deb Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 26 Mar 2012 15:30:11 +0530 Subject: [PATCH 53/59] modified item code get_query in purchase cycle --- erpnext/buying/doctype/purchase_common/purchase_common.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index 9adb08a8ae..89094e9a00 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -162,7 +162,11 @@ cur_frm.cscript.conversion_rate = function(doc,cdt,cdn) { //==================== Item Code Get Query ======================================================= // Only Is Purchase Item = 'Yes' and Items not moved to trash are allowed. cur_frm.fields_dict[fname].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { - return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE ifnull(tabItem.is_purchase_item, "No")="Yes"'+ (doc.is_subcontracted=="Yes" ? ' AND ifnull(tabItem.is_sub_contracted_item, "No")="Yes"' : '') + ' AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' + if (doc.is_subcontracted =="Yes") { + return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE ifnull(tabItem.is_sub_contracted_item, "No")="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' + } else { + return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE ifnull(tabItem.is_purchase_item, "No")="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' + } } //==================== Get Item Code Details ===================================================== From 854935f12c9a11df9b363ac2d58c2a3e25ee39a1 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 26 Mar 2012 15:40:56 +0530 Subject: [PATCH 54/59] added docstatus in item get_query in PV --- erpnext/accounts/doctype/payable_voucher/payable_voucher.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js index f8ef91ec3e..0bba213137 100644 --- a/erpnext/accounts/doctype/payable_voucher/payable_voucher.js +++ b/erpnext/accounts/doctype/payable_voucher/payable_voucher.js @@ -254,7 +254,7 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) { // Item Code // ---------- cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) { - return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE tabItem.is_purchase_item="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.%(key)s LIKE "%s" LIMIT 50' + return 'SELECT tabItem.name, tabItem.description FROM tabItem WHERE tabItem.is_purchase_item="Yes" AND (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` ="0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50' } // Credit To From 063fe503db9a398b2a70fefd05e256144c21617c Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 26 Mar 2012 22:32:34 +0530 Subject: [PATCH 55/59] fix in queries in stock reconciliation --- .../doctype/stock_reconciliation/stock_reconciliation.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py index 08ef1bcac9..86cb099f92 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.py @@ -75,7 +75,8 @@ class DocType: def validate_item(self, item, count): """ Validate item exists and non-serialized""" - det = sql("select item_code, has_serial_no from `tabItem` where name = '%s'"% cstr(item), as_dict = 1) + det = sql("select item_code, has_serial_no from `tabItem` \ + where name = %s", cstr(item), as_dict = 1) if not det: msgprint("Item: " + cstr(item) + " mentioned at Row No. " + cstr(count) + "does not exist in the system") self.validated = 0 @@ -88,7 +89,7 @@ class DocType: def validate_warehouse(self, wh, count,): """Validate warehouse exists""" - if not sql("select name from `tabWarehouse` where name = '%s'" % cstr(wh)): + if not sql("select name from `tabWarehouse` where name = %s", cstr(wh)): msgprint("Warehouse: " + cstr(wh) + " mentioned at Row No. " + cstr(count) + " does not exist in the system") self.validated = 0 From 6ed0450dba393b53991b602695f156b5b847501b Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 28 Mar 2012 11:32:44 +0530 Subject: [PATCH 56/59] reload mapper for checking ref value --- .../Delivery Note-Receivable Voucher.txt | 12 +++++++++++- .../Sales Order-Receivable Voucher.txt | 12 +++++++++++- erpnext/patches/jan_mar_2012/reload_mapper.py | 7 +++++++ erpnext/patches/patch_list.py | 5 +++++ .../Sales Order-Delivery Note.txt | 6 +++--- 5 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 erpnext/patches/jan_mar_2012/reload_mapper.py diff --git a/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt b/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt index 9ed756f023..185af99c26 100644 --- a/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt +++ b/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt @@ -134,6 +134,16 @@ 'to_field': 'serial_no' }, + # Field Mapper Detail + { + 'checking_operator': u'=', + 'doctype': u'Field Mapper Detail', + 'from_field': u'export_rate', + 'map': u'Yes', + 'match_id': 1, + 'to_field': u'export_rate' + }, + # Table Mapper Detail { 'doctype': 'Table Mapper Detail', @@ -186,4 +196,4 @@ 'to_table': 'Sales Team', 'validation_logic': 'name is not null' } -] \ No newline at end of file +] diff --git a/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt b/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt index 630fb1502a..fb180ff1f8 100644 --- a/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt +++ b/erpnext/accounts/DocType Mapper/Sales Order-Receivable Voucher/Sales Order-Receivable Voucher.txt @@ -136,6 +136,16 @@ 'to_field': 'incentives' }, + # Field Mapper Detail + { + 'checking_operator': u'=', + 'doctype': u'Field Mapper Detail', + 'from_field': u'export_rate', + 'map': u'Yes', + 'match_id': 1, + 'to_field': u'export_rate' + }, + # Table Mapper Detail { 'doctype': 'Table Mapper Detail', @@ -188,4 +198,4 @@ 'to_table': 'Sales Team', 'validation_logic': 'name is not null' } -] \ No newline at end of file +] diff --git a/erpnext/patches/jan_mar_2012/reload_mapper.py b/erpnext/patches/jan_mar_2012/reload_mapper.py new file mode 100644 index 0000000000..3a43d871b9 --- /dev/null +++ b/erpnext/patches/jan_mar_2012/reload_mapper.py @@ -0,0 +1,7 @@ +def execute(): + import webnotes + from webnotes.modules.module_manager import reload_doc + + reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note') + reload_doc('accounts', 'DocType Mapper', 'Sales Order-Receivable Voucher') + reload_doc('accounts', 'DocType Mapper', 'Delivery Note-Receivable Voucher') diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 3bf4b6a3ae..247f5d88ea 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -207,5 +207,10 @@ patch_list = [ 'patch_file': 'update_se_fld_options', 'description': 'Purpose SE: Others to Other' }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'reload_mapper', + 'description': 'SO-DN, SO-Rv, DN-RV' + }, ] diff --git a/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt b/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt index fcadcd4245..43e800fef3 100644 --- a/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt +++ b/erpnext/stock/DocType Mapper/Sales Order-Delivery Note/Sales Order-Delivery Note.txt @@ -131,10 +131,10 @@ { 'checking_operator': u'=', 'doctype': u'Field Mapper Detail', - 'from_field': u'basic_rate', + 'from_field': u'export_rate', 'map': u'Yes', 'match_id': 1, - 'to_field': u'basic_rate' + 'to_field': u'export_rate' }, # Field Mapper Detail @@ -264,4 +264,4 @@ 'to_table': u'Delivery Note', 'validation_logic': u'docstatus = 1' } -] \ No newline at end of file +] From 13f789701efeb273de65985fbbaa07a3b0bfbb88 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 28 Mar 2012 11:33:25 +0530 Subject: [PATCH 57/59] erro fixed in reorder_item --- erpnext/stock/doctype/bin/bin.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index dc847f6f6a..de2d1315c4 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -337,12 +337,12 @@ class DocType: and t1.docstatus != 2 """, self.doc.item_code) - if ((flt(ret[0]['re_order_level']) > flt(current_qty)) and ret[0]['re_order_level']): - self.create_auto_indent(ret[0], doc_type, doc_name) + if ((flt(ret[0]['re_order_level']) > flt(current_qty[0][0])) and ret[0]['re_order_level']): + self.create_auto_indent(ret[0], doc_type, doc_name, current_qty[0][0]) - def create_auto_indent(self, i , doc_type, doc_name): + def create_auto_indent(self, i , doc_type, doc_name, cur_qty): """ Create indent on reaching reorder level """ indent = Document('Indent') @@ -361,7 +361,7 @@ class DocType: indent_details_child.item_name = i['item_name'] indent_details_child.description = i['description'] indent_details_child.item_group = i['item_group'] - indent_details_child.qty = i['re_order_qty'] + indent_details_child.qty = i['re_order_qty'] or (flt(i['re_order_level']) - flt(cur_qty)) indent_details_child.brand = i['brand'] indent_details_child.save() indent_obj = get_obj('Indent',indent.name,with_children=1) From 5b00addaf777cbf708ba58f969ee676d36dee726 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 28 Mar 2012 11:38:25 +0530 Subject: [PATCH 58/59] reload mapper for checking ref value --- erpnext/patches/jan_mar_2012/reload_mapper.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erpnext/patches/jan_mar_2012/reload_mapper.py b/erpnext/patches/jan_mar_2012/reload_mapper.py index 3a43d871b9..a6e3102bba 100644 --- a/erpnext/patches/jan_mar_2012/reload_mapper.py +++ b/erpnext/patches/jan_mar_2012/reload_mapper.py @@ -5,3 +5,5 @@ def execute(): reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note') reload_doc('accounts', 'DocType Mapper', 'Sales Order-Receivable Voucher') reload_doc('accounts', 'DocType Mapper', 'Delivery Note-Receivable Voucher') + + webnotes.conn.sql("delete from `tabField Mapper Detail` where parent = 'Sales Order-Delivery Note' and from_field = 'basic_rate' and to_field = 'basic_rate'") From e6340f26c2861545dfffb61177a2b9170d598101 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 28 Mar 2012 14:11:31 +0530 Subject: [PATCH 59/59] mapper fix in DN_RV --- .../Delivery Note-Receivable Voucher.txt | 11 ----------- erpnext/patches/jan_mar_2012/mapper_fix.py | 3 +++ erpnext/patches/patch_list.py | 5 +++++ 3 files changed, 8 insertions(+), 11 deletions(-) create mode 100644 erpnext/patches/jan_mar_2012/mapper_fix.py diff --git a/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt b/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt index 185af99c26..7a4544fff8 100644 --- a/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt +++ b/erpnext/accounts/DocType Mapper/Delivery Note-Receivable Voucher/Delivery Note-Receivable Voucher.txt @@ -153,17 +153,6 @@ 'validation_logic': 'docstatus=1' }, - # Table Mapper Detail - { - 'doctype': 'Table Mapper Detail', - 'from_field': 'delivery_note_details', - 'from_table': 'Delivery Note Detail', - 'match_id': 1, - 'to_field': 'entries', - 'to_table': 'RV Detail', - 'validation_logic': 'amount > ifnull(billed_amt, 0) and docstatus = 1' - }, - # Table Mapper Detail { 'doctype': 'Table Mapper Detail', diff --git a/erpnext/patches/jan_mar_2012/mapper_fix.py b/erpnext/patches/jan_mar_2012/mapper_fix.py new file mode 100644 index 0000000000..c651c5ed74 --- /dev/null +++ b/erpnext/patches/jan_mar_2012/mapper_fix.py @@ -0,0 +1,3 @@ +def execute(): + import webnotes + webnotes.conn.sql("delete from `tabTable Mapper Detail` where to_table = 'RV Detail' and parent = 'Delivery Note-Receivable Voucher' and validation_logic = 'amount > ifnull(billed_amt, 0) and docstatus = 1'") diff --git a/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 247f5d88ea..5e6a50423d 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -212,5 +212,10 @@ patch_list = [ 'patch_file': 'reload_mapper', 'description': 'SO-DN, SO-Rv, DN-RV' }, + { + 'patch_module': 'patches.jan_mar_2012', + 'patch_file': 'mapper_fix', + 'description': 'DN-RV duplicate table entry' + }, ]