On creating sales invoice, i want to automate the creation of payment entry

Hello all.
Can some help me in achieving this requirement or give some appropriate path.
On creating sales invoice, i want to automate the creation of payment entry so that the status of that invoice change to paid.

Maybe look into POS Invoice?

@volkswagner i tried it thanks.
but i am not able to accounting entries in chart of accounts

I’m not sure what you mean.

Use server script which gets execute after submission of Sales Invoice.

pe = frappe.get_doc({
‘doctype’: ‘Payment Entry’,
‘posting_date’: frappe.utils.today(),
‘payment_type’: ‘Receive’,
‘mode_of_payment’: mode_of_payment,
‘paid_to’: select_account,
‘paid_from’: doc.debit_to,
‘party_type’: ‘Customer’,
‘paid_amount’: doc.grand_total,
‘received_amount’: doc.grand_total,
‘party’: doc.customer,
‘party_name’: doc.customer_name,
‘company’: doc.company
})

pe.append(“references”, {
“reference_doctype”: “Sales Invoice”,
“reference_name”: doc.name,
“due_date”: doc.due_date,
“total_amount”: doc.grand_total,
“outstanding_amount”: doc.outstanding_amount,
“allocated_amount”: doc.grand_total
})

pe.insert(ignore_permissions=True)
pe.submit()

1 Like

I believe you haven’t done any closing entries for the POS and thereby making consolidated payments for the POS invoices.
If you do that then the ledgers should get affected.