Commit 1cbb1ca9 authored by Patrick's avatar Patrick
Browse files

Version 1.7

parent 8fe68081
# -*- coding: utf-8
from __future__ import unicode_literals
default_app_config = 'repanier.apps.RepanierConfig'
\ No newline at end of file
This diff is collapsed.
# -*- coding: utf-8 -*-
# -*- coding: utf-8
from __future__ import unicode_literals
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from settings import *
from const import *
from models import Customer
from models import LUT_DepartmentForCustomer
......@@ -117,13 +118,13 @@ class PurchaseFilterByProducerForThisPermanence(SimpleListFilter):
class PurchaseFilterByPermanence(SimpleListFilter):
title = REPANIER_PERMANENCES_NAME
title = _("permanence")
parameter_name = 'permanence'
def lookups(self, request, model_admin):
# This list is a collection of permanence.id, .name
return [(c.id, c.__unicode__()) for c in
Permanence.objects.filter(status__in=[PERMANENCE_OPENED, PERMANENCE_SEND])
return [(c.id, c.__str__()) for c in
Permanence.objects.filter(status__in=model_admin.permanence_status_list)
]
def queryset(self, request, queryset):
......@@ -132,3 +133,19 @@ class PurchaseFilterByPermanence(SimpleListFilter):
return queryset.filter(permanence_id=self.value())
else:
return queryset
class OfferItemSendFilter(SimpleListFilter):
title = _("products")
parameter_name = 'is_filled_exact'
def lookups(self, request, model_admin):
# This list is a collection of permanence.id, .name
return [(1, _('only invoiced')),]
def queryset(self, request, queryset):
# This query set is a collection of permanence
if self.value():
return queryset.exclude(quantity_invoiced=DECIMAL_ZERO)
else:
return queryset
\ No newline at end of file
......@@ -7,23 +7,31 @@ from django.utils.translation import ugettext_lazy as _
from const import *
repanier_settings = {
'CONFIG': None,
'TEST_MODE': None,
'GROUP_NAME': None,
'PERMANENCE_NAME': None,
'PERMANENCES_NAME': None,
'PERMANENCE_ON_NAME': None,
'SEND_MAIL_ONLY_TO_STAFF': None,
'SEND_ORDER_TO_BOARD': None,
'INVOICE': None,
'STOCK': None,
'MAX_WEEK_WO_PARTICIPATION': None,
'SEND_OPENING_MAIL_TO_CUSTOMER': None,
'SEND_ORDER_MAIL_TO_CUSTOMER': None,
'SEND_ORDER_MAIL_TO_PRODUCER': None,
'SEND_ORDER_MAIL_TO_BOARD': None,
'SEND_INVOICE_MAIL_TO_CUSTOMER': None,
'SEND_INVOICE_MAIL_TO_PRODUCER': None,
'DISPLAY_ANONYMOUS_ORDER_FORM': None,
'DISPLAY_PRODUCERS_ON_ORDER_FORM': None,
'BANK_ACCOUNT': None,
'PRODUCER_ORDER_ROUNDED': None,
'PRODUCER_PRE_OPENING': None,
'ACCEPT_CHILD_GROUP': None,
'DELIVERY_POINT': None,
'INVOICE': None,
'STOCK': None,
'DISPLAY_VAT': None,
'MAX_WEEK_WO_PARTICIPATION': None,
'VAT_ID': None,
'DELIVERY_POINT': None
'PAGE_BREAK_ON_CUSTOMER_CHECK': None
}
class RepanierConfig(AppConfig):
......@@ -43,20 +51,27 @@ class RepanierConfig(AppConfig):
site.save()
config = Configuration.objects.create(
group_name=group_name,
test_mode=True,
name=PERMANENCE_NAME_PERMANENCE,
send_mail_only_to_staff=True,
send_order_to_board=False,
max_week_wo_participation=Decimal('99'),
send_opening_mail_to_customer=False,
send_order_mail_to_customer=False,
send_order_mail_to_producer=False,
send_invoice_mail_to_customer=False,
send_invoice_mail_to_producer=False,
send_order_mail_to_board=False,
invoice=True,
stock=False,
display_anonymous_order_form=False,
display_producer_on_order_form=True,
display_producer_on_order_form=False,
bank_account="BE99 9999 9999 9999",
producer_order_rounded=False,
producer_pre_opening=False,
accept_child_group=False,
display_vat=True,
max_week_wo_participation=Decimal('99'),
delivery_point=False,
display_vat=False,
vat_id=EMPTY_STRING,
delivery_point=False
page_break_on_customer_check=False
)
config.save()
except Exception as error_str:
......
# -*- coding: utf-8 -*-
# -*- coding: utf-8
from __future__ import unicode_literals
from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
from django.db.models import F
from const import DECIMAL_ZERO, DECIMAL_ONE, DECIMAL_TWO
from email.email_alert import send_error
from models import Customer, Staff, Configuration
from django.utils.translation import ugettext_lazy as _
from tools import sint
class RepanierCustomBackend(ModelBackend):
def authenticate(self, **credentials):
try:
user_or_none = super(RepanierCustomBackend, self).authenticate(**credentials)
if user_or_none and not user_or_none.is_superuser:
try:
a = user_or_none.customer
if not a.is_active:
user_or_none = None
except:
try:
a = user_or_none.staff
if not a.is_active:
user = None
def __init__(self, *args, **kwargs):
super(RepanierCustomBackend, self).__init__(*args, **kwargs)
def authenticate(self, username=None, password=None, confirm=None, **kwargs):
self.user = None
# try:
user_username = User.objects.filter(username=username[:30]).order_by().first()
if user_username is None:
user_username = User.objects.filter(email=username).order_by().first()
if user_username is not None:
username = user_username.username
if user_username is not None:
staff = Staff.objects.filter(
user=user_username, is_active=True
).order_by().first()
else:
staff = None
if staff is not None:
customer = staff.customer_responsible
else:
customer = Customer.objects.filter(
user=user_username, is_active=True
).order_by().first()
user_or_none = super(RepanierCustomBackend, self).authenticate(username, password)
if user_or_none is not None:
if user_or_none.is_superuser and customer is not None:
# a customer or a staff member may not be superuser
user_or_none = None
except:
if customer is not None:
# This is a customer or staff member
login_attempt_counter = customer.login_attempt_counter
if login_attempt_counter > DECIMAL_ONE:
if confirm is None:
confirm = ""
else:
confirm = str(sint(confirm))
phone_digits = ""
i = 0
phone1 = customer.phone1
while i < len(phone1):
if '0' <= phone1[i] <= '9':
phone_digits += phone1[i]
i += 1
if confirm is not None and len(confirm) >= 4 and phone_digits.endswith(confirm):
pass
else:
# Sorry you may no log in because the four last digits of your phone are not given
user_or_none = None
except Exception as e:
if user_or_none is None:
if login_attempt_counter < 50:
Customer.objects.filter(id=customer.id).update(
login_attempt_counter=F('login_attempt_counter') +
DECIMAL_ONE
)
if login_attempt_counter > DECIMAL_ONE:
raise forms.ValidationError(
_("Too many attempt."),
code='attempt',
)
else:
if login_attempt_counter < 10:
Customer.objects.filter(id=customer.id).update(
login_attempt_counter=DECIMAL_ZERO
)
else:
Customer.objects.filter(id=customer.id).update(
may_order=False
)
Staff.objects.filter(customer_responsible_id=customer.id).update(
is_active=False
)
elif user_username is not None and user_username.is_superuser:
# This is the superuser. One and only one superuser should be defined.
login_attempt_counter = Configuration.objects.filter(
id=DECIMAL_ONE
).only(
'login_attempt_counter'
).first().login_attempt_counter
if user_or_none is None:
# Failed to log in
if login_attempt_counter < 50:
Configuration.objects.filter(id=DECIMAL_ONE).update(
login_attempt_counter=F('login_attempt_counter') +
DECIMAL_ONE
)
if login_attempt_counter > DECIMAL_ONE:
send_error("Login attempt failed : %s" % username)
else:
# Log in successful
if login_attempt_counter > 6:
# Sorry you may no log in because of too many failed log in attempt
user_or_none = None
else:
Configuration.objects.filter(id=DECIMAL_ONE).update(
login_attempt_counter=DECIMAL_ZERO
)
if login_attempt_counter > DECIMAL_TWO:
send_error("Login attempt success : %s" % username)
# except:
# user_or_none = None
self.user = user_or_none
# if user_or_none :
# print ('Authenticate user : %s' % getattr(user_or_none, get_user_model().USERNAME_FIELD))
# else:
......@@ -28,22 +124,24 @@ class RepanierCustomBackend(ModelBackend):
return user_or_none
def get_user(self, user_id):
try:
user_or_none = User.objects.get(pk=user_id)
if user_or_none and not user_or_none.is_superuser:
try:
a = user_or_none.customer
if self.user is not None and self.user.id == user_id:
return self.user
user_or_none = User.objects.filter(pk=user_id).only("id", "is_superuser", "is_staff").order_by().first()
if user_or_none is not None and not user_or_none.is_superuser:
a = Customer.objects.filter(user_id=user_or_none.id)\
.only("is_active").order_by().first()
if a is not None:
if not a.is_active:
user_or_none = None
except:
try:
a = user_or_none.staff
else:
a = Staff.objects.filter(user_id=user_or_none.id)\
.only("is_active").order_by().first()
if a is not None:
if not a.is_active:
user_or_none = None
except:
user_or_none = None
except:
else:
user_or_none = None
self.user = user_or_none
# if user_or_none :
# print ('Get user : %s' % getattr(user_or_none, get_user_model().USERNAME_FIELD))
# else:
......
# -*- coding: utf-8 -*-
# -*- coding: utf-8
from __future__ import unicode_literals
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from cms.toolbar_pool import toolbar_pool
from cms.toolbar.items import Break, SubMenu
from cms.cms_toolbar import ADMIN_MENU_IDENTIFIER, ADMINISTRATION_BREAK
from cms.toolbar_base import CMSToolbar
from apps import repanier_settings
from const import *
from models import Configuration
@toolbar_pool.register
......@@ -27,12 +30,18 @@ class RepanierToolbar(CMSToolbar):
position=position
)
# add_sideframe_item
config = Configuration.objects.all().only("id").order_by().first()
url = reverse('admin:repanier_configuration_change', args=(config.id,))
office_menu.add_sideframe_item(_('Configuration'), url=url)
url = reverse('admin:repanier_staff_changelist')
office_menu.add_sideframe_item(_('Staff Member List'), url=url)
url = reverse('admin:repanier_lut_permanencerole_changelist')
office_menu.add_sideframe_item(_('Permanence Role List'), url=url)
url = reverse('admin:repanier_lut_productionmode_changelist')
office_menu.add_sideframe_item(_('Production Mode List'), url=url)
if repanier_settings['DELIVERY_POINT']:
url = reverse('admin:repanier_lut_deliverypoint_changelist')
office_menu.add_sideframe_item(_('Delivery Point List'), url=url)
url = reverse('admin:repanier_lut_departmentforcustomer_changelist')
office_menu.add_sideframe_item(_('Departement for Customer List'), url=url)
......@@ -46,13 +55,18 @@ class RepanierToolbar(CMSToolbar):
position += 1
url = reverse('admin:repanier_permanenceinpreparation_changelist')
admin_menu.add_sideframe_item(_('Permanence in Preparation List'), url=url, position=position)
admin_menu.add_sideframe_item(_("%(name)s in preparation list") % {'name': repanier_settings['PERMANENCES_NAME']}, url=url, position=position)
if self.request.user.groups.filter(name=READ_ONLY_GROUP).count() == 0:
# Not visible for read-only users
if repanier_settings['INVOICE']:
position += 1
url = reverse('admin:repanier_permanencedone_changelist')
admin_menu.add_sideframe_item(_('Permanence done List'), url=url, position=position)
admin_menu.add_sideframe_item(_("%(name)s done list") % {'name': repanier_settings['PERMANENCES_NAME']}, url=url, position=position)
position += 1
url = reverse('admin:repanier_bankaccount_changelist')
admin_menu.add_sideframe_item(_('Bank Account List'), url=url, position=position)
else:
position += 1
url = reverse('admin:repanier_permanencedone_changelist')
admin_menu.add_sideframe_item(_("%(name)s archived list") % {'name': repanier_settings['PERMANENCES_NAME']}, url=url, position=position)
# -*- coding: utf-8 -*-
# -*- coding: utf-8
from __future__ import unicode_literals
from decimal import *
from django.utils.translation import ugettext_lazy as _
READ_ONLY_GROUP = "read_only"
ORDER_GROUP = "order"
INVOICE_GROUP = "invoice"
COORDINATION_GROUP = "coordination"
WEBMASTER_GROUP = "webmaster"
EMPTY_STRING = ''
DECIMAL_ZERO = Decimal('0')
DECIMAL_ONE = Decimal('1')
DECIMAL_TWO = Decimal('2')
DECIMAL_1_02 = Decimal('1.02')
DECIMAL_1_06 = Decimal('1.06')
DECIMAL_1_12 = Decimal('1.12')
DECIMAL_1_21 = Decimal('1.21')
DECIMAL_0_02 = Decimal('0.02')
DECIMAL_0_06 = Decimal('0.06')
DECIMAL_0_12 = Decimal('0.12')
DECIMAL_0_21 = Decimal('0.21')
ZERO_DECIMAL = Decimal('0')
TWO_DECIMALS = Decimal('0.00')
THREE_DECIMALS = Decimal('0.000')
FOUR_DECIMALS = Decimal('0.0000')
ONE_DECIMAL = Decimal('0.1')
TWO_DECIMALS = Decimal('0.01')
THREE_DECIMALS = Decimal('0.001')
FOUR_DECIMALS = Decimal('0.0001')
PERMANENCE_DISABLED = '050'
PERMANENCE_PLANNED = '100'
PERMANENCE_WAIT_FOR_PRE_OPEN = '110'
PERMANENCE_PRE_OPEN = '120'
PERMANENCE_WAIT_FOR_OPEN = '200'
PERMANENCE_OPENED = '300'
PERMANENCE_WAIT_FOR_CLOSED = '350'
PERMANENCE_CLOSED = '370'
PERMANENCE_WAIT_FOR_SEND = '400'
PERMANENCE_SEND = '500'
PERMANENCE_WAIT_FOR_DONE = '600'
PERMANENCE_INVOICES_VALIDATION_FAILED = '700'
PERMANENCE_DONE = '800'
PERMANENCE_CANCELED = '900'
PERMANENCE_ARCHIVED = '900'
LUT_PERMANENCE_STATUS = (
(PERMANENCE_DISABLED, unicode(_('disabled'))),
(PERMANENCE_PLANNED, unicode(_('planned'))),
(PERMANENCE_WAIT_FOR_OPEN, unicode(_('wait for open'))),
(PERMANENCE_OPENED, unicode(_('orders opened'))),
(PERMANENCE_WAIT_FOR_SEND, unicode(_('wait for send'))),
(PERMANENCE_SEND, unicode(_('orders send to producers'))),
(PERMANENCE_WAIT_FOR_DONE, unicode(_('wait for done'))),
(PERMANENCE_INVOICES_VALIDATION_FAILED, unicode(_('invoices validation test failed'))),
(PERMANENCE_DONE, unicode(_('done')))
(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'))
)
PRODUCT_PLACEMENT_FREEZER = '100'
......@@ -48,67 +65,16 @@ PRODUCT_PLACEMENT_OUT_OF_BASKET = '300'
PRODUCT_PLACEMENT_BASKET = '400'
LUT_PRODUCT_PLACEMENT = (
(PRODUCT_PLACEMENT_FREEZER, unicode(_('freezer'))),
(PRODUCT_PLACEMENT_FRIDGE, unicode(_('fridge'))),
(PRODUCT_PLACEMENT_OUT_OF_BASKET, unicode(_('loose, out of the basket'))),
(PRODUCT_PLACEMENT_BASKET, unicode(_('into the basket'))),
(PRODUCT_PLACEMENT_FREEZER, _('freezer')),
(PRODUCT_PLACEMENT_FRIDGE, _('fridge')),
(PRODUCT_PLACEMENT_OUT_OF_BASKET, _('loose, out of the basket')),
(PRODUCT_PLACEMENT_BASKET, _('into the basket')),
)
# PRODUCT_ORDER_UNIT_LOOSE_PC = '100'
# PRODUCT_ORDER_UNIT_LOOSE_KG = '120'
# PRODUCT_ORDER_UNIT_LOOSE_PC_KG = '140'
# PRODUCT_ORDER_UNIT_NAMED_LT = '150'
# PRODUCT_ORDER_UNIT_LOOSE_BT_LT = '160'
# PRODUCT_ORDER_UNIT_NAMED_PC = '200'
# PRODUCT_ORDER_UNIT_NAMED_KG = '220'
# PRODUCT_ORDER_UNIT_NAMED_PC_KG = '240'
# PRODUCT_ORDER_UNIT_DEPOSIT = '300'
# PRODUCT_ORDER_UNIT_SUBSCRIPTION = '400'
# PRODUCT_ORDER_UNIT_TRANSPORTATION = '500'
#
# LUT_PRODUCT_ORDER_UNIT = (
# (PRODUCT_ORDER_UNIT_LOOSE_PC, unicode(_("/piece (loose)"))),
# (PRODUCT_ORDER_UNIT_NAMED_PC, unicode(_("/piece (named)"))),
# (PRODUCT_ORDER_UNIT_LOOSE_KG, unicode(_("/Kg (loose)"))),
# (PRODUCT_ORDER_UNIT_NAMED_KG, unicode(_("/Kg (named)"))),
# (PRODUCT_ORDER_UNIT_LOOSE_PC_KG, unicode(_("/piece -> Kg (loose)"))),
# (PRODUCT_ORDER_UNIT_NAMED_PC_KG, unicode(_("/piece -> Kg (named)"))),
# (PRODUCT_ORDER_UNIT_NAMED_LT, unicode(_("/L (named)"))),
# (PRODUCT_ORDER_UNIT_LOOSE_BT_LT, unicode(_("/piece -> L (loose)"))),
# (PRODUCT_ORDER_UNIT_DEPOSIT, unicode(
# _(
# 'As a deposit, a bag : always add this product to preparation list when the customer has purchased something.'))),
# (PRODUCT_ORDER_UNIT_SUBSCRIPTION, unicode(_(
# 'As a subscription, common expense : add the minimal order quantity of this product to each customer of the group'))),
# (PRODUCT_ORDER_UNIT_TRANSPORTATION, unicode(_(
# 'As a transportation cost : add the minimal order quantity of this product to the basket representing the group.'))),
# )
#
# LUT_PRODUCT_ORDER_UNIT_REVERSE = (
# (unicode(_("/piece (loose)")), PRODUCT_ORDER_UNIT_LOOSE_PC),
# (unicode(_("/Kg (loose)")), PRODUCT_ORDER_UNIT_LOOSE_KG),
# (unicode(_("/piece -> Kg (loose)")), PRODUCT_ORDER_UNIT_LOOSE_PC_KG),
# (unicode(_("/piece -> L (loose)")), PRODUCT_ORDER_UNIT_LOOSE_BT_LT),
# (unicode(_("/piece (named)")), PRODUCT_ORDER_UNIT_NAMED_PC),
# (unicode(_("/Kg (named)")), PRODUCT_ORDER_UNIT_NAMED_KG),
# (unicode(_("/L (named)")), PRODUCT_ORDER_UNIT_NAMED_LT),
# (unicode(_("/piece -> Kg (named)")), PRODUCT_ORDER_UNIT_NAMED_PC_KG),
# (unicode(
# _(
# 'As a deposit, a bag : always add this product to preparation list when the customer has purchased something.')),
# PRODUCT_ORDER_UNIT_DEPOSIT),
# (unicode(_(
# 'As a subscription, common expense : add the minimal order quantity of this product to each customer of the group')),
# PRODUCT_ORDER_UNIT_SUBSCRIPTION),
# (unicode(_(
# 'As a transportation cost : add the minimal order quantity of this product to the basket representing the group.')),
# PRODUCT_ORDER_UNIT_TRANSPORTATION),
# )
PRODUCT_ORDER_UNIT_PC = '100'
PRODUCT_ORDER_UNIT_PC_PRICE_KG = '105' # NEW
PRODUCT_ORDER_UNIT_PC_PRICE_LT = '110' # NEW
PRODUCT_ORDER_UNIT_PC_PRICE_PC = '115' # NEW
PRODUCT_ORDER_UNIT_PC_PRICE_KG = '105'
PRODUCT_ORDER_UNIT_PC_PRICE_LT = '110'
PRODUCT_ORDER_UNIT_PC_PRICE_PC = '115'
PRODUCT_ORDER_UNIT_KG = '120'
PRODUCT_ORDER_UNIT_PC_KG = '140'
PRODUCT_ORDER_UNIT_LT = '150'
......@@ -117,42 +83,43 @@ PRODUCT_ORDER_UNIT_SUBSCRIPTION = '400'
PRODUCT_ORDER_UNIT_TRANSPORTATION = '500'
LUT_PRODUCT_ORDER_UNIT = (
(PRODUCT_ORDER_UNIT_PC, unicode(_("bought per piece"))),
(PRODUCT_ORDER_UNIT_PC_PRICE_KG, unicode(_("bought per piece (price /kg)"))),
(PRODUCT_ORDER_UNIT_PC_PRICE_LT, unicode(_("bought per piece (price /l)"))),
(PRODUCT_ORDER_UNIT_PC_PRICE_PC, unicode(_("bought per piece (price /pc)"))),
(PRODUCT_ORDER_UNIT_KG, unicode(_("bought per kg"))),
(PRODUCT_ORDER_UNIT_PC_KG, unicode(_("bought per piece, invoiced following the weight"))),
(PRODUCT_ORDER_UNIT_LT, unicode(_("bought per l"))),
(PRODUCT_ORDER_UNIT_DEPOSIT, unicode(
_(
'As a deposit, a bag : always add this product to preparation list when the customer has purchased something.'))),
(PRODUCT_ORDER_UNIT_SUBSCRIPTION, unicode(_(
'As a subscription, common expense : add the minimal order quantity of this product to each customer of the group'))),
(PRODUCT_ORDER_UNIT_TRANSPORTATION, unicode(_(
'As a transportation cost : add the minimal order quantity of this product to the basket representing the group.'))),
(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_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.')),
)
LUT_PRODUCT_ORDER_UNIT_REVERSE = (
(unicode(_("bought per piece")), PRODUCT_ORDER_UNIT_PC),
(unicode(_("bought per piece (price /kg)")), PRODUCT_ORDER_UNIT_PC_PRICE_KG),
(unicode(_("bought per piece (price /l)")), PRODUCT_ORDER_UNIT_PC_PRICE_LT),
(unicode(_("bought per piece (price /pc)")), PRODUCT_ORDER_UNIT_PC_PRICE_PC),
(unicode(_("bought per kg")), PRODUCT_ORDER_UNIT_KG),
(unicode(_("bought per piece, invoiced following the weight")), PRODUCT_ORDER_UNIT_PC_KG),
(unicode(_("bought per l")), PRODUCT_ORDER_UNIT_LT),
(unicode(
_(
'As a deposit, a bag : always add this product to preparation list when the customer has purchased something.')),
(_("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.'),
PRODUCT_ORDER_UNIT_DEPOSIT),
(unicode(_(
'As a subscription, common expense : add the minimal order quantity of this product to each customer of the group')),
(_('As a subscription, common expense : add the minimal order quantity of this product to each customer of the group'),
PRODUCT_ORDER_UNIT_SUBSCRIPTION),
(unicode(_(
'As a transportation cost : add the minimal order quantity of this product to the basket representing the group.')),
(_('As a transportation cost : add the minimal order quantity of this product to the basket representing the group.'),
PRODUCT_ORDER_UNIT_TRANSPORTATION),
)
LUT_PRODUCER_PRODUCT_ORDER_UNIT = (
(PRODUCT_ORDER_UNIT_PC_PRICE_PC, _("Sold by piece")),
(PRODUCT_ORDER_UNIT_PC_PRICE_KG, _("Sold by weight")),
(PRODUCT_ORDER_UNIT_PC_KG, _("Sold by piece, invoiced following the weight")),
)
VAT_100 = '100'
VAT_200 = '200'
VAT_300 = '300'
......@@ -161,29 +128,42 @@ VAT_500 = '500'
VAT_600 = '600'
LUT_VAT = (
(VAT_100, unicode(_('none'))),
(VAT_200, unicode(_('compensation 2%'))),
(VAT_300, unicode(_('compensation 6%'))),
(VAT_400, unicode(_('vat 6%'))),