Coverage for src/sideshow_corepos/web/menus.py: 0%

17 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-02-20 09:00 -0600

1# -*- coding: utf-8; -*- 

2################################################################################ 

3# 

4# Sideshow-COREPOS -- Case/Special Order Tracker for CORE-POS 

5# Copyright © 2025 Lance Edgar 

6# 

7# This file is part of Sideshow. 

8# 

9# Sideshow is free software: you can redistribute it and/or modify it 

10# under the terms of the GNU General Public License as published by 

11# the Free Software Foundation, either version 3 of the License, or 

12# (at your option) any later version. 

13# 

14# Sideshow is distributed in the hope that it will be useful, but 

15# WITHOUT ANY WARRANTY; without even the implied warranty of 

16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 

17# General Public License for more details. 

18# 

19# You should have received a copy of the GNU General Public License 

20# along with Sideshow. If not, see <http://www.gnu.org/licenses/>. 

21# 

22################################################################################ 

23""" 

24Sideshow-COREPOS - custom menus 

25""" 

26 

27from sideshow.web import menus as base 

28 

29 

30class SideshowMenuHandler(base.SideshowMenuHandler): 

31 """ 

32 Custom menu handler for Sideshow, which adds CORE-POS entries. 

33 """ 

34 

35 def make_customers_menu(self, request, **kwargs): 

36 """ 

37 This adds the entry for CORE-POS Members. 

38 """ 

39 menu = super().make_customers_menu(request, **kwargs) 

40 

41 menu['items'].extend([ 

42 {'type': 'sep'}, 

43 { 

44 'title': "CORE-POS Members", 

45 'route': 'corepos_members', 

46 'perm': 'corepos_members.list', 

47 }, 

48 ]) 

49 

50 return menu 

51 

52 def make_products_menu(self, request, **kwargs): 

53 """ 

54 This adds the entry for CORE-POS Products. 

55 """ 

56 menu = super().make_products_menu(request, **kwargs) 

57 

58 menu['items'].extend([ 

59 {'type': 'sep'}, 

60 { 

61 'title': "CORE-POS Products", 

62 'route': 'corepos_products', 

63 'perm': 'corepos_products.list', 

64 }, 

65 ]) 

66 

67 return menu 

68 

69 def make_other_menu(self, request, **kwargs): 

70 """ 

71 This adds the entry for CORE Office. 

72 """ 

73 menu = super().make_other_menu(request, **kwargs) 

74 

75 corepos = self.app.get_corepos_handler() 

76 url = corepos.get_office_url() 

77 if url: 

78 menu['items'].extend([ 

79 { 

80 'title': "CORE Office", 

81 'url': url, 

82 'target': '_blank', 

83 }, 

84 ]) 

85 

86 return menu