Skip to content

Commit 7e22eda

Browse files
committed
Feat: Added default room field in 'ury_restaurant' and implemented roomwise table ordering API for 'ury_pos'.
1 parent c7e9c7d commit 7e22eda

5 files changed

Lines changed: 108 additions & 60 deletions

File tree

ury/fixtures/custom_field.json

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,14 +1466,14 @@
14661466
"columns": 0,
14671467
"default": null,
14681468
"depends_on": null,
1469-
"description": null,
1469+
"description": "Enables Cashiers to view all statuses (Paid, Consolidated, Return Invoices) in the recent order.",
14701470
"docstatus": 0,
14711471
"doctype": "Custom Field",
1472-
"dt": "Sales Invoice",
1472+
"dt": "POS Profile",
14731473
"fetch_from": null,
14741474
"fetch_if_empty": 0,
1475-
"fieldname": "order_info",
1476-
"fieldtype": "Section Break",
1475+
"fieldname": "view_all_status",
1476+
"fieldtype": "Check",
14771477
"hidden": 0,
14781478
"hide_border": 0,
14791479
"hide_days": 0,
@@ -1484,15 +1484,15 @@
14841484
"in_list_view": 0,
14851485
"in_preview": 0,
14861486
"in_standard_filter": 0,
1487-
"insert_after": "amended_from",
1487+
"insert_after": "role_restricted_for_table_order",
14881488
"is_system_generated": 0,
14891489
"is_virtual": 0,
1490-
"label": "Order Info",
1490+
"label": "Allow Cashier To View All Status",
14911491
"length": 0,
14921492
"mandatory_depends_on": null,
1493-
"modified": "2023-09-14 00:31:35.774264",
1493+
"modified": "2024-01-23 13:30:17.539810",
14941494
"module": null,
1495-
"name": "Sales Invoice-order_info",
1495+
"name": "POS Profile-view_all_status",
14961496
"no_copy": 0,
14971497
"non_negative": 0,
14981498
"options": null,
@@ -1520,14 +1520,14 @@
15201520
"columns": 0,
15211521
"default": null,
15221522
"depends_on": null,
1523-
"description": "Enables Cashiers to view all statuses (Paid, Consolidated, Return Invoices) in the recent order.",
1523+
"description": null,
15241524
"docstatus": 0,
15251525
"doctype": "Custom Field",
1526-
"dt": "POS Profile",
1526+
"dt": "Sales Invoice",
15271527
"fetch_from": null,
15281528
"fetch_if_empty": 0,
1529-
"fieldname": "view_all_status",
1530-
"fieldtype": "Check",
1529+
"fieldname": "order_info",
1530+
"fieldtype": "Section Break",
15311531
"hidden": 0,
15321532
"hide_border": 0,
15331533
"hide_days": 0,
@@ -1538,15 +1538,15 @@
15381538
"in_list_view": 0,
15391539
"in_preview": 0,
15401540
"in_standard_filter": 0,
1541-
"insert_after": "role_restricted_for_table_order",
1541+
"insert_after": "amended_from",
15421542
"is_system_generated": 0,
15431543
"is_virtual": 0,
1544-
"label": "Allow Cashier To View All Status",
1544+
"label": "Order Info",
15451545
"length": 0,
15461546
"mandatory_depends_on": null,
1547-
"modified": "2024-01-23 13:30:17.539810",
1547+
"modified": "2023-09-14 00:31:35.774264",
15481548
"module": null,
1549-
"name": "POS Profile-view_all_status",
1549+
"name": "Sales Invoice-order_info",
15501550
"no_copy": 0,
15511551
"non_negative": 0,
15521552
"options": null,
@@ -1626,16 +1626,16 @@
16261626
"collapsible": 0,
16271627
"collapsible_depends_on": null,
16281628
"columns": 0,
1629-
"default": "Dine In",
1629+
"default": null,
16301630
"depends_on": null,
16311631
"description": null,
16321632
"docstatus": 0,
16331633
"doctype": "Custom Field",
1634-
"dt": "Sales Invoice",
1634+
"dt": "POS Profile",
16351635
"fetch_from": null,
16361636
"fetch_if_empty": 0,
1637-
"fieldname": "order_type",
1638-
"fieldtype": "Select",
1637+
"fieldname": "remove_items",
1638+
"fieldtype": "Check",
16391639
"hidden": 0,
16401640
"hide_border": 0,
16411641
"hide_days": 0,
@@ -1646,18 +1646,18 @@
16461646
"in_list_view": 0,
16471647
"in_preview": 0,
16481648
"in_standard_filter": 0,
1649-
"insert_after": "order_info",
1649+
"insert_after": "view_all_status",
16501650
"is_system_generated": 0,
16511651
"is_virtual": 0,
1652-
"label": "Order Type",
1652+
"label": "Allow Cashier To Edit And Remove Table Order Items",
16531653
"length": 0,
16541654
"mandatory_depends_on": null,
1655-
"modified": "2023-09-14 00:31:36.390337",
1655+
"modified": "2024-01-23 13:32:45.884420",
16561656
"module": null,
1657-
"name": "Sales Invoice-order_type",
1657+
"name": "POS Profile-remove_items",
16581658
"no_copy": 0,
16591659
"non_negative": 0,
1660-
"options": "\nDine In\nTake Away\nDelivery\nPhone In\nAggregators",
1660+
"options": null,
16611661
"permlevel": 0,
16621662
"precision": "",
16631663
"print_hide": 0,
@@ -1680,16 +1680,16 @@
16801680
"collapsible": 0,
16811681
"collapsible_depends_on": null,
16821682
"columns": 0,
1683-
"default": null,
1683+
"default": "Dine In",
16841684
"depends_on": null,
16851685
"description": null,
16861686
"docstatus": 0,
16871687
"doctype": "Custom Field",
1688-
"dt": "POS Profile",
1688+
"dt": "Sales Invoice",
16891689
"fetch_from": null,
16901690
"fetch_if_empty": 0,
1691-
"fieldname": "remove_items",
1692-
"fieldtype": "Check",
1691+
"fieldname": "order_type",
1692+
"fieldtype": "Select",
16931693
"hidden": 0,
16941694
"hide_border": 0,
16951695
"hide_days": 0,
@@ -1700,18 +1700,18 @@
17001700
"in_list_view": 0,
17011701
"in_preview": 0,
17021702
"in_standard_filter": 0,
1703-
"insert_after": "view_all_status",
1703+
"insert_after": "order_info",
17041704
"is_system_generated": 0,
17051705
"is_virtual": 0,
1706-
"label": "Allow Cashier To Edit And Remove Table Order Items",
1706+
"label": "Order Type",
17071707
"length": 0,
17081708
"mandatory_depends_on": null,
1709-
"modified": "2024-01-23 13:32:45.884420",
1709+
"modified": "2023-09-14 00:31:36.390337",
17101710
"module": null,
1711-
"name": "POS Profile-remove_items",
1711+
"name": "Sales Invoice-order_type",
17121712
"no_copy": 0,
17131713
"non_negative": 0,
1714-
"options": null,
1714+
"options": "\nDine In\nTake Away\nDelivery\nPhone In\nAggregators",
17151715
"permlevel": 0,
17161716
"precision": "",
17171717
"print_hide": 0,
@@ -1788,16 +1788,16 @@
17881788
"collapsible": 0,
17891789
"collapsible_depends_on": null,
17901790
"columns": 0,
1791-
"default": null,
1791+
"default": "1",
17921792
"depends_on": null,
17931793
"description": null,
17941794
"docstatus": 0,
17951795
"doctype": "Custom Field",
1796-
"dt": "Sales Invoice",
1796+
"dt": "POS Profile",
17971797
"fetch_from": null,
17981798
"fetch_if_empty": 0,
1799-
"fieldname": "waiter",
1800-
"fieldtype": "Data",
1799+
"fieldname": "show_image",
1800+
"fieldtype": "Check",
18011801
"hidden": 0,
18021802
"hide_border": 0,
18031803
"hide_days": 0,
@@ -1808,15 +1808,15 @@
18081808
"in_list_view": 0,
18091809
"in_preview": 0,
18101810
"in_standard_filter": 0,
1811-
"insert_after": "order_type",
1811+
"insert_after": "remove_items",
18121812
"is_system_generated": 0,
18131813
"is_virtual": 0,
1814-
"label": "Waiter",
1814+
"label": "Show Item Image In URY Pos",
18151815
"length": 0,
18161816
"mandatory_depends_on": null,
1817-
"modified": "2023-09-14 00:31:36.754796",
1817+
"modified": "2024-02-09 19:24:46.076630",
18181818
"module": null,
1819-
"name": "Sales Invoice-waiter",
1819+
"name": "POS Profile-show_image",
18201820
"no_copy": 0,
18211821
"non_negative": 0,
18221822
"options": null,
@@ -1825,7 +1825,7 @@
18251825
"print_hide": 0,
18261826
"print_hide_if_no_value": 0,
18271827
"print_width": null,
1828-
"read_only": 1,
1828+
"read_only": 0,
18291829
"read_only_depends_on": null,
18301830
"report_hide": 0,
18311831
"reqd": 0,
@@ -1842,16 +1842,16 @@
18421842
"collapsible": 0,
18431843
"collapsible_depends_on": null,
18441844
"columns": 0,
1845-
"default": "1",
1845+
"default": null,
18461846
"depends_on": null,
18471847
"description": null,
18481848
"docstatus": 0,
18491849
"doctype": "Custom Field",
1850-
"dt": "POS Profile",
1850+
"dt": "Sales Invoice",
18511851
"fetch_from": null,
18521852
"fetch_if_empty": 0,
1853-
"fieldname": "show_image",
1854-
"fieldtype": "Check",
1853+
"fieldname": "waiter",
1854+
"fieldtype": "Data",
18551855
"hidden": 0,
18561856
"hide_border": 0,
18571857
"hide_days": 0,
@@ -1862,15 +1862,15 @@
18621862
"in_list_view": 0,
18631863
"in_preview": 0,
18641864
"in_standard_filter": 0,
1865-
"insert_after": "remove_items",
1865+
"insert_after": "order_type",
18661866
"is_system_generated": 0,
18671867
"is_virtual": 0,
1868-
"label": "Show Item Image In URY Pos",
1868+
"label": "Waiter",
18691869
"length": 0,
18701870
"mandatory_depends_on": null,
1871-
"modified": "2024-02-09 19:24:46.076630",
1871+
"modified": "2023-09-14 00:31:36.754796",
18721872
"module": null,
1873-
"name": "POS Profile-show_image",
1873+
"name": "Sales Invoice-waiter",
18741874
"no_copy": 0,
18751875
"non_negative": 0,
18761876
"options": null,
@@ -1879,7 +1879,7 @@
18791879
"print_hide": 0,
18801880
"print_hide_if_no_value": 0,
18811881
"print_width": null,
1882-
"read_only": 0,
1882+
"read_only": 1,
18831883
"read_only_depends_on": null,
18841884
"report_hide": 0,
18851885
"reqd": 0,

