Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5856d96
creating pos opening entry without a quality review is blocked
amnuoo Jan 7, 2026
1607ae6
taking value for goal from quality goal
amnuoo Jan 7, 2026
a268f06
check for goal in quality review
amnuoo Jan 7, 2026
7c1013b
completed blocking of pos opening entry if quality review is not present
amnuoo Jan 7, 2026
84a2d88
fetch quality goal for POS closing entry
amnuoo Jan 8, 2026
87eefcf
checking Quality review for POS closing entry is present
amnuoo Jan 8, 2026
43ce7f6
Print a warning message if the status is Failed
amnuoo Jan 8, 2026
e07eab4
warning message printed for the POS closing entry if the quality revi…
amnuoo Jan 8, 2026
1fcf462
fixed problem of closing entry
amnuoo Jan 8, 2026
63f3509
get roles of current user
amnuoo Jan 9, 2026
d5c6cf9
check whether link field has elements of the logged in user
amnuoo Jan 9, 2026
59a65b9
connected with js using set.query method
amnuoo Jan 9, 2026
417834f
added hook
amnuoo Jan 9, 2026
52c13dc
final fix for the hooks problem
amnuoo Jan 9, 2026
65f90f8
enable/disable option added
amnuoo Jan 12, 2026
0ba20b6
removed console checks
amnuoo Jan 12, 2026
999fabb
assigning specific goal removed and made it based on role
amnuoo Jan 12, 2026
7ce7d2e
made same changes for closing also
amnuoo Jan 12, 2026
b44bed8
message corrected
amnuoo Jan 12, 2026
04cedfa
check box changed to childtable in pos profile for pos opening entry
amnuoo Jan 14, 2026
bd02d73
throwing error for failed review changed into a warning message
amnuoo Jan 14, 2026
570c707
childtable for closing entry is done
amnuoo Jan 14, 2026
f6fa7e9
api added for checklist
amnuoo Jan 14, 2026
5158882
update: added quality_review file in app include js
amnuoo Jan 14, 2026
d24a978
refactor: custom field has been added to the ury module
amnuoo Jan 14, 2026
023bf1c
fix: validate the POS checklist status and redirect the user if it's…
MVVYSHNAV Jan 22, 2026
cba4ee5
fix: pos checklist validation
MVVYSHNAV Jan 23, 2026
87d4209
fix: checklist validation and alert appears before POS alerts
MVVYSHNAV Jan 23, 2026
6dd4e25
fix: removed repeat call in hook
MVVYSHNAV Jan 23, 2026
35df555
fix:Added role field to the daily quality check childtable
amnuoo Jan 23, 2026
04a441d
add checklist_type parameter and Prevented opening checklist from blo…
MVVYSHNAV Jan 23, 2026
69009db
fix: user role comparison logic and syntax error in backend API.
MVVYSHNAV Jan 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 32 additions & 16 deletions ury/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"/assets/ury/js/quick_entry.js",
"/assets/ury/js/pos_print.js",
"/assets/ury/js/restrict_qty_edit_pos.js",
"/assets/ury/js/ury_pos_kot.js"
"/assets/ury/js/ury_pos_kot.js",
"/assets/ury/js/quality_review.js"
]

# include js, css files in header of web template
Expand All @@ -35,12 +36,12 @@
# include js in page
page_js = {"point-of-sale": ["public/js/pos_extend.js"]}


# include js in doctype views
# doctype_js = {"POS Invoive" : "public/js/pos_print.js"}
# doctype_list_js = {"doctype" : "public/js/doctype_list.js"}
# doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"}
# doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"}

# Splash Image in Website Settings
website_context = {"splash_image": "/assets/ury/Images/ury-logo.jpg"}

Expand Down Expand Up @@ -121,30 +122,45 @@
"POS Invoice": {
"before_insert": "ury.ury.hooks.ury_pos_invoice.before_insert",
"validate": "ury.ury.hooks.ury_pos_invoice.validate",
"after_insert":"ury.ury.api.ury_kot_order_number.set_order_number",
"after_insert": "ury.ury.api.ury_kot_order_number.set_order_number",
"before_submit": "ury.ury.hooks.ury_pos_invoice.before_submit",
"on_cancel": "ury.ury.hooks.ury_pos_invoice.on_trash",
"on_trash": "ury.ury.hooks.ury_pos_invoice.on_trash",
},
"POS Profile": {"validate": "ury.ury.hooks.ury_pos_profile.validate"},

"POS Profile": {
"validate": "ury.ury.hooks.ury_pos_profile.validate"
},

