Merge pull request #56045 from mihir-kandoi/pg-final-fixes

fix(postgres): final fix-class changes (asset GROUP BY + accounts-controller boolean)
This commit is contained in:
Mihir Kandoi
2026-06-17 16:32:13 +05:30
committed by GitHub
2 changed files with 6 additions and 4 deletions

View File

@@ -96,7 +96,9 @@ def get_depreciable_assets_data(date):
.where(a.status.isin(["Submitted", "Partially Depreciated"]))
.where(ds.journal_entry.isnull())
.where(ds.schedule_date <= date)
.groupby(ads.name)
# a.name/a.creation are constant per ads.name; include them so postgres accepts the
# SELECT and ORDER BY (one row per Asset Depreciation Schedule either way)
.groupby(ads.name, a.name, a.creation)
.orderby(a.creation, order=Order.desc)
)

View File

@@ -1583,13 +1583,13 @@ def update_invoice_status():
total = (
frappe.qb.terms.Case()
.when(invoice.disable_rounded_total, invoice.grand_total)
.when(invoice.disable_rounded_total == 1, invoice.grand_total)
.else_(invoice.rounded_total)
)
base_total = (
frappe.qb.terms.Case()
.when(invoice.disable_rounded_total, invoice.base_grand_total)
.when(invoice.disable_rounded_total == 1, invoice.base_grand_total)
.else_(invoice.base_rounded_total)
)
@@ -1602,7 +1602,7 @@ def update_invoice_status():
& (invoice.outstanding_amount > 0)
& (invoice.status.like("Unpaid%") | invoice.status.like("Partly Paid%"))
& (
((invoice.is_pos & invoice.due_date < today) | is_overdue)
(((invoice.is_pos == 1) & (invoice.due_date < today)) | is_overdue)
if doctype == "Sales Invoice"
else is_overdue
)