“Where is the value for the ‘Account Balance (To)’ field coming from? When I select the party, the value is automatically set in this field. Please help me identify the source of this value.”
paid_from_account_balance = frappe.db.get_value(“Account”,{“name”: “Debtors - NI”, “company”: payment_entry.company},“account_balance”)
Using the above code i cant get the value
When the sales invoice submit i want to automatically create its payment entry i am doing it in the server script .below is my code
payment_entry = frappe.new_doc("Payment Entry")
payment_entry.payment_type = "Receive"
payment_entry.mode_of_payment = "Cash-NI"
payment_entry.party_type = "Customer"
payment_entry.party = sales_invoice.customer
payment_entry.company = sales_invoice.company
payment_entry.paid_amount = sales_invoice.grand_total
payment_entry.received_amount = sales_invoice.grand_total
payment_entry.reference_date = frappe.utils.nowdate()
payment_entry.target_exchange_rate = sales_invoice.conversion_rate
payment_entry.paid_to = "Cash - NI"
payment_entry.paid_from = "Debtors - NI"
payment_entry.paid_to_account_currency = "INR"
payment_entry.paid_from_account_currency = "INR"
"reference_doctype": "Sales Invoice",
"reference_name": sales_invoice.name,
"total_amount":sales_invoice.grand_total,
"outstanding_amount":sales_invoice.grand_total,
"allocated_amount": sales_invoice.grand_total,
})
payment_entry.insert()
payment_entry.save()