Merge pull request #37041 from vorasmit/fix-advances
fix: multiple fixes for booking advances in seperate account
This commit is contained in:
commit
6664bc98a0
@ -98,7 +98,6 @@ class PaymentEntry(AccountsController):
|
||||
if self.difference_amount:
|
||||
frappe.throw(_("Difference Amount must be zero"))
|
||||
self.make_gl_entries()
|
||||
self.make_advance_gl_entries()
|
||||
self.update_outstanding_amounts()
|
||||
self.update_advance_paid()
|
||||
self.update_payment_schedule()
|
||||
@ -152,7 +151,6 @@ class PaymentEntry(AccountsController):
|
||||
)
|
||||
super(PaymentEntry, self).on_cancel()
|
||||
self.make_gl_entries(cancel=1)
|
||||
self.make_advance_gl_entries(cancel=1)
|
||||
self.update_outstanding_amounts()
|
||||
self.update_advance_paid()
|
||||
self.delink_advance_entry_references()
|
||||
@ -1060,6 +1058,8 @@ class PaymentEntry(AccountsController):
|
||||
else:
|
||||
self.make_exchange_gain_loss_journal()
|
||||
|
||||
self.make_advance_gl_entries(cancel=cancel)
|
||||
|
||||
def add_party_gl_entries(self, gl_entries):
|
||||
if self.party_account:
|
||||
if self.payment_type == "Receive":
|
||||
@ -1128,7 +1128,7 @@ class PaymentEntry(AccountsController):
|
||||
if self.book_advance_payments_in_separate_party_account:
|
||||
gl_entries = []
|
||||
for d in self.get("references"):
|
||||
if d.reference_doctype in ("Sales Invoice", "Purchase Invoice"):
|
||||
if d.reference_doctype in ("Sales Invoice", "Purchase Invoice", "Journal Entry"):
|
||||
if not (against_voucher_type and against_voucher) or (
|
||||
d.reference_doctype == against_voucher_type and d.reference_name == against_voucher
|
||||
):
|
||||
@ -1164,6 +1164,13 @@ class PaymentEntry(AccountsController):
|
||||
"voucher_detail_no": invoice.name,
|
||||
}
|
||||
|
||||
posting_date = frappe.db.get_value(
|
||||
invoice.reference_doctype, invoice.reference_name, "posting_date"
|
||||
)
|
||||
|
||||
if getdate(posting_date) < getdate(self.posting_date):
|
||||
posting_date = self.posting_date
|
||||
|
||||
dr_or_cr = "credit" if invoice.reference_doctype == "Sales Invoice" else "debit"
|
||||
args_dict["account"] = invoice.account
|
||||
args_dict[dr_or_cr] = invoice.allocated_amount
|
||||
@ -1172,6 +1179,7 @@ class PaymentEntry(AccountsController):
|
||||
{
|
||||
"against_voucher_type": invoice.reference_doctype,
|
||||
"against_voucher": invoice.reference_name,
|
||||
"posting_date": posting_date,
|
||||
}
|
||||
)
|
||||
gle = self.get_gl_dict(
|
||||
|
@ -24,7 +24,8 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo
|
||||
filters: {
|
||||
"company": this.frm.doc.company,
|
||||
"is_group": 0,
|
||||
"account_type": frappe.boot.party_account_types[this.frm.doc.party_type]
|
||||
"account_type": frappe.boot.party_account_types[this.frm.doc.party_type],
|
||||
"root_type": this.frm.doc.party_type == 'Customer' ? "Asset" : "Liability"
|
||||
}
|
||||
};
|
||||
});
|
||||
|
@ -491,14 +491,13 @@ def reconcile_against_document(args, skip_ref_details_update_for_pe=False): # n
|
||||
gl_map = doc.build_gl_map()
|
||||
create_payment_ledger_entry(gl_map, update_outstanding="No", cancel=0, adv_adj=1)
|
||||
|
||||
if voucher_type == "Payment Entry":
|
||||
doc.make_advance_gl_entries()
|
||||
|
||||
# Only update outstanding for newly linked vouchers
|
||||
for entry in entries:
|
||||
update_voucher_outstanding(
|
||||
entry.against_voucher_type, entry.against_voucher, entry.account, entry.party_type, entry.party
|
||||
)
|
||||
if voucher_type == "Payment Entry":
|
||||
doc.make_advance_gl_entries(entry.against_voucher_type, entry.against_voucher)
|
||||
|
||||
frappe.flags.ignore_party_validation = False
|
||||
|
||||
|
@ -12,6 +12,7 @@ frappe.ui.form.on("Supplier", {
|
||||
return {
|
||||
filters: {
|
||||
'account_type': 'Payable',
|
||||
'root_type': 'Liability',
|
||||
'company': d.company,
|
||||
"is_group": 0
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ frappe.ui.form.on("Customer", {
|
||||
let d = locals[cdt][cdn];
|
||||
let filters = {
|
||||
'account_type': 'Receivable',
|
||||
'root_type': 'Asset',
|
||||
'company': d.company,
|
||||
"is_group": 0
|
||||
};
|
||||
|
@ -200,8 +200,8 @@ erpnext.company.setup_queries = function(frm) {
|
||||
$.each([
|
||||
["default_bank_account", {"account_type": "Bank"}],
|
||||
["default_cash_account", {"account_type": "Cash"}],
|
||||
["default_receivable_account", {"account_type": "Receivable"}],
|
||||
["default_payable_account", {"account_type": "Payable"}],
|
||||
["default_receivable_account", { "root_type": "Asset", "account_type": "Receivable" }],
|
||||
["default_payable_account", { "root_type": "Liability", "account_type": "Payable" }],
|
||||
["default_expense_account", {"root_type": "Expense"}],
|
||||
["default_income_account", {"root_type": "Income"}],
|
||||
["round_off_account", {"root_type": "Expense"}],
|
||||
|
@ -30,6 +30,7 @@ frappe.ui.form.on("Customer Group", {
|
||||
frm.set_query('account', 'accounts', function (doc, cdt, cdn) {
|
||||
return {
|
||||
filters: {
|
||||
'root_type': 'Asset',
|
||||
"account_type": 'Receivable',
|
||||
"company": locals[cdt][cdn].company,
|
||||
"is_group": 0
|
||||
|
@ -30,6 +30,7 @@ frappe.ui.form.on("Supplier Group", {
|
||||
frm.set_query('account', 'accounts', function (doc, cdt, cdn) {
|
||||
return {
|
||||
filters: {
|
||||
'root_type': 'Liability',
|
||||
'account_type': 'Payable',
|
||||
'company': locals[cdt][cdn].company,
|
||||
"is_group": 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user