[fix] shot ledger buttons for closed DN / PR

This commit is contained in:
Rushabh Mehta 2015-11-04 15:31:41 +05:30
parent d48c2394e8
commit 20a7d820ab
3 changed files with 19 additions and 19 deletions

View File

@ -249,13 +249,7 @@ cur_frm.cscript.update_status = function(label, status){
}
cur_frm.cscript['Unstop Sales Order'] = function() {
var doc = cur_frm.doc;
return $c('runserverobj', {
'method':'unstop_sales_order',
'docs': doc
}, function(r,rt) {
cur_frm.refresh();
});
cur_frm.cscript.update_status('Re-open', 'Draft')
}
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {

View File

@ -41,12 +41,15 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
}
}
if (doc.docstatus==1 && doc.status!="Closed") {
if (doc.docstatus==1) {
this.show_stock_ledger();
if (cint(frappe.defaults.get_default("auto_accounting_for_stock"))) {
this.show_general_ledger();
}
cur_frm.add_custom_button(__("Close"), this.close_delivery_note)
if(doc.status !== "Closed") {
cur_frm.add_custom_button(__("Close"), this.close_delivery_note)
}
}
if(doc.__onload && !doc.__onload.billing_complete && doc.docstatus==1 && !doc.is_return && doc.status!="Closed") {
@ -98,11 +101,11 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
items_on_form_rendered: function(doc, grid_row) {
erpnext.setup_serial_no();
},
close_delivery_note: function(doc){
cur_frm.cscript.update_status("Closed")
},
reopen_delivery_note : function() {
cur_frm.cscript.update_status("Submitted")
}

View File

@ -29,10 +29,13 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
refresh: function() {
this._super();
this.show_stock_ledger();
if (cint(frappe.defaults.get_default("auto_accounting_for_stock"))) {
this.show_general_ledger();
if(this.frm.doc.docstatus===1) {
this.show_stock_ledger();
if (cint(frappe.defaults.get_default("auto_accounting_for_stock"))) {
this.show_general_ledger();
}
}
if(!this.frm.doc.is_return && this.frm.doc.status!="Closed") {
if(this.frm.doc.docstatus==0) {
cur_frm.add_custom_button(__('From Purchase Order'),
@ -59,12 +62,12 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
cur_frm.add_custom_button(__("Close"), this.close_purchase_receipt)
}
}
if(this.frm.doc.docstatus==1 && this.frm.doc.status === "Closed") {
cur_frm.add_custom_button(__('Re-open'), this.reopen_purchase_receipt)
}
this.frm.toggle_reqd("supplier_warehouse", this.frm.doc.is_subcontracted==="Yes");
},
@ -127,11 +130,11 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
tc_name: function() {
this.get_terms();
},
close_purchase_receipt: function() {
cur_frm.cscript.update_status("Closed");
},
reopen_purchase_receipt: function() {
cur_frm.cscript.update_status("Submitted");
}