Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: release v15 #45263

Merged
merged 64 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
296d5d2
chore: removal of tally migration feature (#45100)
diptanilsaha Jan 7, 2025
e578ab2
refactor: remove tally migration doctype
ruthra-kumar Jan 8, 2025
122b966
fix: timeout error for work order
rohitwaghchaure Jan 9, 2025
5e32796
Merge pull request #45179 from frappe/mergify/bp/version-15-hotfix/pr…
rohitwaghchaure Jan 9, 2025
a79cae1
fix: not able to see create Quality Inspection button
rohitwaghchaure Jan 9, 2025
f414fa4
fix: do not add ordered items from Quotation to new Sales Order
rohitwaghchaure Jan 9, 2025
01c7956
Merge pull request #45184 from frappe/mergify/bp/version-15-hotfix/pr…
rohitwaghchaure Jan 9, 2025
ef3e442
Merge pull request #45186 from frappe/mergify/bp/version-15-hotfix/pr…
rohitwaghchaure Jan 9, 2025
d84601b
fix: precision loss causing process loss variance
FathihMohammed Jan 9, 2025
698b6e6
Merge pull request #45140 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Jan 9, 2025
f5c9ab0
Merge pull request #45197 from FathihMohammed/qty_precision_fix
rohitwaghchaure Jan 10, 2025
0df1808
fix: delivery_document_no column issue
rohitwaghchaure Jan 10, 2025
f7e3854
fix: incorrect valuation rate for PI based revaluation
rohitwaghchaure Jan 10, 2025
9426a32
chore: fix conflicts
rohitwaghchaure Jan 11, 2025
bb170c0
chore: fix conflicts
rohitwaghchaure Jan 11, 2025
7d66e4e
fix: test case
rohitwaghchaure Jan 11, 2025
0665bc4
chore: removal of decapitalization feature (backport #45162) (#45173)
mergify[bot] Jan 13, 2025
47c6e5a
fix: typo in manufacturing settings (backport #45190) (#45193)
mergify[bot] Jan 13, 2025
fe5c458
fix: batch number search on pos (#45209)
diptanilsaha Jan 13, 2025
f7448c6
fix(Timesheet): ignore permissions when updating Task and Project (ba…
mergify[bot] Jan 13, 2025
4ee6a4e
Merge pull request #45218 from frappe/mergify/bp/version-15-hotfix/pr…
rohitwaghchaure Jan 13, 2025
1363333
Merge pull request #45217 from frappe/mergify/bp/version-15-hotfix/pr…
rohitwaghchaure Jan 13, 2025
38cb5a9
fix: update discounting on mixed conditions
Dec 19, 2024
1d5a73a
fix: Semgrep rules
Dec 23, 2024
07c3605
fix: deduct tds on excess amount if checked
ljain112 Dec 31, 2024
42eb88f
fix: set billing and shipping address on change of company
Jan 3, 2025
80e6112
fix: pass right existing address
Jan 3, 2025
9757c92
Merge pull request #45252 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Jan 14, 2025
3f6d774
fix: don't create invoice if invoice start date is in future
Jan 3, 2025
abfcfdf
fix: minor update for readability
Jan 7, 2025
f897999
Merge pull request #45254 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Jan 14, 2025
74a256a
Merge pull request #45255 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Jan 14, 2025
13c3483
Merge pull request #45256 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Jan 14, 2025
f954b24
Merge pull request #45234 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Jan 14, 2025
7a3687c
fix: change string to be able to translate (#45090)
mahsem Jan 14, 2025
2f2554e
fix: auto fetch batch and serial no for draft stock transactions
rohitwaghchaure Jan 13, 2025
2676e0e
chore: fix conflicts
rohitwaghchaure Jan 14, 2025
b4bcb7f
Merge pull request #45257 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Jan 14, 2025
36d1fbd
fix: incorrect label in Item-wise sales register
ruthra-kumar Jan 14, 2025
8ab39f5
Merge pull request #45261 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Jan 14, 2025
ad9e5d4
refactor: introduce select fields in company and payment entry
ruthra-kumar Jan 9, 2025
55d699e
refactor: patch to migrate checkbox to select
ruthra-kumar Jan 9, 2025
34b336c
refactor: test cases updated
ruthra-kumar Jan 9, 2025
74f00bb
refactor: payment entry to handle posting date on configuation
ruthra-kumar Jan 9, 2025
be8e1c0
refactor: hide old checkbox
ruthra-kumar Jan 9, 2025
2cdfa91
test: ensure reconciliation date config takes effect
ruthra-kumar Jan 10, 2025
a438520
refactor: store reconciliation date in reference
ruthra-kumar Jan 13, 2025
e7571c1
refactor: save reconcile effect on reference table
ruthra-kumar Jan 13, 2025
8f43104
refactor: backwards compatibility
ruthra-kumar Jan 13, 2025
18946f8
refactor: only update `reconcile_effect_on` advance in separate acc
ruthra-kumar Jan 14, 2025
14d1f67
chore: resolve conflicts
ruthra-kumar Jan 14, 2025
f91eb3e
Merge pull request #45265 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Jan 14, 2025
e1405a5
refactor: allow users to configure interval for Semi-Auto payment rec…
ruthra-kumar Jan 14, 2025
d508ea2
Merge pull request #45267 from frappe/mergify/bp/version-15-hotfix/pr…
ruthra-kumar Jan 14, 2025
af21bca
fix: linter issue
rohitwaghchaure Jan 14, 2025
1be8051
Merge pull request #45258 from frappe/mergify/bp/version-15-hotfix/pr…
rohitwaghchaure Jan 14, 2025
9ee5651
fix: incorrect valuation for sales return with different warhouse
rohitwaghchaure Jan 14, 2025
1c6fe9d
chore: fix conflicts
rohitwaghchaure Jan 14, 2025
88c10fa
Merge pull request #45268 from frappe/mergify/bp/version-15-hotfix/pr…
rohitwaghchaure Jan 14, 2025
bb0695a
fix: Skip WIP Warehouse transfer
mihir-kandoi Jan 13, 2025
8ba42cf
fix: tests
mihir-kandoi Jan 14, 2025
4e1d400
test: Added new test to check wip skip
mihir-kandoi Jan 15, 2025
f5667f5
fix: test case
rohitwaghchaure Jan 15, 2025
80b80e7
Merge pull request #45274 from frappe/mergify/bp/version-15-hotfix/pr…
rohitwaghchaure Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@
"show_payment_schedule_in_print",
"currency_exchange_section",
"allow_stale",
"column_break_yuug",
"stale_days",
"section_break_jpd0",
"auto_reconcile_payments",
"stale_days",
"auto_reconciliation_job_trigger",
"reconciliation_queue_size",
"column_break_resa",
"invoicing_settings_tab",
"accounts_transactions_settings_section",
"over_billing_allowance",
Expand Down Expand Up @@ -489,14 +493,36 @@
"fieldname": "create_pr_in_draft_status",
"fieldtype": "Check",
"label": "Create in Draft Status"
},
{
"fieldname": "column_break_yuug",
"fieldtype": "Column Break"
},
{
"fieldname": "column_break_resa",
"fieldtype": "Column Break"
},
{
"default": "15",
"description": "Interval should be between 1 to 59 MInutes",
"fieldname": "auto_reconciliation_job_trigger",
"fieldtype": "Int",
"label": "Auto Reconciliation Job Trigger"
},
{
"default": "5",
"description": "Documents Processed on each trigger. Queue Size should be between 5 and 100",
"fieldname": "reconciliation_queue_size",
"fieldtype": "Int",
"label": "Reconciliation Queue Size"
}
],
"icon": "icon-cog",
"idx": 1,
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2024-07-26 06:48:52.714630",
"modified": "2025-01-13 17:38:39.661320",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Settings",
Expand Down
19 changes: 19 additions & 0 deletions erpnext/accounts/doctype/accounts_settings/accounts_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from frappe.model.document import Document
from frappe.utils import cint

from erpnext.accounts.utils import sync_auto_reconcile_config
from erpnext.stock.utils import check_pending_reposting


Expand All @@ -27,6 +28,7 @@ class AccountsSettings(Document):
allow_multi_currency_invoices_against_single_party_account: DF.Check
allow_stale: DF.Check
auto_reconcile_payments: DF.Check
auto_reconciliation_job_trigger: DF.Int
automatically_fetch_payment_terms: DF.Check
automatically_process_deferred_accounting_entry: DF.Check
book_asset_depreciation_entry_automatically: DF.Check
Expand All @@ -51,6 +53,7 @@ class AccountsSettings(Document):
over_billing_allowance: DF.Currency
post_change_gl_entries: DF.Check
receivable_payable_remarks_length: DF.Int
reconciliation_queue_size: DF.Int
role_allowed_to_over_bill: DF.Link | None
round_row_wise_tax: DF.Check
show_balance_in_coa: DF.Check
Expand Down Expand Up @@ -90,6 +93,8 @@ def validate(self):
if clear_cache:
frappe.clear_cache()

self.validate_and_sync_auto_reconcile_config()

def validate_stale_days(self):
if not self.allow_stale and cint(self.stale_days) <= 0:
frappe.msgprint(
Expand All @@ -114,3 +119,17 @@ def enable_payment_schedule_in_print(self):
def validate_pending_reposts(self):
if self.acc_frozen_upto:
check_pending_reposting(self.acc_frozen_upto)

def validate_and_sync_auto_reconcile_config(self):
if self.has_value_changed("auto_reconciliation_job_trigger"):
if (
cint(self.auto_reconciliation_job_trigger) > 0
and cint(self.auto_reconciliation_job_trigger) < 60
):
sync_auto_reconcile_config(self.auto_reconciliation_job_trigger)
else:
frappe.throw(_("Cron Interval should be between 1 and 59 Min"))

if self.has_value_changed("reconciliation_queue_size"):
if cint(self.reconciliation_queue_size) < 5 or cint(self.reconciliation_queue_size) > 100:
frappe.throw(_("Queue Size should be between 5 and 100"))
13 changes: 12 additions & 1 deletion erpnext/accounts/doctype/payment_entry/payment_entry.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"party_name",
"book_advance_payments_in_separate_party_account",
"reconcile_on_advance_payment_date",
"advance_reconciliation_takes_effect_on",
"column_break_11",
"bank_account",
"party_bank_account",
Expand Down Expand Up @@ -782,6 +783,16 @@
"options": "No\nYes",
"print_hide": 1,
"search_index": 1
},
{
"default": "Oldest Of Invoice Or Advance",
"fetch_from": "company.reconciliation_takes_effect_on",
"fieldname": "advance_reconciliation_takes_effect_on",
"fieldtype": "Select",
"hidden": 1,
"label": "Advance Reconciliation Takes Effect On",
"no_copy": 1,
"options": "Advance Payment Date\nOldest Of Invoice Or Advance\nReconciliation Date"
}
],
"index_web_pages_for_search": 1,
Expand All @@ -795,7 +806,7 @@
"table_fieldname": "payment_entries"
}
],
"modified": "2024-11-07 11:19:19.320883",
"modified": "2025-01-13 16:03:47.169699",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Entry",
Expand Down
26 changes: 18 additions & 8 deletions erpnext/accounts/doctype/payment_entry/payment_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,16 +1401,26 @@ def add_advance_gl_for_reference(self, gl_entries, invoice):
"voucher_detail_no": invoice.name,
}

