import frappe
from erpnext.accounts.doctype.sales_invoice.sales_invoice import SalesInvoice
def shoutout(self):
print(“Yay!”)
def before_cancel(self):
self.shoutout()
self.update_time_sheet(None)
def build_my_thing():
SalesInvoice.shoutout = shoutout
SalesInvoice.before_cancel = before_cancel
I have tested above code but its not working in my case. As I have to override method which is linked with several methods in same core python file.
Here is my code
def g_entry(self):
print(“HELLO”) #this for test
self.check_permission(‘write’)
earnings = self.get_salary_component_total(component_type = “earnings”) or {}
deductions = self.get_salary_component_total(component_type = “deductions”) or {}
default_payroll_payable_account = self.get_default_payroll_payable_account()
jv_name = “”
precision = frappe.get_precision(“Journal Entry Account”, “debit_in_account_currency”)
if earnings or deductions:
journal_entry = frappe.new_doc('Journal Entry')
journal_entry.voucher_type = 'Journal Entry'
journal_entry.user_remark = _('Accrual Journal Entry for salaries from {0} to {1}')\
.format(self.start_date, self.end_date)
journal_entry.company = self.company
journal_entry.posting_date = self.posting_date
# I want add below line in this code in custom python file:
journal_entry.naming_series = self.naming_series
I am new ERPNEXT. Please Help Me…