const.py 9.27 KB
Newer Older
Patrick's avatar
Patrick committed
1
2
# -*- coding: utf-8
from __future__ import unicode_literals
Patrick's avatar
Patrick committed
3

Patrick's avatar
Patrick committed
4
from decimal import *
Patrick Colmant's avatar
Patrick Colmant committed
5
from django.utils.translation import ugettext_lazy as _
Patrick's avatar
Patrick committed
6
from repanier.fields.RepanierMoneyField import RepanierMoney
Patrick Colmant's avatar
Patrick Colmant committed
7

8
9
ORDER_GROUP = "order"
INVOICE_GROUP = "invoice"
Patrick's avatar
Patrick committed
10
CONTRIBUTOR_GROUP = "contributor"
Patrick's avatar
Patrick committed
11
12
COORDINATION_GROUP = "coordination"
WEBMASTER_GROUP = "webmaster"
Patrick's avatar
Patrick committed
13
DEMO_EMAIL = "repanier@no-spam.ws"
Patrick's avatar
Patrick committed
14
15

EMPTY_STRING = ''
16

Patrick's avatar
Patrick committed
17
18
DECIMAL_ZERO = Decimal('0')
DECIMAL_ONE = Decimal('1')
Patrick's avatar
Patrick committed
19
DECIMAL_TWO = Decimal('2')
20
DECIMAL_THREE = Decimal('3')
21
DECIMAL_1_02 = Decimal('1.02')
Patrick's avatar
Patrick committed
22
DECIMAL_1_04 = Decimal('1.04')
23
DECIMAL_1_06 = Decimal('1.06')
Patrick's avatar
Patrick committed
24
DECIMAL_1_10 = Decimal('1.10')
Patrick's avatar
Patrick committed
25
26
27
DECIMAL_1_12 = Decimal('1.12')
DECIMAL_1_21 = Decimal('1.21')
DECIMAL_0_02 = Decimal('0.02')
Patrick's avatar
Patrick committed
28
29
30
31
32
DECIMAL_0_04 = Decimal('0.04')
DECIMAL_0_021 = Decimal('0.021')
DECIMAL_0_025 = Decimal('0.025')
DECIMAL_0_038 = Decimal('0.038')
DECIMAL_0_055 = Decimal('0.055')
33
DECIMAL_0_06 = Decimal('0.06')
Patrick's avatar
Patrick committed
34
35
DECIMAL_0_08 = Decimal('0.08')
DECIMAL_0_10 = Decimal('0.10')
36
DECIMAL_0_12 = Decimal('0.12')
Patrick's avatar
Patrick committed
37
DECIMAL_0_20 = Decimal('0.20')
38
39
DECIMAL_0_21 = Decimal('0.21')
ZERO_DECIMAL = Decimal('0')
Patrick's avatar
Patrick committed
40
41
42
43
ONE_DECIMAL = Decimal('0.1')
TWO_DECIMALS = Decimal('0.01')
THREE_DECIMALS = Decimal('0.001')
FOUR_DECIMALS = Decimal('0.0001')
Patrick's avatar
Patrick committed
44

45
46
47
ONE_LEVEL_DEPTH = 0
TWO_LEVEL_DEPTH = 1

Patrick's avatar
Patrick committed
48
49
REPANIER_MONEY_ZERO = RepanierMoney()

pi's avatar
pi committed
50
PERMANENCE_DISABLED = '050'
Patrick's avatar
Patrick committed
51
PERMANENCE_PLANNED = '100'
Patrick's avatar
Patrick committed
52
53
PERMANENCE_WAIT_FOR_PRE_OPEN = '110'
PERMANENCE_PRE_OPEN = '120'
54
PERMANENCE_WAIT_FOR_OPEN = '200'
pi's avatar
pi committed
55
PERMANENCE_OPENED = '300'
Patrick's avatar
Patrick committed
56
57
PERMANENCE_WAIT_FOR_CLOSED = '350'
PERMANENCE_CLOSED = '370'
pi's avatar
pi committed
58
59
60
PERMANENCE_WAIT_FOR_SEND = '400'
PERMANENCE_SEND = '500'
PERMANENCE_WAIT_FOR_DONE = '600'
Patrick's avatar
Patrick committed
61
PERMANENCE_INVOICES_VALIDATION_FAILED = '700'
pi's avatar
pi committed
62
PERMANENCE_DONE = '800'
Patrick's avatar
Patrick committed
63
PERMANENCE_ARCHIVED = '900'
Patrick Colmant's avatar
Patrick Colmant committed
64
65