if self.reconcile_on_advance_payment_date:
posting_date = self.posting_date
if invoice.reconcile_effect_on:
posting_date = invoice.reconcile_effect_on
else:
date_field = "posting_date"
if invoice.reference_doctype in ["Sales Order", "Purchase Order"]:
date_field = "transaction_date"
posting_date = frappe.db.get_value(invoice.reference_doctype, invoice.reference_name, date_field)

if getdate(posting_date) < getdate(self.posting_date):
# For backwards compatibility
# Supporting reposting on payment entries reconciled before select field introduction
if self.advance_reconciliation_takes_effect_on == "Advance Payment Date":
posting_date = self.posting_date
elif self.advance_reconciliation_takes_effect_on == "Oldest Of Invoice Or Advance":
date_field = "posting_date"
if invoice.reference_doctype in ["Sales Order", "Purchase Order"]:
date_field = "transaction_date"
posting_date = frappe.db.get_value(
invoice.reference_doctype, invoice.reference_name, date_field
)

if getdate(posting_date) < getdate(self.posting_date):
posting_date = self.posting_date
elif self.advance_reconciliation_takes_effect_on == "Reconciliation Date":
posting_date = nowdate()
frappe.db.set_value("Payment Entry Reference", invoice.name, "reconcile_effect_on", posting_date)

