feat(Asset Repair): Add 'View General Ledger' button

This commit is contained in:
GangaManoj 2021-05-13 00:58:07 +05:30
parent 7ad74cf800
commit c2b0102852
2 changed files with 14 additions and 4 deletions

View File

@ -29,6 +29,15 @@ frappe.ui.form.on('Asset Repair', {
refresh: function(frm) {
frm.toggle_display(['completion_date', 'repair_status', 'accounting_details', 'accounting_dimensions_section'], !(frm.doc.__islocal));
frm.toggle_display(['stock_consumption_details_section'], frm.doc.stock_consumption)
if (frm.doc.docstatus) {
frm.add_custom_button("View General Ledger", function() {
frappe.route_options = {
"voucher_no": frm.doc.name
};
frappe.set_route("query-report", "General Ledger");
});
}
},
repair_status: (frm) => {

View File

@ -5,11 +5,10 @@
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import time_diff_in_hours
from frappe.utils import time_diff_in_hours, getdate
from frappe.model.document import Document
from frappe.utils import flt
from erpnext.accounts.general_ledger import make_gl_entries
from erpnext.controllers.accounts_controller import AccountsController
class AssetRepair(Document):
def validate(self):
@ -66,7 +65,8 @@ class AssetRepair(Document):
"against": repair_and_maintenance_account,
"voucher_type": self.doctype,
"voucher_no": self.name,
"cost_center": self.cost_center
"cost_center": self.cost_center,
"posting_date": getdate()
})
gl_entry.insert()
gl_entry = frappe.get_doc({
@ -77,7 +77,8 @@ class AssetRepair(Document):
"against": self.payable_account,
"voucher_type": self.doctype,
"voucher_no": self.name,
"cost_center": self.cost_center
"cost_center": self.cost_center,
"posting_date": getdate()
})
gl_entry.insert()