LUT_PERMANENCE_STATUS = (
Patrick's avatar
Patrick committed
66
67
68
69
70
71
72
73
74
75
76
77
78
79
    (PERMANENCE_DISABLED, _('disabled')),
    (PERMANENCE_PLANNED, _('planned')),
    (PERMANENCE_WAIT_FOR_PRE_OPEN, _('wait for pre-open')),
    (PERMANENCE_PRE_OPEN, _('orders pre-opened')),
    (PERMANENCE_WAIT_FOR_OPEN, _('wait for open')),
    (PERMANENCE_OPENED, _('orders opened')),
    (PERMANENCE_WAIT_FOR_CLOSED, _('wait for close')),
    (PERMANENCE_CLOSED, _('orders closed')),
    (PERMANENCE_WAIT_FOR_SEND, _('wait for send')),
    (PERMANENCE_SEND, _('orders send to producers')),
    (PERMANENCE_WAIT_FOR_DONE, _('wait for done')),
    (PERMANENCE_INVOICES_VALIDATION_FAILED, _('invoices validation test failed')),
    (PERMANENCE_DONE, _('done')),
    (PERMANENCE_ARCHIVED, _('archived'))
Patrick Colmant's avatar
Patrick Colmant committed
80
81
)

pi's avatar
pi committed
82
83
84
PRODUCT_PLACEMENT_FREEZER = '100'
PRODUCT_PLACEMENT_FRIDGE = '200'
PRODUCT_PLACEMENT_OUT_OF_BASKET = '300'
Patrick's avatar
Patrick committed
85
PRODUCT_PLACEMENT_BASKET = '400'
86
87

LUT_PRODUCT_PLACEMENT = (
Patrick's avatar
Patrick committed
88
89
90
91
    (PRODUCT_PLACEMENT_FREEZER, _('freezer')),
    (PRODUCT_PLACEMENT_FRIDGE, _('fridge')),
    (PRODUCT_PLACEMENT_OUT_OF_BASKET, _('loose, out of the basket')),
    (PRODUCT_PLACEMENT_BASKET, _('into the basket')),
Patrick's avatar
Patrick committed
92
93
)

Patrick's avatar
Patrick committed
94
95
96
97
98
99
100
LUT_PRODUCT_PLACEMENT_REVERSE = (
    (_('freezer'), PRODUCT_PLACEMENT_FREEZER),
    (_('fridge'), PRODUCT_PLACEMENT_FRIDGE),
    (_('loose, out of the basket'), PRODUCT_PLACEMENT_OUT_OF_BASKET),
    (_('into the basket'), PRODUCT_PLACEMENT_BASKET),
)

101
PRODUCT_ORDER_UNIT_PC = '100'
Patrick's avatar
Patrick committed
102
103
104
PRODUCT_ORDER_UNIT_PC_PRICE_KG = '105'
PRODUCT_ORDER_UNIT_PC_PRICE_LT = '110'
PRODUCT_ORDER_UNIT_PC_PRICE_PC = '115'
105
106
107
PRODUCT_ORDER_UNIT_KG = '120'
PRODUCT_ORDER_UNIT_PC_KG = '140'
PRODUCT_ORDER_UNIT_LT = '150'
Patrick's avatar
Patrick committed
108
109
110
111
112
PRODUCT_ORDER_UNIT_DEPOSIT = '300'
PRODUCT_ORDER_UNIT_SUBSCRIPTION = '400'
PRODUCT_ORDER_UNIT_TRANSPORTATION = '500'

LUT_PRODUCT_ORDER_UNIT = (
Patrick's avatar
Patrick committed
113
114
115
116
117
118
119
120
    (PRODUCT_ORDER_UNIT_PC, _("bought per piece")),
    (PRODUCT_ORDER_UNIT_PC_PRICE_KG, _("bought per piece (price /kg)")),
    (PRODUCT_ORDER_UNIT_PC_PRICE_LT, _("bought per piece (price /l)")),
    (PRODUCT_ORDER_UNIT_PC_PRICE_PC, _("bought per piece (price /pc)")),
    (PRODUCT_ORDER_UNIT_KG, _("bought per kg")),
    (PRODUCT_ORDER_UNIT_PC_KG, _("bought per piece, invoiced following the weight")),
    (PRODUCT_ORDER_UNIT_LT, _("bought per l")),
    (PRODUCT_ORDER_UNIT_DEPOSIT,
Patrick's avatar
Patrick committed
121
     _('As a deposit, a bag : always add this product to preparation list when the customer has purchased something.')),
Patrick's avatar
Patrick committed
122
123
124
125
    (PRODUCT_ORDER_UNIT_SUBSCRIPTION, _(
        'As a subscription, common expense : add the minimal order quantity of this product to each customer of the group')),
    (PRODUCT_ORDER_UNIT_TRANSPORTATION, _(
        'As a transportation cost : add the minimal order quantity of this product to the basket representing the group.')),
Patrick's avatar
Patrick committed
126
127
128
)