dr_or_cr, account = self.get_dr_and_account_for_advances(invoice)
args_dict["account"] = account
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"payment_term_outstanding",
"account_type",
"payment_type",
"reconcile_effect_on",
"column_break_4",
"total_amount",
"outstanding_amount",
Expand Down Expand Up @@ -144,12 +145,18 @@
"is_virtual": 1,
"label": "Payment Request Outstanding",
"read_only": 1
},
{
"fieldname": "reconcile_effect_on",
"fieldtype": "Date",
"label": "Reconcile Effect On",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-09-16 18:11:50.019343",
"modified": "2025-01-13 15:56:18.895082",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Entry Reference",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class PaymentEntryReference(Document):
payment_term: DF.Link | None
payment_term_outstanding: DF.Float
payment_type: DF.Data | None
reconcile_effect_on: DF.Date | None
reference_doctype: DF.Link
reference_name: DF.DynamicLink
total_amount: DF.Float
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from frappe import qb
from frappe.tests.utils import FrappeTestCase, change_settings
from frappe.utils import add_days, add_years, flt, getdate, nowdate, today
from frappe.utils.data import getdate as convert_to_date

from erpnext import get_default_cost_center
from erpnext.accounts.doctype.payment_entry.payment_entry import get_payment_entry
Expand Down Expand Up @@ -1671,7 +1672,7 @@ def test_advance_payment_reconciliation_date(self):
{
"book_advance_payments_in_separate_party_account": 1,
"default_advance_paid_account": self.advance_payable_account,
"reconcile_on_advance_payment_date": 1,
"reconciliation_takes_effect_on": "Advance Payment Date",
},
)

