Commit 5a3fbcd9 authored by Patrick's avatar Patrick

Add is_group field to customer to simplify the logic

parent a5ec1709
......@@ -142,6 +142,7 @@ class CustomerResource(resources.ModelResource):
date_balance = fields.Field(attribute='get_admin_date_balance', widget=DateWidgetExcel(), readonly=True)
balance = fields.Field(attribute='get_admin_balance', widget=TwoMoneysWidget(), readonly=True)
may_order = fields.Field(attribute='may_order', default=False, widget=DecimalBooleanWidget(), readonly=False)
is_group = fields.Field(attribute='is_group', default=False, widget=DecimalBooleanWidget(), readonly=False)
represent_this_buyinggroup = fields.Field(attribute='represent_this_buyinggroup', widget=DecimalBooleanWidget(),
readonly=True)
is_active = fields.Field(attribute='is_active', widget=DecimalBooleanWidget(), readonly=True)
......@@ -202,7 +203,8 @@ class CustomerResource(resources.ModelResource):
'bank_account1', 'bank_account2',
'date_balance', 'balance', 'price_list_multiplier',
'membership_fee_valid_until', 'last_membership_fee', 'last_membership_fee_date',
'participation', 'purchase', 'represent_this_buyinggroup', 'is_active', 'delivery_point', 'valid_email'
'participation', 'purchase', 'represent_this_buyinggroup', 'is_group', 'is_active', 'delivery_point',
'valid_email'
)
export_order = fields
import_id_fields = ('id',)
......@@ -239,7 +241,7 @@ class CustomerWithUserDataAdmin(ImportExportMixin, admin.ModelAdmin):
search_fields = ('short_basket_name', 'long_basket_name', 'user__email', 'email2')
list_per_page = 16
list_max_show_all = 16
list_filter = ('is_active', 'may_order', 'valid_email')
list_filter = ('is_active', 'may_order', 'is_group', 'valid_email')
def has_delete_permission(self, request, customer=None):
if request.user.groups.filter(
......@@ -320,7 +322,7 @@ class CustomerWithUserDataAdmin(ImportExportMixin, admin.ModelAdmin):
else:
fields_basic += [
('get_admin_balance', 'price_list_multiplier', 'get_admin_date_balance'),
('may_order', 'is_active'),
('may_order', 'is_group', 'is_active'),
]
else:
fields_basic += [
......
......@@ -103,10 +103,7 @@ class LUTDeliveryPointDataForm(TranslatableModelForm):
required=False
)
customer_responsible = forms.ModelChoiceField(
Customer.objects.filter(
may_order=False, is_active=True, delivery_point__isnull=True,
represent_this_buyinggroup=False
),
Customer.objects.filter(is_group=True, is_active=True),
label=_("customer_responsible"),
help_text=_("Invoices are sent to this consumer who is responsible for collecting the payments."),
required=False)
......
......@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Repanier\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-03-14 14:00+0100\n"
"PO-Revision-Date: 2017-03-14 14:03+0100\n"
"POT-Creation-Date: 2017-03-21 19:36+0100\n"
"PO-Revision-Date: 2017-03-21 19:58+0100\n"
"Last-Translator: Patrick Colmant <pcolmant@gmail.com>\n"
"Language-Team: Patrick Colmant <pcolmant@gmail.com>\n"
"Language: fr\n"
......@@ -23,11 +23,11 @@ msgstr ""
msgid "producers"
msgstr "Producteurs"
#: admin/admin_filter.py:52 models/lut.py:124
#: admin/admin_filter.py:52 models/lut.py:142
msgid "departments for customer"
msgstr "Rayons"
#: admin/admin_filter.py:82 models/lut.py:50
#: admin/admin_filter.py:82 models/lut.py:56
msgid "production modes"
msgstr "Labels"
......@@ -42,7 +42,7 @@ msgid "vat"
msgstr "TVA"
#: admin/admin_filter.py:133 admin/bankaccount.py:144 models/bankaccount.py:23
#: models/bankaccount.py:110 models/customer.py:268 models/invoice.py:23
#: models/bankaccount.py:110 models/customer.py:269 models/invoice.py:23
#: models/invoice.py:26 models/invoice.py:406 models/invoice.py:450
#: models/permanenceboard.py:15 models/purchase.py:42 models/purchase.py:44
#: xlsx/xlsx_order.py:304 xlsx/xlsx_purchase.py:45 xlsx/xlsx_purchase.py:593
......@@ -59,7 +59,7 @@ msgid "producer"
msgstr "Fournisseur"
#: admin/admin_filter.py:186 admin/admin_filter.py:207
#: models/permanence.py:469 models/purchase.py:174
#: models/permanence.py:472 models/purchase.py:174
msgid "permanence"
msgstr "permanence"
......@@ -79,8 +79,8 @@ msgstr "Statut"
msgid "not invoiced"
msgstr "Pas encore facturés"
#: admin/admin_filter.py:244 models/customer.py:100 models/customer.py:161
#: models/customer.py:190 models/invoice.py:92 models/invoice.py:340
#: admin/admin_filter.py:244 models/customer.py:100 models/customer.py:162
#: models/customer.py:191 models/invoice.py:92 models/invoice.py:340
#: models/producer.py:97 models/producer.py:158 models/producer.py:228
#: models/producer.py:263
msgid "balance"
......@@ -197,8 +197,8 @@ msgstr "Consigne calculée"
msgid "flip_flop_select_for_offer_status for offer"
msgstr "✔ en commande ↔ ✘ pas en commande"
#: admin/box.py:191 admin/permanence_done.py:122 admin/permanence_done.py:326
#: admin/permanence_done.py:427 admin/permanence_in_preparation.py:226
#: admin/box.py:191 admin/permanence_done.py:122 admin/permanence_done.py:321
#: admin/permanence_done.py:422 admin/permanence_in_preparation.py:226
#: admin/permanence_in_preparation.py:270
#: admin/permanence_in_preparation.py:291
#: admin/permanence_in_preparation.py:422
......@@ -213,8 +213,8 @@ msgstr "Action annulée par l'utilisateur."
#: admin/box.py:197 admin/permanence_done.py:85 admin/permanence_done.py:96
#: admin/permanence_done.py:107 admin/permanence_done.py:128
#: admin/permanence_done.py:307 admin/permanence_done.py:332
#: admin/permanence_done.py:433 admin/permanence_done.py:454
#: admin/permanence_done.py:302 admin/permanence_done.py:327
#: admin/permanence_done.py:428 admin/permanence_done.py:449
#: admin/permanence_in_preparation.py:216
#: admin/permanence_in_preparation.py:232
#: admin/permanence_in_preparation.py:276
......@@ -243,7 +243,7 @@ msgstr "Créer un duplicata"
msgid "Advanced descriptions"
msgstr "Descriptions avancées"
#: admin/box.py:234 admin/configuration.py:98 admin/customer.py:342
#: admin/box.py:234 admin/configuration.py:98 admin/customer.py:344
#: admin/producer.py:311 admin/product.py:475
msgid "Advanced options"
msgstr "Paramètres avancés"
......@@ -277,8 +277,7 @@ msgid "Invoicing mails"
msgstr "✉ mails de facturation des commandes"
#: admin/customer.py:34 admin/staff.py:21
#: templates/repanier/who_is_who.html:86
#: templates/repanier/who_is_who.html:110
#: templates/repanier/who_is_who.html:58 templates/repanier/who_is_who.html:82
msgid "Email"
msgstr "✉"
......@@ -331,49 +330,49 @@ msgstr ""
msgid "This bank account already belongs to another customer."
msgstr "Ce compte en banque appartient déjà à un autre consommateur."
#: admin/customer.py:177
#: admin/customer.py:178
#, python-format
msgid "The email %s is already used by another user."
msgstr "L'e-mail %s est déjà utilisé par un autre utilisateur."
#: admin/customer.py:180
#: admin/customer.py:181
#, python-format
msgid "The short_basket_name %s is already used by another user."
msgstr "Ce nom de panier %s est déjà attribué à un autre utilisateur."
#: admin/customer.py:220 admin/producer.py:96
#: admin/customer.py:222 admin/producer.py:96
#, python-format
msgid "Export purchases of %s"
msgstr "Exporter la liste de produits achetés en %s"
#: admin/customer.py:269 models/producer.py:36 xlsx/xlsx_order.py:43
#: admin/customer.py:271 models/producer.py:36 xlsx/xlsx_order.py:43
#: xlsx/xlsx_order.py:92
msgid "email"
msgstr "✉"
#: admin/customer.py:278
#: admin/customer.py:280
msgid "date joined"
msgstr "Date d'inscription"
#: admin/customer.py:286
#: admin/customer.py:288
msgid "last login"
msgstr "Dernière connexion"
#: admin/customer.py:400
#: admin/customer.py:402
#, python-format
msgid ""
" in addition to the %(discount)s%% personal discount rate on to the pricelist"
msgstr ""
" en + de la réduction personnelle de %(discount)s%% accordée sur le tarif"
#: admin/customer.py:405
#: admin/customer.py:407
#, python-format
msgid ""
" in addition to the %(surcharge)s%% personal surcharge on to the pricelist"
msgstr ""
" en + de la surcharge personnelle de %(surcharge)s%% appliquée sur le tarif"
#: admin/customer.py:410
#: admin/customer.py:412
#, python-format
msgid ""
"%(discount)s%% discount is granted to consumer invoices when delivered to "
......@@ -382,7 +381,7 @@ msgstr ""
"Une réduction de %(discount)s%% sur les factures avec livraison "
"\"%(delivery_point)s\" est accordée%(customer_price)s."
#: admin/customer.py:418
#: admin/customer.py:420
#, python-format
msgid ""
"%(surcharge)s%% surcharge is applied to consumer invoices when delivered to "
......@@ -445,15 +444,22 @@ msgstr "Montant réclamé par le producteur"
msgid "invoice reference"
msgstr "Référence facture"
#: admin/lut.py:55
#: admin/lut.py:85 admin/lut.py:88
#, python-format
msgid "The maximum level for this model is %d"
msgstr ""
"Pour simplifier la lisibilité de l'interface pour les consommateurs/"
"producteurs, le nombre maximum de niveau pour ce type d'objet est de %d"
#: admin/lut.py:102
msgid "Members"
msgstr "Membres"
#: admin/lut.py:63 models/lut.py:70 models/staff.py:24
#: admin/lut.py:107 models/lut.py:81 models/staff.py:24
msgid "customer_responsible"
msgstr "Consommateur responsable"
#: admin/lut.py:64 models/lut.py:71
#: admin/lut.py:108 models/lut.py:82
msgid ""
"Invoices are sent to this consumer who is responsible for collecting the "
"payments."
......@@ -462,7 +468,7 @@ msgstr ""
"les paiements. Ce consommateur doit être actif, mais ne peut pas être "
"autorisé à commander."
#: admin/lut.py:88
#: admin/lut.py:132
#, python-format
msgid ""
"This customer is already responsible of another delivery point "
......@@ -498,7 +504,7 @@ msgstr "Action effectuée."
msgid "You must first invoice the %(permanence)s."
msgstr "Vous devez d'abord facturer la %(permanence)s."
#: admin/permanence_done.py:171
#: admin/permanence_done.py:164
#, python-format
msgid ""
"The payment date must be between %(min_payment_date)s and "
......@@ -507,50 +513,50 @@ msgstr ""
"La date de paiement doit se situer entre le %(min_payment_date)s et le "
"%(max_payment_date)s."
#: admin/permanence_done.py:212
#: admin/permanence_done.py:205
msgid ""
"Please make the following payments, whose bank movements have been generated"
msgstr ""
"Veuillez effectuer les paiements suivants. Les mouvements de compte "
"correspondants ont été générés."
#: admin/permanence_done.py:292
#: admin/permanence_done.py:287
msgid "Please, confirm the action : generate the invoices"
msgstr "Veuillez confirmer votre demande de calcul des factures."
#: admin/permanence_done.py:300
#: admin/permanence_done.py:295
msgid "generate invoices"
msgstr "3 --- Produire les factures"
#: admin/permanence_done.py:322
#: admin/permanence_done.py:317
msgid "archive"
msgstr "Archiver"
#: admin/permanence_done.py:344 tools.py:586
#: admin/permanence_done.py:339 tools.py:586
#, python-format
msgid "The amount of your order is %(amount)s."
msgstr "Le montant de votre commande s'élève à %(amount)s."
#: admin/permanence_done.py:348 admin/permanence_in_preparation.py:551
#: admin/permanence_done.py:343 admin/permanence_in_preparation.py:551
#: tools.py:616
#, python-format
msgid "The balance of your account as of %(date)s is %(balance)s."
msgstr "Le solde de votre compte en date du %(date)s est de %(balance)s."
#: admin/permanence_done.py:353
#: admin/permanence_done.py:348
msgid "Please pay"
msgstr "Veuillez verser"
#: admin/permanence_done.py:355
#: admin/permanence_done.py:350
msgid "to the bank account number"
msgstr "sur le compte bancaire"
#: admin/permanence_done.py:357
#: admin/permanence_done.py:352
msgid "with communication"
msgstr "avec comme communication"
#: admin/permanence_done.py:358 admin/permanence_done.py:362
#: admin/permanence_done.py:363 admin/permanence_in_preparation.py:378
#: admin/permanence_done.py:353 admin/permanence_done.py:357
#: admin/permanence_done.py:358 admin/permanence_in_preparation.py:378
#: admin/permanence_in_preparation.py:379
#: admin/permanence_in_preparation.py:567
#: admin/permanence_in_preparation.py:569
......@@ -559,7 +565,7 @@ msgstr "avec comme communication"
msgid "short_basket_name"
msgstr "Dénomination abrégée du panier"
#: admin/permanence_done.py:360 admin/permanence_done.py:361
#: admin/permanence_done.py:355 admin/permanence_done.py:356
#: admin/permanence_in_preparation.py:376
#: admin/permanence_in_preparation.py:377
#: admin/permanence_in_preparation.py:582
......@@ -567,7 +573,7 @@ msgstr "Dénomination abrégée du panier"
msgid "long_basket_name"
msgstr "Dénomination étendue du panier"
#: admin/permanence_done.py:383 admin/permanence_done.py:384
#: admin/permanence_done.py:378 admin/permanence_done.py:379
#: admin/permanence_in_preparation.py:321
#: admin/permanence_in_preparation.py:322
#: admin/permanence_in_preparation.py:601
......@@ -575,23 +581,23 @@ msgstr "Dénomination étendue du panier"
msgid "long_profile_name"
msgstr "Nom étendu"
#: admin/permanence_done.py:412
#: admin/permanence_done.py:407
msgid "Please, confirm the action : send invoices"
msgstr "Veuillez confirmer votre demande de transmettre les factures."
#: admin/permanence_done.py:423
#: admin/permanence_done.py:418
msgid "send invoices"
msgstr "5 --- Envoyer les factures"
#: admin/permanence_done.py:443
#: admin/permanence_done.py:438
msgid "Please, confirm the action : cancel the invoices"
msgstr "Veuillez confirmer votre demande d'annulation des factures."
#: admin/permanence_done.py:449
#: admin/permanence_done.py:444
msgid "cancel latest invoices"
msgstr "Annuler la dernière facturation"
msgstr "Annuler la dernière facture"
#: admin/permanence_done.py:462
#: admin/permanence_done.py:457
msgid "cancel archiving"
msgstr "Annuler l'archivage"
......@@ -673,7 +679,7 @@ msgstr ""
"comme communication \"%(communication)s\"."
#: admin/permanence_in_preparation.py:591 admin/purchase.py:94
#: models/customer.py:108 models/deliveryboard.py:26 models/lut.py:97
#: models/customer.py:108 models/deliveryboard.py:27 models/lut.py:109
#: models/purchase.py:182 xlsx/xlsx_order.py:38
msgid "delivery point"
msgstr "Point de livraison"
......@@ -947,7 +953,7 @@ msgstr "La quantité doit être différente de zéro."
msgid "department_for_customer"
msgstr "Rayon"
#: admin/purchase.py:243 const.py:229 email/email_order.py:31
#: admin/purchase.py:243 const.py:232 email/email_order.py:31
#: models/configuration.py:299 views/btn_confirm_order_ajax.py:48
msgid "Order"
msgstr "Commande"
......@@ -1382,237 +1388,237 @@ msgstr "Mouvements de compte"
msgid "%(name)s archived list"
msgstr "%(name)s à archiver"
#: const.py:63
#: const.py:66
msgid "disabled"
msgstr "Désactivé"
#: const.py:64
#: const.py:67
msgid "planned"
msgstr "Planifié"
#: const.py:65
#: const.py:68
msgid "wait for pre-open"
msgstr "En cours de pré-ouverture"
#: const.py:66
#: const.py:69
msgid "orders pre-opened"
msgstr "Commandes pré-ouvertes"
#: const.py:67
#: const.py:70
msgid "wait for open"
msgstr "En cours d'ouverture"
#: const.py:68
#: const.py:71
msgid "orders opened"
msgstr "Commandes ouvertes"
#: const.py:69
#: const.py:72
msgid "wait for close"
msgstr "En cours de clôture"
#: const.py:70 models/deliveryboard.py:99 models/permanence.py:462
#: const.py:73 models/deliveryboard.py:107 models/permanence.py:465
msgid "orders closed"
msgstr "Commandes clôturées"
#: const.py:71
#: const.py:74
msgid "wait for send"
msgstr "En cours de transmission"
#: const.py:72
#: const.py:75
msgid "orders send to producers"
msgstr "Commandes transmises"
#: const.py:73
#: const.py:76
msgid "wait for done"
msgstr "En cours de facturation"
#: const.py:74
#: const.py:77
msgid "invoices validation test failed"
msgstr "Factures non valides"
#: const.py:75
#: const.py:78
msgid "done"
msgstr "Commandes facturées"
#: const.py:76
#: const.py:79
msgid "archived"
msgstr "Commandes archivées"
#: const.py:85 const.py:92
#: const.py:88 const.py:95
msgid "freezer"
msgstr "Surgélateur"
#: const.py:86 const.py:93
#: const.py:89 const.py:96
msgid "fridge"
msgstr "Frigo"
#: const.py:87 const.py:94
#: const.py:90 const.py:97
msgid "loose, out of the basket"
msgstr "En dehors du panier"
#: const.py:88 const.py:95
#: const.py:91 const.py:98
msgid "into the basket"
msgstr "Panier"
#: const.py:110 const.py:126 const.py:144
#: const.py:113 const.py:129 const.py:147
msgid "bought per piece"
msgstr "Vendu à la pièce."
#: const.py:111 const.py:127 const.py:145
#: const.py:114 const.py:130 const.py:148
msgid "bought per piece (price /kg)"
msgstr "Vendu à la pièce (prix affiché au kg)."
#: const.py:112 const.py:128 const.py:146
#: const.py:115 const.py:131 const.py:149
msgid "bought per piece (price /l)"
msgstr "Vendu à la pièce (prix affiché au ℓ)."
#: const.py:113 const.py:129 const.py:147
#: const.py:116 const.py:132 const.py:150
msgid "bought per piece (price /pc)"
msgstr "Vendu en pack."
#: const.py:114 const.py:130 const.py:148
#: const.py:117 const.py:133 const.py:151
msgid "bought per kg"
msgstr "Vendu au poids (en kg)."
#: const.py:115 const.py:131 const.py:149
#: const.py:118 const.py:134 const.py:152
msgid "bought per piece, invoiced following the weight"
msgstr "Vendu à la pièce, facturé selon le poids réel."
#: const.py:116 const.py:132 const.py:150
#: const.py:119 const.py:135 const.py:153
msgid "bought per l"
msgstr "Vendu au volume (en ℓ)."
#: const.py:118 const.py:133 const.py:152
#: const.py:121 const.py:136 const.py:155
msgid ""
"As a deposit, a bag : always add this product to preparation list when the "
"customer has purchased something."
msgstr "Consigne reprise à la permanence."
#: const.py:120 const.py:136
#: const.py:123 const.py:139
msgid ""
"As a subscription, common expense : add the minimal order quantity of this "
"product to each customer of the group"
msgstr "Cotisation."
#: const.py:122 const.py:139 const.py:154
#: const.py:125 const.py:142 const.py:157
msgid ""
"As a transportation cost : add the minimal order quantity of this product to "
"the basket representing the group."
msgstr "Frais de livraison."
#: const.py:158
#: const.py:161
msgid "Sold by piece"
msgstr "Vendu à la pièce"
#: const.py:159
#: const.py:162
msgid "Sold by weight"
msgstr "Vendu au poids"
#: const.py:160
#: const.py:163
msgid "Sold by l"
msgstr "Vendu au ℓ"
#: const.py:161
#: const.py:164
msgid "Sold by piece, invoiced following the weight"
msgstr "Vendu à la pièce, facturé selon le poids réel"
#: const.py:183
#: const.py:186
msgid "none"
msgstr "Aucune"
#: const.py:184
#: const.py:187
msgid "compensation 2%"
msgstr "2% de compensation"
#: const.py:185
#: const.py:188
msgid "compensation 6%"
msgstr "6% de compensation"
#: const.py:186
#: const.py:189
msgid "vat 2.1%"
msgstr "2,1% de TVA"
#: const.py:187
#: const.py:190
msgid "vat 2.5%"
msgstr "2,5% de TVA"
#: const.py:188
#: const.py:191
msgid "vat 3.8%"
msgstr "3,8% de TVA"
#: const.py:189
#: const.py:192
msgid "vat 4%"
msgstr "4% de TVA"
#: const.py:190
#: const.py:193
msgid "vat 5.5%"
msgstr "5,5% de TVA"
#: const.py:191
#: const.py:194
msgid "vat 6%"
msgstr "6% de TVA"
#: const.py:192
#: const.py:195
msgid "vat 8%"
msgstr "8% de TVA"
#: const.py:193
#: const.py:196
msgid "vat 10%"
msgstr "10% de TVA"
#: const.py:194
#: const.py:197
msgid "vat 12%"
msgstr "12% de TVA"
#: const.py:195
#: const.py:198
msgid "vat 20%"
msgstr "20% de TVA"
#: const.py:196
#: const.py:199
msgid "vat 21%"
msgstr "21% de TVA"
#: const.py:209
#: const.py:212
msgid "This is not the latest total"
msgstr "Ceci n'est pas le dernier solde"
#: const.py:214
#: const.py:217
msgid "This is the next latest bank total"
msgstr "Ceci est le prochain solde. Le système est en train de le calculer."
#: const.py:215
#: const.py:218
msgid "This is the latest bank total"
msgstr "Ceci est le dernier solde."
#: const.py:226 models/configuration.py:287
#: const.py:229 models/configuration.py:287
msgid "Permanence"
msgstr "Permanence"
#: const.py:227 models/configuration.py:291
#: const.py:230 models/configuration.py:291
msgid "Closure"
msgstr "Clôture"
#: const.py:228 models/configuration.py:295
#: const.py:231 models/configuration.py:295
msgid "Delivery"
msgstr "Livraison"
#: const.py:230 models/configuration.py:303