"Sales Invoice": {
"before_insert": "ury.ury.hooks.ury_sales_invoice.before_insert",
"on_update":"ury.ury.hooks.ury_sales_invoice.on_update",
},
"Customer": {"before_save": "ury.ury.hooks.ury_customer.before_insert"},
"Item": {"validate": "ury.ury.hooks.ury_item.validate"},
"on_update": "ury.ury.hooks.ury_sales_invoice.on_update",
},

"Customer": {
"before_save": "ury.ury.hooks.ury_customer.before_insert"
},

"Item": {
"validate": "ury.ury.hooks.ury_item.validate"
},

"POS Opening Entry": {
"validate":"ury.ury.hooks.ury_pos_opening_entry.set_cashier_room",
"validate": "ury.ury.hooks.ury_pos_opening_entry.validate",
"before_save": "ury.ury.hooks.ury_pos_opening_entry.before_save",
"before_insert":"ury.ury.api.ury_kot_order_number.set_last_invoice_in_pos_open",
},
"before_insert": "ury.ury.api.ury_kot_order_number.set_last_invoice_in_pos_open",

},

"POS Closing Entry": {
"before_save": "ury.ury.hooks.ury_pos_closing_entry.before_save",
"validate":"ury.ury.hooks.ury_pos_closing_entry.validate"
},
"validate": "ury.ury.hooks.ury_pos_closing_entry.validate",
"before_submit": "ury.ury.hooks.ury_pos_closing_entry.validate_pos_closing_quality_review",
},

"URY Menu Course": {
"validate": "ury.ury.api.ury_menu_course_validation.validate_priority",
}
"validate": "ury.ury.api.ury_menu_course_validation.validate_priority",
}
}

# Scheduled Tasks
Expand Down Expand Up @@ -373,4 +389,4 @@
},
{"dt": "Role", "filters": [["role_name", "like", "URY %"]]},
"Client Script",
]
]
9 changes: 9 additions & 0 deletions ury/public/js/quality_review.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
frappe.ui.form.on("Quality Review", {
setup(frm) {
frm.set_query("goal", function () {
return {
query: "ury.ury.api.quality_goal.quality_goal_for_current_user"
};
});
}
});
76 changes: 76 additions & 0 deletions ury/ury/api/pos_checklist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import frappe
from frappe.utils import flt, get_datetime, today
from ury.ury_pos.api import getBranch


@frappe.whitelist()
def checklist(**kwargs):
today_date = today()
employee = frappe.session.user
branchName = getBranch()

pos_opening_list = frappe.get_all(
"POS Opening Entry",
filters={
"branch": branchName,
"docstatus": 1,
"status": "Open"
},
fields=["posting_date"]
)

if pos_opening_list:
pos_open = 1
pos_posting_date = pos_opening_list[0].posting_date
else:
pos_open = 0
pos_posting_date = today_date

user_roles = frappe.get_roles(employee)

pos_profile_name = frappe.get_value(
"POS Profile",
{"branch": branchName},
"name"
)

if not pos_profile_name:
return {
"pos_open": pos_open,
"checklist": 1
}

pos_profile = frappe.get_doc("POS Profile", pos_profile_name)
daily_quality_checklist = pos_profile.custom_daily_quality_checking

if not daily_quality_checklist:
return {
"pos_open": pos_open,
"checklist": 1
}

to_submit_checklists = []
for checklist in daily_quality_checklist:
for user_role in user_roles:
if checklist.role == user_role:
to_submit_checklists.append(checklist)

if not to_submit_checklists:
return {
"pos_open": pos_open,
"checklist": 1
}

is_checklist_submitted = frappe.db.exists({
"doctype": "Quality Review",
"date": pos_posting_date,
"status": ["in", ["Open", "Passed"]],
"owner": employee
})

return {
"pos_open": pos_open,
"checklist": 1 if is_checklist_submitted else 0,
"checklist_name": [check.checklist for check in to_submit_checklists],
"pos_posting_date": pos_posting_date
}
32 changes: 32 additions & 0 deletions ury/ury/api/quality_goal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import frappe

@frappe.whitelist()
def quality_goal_for_current_user(
doctype, txt, searchfield, start, page_len, filters
):
user = frappe.session.user

if user == "Administrator":
return frappe.db.sql("""
SELECT name
FROM `tabQuality Goal`
WHERE name LIKE %s
ORDER BY modified DESC
LIMIT %s, %s
""", (f"%{txt}%", start, page_len))

roles = frappe.get_roles(user)
if not roles:
return []

placeholders = ", ".join(["%s"] * len(roles))

return frappe.db.sql(f"""
SELECT name
FROM `tabQuality Goal`
WHERE
name LIKE %s
AND custom_assigned_role IN ({placeholders})
ORDER BY modified DESC
LIMIT %s, %s
""", tuple([f"%{txt}%"] + roles + [start, page_len]))
Loading