Expand Down Expand Up @@ -1720,7 +1721,7 @@ def test_advance_payment_reconciliation_against_journal_for_customer(self):
{
"book_advance_payments_in_separate_party_account": 1,
"default_advance_received_account": self.advance_receivable_account,
"reconcile_on_advance_payment_date": 0,
"reconciliation_takes_effect_on": "Oldest Of Invoice Or Advance",
},
)
amount = 200.0
Expand Down Expand Up @@ -1829,7 +1830,7 @@ def test_advance_payment_reconciliation_against_journal_for_supplier(self):
{
"book_advance_payments_in_separate_party_account": 1,
"default_advance_paid_account": self.advance_payable_account,
"reconcile_on_advance_payment_date": 0,
"reconciliation_takes_effect_on": "Oldest Of Invoice Or Advance",
},
)
amount = 200.0
Expand Down Expand Up @@ -2048,6 +2049,102 @@ def test_reconciliation_on_closed_period_payment(self):
self.assertEqual(pr.get("invoices"), [])
self.assertEqual(pr.get("payments"), [])

def test_advance_reconciliation_effect_on_same_date(self):
frappe.db.set_value(
"Company",
self.company,
{
"book_advance_payments_in_separate_party_account": 1,
"default_advance_received_account": self.advance_receivable_account,
"reconciliation_takes_effect_on": "Reconciliation Date",
},
)
inv_date = convert_to_date(add_days(nowdate(), -1))
adv_date = convert_to_date(add_days(nowdate(), -2))

si = self.create_sales_invoice(posting_date=inv_date, qty=1, rate=200)
pe = self.create_payment_entry(posting_date=adv_date, amount=80).save().submit()

pr = self.create_payment_reconciliation()
pr.from_invoice_date = add_days(nowdate(), -1)
pr.to_invoice_date = nowdate()
pr.from_payment_date = add_days(nowdate(), -2)
pr.to_payment_date = nowdate()
pr.default_advance_account = self.advance_receivable_account

