mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-31 18:59:08 +00:00
fix: pos closing valdation (#24605)
This commit is contained in:
@@ -20,11 +20,16 @@ class POSClosingEntry(StatusUpdater):
|
|||||||
self.validate_pos_invoices()
|
self.validate_pos_invoices()
|
||||||
|
|
||||||
def validate_pos_closing(self):
|
def validate_pos_closing(self):
|
||||||
user = frappe.get_all("POS Closing Entry",
|
user = frappe.db.sql("""
|
||||||
filters = { "user": self.user, "docstatus": 1, "pos_profile": self.pos_profile },
|
SELECT name FROM `tabPOS Closing Entry`
|
||||||
or_filters = {
|
WHERE
|
||||||
"period_start_date": ("between", [self.period_start_date, self.period_end_date]),
|
user = %(user)s AND docstatus = 1 AND pos_profile = %(profile)s AND
|
||||||
"period_end_date": ("between", [self.period_start_date, self.period_end_date])
|
(period_start_date between %(start)s and %(end)s OR period_end_date between %(start)s and %(end)s)
|
||||||
|
""", {
|
||||||
|
'user': self.user,
|
||||||
|
'profile': self.pos_profile,
|
||||||
|
'start': self.period_start_date,
|
||||||
|
'end': self.period_end_date
|
||||||
})
|
})
|
||||||
|
|
||||||
if user:
|
if user:
|
||||||
|
|||||||
@@ -212,8 +212,8 @@ def consolidate_pos_invoices(pos_invoices=[], closing_entry={}):
|
|||||||
invoice_by_customer = get_invoice_customer_map(invoices)
|
invoice_by_customer = get_invoice_customer_map(invoices)
|
||||||
|
|
||||||
if len(invoices) >= 5 and closing_entry:
|
if len(invoices) >= 5 and closing_entry:
|
||||||
enqueue_job(create_merge_logs, invoice_by_customer, closing_entry)
|
|
||||||
closing_entry.set_status(update=True, status='Queued')
|
closing_entry.set_status(update=True, status='Queued')
|
||||||
|
enqueue_job(create_merge_logs, invoice_by_customer, closing_entry)
|
||||||
else:
|
else:
|
||||||
create_merge_logs(invoice_by_customer, closing_entry)
|
create_merge_logs(invoice_by_customer, closing_entry)
|
||||||
|
|
||||||
@@ -225,8 +225,8 @@ def unconsolidate_pos_invoices(closing_entry):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if len(merge_logs) >= 5:
|
if len(merge_logs) >= 5:
|
||||||
enqueue_job(cancel_merge_logs, merge_logs, closing_entry)
|
|
||||||
closing_entry.set_status(update=True, status='Queued')
|
closing_entry.set_status(update=True, status='Queued')
|
||||||
|
enqueue_job(cancel_merge_logs, merge_logs, closing_entry)
|
||||||
else:
|
else:
|
||||||
cancel_merge_logs(merge_logs, closing_entry)
|
cancel_merge_logs(merge_logs, closing_entry)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user