source: rattail/rattail/settings.py @ 2cb0363

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

Expose settings for tailbone vue.js and buefy versions

  • Property mode set to 100644
File size: 12.7 KB
Line 
1# -*- coding: utf-8; -*-
2################################################################################
3#
4#  Rattail -- Retail Software Framework
5#  Copyright © 2010-2021 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_sticky_headers(Setting):
92    """
93    Whether table/grid headers should be "sticky" for *ALL* grids.
94    This causes the grid header to remain visible as user scrolls down
95    through the row/record list; however it isn't perfect yet.  Also
96    please note, it will only work with Buefy 0.8.13 or newer.
97    """
98    namespace = 'tailbone'
99    name = 'sticky_headers'
100    data_type = bool
101
102
103class tailbone_vue_version(Setting):
104    """
105    Version of the Vue.js library to use for "falafel" (Buefy) based
106    themes.  The minimum should be '2.6.10' but feel free to
107    experiment.
108    """
109    namespace = 'tailbone'
110    name = 'vue_version'
111
112
113class rattail_single_store(Setting):
114    """
115    If set, the app should assume there is only one Store record, and that all
116    purchases etc. will pertain to it.
117    """
118    namespace = 'rattail'
119    name = 'single_store'
120    data_type = bool
121
122
123class rattail_demo(Setting):
124    """
125    If set, the app is considered to be running in "demo" mode.
126    """
127    namespace = 'rattail'
128    name = 'demo'
129    data_type = bool
130
131
132class rattail_appdir(Setting):
133    """
134    Path to the "app" dir for the running instance.
135    """
136    namespace = 'rattail'
137    name = 'appdir'
138
139
140class rattail_workdir(Setting):
141    """
142    Path to the "work" dir for the running instance.
143    """
144    namespace = 'rattail'
145    name = 'workdir'
146
147
148##############################
149# Customer Orders
150##############################
151
152class rattail_custorders_new_order_requires_customer(Setting):
153    """
154    If set, then all new orders require a proper customer account.  If
155    *not* set then just a "person" will suffice.
156    """
157    group = "Customer Orders"
158    namespace = 'rattail.custorders'
159    name = 'new_order_requires_customer'
160    data_type = bool
161
162class rattail_custorders_new_orders_allow_contact_info_choice(Setting):
163    """
164    If set, then user can choose from contact info options, when
165    creating new order.  If *not* set then they cannot choose, and
166    must use whatever the batch handler provides.
167    """
168    group = "Customer Orders"
169    namespace = 'rattail.custorders'
170    name = 'new_orders.allow_contact_info_choice'
171    data_type = bool
172
173class rattail_custorders_new_orders_restrict_contact_info(Setting):
174    """
175    If set, then user can only choose from existing contact info options,
176    for the customer/order.  If *not* set, then user is allowed to enter
177    new/different contact info.
178    """
179    group = "Customer Orders"
180    namespace = 'rattail.custorders'
181    name = 'new_orders.restrict_contact_info'
182    data_type = bool
183
184class rattail_custorders_product_price_may_be_questionable(Setting):
185    """
186    If set, then user may indicate that the price for a given product
187    is "questionable" - which normally would cause a new step in the
188    workflow, for someone to update and/or confirm the price.  If
189    *not* set then user cannot mark any price as questionable.
190    """
191    group = "Customer Orders"
192    namespace = 'rattail.custorders'
193    name = 'product_price_may_be_questionable'
194    data_type = bool
195
196
197##############################
198# DataSync
199##############################
200
201class rattail_datasync_url(Setting):
202    """
203    URL for datasync change queue.
204    """
205    group = "DataSync"
206    namespace = 'rattail.datasync'
207    name = 'url'
208
209
210class tailbone_datasync_restart(Setting):
211    """
212    Command used when restarting the datasync daemon.
213    """
214    group = "DataSync"
215    namespace = 'tailbone'
216    name = 'datasync.restart'
217
218
219##############################
220# Email
221##############################
222
223class rattail_mail_record_attempts(Setting):
224    """
225    If enabled, this flag will cause Email Attempts to be recorded in the
226    database, for "most" attempts to send email.
227    """
228    group = "Email"
229    namespace = 'rattail.mail'
230    name = 'record_attempts'
231    data_type = bool
232
233
234##############################
235# FileMon
236##############################
237
238class tailbone_filemon_restart(Setting):
239    """
240    Command used when restarting the filemon daemon.
241    """
242    group = "FileMon"
243    namespace = 'tailbone'
244    name = 'filemon.restart'
245
246
247##############################
248# Inventory
249##############################
250
251class tailbone_inventory_force_unit_item(Setting):
252    """
253    Defines which of the possible "product key" fields should be effectively
254    treated as the product key.
255    """
256    group = "Inventory"
257    namespace = 'tailbone'
258    name = 'inventory.force_unit_item'
259    data_type = bool
260
261
262##############################
263# Products
264##############################
265
266class rattail_product_key(Setting):
267    """
268    Defines which of the possible "product key" fields should be effectively
269    treated as the product key.
270    """
271    group = "Products"
272    namespace = 'rattail'
273    name = 'product.key'
274    choices = [
275        'upc',
276        'item_id',
277        'scancode',
278    ]
279
280
281class rattail_product_key_title(Setting):
282    """
283    Defines the official "title" (display name) for the product key field.
284    """
285    group = "Products"
286    namespace = 'rattail'
287    name = 'product.key_title'
288
289
290class rattail_products_mobile_quick_lookup(Setting):
291    """
292    If set, the mobile Products page will only allow "quick lookup" access to
293    product records.  If NOT set, then the typical record listing is shown.
294    """
295    group = "Products"
296    namespace = 'rattail'
297    name = 'products.mobile.quick_lookup'
298    data_type = bool
299
300
301class tailbone_products_show_pod_image(Setting):
302    """
303    If a product has an image within the database, it will be shown when
304    viewing the product details.  If this flag is set, and the product has no
305    image, then the "POD" image will be shown, if available.  If not set, the
306    POD image will not be used as a fallback.
307    """
308    group = "Products"
309    namespace = 'tailbone'
310    name = 'products.show_pod_image'
311    data_type = bool
312
313
314##############################
315# Purchasing / Receiving
316##############################
317
318class rattail_batch_purchase_allow_cases(Setting):
319    """
320    Determines whether or not "cases" is a valid UOM for ordering, receiving etc.
321    """
322    group = "Purchasing / Receiving"
323    namespace = 'rattail.batch'
324    name = 'purchase.allow_cases'
325    data_type = bool
326
327
328class rattail_batch_purchase_allow_expired_credits(Setting):
329    """
330    Determines whether or not "expired" is a valid type for purchase credits.
331    """
332    group = "Purchasing / Receiving"
333    namespace = 'rattail.batch'
334    name = 'purchase.allow_expired_credits'
335    data_type = bool
336
337
338class rattail_batch_purchase_allow_receiving_from_scratch(Setting):
339    """
340    Determines whether or not receiving "from scratch" is allowed.  In this
341    mode, the batch starts out empty and receiver must add product to it over
342    time.
343    """
344    group = "Purchasing / Receiving"
345    namespace = 'rattail.batch'
346    name = 'purchase.allow_receiving_from_scratch'
347    data_type = bool
348
349
350class rattail_batch_purchase_allow_receiving_from_invoice(Setting):
351    """
352    Determines whether or not receiving "from invoice" is allowed.  In this
353    mode, the user must first upload an invoice file they wish to receive
354    against.
355    """
356    group = "Purchasing / Receiving"
357    namespace = 'rattail.batch'
358    name = 'purchase.allow_receiving_from_invoice'
359    data_type = bool
360
361
362class rattail_batch_purchase_allow_receiving_from_purchase_order(Setting):
363    """
364    Determines whether or not receiving "from PO" is allowed.  In this mode,
365    the user must first select the purchase order (PO) they wish to receive
366    against.  The batch is initially populated with order quantities from the
367    PO, and user then updates (or adds) rows over time.
368    """
369    group = "Purchasing / Receiving"
370    namespace = 'rattail.batch'
371    name = 'purchase.allow_receiving_from_purchase_order'
372    data_type = bool
373
374
375class rattail_batch_purchase_allow_receiving_from_purchase_order_with_invoice(Setting):
376    """
377    Determines whether or not receiving "from PO with invoice" is
378    allowed.  In this mode, the user must first select the purchase
379    order (PO) they wish to receive against, as well as upload an
380    invoice file.  The batch is initially populated with order
381    quantities from the PO, then the invoice data is overlaid onto it.
382    """
383    group = "Purchasing / Receiving"
384    namespace = 'rattail.batch'
385    name = 'purchase.allow_receiving_from_purchase_order_with_invoice'
386    data_type = bool
387
388
389class rattail_batch_purchase_allow_truck_dump_receiving(Setting):
390    """
391    Determines whether or not "truck dump" receiving is allowed.  This is a
392    rather complicated feature, where one "parent" truck dump batch is created
393    for the receiver, plus several "child" batches, one for each invoice
394    involved.
395    """
396    group = "Purchasing / Receiving"
397    namespace = 'rattail.batch'
398    name = 'purchase.allow_truck_dump_receiving'
399    data_type = bool
400
401
402class rattail_batch_purchase_mobile_images(Setting):
403    """
404    If set, product images will be displayed when viewing a purchasing batch row.
405    """
406    group = "Purchasing / Receiving"
407    namespace = 'rattail.batch'
408    name = 'purchase.mobile_images'
409    data_type = bool
410
411
412class rattail_batch_purchase_mobile_quick_receive(Setting):
413    """
414    If set, a "quick receive" button will be available for mobile receiving.
415    """
416    group = "Purchasing / Receiving"
417    namespace = 'rattail.batch'
418    name = 'purchase.mobile_quick_receive'
419    data_type = bool
420
421
422class rattail_batch_purchase_mobile_quick_receive_all(Setting):
423    """
424    If set, the mobile "quick receive" button will receive "all" (remaining
425    quantity) for the item, instead of "one".
426    """
427    group = "Purchasing / Receiving"
428    namespace = 'rattail.batch'
429    name = 'purchase.mobile_quick_receive_all'
430    data_type = bool
431
432
433##############################
434# Reporting
435##############################
436
437class tailbone_reporting_choosing_uses_form(Setting):
438    """
439    When generating a new report, if this flag is set then you will choose the
440    report from a dropdown.  If the flag is not set then you will see all
441    reports listed on the page and you'll click the link for one.
442    """
443    group = "Reporting"
444    namespace = 'tailbone'
445    name = 'reporting.choosing_uses_form'
446    data_type = bool
447
448
449##############################
450# Vendors
451##############################
452
453class rattail_vendor_use_autocomplete(Setting):
454    """
455    If set, `vendor` fields will use the autocomplete widget; otherwise such
456    fields will use a drop-down (select) widget.
457    """
458    group = "Vendors"
459    namespace = 'rattail'
460    name = 'vendor.use_autocomplete'
461    data_type = bool
Note: See TracBrowser for help on using the repository browser.