LUT_PRODUCT_ORDER_UNIT_REVERSE = (
Patrick's avatar
Patrick committed
129
130
131
132
133
134
135
136
    (_("bought per piece"), PRODUCT_ORDER_UNIT_PC),
    (_("bought per piece (price /kg)"), PRODUCT_ORDER_UNIT_PC_PRICE_KG),
    (_("bought per piece (price /l)"), PRODUCT_ORDER_UNIT_PC_PRICE_LT),
    (_("bought per piece (price /pc)"), PRODUCT_ORDER_UNIT_PC_PRICE_PC),
    (_("bought per kg"), PRODUCT_ORDER_UNIT_KG),
    (_("bought per piece, invoiced following the weight"), PRODUCT_ORDER_UNIT_PC_KG),
    (_("bought per l"), PRODUCT_ORDER_UNIT_LT),
    (_('As a deposit, a bag : always add this product to preparation list when the customer has purchased something.'),
Patrick's avatar
Patrick committed
137
     PRODUCT_ORDER_UNIT_DEPOSIT),
Patrick's avatar
Patrick committed
138
139
    (_(
        'As a subscription, common expense : add the minimal order quantity of this product to each customer of the group'),
Patrick's avatar
Patrick committed
140
     PRODUCT_ORDER_UNIT_SUBSCRIPTION),
Patrick's avatar
Patrick committed
141
142
    (_(
        'As a transportation cost : add the minimal order quantity of this product to the basket representing the group.'),
Patrick's avatar
Patrick committed
143
     PRODUCT_ORDER_UNIT_TRANSPORTATION),
pi's avatar
pi committed
144
145
)

Patrick's avatar
Patrick committed
146
147
148
149
150
151
152
153
154
155
156
157
158
159
LUT_PRODUCT_ORDER_UNIT_WO_SUBSCRIPTION = (
    (PRODUCT_ORDER_UNIT_PC, _("bought per piece")),
    (PRODUCT_ORDER_UNIT_PC_PRICE_KG, _("bought per piece (price /kg)")),
    (PRODUCT_ORDER_UNIT_PC_PRICE_LT, _("bought per piece (price /l)")),
    (PRODUCT_ORDER_UNIT_PC_PRICE_PC, _("bought per piece (price /pc)")),
    (PRODUCT_ORDER_UNIT_KG, _("bought per kg")),
    (PRODUCT_ORDER_UNIT_PC_KG, _("bought per piece, invoiced following the weight")),
    (PRODUCT_ORDER_UNIT_LT, _("bought per l")),
    (PRODUCT_ORDER_UNIT_DEPOSIT,
     _('As a deposit, a bag : always add this product to preparation list when the customer has purchased something.')),
    (PRODUCT_ORDER_UNIT_TRANSPORTATION, _(
        'As a transportation cost : add the minimal order quantity of this product to the basket representing the group.')),
)

Patrick's avatar
Patrick committed
160
161
162
LUT_PRODUCER_PRODUCT_ORDER_UNIT = (
    (PRODUCT_ORDER_UNIT_PC_PRICE_PC, _("Sold by piece")),
    (PRODUCT_ORDER_UNIT_PC_PRICE_KG, _("Sold by weight")),
163
    (PRODUCT_ORDER_UNIT_PC_PRICE_LT, _("Sold by l")),
Patrick's avatar
Patrick committed
164
165
166
    (PRODUCT_ORDER_UNIT_PC_KG, _("Sold by piece, invoiced following the weight")),
)

pi's avatar
pi committed
167
VAT_100 = '100'
168
VAT_200 = '200'
pi's avatar
pi committed
169
VAT_300 = '300'
Patrick's avatar
Patrick committed
170
171
172
173
174
VAT_315 = '315'
VAT_325 = '325'
VAT_360 = '360'
VAT_375 = '375'
VAT_350 = '350'
pi's avatar
pi committed
175
VAT_400 = '400'
Patrick's avatar
Patrick committed
176
177
VAT_430 = '430'
VAT_460 = '460'
pi's avatar
pi committed
178
VAT_500 = '500'
Patrick's avatar
Patrick committed
179
VAT_590 = '590'
pi's avatar
pi committed
180
181
VAT_600 = '600'

Patrick's avatar
Patrick committed
182
183
DICT_VAT_LABEL = 0
DICT_VAT_RATE = 1
pi's avatar
pi committed
184

