@Sangram thanks for the support … what i need is to submit the salary slip by running the submit_salary_slips that was created by ERPNEXT … but this one has some other code to process or data to add on the JE …
For example i need to add two rows with account 3450 as debit and 3221 as credit and only after the JE is generated or created.
The only way i have found to add those records was by orver writing the button with my own submit salary slip and add my code but when i try to call the method and when executing the PY the object properties like self.start_date and other fields are not valid it returns errors…
I need to execute all the code that the ERPNEXT Submit_salary_slip has but from my Validations.process_payroll.py
I hope i have managed to explain my point.
Once again thanks.
Hi,
Sorry but as i have been trying to have this working for almost 2 days i thought that by asking the community would be the quickest way to have it solved.
cur_frm.cscript.submit_salary_slip = function(doc, cdt, cdn) {
//Do your customization here. Copy paste default code along with your custom script. So, it will not break the flow.
}
if like this it says submit_salary_slips1() takes exactly 1 argument (0 given)
if the cur_frm.doc object returns a Dict cant i create a DICT when submit_salary_slip1 is called so that the other functions will access the data or information the object has ?
I have managed to have it working before but the problem was that when i do doc.get(‘start_date’) it returned error.
Thanks for the support, but i for what i need to do i think i need the whitelist …
to run or execute all the code run on erpnext process_payroll.py i had to copy the file to my angola_erpnext.validation.process_payroll
And on the PY i have copied i will make the changes i need … reason why i need the whitelist and to pass the object or dict me.doc/cur_frm.doc in order to be able to doc.get(‘start_date’) which is executed on this
def check_mandatory(self):
for fieldname in [‘company’, ‘start_date’, ‘end_date’]:
if not self.get(fieldname):
frappe.throw(_(“Please set {0}”).format(self.meta.get_label(fieldname)))
Oh ok, so its not in the doctype py class.
Did you follow this code exactly ?
Edit: you cant access self variable in your case, you have to pass the doc as an argument
Edit: as @Sangram pointed out, you might have to do json.loads