fix: query logic
This commit is contained in:
parent
22d2970339
commit
2fea073539
@ -1,5 +1,4 @@
|
|||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import nowdate
|
|
||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
# fixes status of quotations which have status 'Expired' despite having valid sales order created
|
# fixes status of quotations which have status 'Expired' despite having valid sales order created
|
||||||
@ -16,7 +15,7 @@ def execute():
|
|||||||
and qo.valid_till < so.transaction_date""" # check if SO was created after quotation expired
|
and qo.valid_till < so.transaction_date""" # check if SO was created after quotation expired
|
||||||
|
|
||||||
frappe.db.sql(
|
frappe.db.sql(
|
||||||
"""UPDATE `tabQuotation` qo SET qo.status = 'Expired' WHERE {cond} and not exists({invalid_so_against_quo})"""
|
"""UPDATE `tabQuotation` qo SET qo.status = 'Expired' WHERE {cond} and exists({invalid_so_against_quo})"""
|
||||||
.format(cond=cond, invalid_so_against_quo=invalid_so_against_quo)
|
.format(cond=cond, invalid_so_against_quo=invalid_so_against_quo)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -30,6 +29,6 @@ def execute():
|
|||||||
and qo.valid_till >= so.transaction_date""" # check if SO was created before quotation expired
|
and qo.valid_till >= so.transaction_date""" # check if SO was created before quotation expired
|
||||||
|
|
||||||
frappe.db.sql(
|
frappe.db.sql(
|
||||||
"""UPDATE `tabQuotation` qo SET qo.status = 'Closed' WHERE {cond} and not exists({valid_so_against_quo})"""
|
"""UPDATE `tabQuotation` qo SET qo.status = 'Closed' WHERE {cond} and exists({valid_so_against_quo})"""
|
||||||
.format(cond=cond, valid_so_against_quo=valid_so_against_quo)
|
.format(cond=cond, valid_so_against_quo=valid_so_against_quo)
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user