Code Duplication    Length = 65-67 lines in 2 locations

bika/lims/controlpanel/bika_samplepoints.py 1 location

@@ 47-113 (lines=67) @@
44
45
class SamplePointsView(BikaListingView):
46
47
    def __init__(self, context, request):
48
        super(SamplePointsView, self).__init__(context, request)
49
50
        self.catalog = "bika_setup_catalog"
51
        self.contentFilter = {
52
            "portal_type": "SamplePoint",
53
            "sort_on": "sortable_title",
54
            "sort_order": "ascending",
55
        }
56
57
        self.context_actions = {
58
            _("Add"): {
59
                "url": "createObject?type_name=SamplePoint",
60
                "permission": AddSamplePoint,
61
                "icon": "++resource++bika.lims.images/add.png"}
62
        }
63
64
        self.title = self.context.translate(_("Sample Points"))
65
        self.icon = "{}/{}".format(
66
            self.portal_url,
67
            "/++resource++bika.lims.images/samplepoint_big.png"
68
        )
69
70
        self.show_select_row = False
71
        self.show_select_column = True
72
        self.pagesize = 25
73
74
        self.columns = collections.OrderedDict((
75
            ("Title", {
76
                "title": _("Sample Point"),
77
                "index": "sortable_title"}),
78
            ("Description", {
79
                "title": _("Description"),
80
                "index": "Description",
81
                "toggle": True}),
82
            ("Owner", {
83
                "title": _p("Owner"),
84
                "sortable": False,
85
                "toggle": True}),
86
            ("getComposite", {
87
                "title": _("Composite"),
88
                "sortable": False,
89
                "toggle": False}),
90
            ("SampleTypes", {
91
                "title": _("Sample Types"),
92
                "index": "sampletype_title",
93
                "toggle": True}),
94
        ))
95
96
        self.review_states = [
97
            {
98
                "id": "default",
99
                "title": _("Active"),
100
                "contentFilter": {"is_active": True},
101
                "transitions": [{"id": "deactivate"}, ],
102
                "columns": self.columns.keys(),
103
            }, {
104
                "id": "inactive",
105
                "title": _("Inactive"),
106
                "contentFilter": {'is_active': False},
107
                "transitions": [{"id": "activate"}, ],
108
                "columns": self.columns.keys(),
109
            }, {
110
                "id": "all",
111
                "title": _("All"),
112
                "contentFilter": {},
113
                "columns": self.columns.keys(),
114
            }
115
        ]
116

bika/lims/controlpanel/bika_departments.py 1 location

@@ 44-108 (lines=65) @@
41
42
class DepartmentsView(BikaListingView):
43
44
    def __init__(self, context, request):
45
        super(DepartmentsView, self).__init__(context, request)
46
47
        self.catalog = "bika_setup_catalog"
48
49
        self.contentFilter = {
50
            "portal_type": "Department",
51
            "sort_order": "ascending",
52
            "sort_on": "sortable_title"
53
        }
54
55
        self.context_actions = {
56
            _("Add"): {
57
                "url": "createObject?type_name=Department",
58
                "permission": AddDepartment,
59
                "icon": "++resource++bika.lims.images/add.png"}
60
        }
61
62
        self.title = self.context.translate(_("Lab Departments"))
63
        self.icon = "{}/{}".format(
64
            self.portal_url,
65
            "/++resource++bika.lims.images/department_big.png"
66
        )
67
68
        self.show_select_row = False
69
        self.show_select_column = True
70
        self.pagesize = 25
71
72
        self.columns = collections.OrderedDict((
73
            ("Title", {
74
                "title": _("Department"),
75
                "index": "sortable_title"}),
76
            ("Description", {
77
                "title": _("Description"),
78
                "index": "Description",
79
                "toggle": True}),
80
            ("Manager", {
81
                "title": _("Manager"),
82
                "toggle": True}),
83
            ("ManagerPhone", {
84
                "title": _("Manager Phone"),
85
                "toggle": True}),
86
            ("ManagerEmail", {
87
                "title": _("Manager Email"),
88
                "toggle": True}),
89
        ))
90
91
        self.review_states = [
92
            {
93
                "id": "default",
94
                "title": _("Active"),
95
                "contentFilter": {"is_active": True},
96
                "transitions": [{"id": "deactivate"}, ],
97
                "columns": self.columns.keys(),
98
            }, {
99
                "id": "inactive",
100
                "title": _("Inactive"),
101
                "contentFilter": {'is_active': False},
102
                "transitions": [{"id": "activate"}, ],
103
                "columns": self.columns.keys(),
104
            }, {
105
                "id": "all",
106
                "title": _("All"),
107
                "contentFilter": {},
108
                "columns": self.columns.keys(),
109
            },
110
        ]
111