source: rattail/rattail/settings.py @ a732a76c

Last change on this file since a732a76c was a732a76c, checked in by Lance Edgar <lance@…>, 7 months ago

Add web app setting for default grid pagesize

  • Property mode set to 100644
File size: 12.9 KB
Line 
1# -*- coding: utf-8; -*-
2################################################################################
3#
4#  Rattail -- Retail Software Framework
5#  Copyright © 2010-2022 Lance Edgar
6#
7#  This file is part of Rattail.
8#
9#  Rattail is free software: you can redistribute it and/or modify it under the
10#  terms of the GNU General Public License as published by the Free Software
11#  Foundation, either version 3 of the License, or (at your option) any later
12#  version.
13#
14#  Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
15#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17#  details.
18#
19#  You should have received a copy of the GNU General Public License along with
20#  Rattail.  If not, see <http://www.gnu.org/licenses/>.
21#
22################################################################################
23"""
24Common setting definitions
25"""
26
27from __future__ import unicode_literals, absolute_import
28
29
30class Setting(object):
31    """
32    Base class for all setting definitions.
33    """
34    group = "(General)"
35    namespace = None
36    name = None
37    data_type = str
38    choices = None
39    required = False
40
41
42##############################
43# (General)
44##############################
45
46class rattail_app_title(Setting):
47    """
48    Official display title for the app.
49    """
50    namespace = 'rattail'
51    name = 'app_title'
52
53
54class rattail_node_title(Setting):
55    """
56    Official display title for the app node.
57    """
58    namespace = 'rattail'
59    name = 'node_title'
60
61
62class rattail_production(Setting):
63    """
64    If set, the app is considered to be running in "production" mode, whereas
65    if disabled, the app is considered to be running in development / testing /
66    staging mode.
67    """
68    namespace = 'rattail'
69    name = 'production'
70    data_type = bool
71
72
73class tailbone_background_color(Setting):
74    """
75    Background color for this app node.  If unset, default color is white.
76    """
77    namespace = 'tailbone'
78    name = 'background_color'
79
80
81class tailbone_buefy_version(Setting):
82    """
83    Version of the Buefy component JS library to use for "falafel"
84    based themes.  The minimum should be '0.8.6' or probably even
85    '0.8.13', but feel free to experiment.
86    """
87    namespace = 'tailbone'
88    name = 'buefy_version'
89
90
91class tailbone_grid_default_pagesize(Setting):
92    """
93    Default page size for grids.
94    """
95    namespace = 'tailbone'
96    name = 'grid.default_pagesize'
97    data_type = int
98
99
100class tailbone_sticky_headers(Setting):
101    """
102    Whether table/grid headers should be "sticky" for *ALL* grids.
103    This causes the grid header to remain visible as user scrolls down
104    through the row/record list; however it isn't perfect yet.  Also
105    please note, it will only work with Buefy 0.8.13 or newer.
106    """
107    namespace = 'tailbone'
108    name = 'sticky_headers'
109    data_type = bool
110
111
112class tailbone_vue_version(Setting):
113    """
114    Version of the Vue.js library to use for "falafel" (Buefy) based
115    themes.  The minimum should be '2.6.10' but feel free to
116    experiment.
117    """
118    namespace = 'tailbone'
119    name = 'vue_version'
120
121
122class rattail_single_store(Setting):
123    """
124    If set, the app should assume there is only one Store record, and that all
125    purchases etc. will pertain to it.
126    """
127    namespace = 'rattail'
128    name = 'single_store'
129    data_type = bool
130
131
132class rattail_demo(Setting):
133    """
134    If set, the app is considered to be running in "demo" mode.
135    """
136    namespace = 'rattail'
137    name = 'demo'
138    data_type = bool
139
140
141class rattail_appdir(Setting):
142    """
143    Path to the "app" dir for the running instance.
144    """
145    namespace = 'rattail'
146    name = 'appdir'
147
148
149class rattail_workdir(Setting):
150    """
151    Path to the "work" dir for the running instance.
152    """
153    namespace = 'rattail'
154    name = 'workdir'
155
156
157##############################
158# Customer Orders
159##############################
160
161class rattail_custorders_new_order_requires_customer(Setting):
162    """
163    If set, then all new orders require a proper customer account.  If
164    *not* set then just a "person" will suffice.
165    """
166    group = "Customer Orders"
167    namespace = 'rattail.custorders'
168    name = 'new_order_requires_customer'
169    data_type = bool
170
171class rattail_custorders_new_orders_allow_contact_info_choice(Setting):
172    """
173    If set, then user can choose from contact info options, when
174    creating new order.  If *not* set then they cannot choose, and
175    must use whatever the batch handler provides.
176    """
177    group = "Customer Orders"
178    namespace = 'rattail.custorders'
179    name = 'new_orders.allow_contact_info_choice'
180    data_type = bool
181
182class rattail_custorders_new_orders_restrict_contact_info(Setting):
183    """
184    If set, then user can only choose from existing contact info options,
185    for the customer/order.  If *not* set, then user is allowed to enter
186    new/different contact info.
187    """
188    group = "Customer Orders"
189    namespace = 'rattail.custorders'
190    name = 'new_orders.restrict_contact_info'
191    data_type = bool
192
193class rattail_custorders_product_price_may_be_questionable(Setting):
194    """
195    If set, then user may indicate that the price for a given product
196    is "questionable" - which normally would cause a new step in the
197    workflow, for someone to update and/or confirm the price.  If
198    *not* set then user cannot mark any price as questionable.
199    """
200    group = "Customer Orders"
201    namespace = 'rattail.custorders'
202    name = 'product_price_may_be_questionable'
203    data_type = bool
204
205
206##############################
207# DataSync
208##############################
209
210class rattail_datasync_url(Setting):
211    """
212    URL for datasync change queue.
213    """
214    group = "DataSync"
215    namespace = 'rattail.datasync'
216    name = 'url'
217
218
219class tailbone_datasync_restart(Setting):
220    """
221    Command used when restarting the datasync daemon.
222    """
223    group = "DataSync"
224    namespace = 'tailbone'
225    name = 'datasync.restart'
226
227
228##############################
229# Email
230##############################
231
232class rattail_mail_record_attempts(Setting):
233    """
234    If enabled, this flag will cause Email Attempts to be recorded in the
235    database, for "most" attempts to send email.
236    """
237    group = "Email"
238    namespace = 'rattail.mail'
239    name = 'record_attempts'
240    data_type = bool
241
242
243##############################
244# FileMon
245##############################
246
247class tailbone_filemon_restart(Setting):
248    """
249    Command used when restarting the filemon daemon.
250    """
251    group = "FileMon"
252    namespace = 'tailbone'
253    name = 'filemon.restart'
254
255
256##############################
257# Inventory
258##############################
259
260class tailbone_inventory_force_unit_item(Setting):
261    """
262    Defines which of the possible "product key" fields should be effectively
263    treated as the product key.
264    """
265    group = "Inventory"
266    namespace = 'tailbone'
267    name = 'inventory.force_unit_item'
268    data_type = bool
269
270
271##############################
272# Products
273##############################
274
275class rattail_product_key(Setting):
276    """
277    Defines which of the possible "product key" fields should be effectively
278    treated as the product key.
279    """
280    group = "Products"
281    namespace = 'rattail'
282    name = 'product.key'
283    choices = [
284        'upc',
285        'item_id',
286        'scancode',
287    ]
288
289
290class rattail_product_key_title(Setting):
291    """
292    Defines the official "title" (display name) for the product key field.
293    """
294    group = "Products"
295    namespace = 'rattail'
296    name = 'product.key_title'
297
298
299class rattail_products_mobile_quick_lookup(Setting):
300    """
301    If set, the mobile Products page will only allow "quick lookup" access to
302    product records.  If NOT set, then the typical record listing is shown.
303    """
304    group = "Products"
305    namespace = 'rattail'
306    name = 'products.mobile.quick_lookup'
307    data_type = bool
308
309
310class tailbone_products_show_pod_image(Setting):
311    """
312    If a product has an image within the database, it will be shown when
313    viewing the product details.  If this flag is set, and the product has no
314    image, then the "POD" image will be shown, if available.  If not set, the
315    POD image will not be used as a fallback.
316    """
317    group = "Products"
318    namespace = 'tailbone'
319    name = 'products.show_pod_image'
320    data_type = bool
321
322
323##############################
324# Purchasing / Receiving
325##############################
326
327class rattail_batch_purchase_allow_cases(Setting):
328    """
329    Determines whether or not "cases" is a valid UOM for ordering, receiving etc.
330    """
331    group = "Purchasing / Receiving"
332    namespace = 'rattail.batch'
333    name = 'purchase.allow_cases'
334    data_type = bool
335
336
337class rattail_batch_purchase_allow_expired_credits(Setting):
338    """
339    Determines whether or not "expired" is a valid type for purchase credits.
340    """
341    group = "Purchasing / Receiving"
342    namespace = 'rattail.batch'
343    name = 'purchase.allow_expired_credits'
344    data_type = bool
345
346
347class rattail_batch_purchase_allow_receiving_from_scratch(Setting):
348    """
349    Determines whether or not receiving "from scratch" is allowed.  In this
350    mode, the batch starts out empty and receiver must add product to it over
351    time.
352    """
353    group = "Purchasing / Receiving"
354    namespace = 'rattail.batch'
355    name = 'purchase.allow_receiving_from_scratch'
356    data_type = bool
357
358
359class rattail_batch_purchase_allow_receiving_from_invoice(Setting):
360    """
361    Determines whether or not receiving "from invoice" is allowed.  In this
362    mode, the user must first upload an invoice file they wish to receive
363    against.
364    """
365    group = "Purchasing / Receiving"
366    namespace = 'rattail.batch'
367    name = 'purchase.allow_receiving_from_invoice'
368    data_type = bool
369
370
371class rattail_batch_purchase_allow_receiving_from_purchase_order(Setting):
372    """
373    Determines whether or not receiving "from PO" is allowed.  In this mode,
374    the user must first select the purchase order (PO) they wish to receive
375    against.  The batch is initially populated with order quantities from the
376    PO, and user then updates (or adds) rows over time.
377    """
378    group = "Purchasing / Receiving"
379    namespace = 'rattail.batch'
380    name = 'purchase.allow_receiving_from_purchase_order'
381    data_type = bool
382
383
384class rattail_batch_purchase_allow_receiving_from_purchase_order_with_invoice(Setting):
385    """
386    Determines whether or not receiving "from PO with invoice" is
387    allowed.  In this mode, the user must first select the purchase
388    order (PO) they wish to receive against, as well as upload an
389    invoice file.  The batch is initially populated with order
390    quantities from the PO, then the invoice data is overlaid onto it.
391    """
392    group = "Purchasing / Receiving"
393    namespace = 'rattail.batch'
394    name = 'purchase.allow_receiving_from_purchase_order_with_invoice'
395    data_type = bool
396
397
398class rattail_batch_purchase_allow_truck_dump_receiving(Setting):
399    """
400    Determines whether or not "truck dump" receiving is allowed.  This is a
401    rather complicated feature, where one "parent" truck dump batch is created
402    for the receiver, plus several "child" batches, one for each invoice
403    involved.
404    """
405    group = "Purchasing / Receiving"
406    namespace = 'rattail.batch'
407    name = 'purchase.allow_truck_dump_receiving'
408    data_type = bool
409
410
411class rattail_batch_purchase_mobile_images(Setting):
412    """
413    If set, product images will be displayed when viewing a purchasing batch row.
414    """
415    group = "Purchasing / Receiving"
416    namespace = 'rattail.batch'
417    name = 'purchase.mobile_images'
418    data_type = bool
419
420
421class rattail_batch_purchase_mobile_quick_receive(Setting):
422    """
423    If set, a "quick receive" button will be available for mobile receiving.
424    """
425    group = "Purchasing / Receiving"
426    namespace = 'rattail.batch'
427    name = 'purchase.mobile_quick_receive'
428    data_type = bool
429
430
431class rattail_batch_purchase_mobile_quick_receive_all(Setting):
432    """
433    If set, the mobile "quick receive" button will receive "all" (remaining
434    quantity) for the item, instead of "one".
435    """
436    group = "Purchasing / Receiving"
437    namespace = 'rattail.batch'
438    name = 'purchase.mobile_quick_receive_all'
439    data_type = bool
440
441
442##############################
443# Reporting
444##############################
445
446class tailbone_reporting_choosing_uses_form(Setting):
447    """
448    When generating a new report, if this flag is set then you will choose the
449    report from a dropdown.  If the flag is not set then you will see all
450    reports listed on the page and you'll click the link for one.
451    """
452    group = "Reporting"
453    namespace = 'tailbone'
454    name = 'reporting.choosing_uses_form'
455    data_type = bool
456
457
458##############################
459# Vendors
460##############################
461
462class rattail_vendor_use_autocomplete(Setting):
463    """
464    If set, `vendor` fields will use the autocomplete widget; otherwise such
465    fields will use a drop-down (select) widget.
466    """
467    group = "Vendors"
468    namespace = 'rattail'
469    name = 'vendor.use_autocomplete'
470    data_type = bool
Note: See TracBrowser for help on using the repository browser.