# reconcile multiple payments against invoice
pr.get_unreconciled_entries()
invoices = [x.as_dict() for x in pr.get("invoices")]
payments = [x.as_dict() for x in pr.get("payments")]
pr.allocate_entries(frappe._dict({"invoices": invoices, "payments": payments}))

# Difference amount should not be calculated for base currency accounts
for row in pr.allocation:
self.assertEqual(flt(row.get("difference_amount")), 0.0)

pr.reconcile()

si.reload()
self.assertEqual(si.status, "Partly Paid")
# check PR tool output post reconciliation
self.assertEqual(len(pr.get("invoices")), 1)
self.assertEqual(pr.get("invoices")[0].get("outstanding_amount"), 120)
self.assertEqual(pr.get("payments"), [])

# Assert Ledger Entries
gl_entries = frappe.db.get_all(
"GL Entry",
filters={"voucher_no": pe.name},
fields=["account", "posting_date", "voucher_no", "against_voucher", "debit", "credit"],
order_by="account, against_voucher, debit",
)

expected_gl = [
{
"account": self.advance_receivable_account,
"posting_date": adv_date,
"voucher_no": pe.name,
"against_voucher": pe.name,
"debit": 0.0,
"credit": 80.0,
},
{
"account": self.advance_receivable_account,
"posting_date": convert_to_date(nowdate()),
"voucher_no": pe.name,
"against_voucher": pe.name,
"debit": 80.0,
"credit": 0.0,
},
{
"account": self.debit_to,
"posting_date": convert_to_date(nowdate()),
"voucher_no": pe.name,
"against_voucher": si.name,
"debit": 0.0,
"credit": 80.0,
},
{
"account": self.bank,
"posting_date": adv_date,
"voucher_no": pe.name,
"against_voucher": None,
"debit": 80.0,
"credit": 0.0,
},
]

self.assertEqual(expected_gl, gl_entries)

# cancel PE
pe.reload()
pe.cancel()
pr.get_unreconciled_entries()
# check PR tool output
self.assertEqual(len(pr.get("invoices")), 1)
self.assertEqual(len(pr.get("payments")), 0)
self.assertEqual(pr.get("invoices")[0].get("outstanding_amount"), 200)


def make_customer(customer_name, currency=None):
if not frappe.db.exists("Customer", customer_name):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def trigger_reconciliation_for_queued_docs():

docs_to_trigger = []
unique_filters = set()
queue_size = 5
queue_size = frappe.db.get_single_value("Accounts Settings", "reconciliation_queue_size") or 5

fields = ["company", "party_type", "party", "receivable_payable_account", "default_advance_account"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@
{
"default": "1",
"depends_on": "eval: doc.is_return && doc.return_against",
"description": "Debit Note will update it's own outstanding amount, even if \"Return Against\" is specified.",
"description": "Debit Note will update it's own outstanding amount, even if 'Return Against' is specified.",
"fieldname": "update_outstanding_for_self",
"fieldtype": "Check",
"label": "Update Outstanding for Self"
Expand All @@ -1633,7 +1633,7 @@
"idx": 204,
"is_submittable": 1,
"links": [],
"modified": "2024-10-25 18:13:01.944477",
"modified": "2025-01-14 11:39:04.564610",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",
Expand Down
4 changes: 2 additions & 2 deletions erpnext/accounts/doctype/sales_invoice/sales_invoice.json
Original file line number Diff line number Diff line change
Expand Up @@ -2161,7 +2161,7 @@
{
"default": "1",
"depends_on": "eval: doc.is_return && doc.return_against",
"description": "Credit Note will update it's own outstanding amount, even if \"Return Against\" is specified.",
"description": "Credit Note will update it's own outstanding amount, even if 'Return Against' is specified.",
"fieldname": "update_outstanding_for_self",
"fieldtype": "Check",
"label": "Update Outstanding for Self",
Expand All @@ -2186,7 +2186,7 @@
"link_fieldname": "consolidated_invoice"
}
],
"modified": "2024-11-26 12:34:09.110690",
"modified": "2025-01-14 11:38:30.446370",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
Expand Down
Loading
Loading