Update table from salary_slip.py

Hi everyone, I need to update a table from salary_slip.py, I need to do this:

frappe.db.sql(“update tabSalary Slip set sena=1500 where employee=‘EMP/0003’”)
frappe.db.commit()

but it’s not working for me, not update the table, how I could to do that? thanks!

I tried to do this:

frappe.db.sql(self,“update tabSalary Slip set sena = %s”,1500,auto_commit = 1)

but neither works, I need help, thanks!

Have you tried without frappe.db.commit()?

If you have want to update a record.

salary_slip = frappe.get_doc("Salary Slip", {"employee":"EMP/0003")
salary_slip.sena = 1500
salary_slip.save(ignore_permissions=True)

For simple db calls like this it’s worth learning to use the Frappe ORM and resort to SQL only when you need to (typically for performance or complexity).

Thank you for the reply but it isn’t work for me, I don’t know if first it has execute something before because not working, I guess when I execute Salary Slip module in my front-end of ERPNext the salary_slip.py must be executing and the code I put on this file but not working, not update the table, It’s very frustrating, thanks anyway…

Thank you tmatteson for you advice but I’m new both in frappe as in python and I need examples for I understand, there are many thing where I don’t know to put on and something like that, thank you anyway…

Can you describe how you think it should work?

Podemos conversar em Skype por un poco tiempo. Yo quero ayudar.

My skype is rodolfo_pablo_1983…

@Rodolfo_Pablo_Silva Como vai? Were you able to make the callback work?

Hi @tmatteson, no man, unfortunately no bro, It’s doesn’t work :pensive: