fix: Test case and code cleanup

This commit is contained in:
Deepesh Garg 2023-06-23 21:53:34 +05:30
parent da6bc1a13e
commit 1894dc8197
6 changed files with 11 additions and 101 deletions

View File

@ -34,6 +34,7 @@ erpnext.accounts.PaymentReconciliationController = class PaymentReconciliationCo
filters: {
"company": this.frm.doc.company,
"is_group": 0,
"account_type": this.frm.doc.party_type == 'Customer' ? "Receivable": "Payable",
"root_type": this.frm.doc.party_type == 'Customer' ? "Liability": "Asset"
}
};

View File

@ -14,8 +14,7 @@
"advance_amount",
"allocated_amount",
"exchange_gain_loss",
"ref_exchange_rate",
"account"
"ref_exchange_rate"
],
"fields": [
{
@ -112,20 +111,13 @@
"label": "Reference Exchange Rate",
"non_negative": 1,
"read_only": 1
},
{
"fieldname": "account",
"fieldtype": "Link",
"label": "Account",
"options": "Account",
"read_only": 1
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-06-01 16:56:48.530169",
"modified": "2023-06-23 21:13:18.013816",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Advance",

View File

@ -1052,12 +1052,13 @@ class SalesInvoice(SellingController):
elif self.docstatus == 2 and cint(self.update_stock) and cint(auto_accounting_for_stock):
make_reverse_gl_entries(voucher_type=self.doctype, voucher_no=self.name)
def get_gl_entries(self):
def get_gl_entries(self, warehouse_account=None):
from erpnext.accounts.general_ledger import merge_similar_entries
gl_entries = []
self.make_customer_gl_entry(gl_entries)
self.make_tax_gl_entries(gl_entries)
self.make_exchange_gain_loss_gl_entries(gl_entries)
self.make_internal_transfer_gl_entries(gl_entries)

View File

@ -14,8 +14,7 @@
"advance_amount",
"allocated_amount",
"exchange_gain_loss",
"ref_exchange_rate",
"account"
"ref_exchange_rate"
],
"fields": [
{
@ -113,20 +112,13 @@
"label": "Reference Exchange Rate",
"non_negative": 1,
"read_only": 1
},
{
"fieldname": "account",
"fieldtype": "Link",
"label": "Account",
"options": "Account",
"read_only": 1
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-05-31 11:47:00.191681",
"modified": "2023-06-23 21:12:57.557731",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Advance",

View File

@ -474,7 +474,9 @@ def reconcile_against_document(args, skip_ref_details_update_for_pe=False): # n
doc = frappe.get_doc(entry.voucher_type, entry.voucher_no)
gl_map = doc.build_gl_map()
create_payment_ledger_entry(gl_map, update_outstanding="No", cancel=0, adv_adj=1)
doc.make_advance_gl_entries(entry.against_voucher_type, entry.against_voucher)
if voucher_type == "Payment Entry":
doc.make_advance_gl_entries(entry.against_voucher_type, entry.against_voucher)
# Only update outstanding for newly linked vouchers
for entry in entries:
@ -732,7 +734,7 @@ def remove_ref_doc_link_from_pe(ref_type, ref_no):
for pe in linked_pe:
try:
pe_doc = frappe.get_doc("Payment Entry", pe, cache=True)
pe_doc = frappe.get_doc("Payment Entry", pe)
pe_doc.set_amounts()
pe_doc.make_advance_gl_entries(against_voucher_type=ref_type, against_voucher=ref_no, cancel=1)
pe_doc.clear_unallocated_reference_document_rows()

View File

@ -2916,84 +2916,6 @@ def update_child_qty_rate(parent_doctype, trans_items, parent_doctype_name, chil
parent.create_stock_reservation_entries()
# def make_advance_liability_entry(
# gl_entries, pe, allocated_amount, invoice, party_type
# ):
# pe = frappe.get_doc("Payment Entry", pe)
# if party_type == "Customer":
# invoice = frappe.get_doc("Sales Invoice", invoice)
# account = pe.paid_from
# dr_or_cr = "debit"
# rev = "credit"
# against = invoice.debit_to
# party = invoice.customer
# else:
# invoice = frappe.get_doc("Purchase Invoice", invoice)
# account = pe.paid_to
# dr_or_cr = "credit"
# rev = "debit"
# against = invoice.credit_to
# party = invoice.supplier
# gl_entries.append(
# pe.get_gl_dict(
# {
# "account": account,
# "party_type": party_type,
# "party": party,
# "due_date": invoice.due_date,
# "against": against,
# dr_or_cr: allocated_amount,
# dr_or_cr + "_in_account_currency": allocated_amount,
# rev: 0,
# rev + "_in_account_currency": 0,
# "cost_center": invoice.cost_center,
# "project": invoice.project,
# "against_voucher_type": "Payment Entry",
# "against_voucher": pe.name,
# },
# invoice.party_account_currency,
# item=pe,
# )
# )
# (dr_or_cr, rev) = ("credit", "debit") if party_type == "Customer" else ("debit", "credit")
# gl_entries.append(
# pe.get_gl_dict(
# {
# "account": against,
# "party_type": party_type,
# "party": party,
# "due_date": invoice.due_date,
# dr_or_cr: allocated_amount,
# dr_or_cr + "_in_account_currency": allocated_amount,
# rev: 0,
# rev + "_in_account_currency": 0,
# "cost_center": invoice.cost_center,
# "project": invoice.project,
# "against_voucher_type": invoice.doctype,
# "against_voucher": invoice.name,
# },
# invoice.party_account_currency,
# item=pe,
# )
# )
# def check_advance_liability_entry(gl_entries, company, advances, invoice, party_type):
# advance_payments_as_liability = frappe.db.get_value(
# "Company", {"company_name": company}, "book_advance_payments_as_liability"
# )
# if advance_payments_as_liability:
# for advance_entry in advances:
# make_advance_liability_entry(
# gl_entries,
# advance_entry.reference_name,
# advance_entry.allocated_amount,
# invoice=invoice,
# party_type=party_type,
# )
@erpnext.allow_regional
def validate_regional(doc):
pass