From 1c2ac00a8294552f3434ef07e13ca71d0baaf7af Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 13 Apr 2012 11:38:01 +0530 Subject: [PATCH] fixes in sales cycle --- .../accounts/doctype/gl_control/gl_control.py | 37 ------------------- .../purchase_invoice/purchase_invoice.py | 5 --- .../doctype/sales_invoice/sales_invoice.js | 5 +-- .../doctype/sales_invoice/sales_invoice.py | 7 ---- .../doctype/sales_order/sales_order.js | 4 +- .../doctype/sales_order/sales_order.py | 4 -- .../doctype/delivery_note/delivery_note.js | 4 +- .../doctype/delivery_note/delivery_note.py | 4 -- .../stock/doctype/stock_entry/stock_entry.js | 6 +-- .../stock_reconciliation.js | 2 +- .../doctype/customer_issue/customer_issue.js | 4 +- js/all-app.js | 4 +- version.num | 2 +- 13 files changed, 14 insertions(+), 74 deletions(-) diff --git a/erpnext/accounts/doctype/gl_control/gl_control.py b/erpnext/accounts/doctype/gl_control/gl_control.py index 2ff5a1fa43..5be3809ee3 100644 --- a/erpnext/accounts/doctype/gl_control/gl_control.py +++ b/erpnext/accounts/doctype/gl_control/gl_control.py @@ -450,43 +450,6 @@ class DocType: if not ret: msgprint("Payment Entry has been modified after you pulled it. Please pull it again.", raise_exception=1) -###################################################################################################################### - - - - # Repair Outstanding Amount - #--------------------------------- - def repair_voucher_outstanding(self, voucher_obj): - msg = [] - - # Get Balance from GL Entries - bal = webnotes.conn.sql("select sum(debit)-sum(credit) from `tabGL Entry` where against_voucher=%s and against_voucher_type=%s", (voucher_obj.doc.name , voucher_obj.doc.doctype)) - bal = bal and flt(bal[0][0]) or 0.0 - if cstr(voucher_obj.doc.doctype) == 'Purchase Invoice': - bal = -bal - - # Check outstanding Amount - if flt(voucher_obj.doc.outstanding_amount) != flt(bal): - msgprint('
Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s)
' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal)) - msg.append('
Difference found in Outstanding Amount of %s : %s (Before : %s; After : %s)
' % (voucher_obj.doc.doctype, voucher_obj.doc.name, voucher_obj.doc.outstanding_amount, bal)) - - # set voucher balance - #webnotes.conn.sql("update `tab%s` set outstanding_amount=%s where name='%s'" % (voucher_obj.doc.doctype, bal, voucher_obj.doc.name)) - webnotes.conn.set(voucher_obj.doc, 'outstanding_amount', flt(bal)) - - # Send Mail - if msg: - email_msg = """ Dear Administrator, - -In Account := %s User := %s has Repaired Outstanding Amount For %s : %s and following was found:- - -%s - -""" % (webnotes.conn.get_value('Control Panel', None,'account_id'), session['user'], voucher_obj.doc.doctype, voucher_obj.doc.name, '\n'.join(msg)) - - sendmail(['support@iwebnotes.com'], subject='Repair Outstanding Amount', parts = [('text/plain', email_msg)]) - # Acknowledge User - msgprint(cstr(voucher_obj.doc.doctype) + " : " + cstr(voucher_obj.doc.name) + " has been checked" + cstr(msg and " and repaired successfully." or ". No changes Found.")) def repost_illegal_cancelled(self, after_date='2011-01-01'): """ diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index 9b3968da2a..be62c93b24 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -558,8 +558,3 @@ class DocType(TransactionBase): def on_update(self): pass -######################################################################## -# Repair Outstanding -####################################################################### - def repair_pv_outstanding(self): - get_obj(dt = 'GL Control').repair_voucher_outstanding(self) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js index 0a25feb104..a2d9f6a753 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.js +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.js @@ -79,7 +79,7 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) { 'source', 'cancel_reason', 'total_advance', 'gross_profit', 'gross_profit_percent', 'get_advances_received', 'advance_adjustment_details', 'sales_partner', 'commission_rate', - 'total_commission', 'repair_outstanding_amt']; + 'total_commission']; item_flds_normal = ['sales_order', 'delivery_note'] item_flds_pos = ['warehouse', 'serial_no', 'batch_no', 'actual_qty', 'delivered_qty'] @@ -115,7 +115,6 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { if(doc.docstatus==1) { cur_frm.add_custom_button('View Ledger', cur_frm.cscript.view_ledger_entry); cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); - unhide_field('repair_outstanding_amt'); if(doc.is_pos==1 && doc.update_stock!=1) cur_frm.add_custom_button('Make Delivery', cur_frm.cscript['Make Delivery Note']); @@ -123,8 +122,6 @@ cur_frm.cscript.refresh = function(doc, dt, dn) { if(doc.outstanding_amount!=0) cur_frm.add_custom_button('Make Payment Entry', cur_frm.cscript.make_bank_voucher); } - else - hide_field('repair_outstanding_amt'); } //fetch retail transaction related fields diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index d89ff042d1..6c956a0dae 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -679,13 +679,6 @@ class DocType(TransactionBase): webnotes.conn.set(self.doc,'outstanding_amount',flt(self.doc.grand_total) - flt(self.doc.total_advance) - flt(self.doc.paid_amount) - flt(self.doc.write_off_amount)) -######################################################################## -# Repair Outstanding - - def repair_rv_outstanding(self): - get_obj(dt = 'GL Control').repair_voucher_outstanding(self) - - #------------------------------------------------------------------------------------- def on_update_after_submit(self): self.convert_into_recurring() diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index dbfd3916fb..43f53b0316 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -92,9 +92,9 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']); } - unhide_field(['repair_sales_order', 'Send SMS', 'message', 'customer_mobile_no']) + unhide_field(['Send SMS', 'message', 'customer_mobile_no']) } else { - hide_field(['repair_sales_order', 'Send SMS', 'message', 'customer_mobile_no']) + hide_field(['Send SMS', 'message', 'customer_mobile_no']) } } diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py index 3270f988ce..6fa737c58f 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.py +++ b/erpnext/selling/doctype/sales_order/sales_order.py @@ -509,7 +509,3 @@ class DocType(TransactionBase): def on_update(self): pass - # Repair Sales Order - # =========================================== - def repair_sales_order(self): - get_obj('Sales Common', 'Sales Common').repair_curr_doctype_details(self) diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.js b/erpnext/stock/doctype/delivery_note/delivery_note.js index 8e158979e6..99c0a73dbb 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.js +++ b/erpnext/stock/doctype/delivery_note/delivery_note.js @@ -64,10 +64,10 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) { if(doc.per_installed < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Installation Note', cur_frm.cscript['Make Installation Note']); if (doc.docstatus!=1) { - hide_field(['SMS', 'Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']); + hide_field(['Send SMS', 'message', 'customer_mobile_no'); } else { cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms); - unhide_field(['SMS','Send SMS', 'message', 'customer_mobile_no', 'Repair Delivery Note']); + unhide_field(['Send SMS', 'message', 'customer_mobile_no'); } if(doc.docstatus==0 && !doc.__islocal) { diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 49d70325b4..ffa656231f 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -487,8 +487,4 @@ class DocType(TransactionBase): self.set_actual_qty() get_obj('Stock Ledger').scrub_serial_nos(self) - # Repair Delivery Note - # =========================================== - def repair_delivery_note(self): - get_obj('Sales Common', 'Sales Common').repair_curr_doctype_details(self) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 07e83edc14..3f371738b0 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -26,8 +26,8 @@ var cfn_set_fields = function(doc, cdt, cdn) { hide_field(lst); if (doc.purpose == 'Production Order' || doc.purpose == 'Other'){ - unhide_field('Get Items'); - hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no','delivery_note_no', 'sales_invoice_no','Warehouse HTML', 'transporter', 'is_excisable_goods', 'excisable_goods']); + unhide_field('get_items'); + hide_field(['from_warehouse', 'to_warehouse','purchase_receipt_no','delivery_note_no', 'sales_invoice_no','warehouse_html', 'transporter', 'is_excisable_goods', 'excisable_goods']); if (doc.purpose=='Production Order') unhide_field(['production_order', 'process']); doc.from_warehouse = ''; @@ -42,7 +42,7 @@ var cfn_set_fields = function(doc, cdt, cdn) { } else{ unhide_field(['from_warehouse', 'to_warehouse']); - hide_field(['production_order', 'process', 'Get Items', 'fg_completed_qty','purchase_receipt_no','delivery_note_no', 'sales_invoice_no']); + hide_field(['production_order', 'process', 'get_items', 'fg_completed_qty','purchase_receipt_no','delivery_note_no', 'sales_invoice_no']); doc.production_order = ''; doc.process = ''; doc.fg_completed_qty = 0; diff --git a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js index a297e0badb..941b863cfd 100644 --- a/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js +++ b/erpnext/stock/doctype/stock_reconciliation/stock_reconciliation.js @@ -15,7 +15,7 @@ // along with this program. If not, see . cur_frm.cscript.refresh = function(doc) { - if (doc.docstatus) hide_field('Steps'); + if (doc.docstatus) hide_field('steps'); } cur_frm.cscript.download_template = function(doc, cdt, cdn) { diff --git a/erpnext/support/doctype/customer_issue/customer_issue.js b/erpnext/support/doctype/customer_issue/customer_issue.js index cb909ac4ac..699c97f637 100644 --- a/erpnext/support/doctype/customer_issue/customer_issue.js +++ b/erpnext/support/doctype/customer_issue/customer_issue.js @@ -22,8 +22,8 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){ } cur_frm.cscript.refresh = function(doc,ct,cdn){ - if(!doc.docstatus) hide_field('Make Maintenance Visit'); - else if(doc.docstatus && (doc.status == 'Open' || doc.status == 'Work In Progress')) unhide_field('Make Maintenance Visit'); + if(!doc.docstatus) hide_field('make_maintenance_visit'); + else if(doc.docstatus && (doc.status == 'Open' || doc.status == 'Work In Progress')) unhide_field('make_maintenance_visit'); } diff --git a/js/all-app.js b/js/all-app.js index 6db411f8c5..ba2dbf5a44 100644 --- a/js/all-app.js +++ b/js/all-app.js @@ -2031,9 +2031,9 @@ _f.frm_dialog.cur_frm.fields_dict[n].refresh();}else{var g=_f.cur_grid_cell;if(g cur_frm.fields_dict[n].refresh();}} set_field_options=function(n,txt){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df)df.options=txt;refresh_field(n);} set_field_permlevel=function(n,level){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df)df.permlevel=level;refresh_field(n);} -hide_field=function(n){function _hide_field(n,hidden){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df)df.hidden=hidden;refresh_field(n);} +hide_field=function(n){function _hide_field(n,hidden){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df)df.hidden=hidden;refresh_field(n);else console.log("hide_field cannot find field "+n);} if(cur_frm){if(n.substr)_hide_field(n,1);else{for(var i in n)_hide_field(n[i],1)}}} -unhide_field=function(n){function _hide_field(n,hidden){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df)df.hidden=hidden;refresh_field(n);} +unhide_field=function(n){function _hide_field(n,hidden){var df=get_field(cur_frm.doctype,n,cur_frm.docname);if(df)df.hidden=hidden;refresh_field(n);else console.log("unhide_field cannot find field "+n);} if(cur_frm){if(n.substr)_hide_field(n,0);else{for(var i in n)_hide_field(n[i],0)}}} get_field_obj=function(fn){return cur_frm.fields_dict[fn];} /* diff --git a/version.num b/version.num index 3641460c4b..1a1e4a6ece 100644 --- a/version.num +++ b/version.num @@ -1 +1 @@ -1671 \ No newline at end of file +1672 \ No newline at end of file