I am trying to create a paid invoice when a sales order is submitted. I have been able to do so but since i am using an is pos I am required to include a mode of payment. I have tried various ways but getting an error. See sample code and assist
target.status=‘Paid’
target.docstatus = 1
target.is_pos = 1
x=frappe.get_doc(“Mode of Payment”,“Cash”)
target.payments = x
target.save()
This gives me an error ModeOfPayment is not not iterable. Where am I going wrong? Please assist