fix: Add view ledger button for cancelled docs (#22433)
* fix: Add view ledger button for cancelled docs * fix: Add moddified to date in Stock Ledger
This commit is contained in:
		
							parent
							
								
									8d8ce63be7
								
							
						
					
					
						commit
						4c726b25ee
					
				| @ -188,14 +188,15 @@ frappe.ui.form.on('Invoice Discounting', { | |||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	show_general_ledger: (frm) => { | 	show_general_ledger: (frm) => { | ||||||
| 		if(frm.doc.docstatus===1) { | 		if(frm.doc.docstatus > 0) { | ||||||
| 			cur_frm.add_custom_button(__('Accounting Ledger'), function() { | 			cur_frm.add_custom_button(__('Accounting Ledger'), function() { | ||||||
| 				frappe.route_options = { | 				frappe.route_options = { | ||||||
| 					voucher_no: frm.doc.name, | 					voucher_no: frm.doc.name, | ||||||
| 					from_date: frm.doc.posting_date, | 					from_date: frm.doc.posting_date, | ||||||
| 					to_date: frm.doc.posting_date, | 					to_date: moment(frm.doc.modified).format('YYYY-MM-DD'), | ||||||
| 					company: frm.doc.company, | 					company: frm.doc.company, | ||||||
| 					group_by: "Group by Voucher (Consolidated)" | 					group_by: "Group by Voucher (Consolidated)", | ||||||
|  | 					show_cancelled_entries: frm.doc.docstatus === 2 | ||||||
| 				}; | 				}; | ||||||
| 				frappe.set_route("query-report", "General Ledger"); | 				frappe.set_route("query-report", "General Ledger"); | ||||||
| 			}, __("View")); | 			}, __("View")); | ||||||
|  | |||||||
| @ -13,15 +13,16 @@ frappe.ui.form.on("Journal Entry", { | |||||||
| 	refresh: function(frm) { | 	refresh: function(frm) { | ||||||
| 		erpnext.toggle_naming_series(); | 		erpnext.toggle_naming_series(); | ||||||
| 
 | 
 | ||||||
| 		if(frm.doc.docstatus==1) { | 		if(frm.doc.docstatus > 0) { | ||||||
| 			frm.add_custom_button(__('Ledger'), function() { | 			frm.add_custom_button(__('Ledger'), function() { | ||||||
| 				frappe.route_options = { | 				frappe.route_options = { | ||||||
| 					"voucher_no": frm.doc.name, | 					"voucher_no": frm.doc.name, | ||||||
| 					"from_date": frm.doc.posting_date, | 					"from_date": frm.doc.posting_date, | ||||||
| 					"to_date": frm.doc.posting_date, | 					"to_date": moment(frm.doc.modified).format('YYYY-MM-DD'), | ||||||
| 					"company": frm.doc.company, | 					"company": frm.doc.company, | ||||||
| 					"finance_book": frm.doc.finance_book, | 					"finance_book": frm.doc.finance_book, | ||||||
| 					"group_by_voucher": 0 | 					"group_by": '', | ||||||
|  | 					"show_cancelled_entries": frm.doc.docstatus === 2 | ||||||
| 				}; | 				}; | ||||||
| 				frappe.set_route("query-report", "General Ledger"); | 				frappe.set_route("query-report", "General Ledger"); | ||||||
| 			}, __('View')); | 			}, __('View')); | ||||||
|  | |||||||
| @ -172,8 +172,8 @@ frappe.ui.form.on('Payment Entry', { | |||||||
| 		frm.toggle_display("base_paid_amount", frm.doc.paid_from_account_currency != company_currency); | 		frm.toggle_display("base_paid_amount", frm.doc.paid_from_account_currency != company_currency); | ||||||
| 
 | 
 | ||||||
| 		frm.toggle_display("base_received_amount", ( | 		frm.toggle_display("base_received_amount", ( | ||||||
| 			frm.doc.paid_to_account_currency != company_currency  | 			frm.doc.paid_to_account_currency != company_currency | ||||||
| 			&& frm.doc.paid_from_account_currency != frm.doc.paid_to_account_currency  | 			&& frm.doc.paid_from_account_currency != frm.doc.paid_to_account_currency | ||||||
| 			&& frm.doc.base_paid_amount != frm.doc.base_received_amount | 			&& frm.doc.base_paid_amount != frm.doc.base_received_amount | ||||||
| 		)); | 		)); | ||||||
| 
 | 
 | ||||||
| @ -234,14 +234,15 @@ frappe.ui.form.on('Payment Entry', { | |||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
| 	show_general_ledger: function(frm) { | 	show_general_ledger: function(frm) { | ||||||
| 		if(frm.doc.docstatus==1) { | 		if(frm.doc.docstatus > 0) { | ||||||
| 			frm.add_custom_button(__('Ledger'), function() { | 			frm.add_custom_button(__('Ledger'), function() { | ||||||
| 				frappe.route_options = { | 				frappe.route_options = { | ||||||
| 					"voucher_no": frm.doc.name, | 					"voucher_no": frm.doc.name, | ||||||
| 					"from_date": frm.doc.posting_date, | 					"from_date": frm.doc.posting_date, | ||||||
| 					"to_date": frm.doc.posting_date, | 					"to_date": moment(frm.doc.modified).format('YYYY-MM-DD'), | ||||||
| 					"company": frm.doc.company, | 					"company": frm.doc.company, | ||||||
| 					group_by: "" | 					"group_by": "", | ||||||
|  | 					"show_cancelled_entries": frm.doc.docstatus === 2 | ||||||
| 				}; | 				}; | ||||||
| 				frappe.set_route("query-report", "General Ledger"); | 				frappe.set_route("query-report", "General Ledger"); | ||||||
| 			}, "fa fa-table"); | 			}, "fa fa-table"); | ||||||
|  | |||||||
| @ -25,9 +25,10 @@ frappe.ui.form.on('Period Closing Voucher', { | |||||||
| 				frappe.route_options = { | 				frappe.route_options = { | ||||||
| 					"voucher_no": frm.doc.name, | 					"voucher_no": frm.doc.name, | ||||||
| 					"from_date": frm.doc.posting_date, | 					"from_date": frm.doc.posting_date, | ||||||
| 					"to_date": frm.doc.posting_date, | 					"to_date": moment(frm.doc.modified).format('YYYY-MM-DD'), | ||||||
| 					"company": frm.doc.company, | 					"company": frm.doc.company, | ||||||
| 					group_by_voucher: 0 | 					"group_by": "", | ||||||
|  | 					"show_cancelled_entries": frm.doc.docstatus === 2 | ||||||
| 				}; | 				}; | ||||||
| 				frappe.set_route("query-report", "General Ledger"); | 				frappe.set_route("query-report", "General Ledger"); | ||||||
| 			}, "fa fa-table"); | 			}, "fa fa-table"); | ||||||
|  | |||||||
| @ -55,14 +55,15 @@ frappe.ui.form.on("Fees", { | |||||||
| 			frm.set_df_property('posting_date', 'read_only', 1); | 			frm.set_df_property('posting_date', 'read_only', 1); | ||||||
| 			frm.set_df_property('posting_time', 'read_only', 1); | 			frm.set_df_property('posting_time', 'read_only', 1); | ||||||
| 		} | 		} | ||||||
| 		if(frm.doc.docstatus===1) { | 		if(frm.doc.docstatus > 0) { | ||||||
| 			frm.add_custom_button(__('Accounting Ledger'), function() { | 			frm.add_custom_button(__('Accounting Ledger'), function() { | ||||||
| 				frappe.route_options = { | 				frappe.route_options = { | ||||||
| 					voucher_no: frm.doc.name, | 					voucher_no: frm.doc.name, | ||||||
| 					from_date: frm.doc.posting_date, | 					from_date: frm.doc.posting_date, | ||||||
| 					to_date: frm.doc.posting_date, | 					to_date: moment(frm.doc.modified).format('YYYY-MM-DD'), | ||||||
| 					company: frm.doc.company, | 					company: frm.doc.company, | ||||||
| 					group_by_voucher: false | 					group_by: '', | ||||||
|  | 					show_cancelled_entries: frm.doc.docstatus === 2 | ||||||
| 				}; | 				}; | ||||||
| 				frappe.set_route("query-report", "General Ledger"); | 				frappe.set_route("query-report", "General Ledger"); | ||||||
| 			}, __("View")); | 			}, __("View")); | ||||||
|  | |||||||
| @ -213,12 +213,15 @@ frappe.ui.form.on("Expense Claim", { | |||||||
| 	refresh: function(frm) { | 	refresh: function(frm) { | ||||||
| 		frm.trigger("toggle_fields"); | 		frm.trigger("toggle_fields"); | ||||||
| 
 | 
 | ||||||
| 		if(frm.doc.docstatus === 1 && frm.doc.approval_status !== "Rejected") { | 		if(frm.doc.docstatus > 0 && frm.doc.approval_status !== "Rejected") { | ||||||
| 			frm.add_custom_button(__('Accounting Ledger'), function() { | 			frm.add_custom_button(__('Accounting Ledger'), function() { | ||||||
| 				frappe.route_options = { | 				frappe.route_options = { | ||||||
| 					voucher_no: frm.doc.name, | 					voucher_no: frm.doc.name, | ||||||
| 					company: frm.doc.company, | 					company: frm.doc.company, | ||||||
| 					group_by_voucher: false | 					from_date: frm.doc.posting_date, | ||||||
|  | 					to_date: moment(frm.doc.modified).format('YYYY-MM-DD'), | ||||||
|  | 					group_by: '', | ||||||
|  | 					show_cancelled_entries: frm.doc.docstatus === 2 | ||||||
| 				}; | 				}; | ||||||
| 				frappe.set_route("query-report", "General Ledger"); | 				frappe.set_route("query-report", "General Ledger"); | ||||||
| 			}, __("View")); | 			}, __("View")); | ||||||
|  | |||||||
| @ -9,12 +9,15 @@ frappe.ui.form.on(cur_frm.doctype, { | |||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		if (['Loan Disbursement', 'Loan Repayment', 'Loan Interest Accrual'].includes(frm.doc.doctype) | 		if (['Loan Disbursement', 'Loan Repayment', 'Loan Interest Accrual'].includes(frm.doc.doctype) | ||||||
| 			&& frm.doc.docstatus == 1) { | 			&& frm.doc.docstatus > 0) { | ||||||
| 
 | 
 | ||||||
| 			frm.add_custom_button(__("Accounting Ledger"), function() { | 			frm.add_custom_button(__("Accounting Ledger"), function() { | ||||||
| 				frappe.route_options = { | 				frappe.route_options = { | ||||||
| 					voucher_no: frm.doc.name, | 					voucher_no: frm.doc.name, | ||||||
| 					company: frm.doc.company | 					company: frm.doc.company, | ||||||
|  | 					from_date: frm.doc.posting_date, | ||||||
|  | 					to_date: moment(frm.doc.modified).format('YYYY-MM-DD'), | ||||||
|  | 					show_cancelled_entries: frm.doc.docstatus === 2 | ||||||
| 				}; | 				}; | ||||||
| 
 | 
 | ||||||
| 				frappe.set_route("query-report", "General Ledger"); | 				frappe.set_route("query-report", "General Ledger"); | ||||||
|  | |||||||
| @ -55,8 +55,9 @@ erpnext.stock.StockController = frappe.ui.form.Controller.extend({ | |||||||
| 				frappe.route_options = { | 				frappe.route_options = { | ||||||
| 					voucher_no: me.frm.doc.name, | 					voucher_no: me.frm.doc.name, | ||||||
| 					from_date: me.frm.doc.posting_date, | 					from_date: me.frm.doc.posting_date, | ||||||
| 					to_date: me.frm.doc.posting_date, | 					to_date: moment(me.frm.doc.modified).format('YYYY-MM-DD'), | ||||||
| 					company: me.frm.doc.company | 					company: me.frm.doc.company, | ||||||
|  | 					show_cancelled_entries: me.frm.doc.docstatus === 2 | ||||||
| 				}; | 				}; | ||||||
| 				frappe.set_route("query-report", "Stock Ledger"); | 				frappe.set_route("query-report", "Stock Ledger"); | ||||||
| 			}, __("View")); | 			}, __("View")); | ||||||
| @ -71,9 +72,10 @@ erpnext.stock.StockController = frappe.ui.form.Controller.extend({ | |||||||
| 				frappe.route_options = { | 				frappe.route_options = { | ||||||
| 					voucher_no: me.frm.doc.name, | 					voucher_no: me.frm.doc.name, | ||||||
| 					from_date: me.frm.doc.posting_date, | 					from_date: me.frm.doc.posting_date, | ||||||
| 					to_date: me.frm.doc.posting_date, | 					to_date: moment(me.frm.doc.modified).format('YYYY-MM-DD'), | ||||||
| 					company: me.frm.doc.company, | 					company: me.frm.doc.company, | ||||||
| 					group_by: "Group by Voucher (Consolidated)" | 					group_by: "Group by Voucher (Consolidated)", | ||||||
|  | 					show_cancelled_entries: me.frm.doc.docstatus === 2 | ||||||
| 				}; | 				}; | ||||||
| 				frappe.set_route("query-report", "General Ledger"); | 				frappe.set_route("query-report", "General Ledger"); | ||||||
| 			}, __("View")); | 			}, __("View")); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user