Retrieves all open POS opening shift vouchers for a specified user, aggregating payment entries and invoice data for each shift.
import frappe
import math
from frappe.utils import today, formatdate, flt, datetime
import calendar
from retail.retail.api.payment_utils import get_shift_payments_entries, get_shift_unallocated_payments, get_shift_invoice_payments, get_shift_pos_invoices
@frappe.whitelist()
def check_opening_shift(user):
open_vouchers = frappe.db.get_all(
"POS Opening Shift",
filters={
"user": user,
"docstatus": 1,
"status": "Open",
},
fields=["name", "pos_profile"],
order_by="period_start_date desc",
)
if not open_vouchers:
return {"count": 0, "shifts": []}
shifts = []
for voucher in open_vouchers:
data = {}
data["pos_opening_shift"] = frappe.get_doc(
"POS Opening Shift",
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key