Im trying to run a custom script to call a custom method with the following code:
frappe.ui.form.on(‘Sales Order’, ‘other_charges’, function(from){
frappe.call({
"method": "erpnext.controllers.taxes_and_totals.calc_tot_cont",
args: { },
callback:function(r){ cur_frm.set_value("total_contribution",total_contribution);}
});
})
My python code is as follows:
@frappe.whitelist()
def calc_tot_cont(self):
total_contribution = 0.0
for item in self.doc.get("items"):
total_contribution += ((item.base_rate - item.incoming_price) * item.qty)
total_contribution -= self.doc.other_charges
return total_contribution
While the script runs, I get an error saying the the method requires 1 argument , but 0 are given. Could somebody help me out with this?
What argument should be given for a method running self?
Thanks a lot!