ury/ury/doctype/ury_order/ury_order.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ def sync_order(
203203
}
204204
past_item.append(previous_item)
205205

206-
# conditional checking for ury and for ury pos
206+
# Conditional checking for 'items' type:
207+
# - 'ury': JSON passed, hence using isinstance
208+
# - 'ury_pos': Already formatted list, hence using else
207209
if isinstance(items, str):
208210
items = json.loads(items)
209211
invoice.items = []
@@ -249,11 +251,14 @@ def sync_order(
249251
filters={"item_code": item.item_code, "price_list": price_list},
250252
fields=["price_list_rate"],
251253
)
252-
253-
item.rate = item_prices[0].price_list_rate
254-
item.cost_center = frappe.db.get_value(
255-
"POS Profile", pos_profile, "cost_center"
256-
)
254+
255+
if not item_prices:
256+
frappe.throw(_("POS Profile Not Found or User permission in POS Profile is not given to this user."))
257+
else:
258+
item.rate = item_prices[0].price_list_rate
259+
item.cost_center = frappe.db.get_value(
260+
"POS Profile", pos_profile, "cost_center"
261+
)
257262

258263
invoice.save()
259264

ury/ury/doctype/ury_restaurant/ury_restaurant.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
"menu_info_section",
1919
"active_menu",
2020
"room_wise_menu",
21+
"column_break_vo5jt",
22+
"default_room",
2123
"menu_for_room"
2224
],
2325
"fields": [
@@ -88,11 +90,22 @@
8890
"fieldtype": "Table",
8991
"label": "Menu For Room",
9092
"options": "Menu for Room"
93+
},
94+
{
95+
"fieldname": "column_break_vo5jt",
96+
"fieldtype": "Column Break"
97+
},
98+
{
99+
"fieldname": "default_room",
100+
"fieldtype": "Link",
101+
"label": "Default Room",
102+
"options": "URY Room",
103+
"reqd": 1
91104
}
92105
],
93106
"image_field": "image",
94107
"links": [],
95-
"modified": "2024-01-08 14:54:48.115520",
108+
"modified": "2024-05-01 19:55:53.124596",
96109
"modified_by": "Administrator",
97110
"module": "URY",
98111
"name": "URY Restaurant",

