Skip to content

Commit bc144cb

Browse files
committed
Add:Room wise menu,Fix:Print field update
1 parent 14a64e2 commit bc144cb

File tree

18 files changed

+302
-110
lines changed

18 files changed

+302
-110
lines changed

FEATURES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636

3737
- Specified rates in the table automatically creates a 'Price list' using the same menu name.
3838

39+
- Default menu is added in URY Restaurant.
40+
41+
- Room wise menu is handled by enabling room wise menu and adding values in the child table.
42+
43+
- If room wise menu is enabled , ury take menu as per the room defined against each table on table selection.
44+
3945
- Menu Selection tab contain :
4046
- Search bar to quickly locate specific menu items, enhancing speed and accuracy during busy periods.
4147

SETUP.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ Follow these steps to set up URY:
3838
- **Company**: Specify the company under which the restaurant is being created.
3939
- **Default customer** : Set a default customer .
4040
- **Invoice Series Prefix**: allows you to define prefix for naming of a Invoice .
41-
- **Active Menu** : Select Menu against the restaurant .
42-
- **Branch** : Select the branch associated with the restaurant .
41+
- **Branch** : Select the branch associated with the restaurant .
4342
- **Default Tax Template** : Mention the [Sales tax](https://docs.erpnext.com/docs/user/manual/en/sales-taxes-and-charges-template) value if applicable .
4443
- **Address** : Provide the address of the restaurant.
44+
- **Default Menu** : Select Menu against the restaurant .
45+
- **Room Wise Menu** : To enable room wise menu .
46+
- **Menu For Room** : Add restaurant menu against each room to handle room wise price list.
4547

4648

4749
**Step 5 :**
@@ -66,7 +68,8 @@ Follow these steps to set up URY:
6668
- Next is to Create Restaurant Room with the following details :
6769

6870
- **Name** : Specify a unique name to the room.
69-
- **Room Type** : Select the type from the list
71+
- **Room Type** : Select the type from the list.
72+
- **Print Settings** : Choose a network printer.
7073

7174
**Step 8 :**
7275

ury/hooks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@
265265
"POS Profile-section_break_tjhrm",
266266
"POS Profile-transfer_role_permissions",
267267
"POS Profile-role_allowed_for_billing",
268+
"POS Profile-role_restricted_for_table_order",
268269
"POS Profile-restaurant_prefix",
269270
"POS Opening Entry-restaurant_info",
270271
"POS Opening Entry-restaurant",

ury/public/js/pos_extend.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,5 @@ frappe.pages['point-of-sale'].on_page_load = function (wrapper) {
184184
wrapper.pos = new erpnext.PointOfSale.Controller(wrapper);
185185
window.cur_pos = wrapper.pos;
186186
});
187-
};
187+
};
188+

ury/public/js/pos_print.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ frappe.ui.form.on('POS Invoice', {
9494
callback: function (r) {
9595
}
9696
});
97+
cur_frm.set_value('invoice_printed', 1);
9798
frappe.dom.unfreeze();
9899
frappe.show_alert({ message: __('Invoice Printed'), indicator: 'green' });
99100
})
@@ -132,10 +133,9 @@ frappe.ui.form.on('POS Invoice', {
132133
if (r.message == "Success") {
133134
$('.standard-actions').addClass('hidden-xs hidden-md');
134135
frappe.show_alert({ message: __('Invoice Printed'), indicator: 'green' });
135-
setTimeout(function () {
136-
frappe.dom.unfreeze();
137-
frappe.ui.toolbar.clear_cache()
138-
}, 1500)
136+
cur_frm.set_value('invoice_printed', 1);
137+
frappe.dom.unfreeze();
138+
cur_frm.reload_doc();
139139
}
140140
else {
141141
console.error(r.message);
@@ -165,6 +165,7 @@ frappe.ui.form.on('POS Invoice', {
165165
},
166166
callback: function (r) {
167167
$('.standard-actions').addClass('hidden-xs hidden-md');
168+
cur_frm.set_value('invoice_printed', 1);
168169
frappe.show_alert({ message: __('Invoice Printed'), indicator: 'green' });
169170
frappe.ui.toolbar.clear_cache()
170171
frappe.dom.unfreeze();
@@ -175,4 +176,5 @@ frappe.ui.form.on('POS Invoice', {
175176
})
176177
}
177178

178-
})
179+
})
180+

