fix: update sql function usage syntax

This commit is contained in:
Faris Ansari
2025-06-06 12:11:18 +05:30
parent 495bf4b765
commit 6a3fc36979
2 changed files with 5 additions and 5 deletions

View File

@@ -766,7 +766,7 @@ def validate_against_pcv(is_opening, posting_date, company):
) )
last_pcv_date = frappe.db.get_value( last_pcv_date = frappe.db.get_value(
"Period Closing Voucher", {"docstatus": 1, "company": company}, "max(period_end_date)" "Period Closing Voucher", {"docstatus": 1, "company": company}, {"MAX": "period_end_date"}
) )
if last_pcv_date and getdate(posting_date) <= getdate(last_pcv_date): if last_pcv_date and getdate(posting_date) <= getdate(last_pcv_date):

View File

@@ -5,7 +5,7 @@
import frappe import frappe
from frappe import _ from frappe import _
from frappe.utils import cint, flt from frappe.utils import cint, flt
from frappe.query_builder.functions import Sum
from erpnext.controllers.status_updater import StatusUpdater from erpnext.controllers.status_updater import StatusUpdater
@@ -128,11 +128,11 @@ class PackingSlip(StatusUpdater):
item.idx item.idx
) )
) )
DocType = frappe.qb.DocType("Delivery Note Item" if item.dn_detail else "Packed Item")
remaining_qty = frappe.db.get_value( remaining_qty = frappe.db.get_value(
"Delivery Note Item" if item.dn_detail else "Packed Item", "Delivery Note Item" if item.dn_detail else "Packed Item",
{"name": item.dn_detail or item.pi_detail, "docstatus": 0}, {"name": item.dn_detail or item.pi_detail, "docstatus": 0},
["sum(qty - packed_qty)"], Sum(DocType.qty - DocType.packed_qty),
) )
if remaining_qty is None: if remaining_qty is None:
@@ -174,7 +174,7 @@ class PackingSlip(StatusUpdater):
return ( return (
cint( cint(
frappe.db.get_value( frappe.db.get_value(
"Packing Slip", {"delivery_note": self.delivery_note, "docstatus": 1}, ["max(to_case_no)"] "Packing Slip", {"delivery_note": self.delivery_note, "docstatus": 1}, {"MAX": "to_case_no"}
) )
) )
+ 1 + 1