fixes in sales cycle

This commit is contained in:
Anand Doshi 2012-04-13 11:38:01 +05:30
parent a73b2965aa
commit 1c2ac00a82
13 changed files with 14 additions and 74 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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'])
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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];}
/*

View File

@ -1 +1 @@
1671
1672