BUGG : ERPNext asset.py invalid empty date "" PostgreSQL

Target : erpnext/assets/doctype/asset/asset.py

Problem: update_maintenance_status() calls frappe.db.exists() with a
filter {“next_due_date”: today()} — but the Asset Maintenance Task
table may contain records with next_due_date = “” (empty string).
PostgreSQL rejects empty string for a date column:
invalid input syntax for type date: “”

Fix : Add a filter to exclude empty/NULL next_due_date values by
also filtering for next_due_date != “” and != None,
i.e., use a proper date filter that only matches today’s actual date.

     The safest fix at the Python level is to guard the frappe.db.exists
     call with an additional "next_due_date": ("!=", "") condition,
     or switch to frappe.db.count() with explicit filters.

      Since frappe.db.exists() concatenates filters as AND conditions,
      we replace the filter dict to explicitly exclude empty dates.

It comes from the fact that ERPNext isn’t really built for PostgreSQL.

Frappe itself works fine with Postgres, but ERPNext is designed and tested mainly on MariaDB.
Running ERPNext on PostgreSQL can cause these kinds of issues because it’s not officially supported.