ury/ury/api/pos_extend.py

Lines changed: 60 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,39 @@
1+
from erpnext.accounts.doctype.sales_invoice.sales_invoice import (
2+
SalesInvoice,
3+
update_multi_mode_option,
4+
)
15
import frappe
26
from frappe.utils.nestedset import get_root_of
37
from frappe.utils import cint
4-
from erpnext.accounts.doctype.pos_invoice.pos_invoice import get_stock_availability
8+
from erpnext.accounts.doctype.pos_invoice.pos_invoice import (
9+
add_return_modes,
10+
get_stock_availability,
11+
)
512
from erpnext.selling.page.point_of_sale.point_of_sale import (
613
search_by_term,
714
get_conditions,
815
get_item_group_condition,
916
)
17+
from erpnext.accounts.party import get_due_date, get_party_account
1018

1119

1220
@frappe.whitelist()
1321
def overrided_past_order_list(search_term, status, limit=20):
1422
user = frappe.session.user
15-
sql_query = """
16-
SELECT b.branch
17-
FROM `tabURY User` AS a
18-
INNER JOIN `tabBranch` AS b ON a.parent = b.name
19-
WHERE a.user = %s
20-
"""
21-
branch_array = frappe.db.sql(sql_query, user, as_dict=True)
2223

23-
if not branch_array:
24-
frappe.throw("User is not Associated with any Branch.Please refresh Page")
24+
if user != "Administrator":
25+
sql_query = """
26+
SELECT b.branch
27+
FROM `tabURY User` AS a
28+
INNER JOIN `tabBranch` AS b ON a.parent = b.name
29+
WHERE a.user = %s
30+
"""
31+
branch_array = frappe.db.sql(sql_query, user, as_dict=True)
32+
33+
if not branch_array:
34+
frappe.throw("User is not Associated with any Branch.Please refresh Page")
2535

26-
branch_name = branch_array[0].get("branch")
36+
branch_name = branch_array[0].get("branch")
2737

