mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-27 22:05:19 +00:00
Convert the remaining raw frappe.db.sql in the CRM module to frappe.qb / ORM so the queries run on PostgreSQL as well as MariaDB. Faithful conversions -- no MariaDB behaviour change: - opportunity.py, doctype/utils.py (get_last_interaction) - reports: campaign_efficiency, first_response_time_for_opportunity (GROUP BY on the grouped Date(creation) + Avg -- Postgres-valid), lead_conversion_time, prospects_engaged_but_not_converted lead_conversion_time also keeps the IS NOT NULL communication-date guard (forward-port of the fix already on develop). Also drops invalid backtick notation from two get_all order_by clauses in doctype/utils.py (order_by="`creation` DESC"), which frappe's query engine rejects -- a latent failure on both engines, surfaced by the new test. Tests: existing opportunity suite plus new both-engine tests for the four previously untested reports/utils. All green on MariaDB and PostgreSQL. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>