mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-26 05:15:20 +00:00
fix(postgres): compare Check fields with == 1 in accounts controller CASE/condition
disable_rounded_total and is_pos are smallint Check fields; postgres rejects using them as bare boolean conditions in CASE WHEN / bitwise-AND, so compare explicitly against 1. No-op on MariaDB. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user