2838
fields = [
2939
"name",
@@ -55,24 +65,46 @@ def overrided_past_order_list(search_term, status, limit=20):
5565
invoice_list = invoices_by_customer + invoices_by_name
5666

5767
elif status:
58-
if status == "To Bill":
59-
invoice_list = frappe.db.get_all(
60-
"POS Invoice",
61-
filters={"status": "Draft", "branch": branch_name},
62-
fields=fields,
63-
)
64-
for invoice in invoice_list:
65-
if invoice.restaurant_table and invoice.invoice_printed == 0:
66-
updated_list.append(invoice)
68+
if user != "Administrator":
69+
if status == "To Bill":
70+
invoice_list = frappe.db.get_all(
71+
"POS Invoice",
72+
filters={"status": "Draft", "branch": branch_name},
73+
fields=fields,
74+
)
75+
for invoice in invoice_list:
76+
if invoice.restaurant_table and invoice.invoice_printed == 0:
77+
updated_list.append(invoice)
78+
79+
else:
80+
invoice_list = frappe.db.get_all(
81+
"POS Invoice",
82+
filters={"status": status, "branch": branch_name},
83+
fields=fields,
84+
)
85+
for invoice in invoice_list:
86+
if not invoice.restaurant_table or invoice.invoice_printed == 1:
87+
updated_list.append(invoice)
6788

6889
else:
69-
invoice_list = frappe.db.get_all(
70-
"POS Invoice",
71-
filters={"status": status, "branch": branch_name},
72-
fields=fields,
73-
)
74-
for invoice in invoice_list:
75-
if not invoice.restaurant_table or invoice.invoice_printed == 1:
76-
updated_list.append(invoice)
90+
if status == "To Bill":
91+
invoice_list = frappe.db.get_all(
92+
"POS Invoice",
93+
filters={"status": "Draft"},
94+
fields=fields,
95+
)
96+
for invoice in invoice_list:
97+
if invoice.restaurant_table and invoice.invoice_printed == 0:
98+
updated_list.append(invoice)
99+
100+
else:
101+
invoice_list = frappe.db.get_all(
102+
"POS Invoice",
103+
filters={"status": status},
104+
fields=fields,
105+
)
106+
for invoice in invoice_list:
107+
if not invoice.restaurant_table or invoice.invoice_printed == 1:
108+
updated_list.append(invoice)
77109

78110
return updated_list

ury/ury/api/ury_print.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,33 @@ def network_printing(
8181
return f"An error occurred: {str(e)}"
8282

8383

84+
@frappe.whitelist()
85+
def select_network_printer(pos_profile, invoice_id):
86+
table = frappe.db.get_value("POS Invoice", invoice_id, "restaurant_table")
87+
print_format = frappe.db.get_value("POS Profile", pos_profile, "print_format")
88+
89+
if table:
90+
room = frappe.db.get_value("URY Table", table, "restaurant_room")
91+
room_bill_printer = frappe.db.get_value(
92+
"URY Printer Settings", {"parent": room, "bill": 1}, "printer"
93+
)
94+
if room_bill_printer:
95+
print = network_printing(
96+
"POS Invoice", invoice_id, room_bill_printer, print_format
97+
)
98+
return print
99+
100+
else:
101+
pos_bill_printer = frappe.db.get_value(
102+
"URY Printer Settings", {"parent": pos_profile, "bill": 1}, "printer"
103+
)
104+
if pos_bill_printer:
105+
print = network_printing(
106+
"POS Invoice", invoice_id, pos_bill_printer, print_format
107+
)
108+
return print
109+
110+
84111
@frappe.whitelist()
85112
def qz_print_update(invoice):
86113
table = frappe.db.get_value("POS Invoice", invoice, "restaurant_table")

ury/ury/doctype/menu_for_room/__init__.py

Whitespace-only changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright (c) 2024, Tridz Technologies Pvt. Ltd and contributors
2+
// For license information, please see license.txt
3+
4+
frappe.ui.form.on('Menu for Room', {
5+
// refresh: function(frm) {
6+
7+
// }
8+
});
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"actions": [],
3+
"allow_rename": 1,
4+
"creation": "2024-01-07 13:11:04.784852",
5+
"default_view": "List",
6+
"doctype": "DocType",
7+
"editable_grid": 1,
8+
"engine": "InnoDB",
9+
"field_order": [
10+
"menu",
11+
"room"
12+
],
13+
"fields": [
14+
{
15+
"fieldname": "menu",
16+
"fieldtype": "Link",
17+
"in_list_view": 1,
18+
"label": "Menu",
19+
"options": "URY Menu"
20+
},
21+
{
22+
"fieldname": "room",
23+
"fieldtype": "Link",
24+
"in_list_view": 1,
25+
"label": "Room",
26+
"options": "URY Room"
27+
}
28+
],
29+
"index_web_pages_for_search": 1,
30+
"istable": 1,
31+
"links": [],
32+
"modified": "2024-01-07 13:11:45.463070",
33+
"modified_by": "Administrator",
34+
"module": "URY",
35+
"name": "Menu for Room",
36+
"owner": "Administrator",
37+
"permissions": [],
38+
"sort_field": "modified",
39+
"sort_order": "DESC",
40+
"states": []
41+
}

0 commit comments

Comments
 (0)