Patrick's avatar
Patrick committed
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
DICT_VAT = {
    VAT_100: (_('none'), DECIMAL_ZERO),
    VAT_200: (_('compensation 2%'), DECIMAL_0_02),
    VAT_300: (_('compensation 6%'), DECIMAL_0_06),
    VAT_315: (_('vat 2.1%'), DECIMAL_0_021),
    VAT_325: (_('vat 2.5%'), DECIMAL_0_025),
    VAT_350: (_('vat 3.8%'), DECIMAL_0_038),
    VAT_360: (_('vat 4%'), DECIMAL_0_04),
    VAT_375: (_('vat 5.5%'), DECIMAL_0_055),
    VAT_400: (_('vat 6%'), DECIMAL_0_06),
    VAT_430: (_('vat 8%'), DECIMAL_0_08),
    VAT_460: (_('vat 10%'), DECIMAL_0_10),
    VAT_500: (_('vat 12%'), DECIMAL_0_12),
    VAT_590: (_('vat 20%'), DECIMAL_0_20),
    VAT_600: (_('vat 21%'), DECIMAL_0_21),
}
Patrick's avatar
Patrick committed
201
202

BANK_NOT_LATEST_TOTAL = '100'
Patrick's avatar
Patrick committed
203
204
205
206
207
BANK_SUBSCRIPTION = '150'
BANK_COMPENSATION = '200' # BANK_COMPENSATION may occurs in previous release of Repanier
BANK_PROFIT = '210'
BANK_TAX = '220'
BANK_CALCULATED_INVOICE = '250'
Patrick's avatar
Patrick committed
208
209
210
211
BANK_NEXT_LATEST_TOTAL = '300'
BANK_LATEST_TOTAL = '400'

LUT_BANK_TOTAL = (
Patrick's avatar
Patrick committed
212
    (BANK_NOT_LATEST_TOTAL, _('This is not the latest total')),
Patrick's avatar
Patrick committed
213
214
215
216
    (BANK_SUBSCRIPTION, BANK_SUBSCRIPTION),
    (BANK_PROFIT, BANK_PROFIT),
    (BANK_TAX, BANK_TAX),
    (BANK_CALCULATED_INVOICE, BANK_CALCULATED_INVOICE),
Patrick's avatar
Patrick committed
217
218
219
220
221
222
223
224
    (BANK_NEXT_LATEST_TOTAL, _('This is the next latest bank total')),
    (BANK_LATEST_TOTAL, _('This is the latest bank total')),
)

PERMANENCE_NAME_PERMANENCE = '100'
PERMANENCE_NAME_CLOSURE = '200'
PERMANENCE_NAME_DELIVERY = '300'
PERMANENCE_NAME_ORDER = '400'
Patrick's avatar
Patrick committed
225
226
PERMANENCE_NAME_OPENING = '500'
PERMANENCE_NAME_DISTRIBUTION = '600'
Patrick's avatar
Patrick committed
227
228
229
230
231
232

LUT_PERMANENCE_NAME = (
    (PERMANENCE_NAME_PERMANENCE, _('Permanence')),
    (PERMANENCE_NAME_CLOSURE, _('Closure')),
    (PERMANENCE_NAME_DELIVERY, _('Delivery')),
    (PERMANENCE_NAME_ORDER, _('Order')),
Patrick's avatar
Patrick committed
233
234
235
236
237
238
239
240
241
    (PERMANENCE_NAME_OPENING, _('Opening')),
    (PERMANENCE_NAME_DISTRIBUTION, _('Distribution')),
)

LIMIT_ORDER_QTY_ITEM = 25
LIMIT_DISPLAYED_PERMANENCE = 25
BOX_VALUE_STR = "-1"
BOX_VALUE_INT = -1
BOX_UNICODE = "📦"  # http://unicode-table.com/fr/1F6CD/
Patrick's avatar
Patrick committed
242
243
LOCK_UNICODE = "✓🔐"
VALID_UNICODE = "✓"
244
BANK_NOTE_UNICODE = "💶"
Patrick's avatar
Patrick committed
245
246
247
248
249
250
251

LUT_CONFIRM = (
    (True, LOCK_UNICODE), (False, EMPTY_STRING)
)

LUT_VALID = (
    (True, VALID_UNICODE), (False, EMPTY_STRING)
252
253
)

254
255
256
257
LUT_BANK_NOTE = (
    (True, BANK_NOTE_UNICODE), (False, EMPTY_STRING)
)

Patrick's avatar
Patrick committed
258
259
260
261
262
263
264
265
266
CURRENCY_EUR = '100'
CURRENCY_CHF = '200'
CURRENCY_LOC = '300'

LUT_CURRENCY = (
    (CURRENCY_EUR, _('Euro')),
    (CURRENCY_CHF, _('Franc')),
    (CURRENCY_LOC, _('Local')),
)