Skip to content

Commit

Permalink
Merge branch 'develop' into VALIDATE-RESERVED-STOCK
Browse files Browse the repository at this point in the history
  • Loading branch information
s-aga-r authored Nov 4, 2023
2 parents 5fcd991 + 56e9a46 commit 4a3ab9e
Show file tree
Hide file tree
Showing 34 changed files with 471 additions and 146 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,30 +65,34 @@
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Voucher Type",
"options": "DocType"
"options": "DocType",
"search_index": 1
},
{
"fieldname": "voucher_no",
"fieldtype": "Dynamic Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Voucher No",
"options": "voucher_type"
"options": "voucher_type",
"search_index": 1
},
{
"fieldname": "against_voucher_type",
"fieldtype": "Link",
"in_standard_filter": 1,
"label": "Against Voucher Type",
"options": "DocType"
"options": "DocType",
"search_index": 1
},
{
"fieldname": "against_voucher_no",
"fieldtype": "Dynamic Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Against Voucher No",
"options": "against_voucher_type"
"options": "against_voucher_type",
"search_index": 1
},
{
"fieldname": "amount",
Expand Down Expand Up @@ -148,13 +152,14 @@
{
"fieldname": "voucher_detail_no",
"fieldtype": "Data",
"label": "Voucher Detail No"
"label": "Voucher Detail No",
"search_index": 1
}
],
"in_create": 1,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-10-30 16:15:00.470283",
"modified": "2023-11-03 16:39:58.904113",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Ledger Entry",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ def get_jv_entries(self):
"t2.against_account like %(bank_cash_account)s" if self.bank_cash_account else "1=1"
)

limit = f"limit {self.payment_limit}" if self.payment_limit else " "

# nosemgrep
journal_entries = frappe.db.sql(
"""
Expand All @@ -132,11 +134,13 @@ def get_jv_entries(self):
ELSE {bank_account_condition}
END)
order by t1.posting_date
{limit}
""".format(
**{
"dr_or_cr": dr_or_cr,
"bank_account_condition": bank_account_condition,
"condition": condition,
"limit": limit,
}
),
{
Expand All @@ -162,16 +166,19 @@ def get_return_invoices(self):
if self.payment_name:
conditions.append(doc.name.like(f"%{self.payment_name}%"))

self.return_invoices = (
self.return_invoices_query = (
qb.from_(doc)
.select(
ConstantColumn(voucher_type).as_("voucher_type"),
doc.name.as_("voucher_no"),
doc.return_against,
)
.where(Criterion.all(conditions))
.run(as_dict=True)
)
if self.payment_limit:
self.return_invoices_query = self.return_invoices_query.limit(self.payment_limit)

self.return_invoices = self.return_invoices_query.run(as_dict=True)

def get_dr_or_cr_notes(self):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"in_create": 1,
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-04-21 17:36:26.642617",
"modified": "2023-11-02 11:32:12.254018",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Process Payment Reconciliation Log",
Expand All @@ -125,7 +125,19 @@
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"role": "Accounts Manager",
"share": 1,
"write": 1
},
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "Accounts User",
"share": 1,
"write": 1
}
Expand Down
10 changes: 6 additions & 4 deletions erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@
"label": "Supplier Invoice No",
"oldfieldname": "bill_no",
"oldfieldtype": "Data",
"print_hide": 1
"print_hide": 1,
"search_index": 1
},
{
"fieldname": "column_break_15",
Expand All @@ -407,7 +408,8 @@
"no_copy": 1,
"options": "Purchase Invoice",
"print_hide": 1,
"read_only": 1
"read_only": 1,
"search_index": 1
},
{
"fieldname": "section_addresses",
Expand Down Expand Up @@ -1602,7 +1604,7 @@
"idx": 204,
"is_submittable": 1,
"links": [],
"modified": "2023-10-16 16:24:51.886231",
"modified": "2023-11-03 15:47:30.319200",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",
Expand Down Expand Up @@ -1665,4 +1667,4 @@
"timeline_field": "supplier",
"title_field": "title",
"track_changes": 1
}
}
8 changes: 7 additions & 1 deletion erpnext/accounts/report/accounts_payable/accounts_payable.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,13 @@ frappe.query_reports["Accounts Payable"] = {
"fieldname": "show_future_payments",
"label": __("Show Future Payments"),
"fieldtype": "Check",
},
{
"fieldname": "ignore_accounts",
"label": __("Group by Voucher"),
"fieldtype": "Check",
}

],

"formatter": function(value, row, column, data, default_formatter) {
Expand Down Expand Up @@ -175,4 +181,4 @@ function get_party_type_options() {
});
});
return options;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,13 @@ frappe.query_reports["Accounts Receivable"] = {
"fieldname": "show_remarks",
"label": __("Show Remarks"),
"fieldtype": "Check",
},
{
"fieldname": "ignore_accounts",
"label": __("Group by Voucher"),
"fieldtype": "Check",
}

],

"formatter": function(value, row, column, data, default_formatter) {
Expand Down Expand Up @@ -205,4 +211,4 @@ function get_party_type_options() {
});
});
return options;
}
}
22 changes: 18 additions & 4 deletions erpnext/accounts/report/accounts_receivable/accounts_receivable.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ def init_voucher_balance(self):
# build all keys, since we want to exclude vouchers beyond the report date
for ple in self.ple_entries:
# get the balance object for voucher_type
key = (ple.account, ple.voucher_type, ple.voucher_no, ple.party)

if self.filters.get("ingore_accounts"):
key = (ple.voucher_type, ple.voucher_no, ple.party)
else:
key = (ple.account, ple.voucher_type, ple.voucher_no, ple.party)

if not key in self.voucher_balance:
self.voucher_balance[key] = frappe._dict(
voucher_type=ple.voucher_type,
Expand Down Expand Up @@ -183,7 +188,10 @@ def get_voucher_balance(self, ple):
):
return

key = (ple.account, ple.against_voucher_type, ple.against_voucher_no, ple.party)
if self.filters.get("ingore_accounts"):
key = (ple.against_voucher_type, ple.against_voucher_no, ple.party)
else:
key = (ple.account, ple.against_voucher_type, ple.against_voucher_no, ple.party)

# If payment is made against credit note
# and credit note is made against a Sales Invoice
Expand All @@ -192,13 +200,19 @@ def get_voucher_balance(self, ple):
if ple.against_voucher_no in self.return_entries:
return_against = self.return_entries.get(ple.against_voucher_no)
if return_against:
key = (ple.account, ple.against_voucher_type, return_against, ple.party)
if self.filters.get("ingore_accounts"):
key = (ple.against_voucher_type, return_against, ple.party)
else:
key = (ple.account, ple.against_voucher_type, return_against, ple.party)

row = self.voucher_balance.get(key)

if not row:
# no invoice, this is an invoice / stand-alone payment / credit note
row = self.voucher_balance.get((ple.account, ple.voucher_type, ple.voucher_no, ple.party))
if self.filters.get("ingore_accounts"):
row = self.voucher_balance.get((ple.voucher_type, ple.voucher_no, ple.party))
else:
row = self.voucher_balance.get((ple.account, ple.voucher_type, ple.voucher_no, ple.party))

row.party_type = ple.party_type
return row
Expand Down
Loading

0 comments on commit 4a3ab9e

Please sign in to comment.