ury/ury/doctype/ury_room/ury_room.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
"editable_grid": 1,
99
"engine": "InnoDB",
1010
"field_order": [
11+
"branch",
12+
"column_break_ahfni",
1113
"room_type",
14+
"section_break_hrqbe",
1215
"printer_settings"
1316
],
1417
"fields": [
@@ -23,11 +26,27 @@
2326
"fieldtype": "Table",
2427
"label": "Printer Settings",
2528
"options": "URY Printer Settings"
29+
},
30+
{
31+
"fieldname": "branch",
32+
"fieldtype": "Link",
33+
"in_list_view": 1,
34+
"label": "Branch",
35+
"options": "Branch",
36+
"reqd": 1
37+
},
38+
{
39+
"fieldname": "column_break_ahfni",
40+
"fieldtype": "Column Break"
41+
},
42+
{
43+
"fieldname": "section_break_hrqbe",
44+
"fieldtype": "Section Break"
2645
}
2746
],
2847
"index_web_pages_for_search": 1,
2948
"links": [],
30-
"modified": "2024-01-08 13:33:41.540961",
49+
"modified": "2024-05-01 19:54:10.412708",
3150
"modified_by": "Administrator",
3251
"module": "URY",
3352
"name": "URY Room",

ury/ury_pos/api.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
from frappe import _
33

44

5+
@frappe.whitelist()
6+
def getTable(room):
7+
branch_name = getBranch()
8+
tables = frappe.get_all(
9+
"URY Table",
10+
fields=["name", "occupied", "latest_invoice_time", "is_take_away", "restaurant_room"],
11+
filters={"branch": branch_name,"restaurant_room":room,}
12+
)
13+
return tables
14+
15+
516
@frappe.whitelist()
617
def getRestaurantMenu(pos_profile, table=None):
718
menu_items = []

0 commit comments

Comments
 (0)