feat(Asset Repair): Add 'View General Ledger' button
This commit is contained in:
parent
7ad74cf800
commit
c2b0102852
@ -29,6 +29,15 @@ frappe.ui.form.on('Asset Repair', {
|
|||||||
refresh: function(frm) {
|
refresh: function(frm) {
|
||||||
frm.toggle_display(['completion_date', 'repair_status', 'accounting_details', 'accounting_dimensions_section'], !(frm.doc.__islocal));
|
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)
|
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) => {
|
repair_status: (frm) => {
|
||||||
|
|||||||
@ -5,11 +5,10 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
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.model.document import Document
|
||||||
from frappe.utils import flt
|
from frappe.utils import flt
|
||||||
from erpnext.accounts.general_ledger import make_gl_entries
|
from erpnext.accounts.general_ledger import make_gl_entries
|
||||||
from erpnext.controllers.accounts_controller import AccountsController
|
|
||||||
|
|
||||||
class AssetRepair(Document):
|
class AssetRepair(Document):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
@ -66,7 +65,8 @@ class AssetRepair(Document):
|
|||||||
"against": repair_and_maintenance_account,
|
"against": repair_and_maintenance_account,
|
||||||
"voucher_type": self.doctype,
|
"voucher_type": self.doctype,
|
||||||
"voucher_no": self.name,
|
"voucher_no": self.name,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center,
|
||||||
|
"posting_date": getdate()
|
||||||
})
|
})
|
||||||
gl_entry.insert()
|
gl_entry.insert()
|
||||||
gl_entry = frappe.get_doc({
|
gl_entry = frappe.get_doc({
|
||||||
@ -77,7 +77,8 @@ class AssetRepair(Document):
|
|||||||
"against": self.payable_account,
|
"against": self.payable_account,
|
||||||
"voucher_type": self.doctype,
|
"voucher_type": self.doctype,
|
||||||
"voucher_no": self.name,
|
"voucher_no": self.name,
|
||||||
"cost_center": self.cost_center
|
"cost_center": self.cost_center,
|
||||||
|
"posting_date": getdate()
|
||||||
})
|
})
|
||||||
gl_entry.insert()
|
gl_entry.insert()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user