mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
Refactor refounding function
This commit is contained in:
parent
e231c612c6
commit
7227a5d6f9
@ -367,11 +367,11 @@ class OperationPDFView(CanViewMixin, DetailView):
|
|||||||
im = ImageReader("core/static/core/img/logo.jpg")
|
im = ImageReader("core/static/core/img/logo.jpg")
|
||||||
iw, ih = im.getSize()
|
iw, ih = im.getSize()
|
||||||
p.drawImage(im, 40, height - 50, width=iw/2, height=ih/2)
|
p.drawImage(im, 40, height - 50, width=iw/2, height=ih/2)
|
||||||
|
|
||||||
labelStr = [["%s %s - %s %s" % (_("Journal"), ti, _("Operation"), num)]]
|
labelStr = [["%s %s - %s %s" % (_("Journal"), ti, _("Operation"), num)]]
|
||||||
|
|
||||||
label = Table(labelStr, colWidths=[150], rowHeights=[20])
|
label = Table(labelStr, colWidths=[150], rowHeights=[20])
|
||||||
|
|
||||||
label.setStyle(TableStyle([
|
label.setStyle(TableStyle([
|
||||||
('ALIGN',(0,0),(-1,-1),'CENTER'),
|
('ALIGN',(0,0),(-1,-1),'CENTER'),
|
||||||
('BOX', (0,0), (-1,-1), 0.25, colors.black),
|
('BOX', (0,0), (-1,-1), 0.25, colors.black),
|
||||||
@ -384,11 +384,11 @@ class OperationPDFView(CanViewMixin, DetailView):
|
|||||||
p.drawString(90, height - 160, _("Label: %(op_label)s") % {"op_label": op_label if op_label != None else ""})
|
p.drawString(90, height - 160, _("Label: %(op_label)s") % {"op_label": op_label if op_label != None else ""})
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
|
|
||||||
data += [["%s" % (_("Credit").upper() if nature == 'CREDIT' else _("Debit").upper())]]
|
data += [["%s" % (_("Credit").upper() if nature == 'CREDIT' else _("Debit").upper())]]
|
||||||
|
|
||||||
data += [[_("Amount: %(amount).2f €") % {"amount": amount}]]
|
data += [[_("Amount: %(amount).2f €") % {"amount": amount}]]
|
||||||
|
|
||||||
payment_mode = ""
|
payment_mode = ""
|
||||||
for m in settings.SITH_ACCOUNTING_PAYMENT_METHOD:
|
for m in settings.SITH_ACCOUNTING_PAYMENT_METHOD:
|
||||||
if m[0] == mode:
|
if m[0] == mode:
|
||||||
@ -398,11 +398,11 @@ class OperationPDFView(CanViewMixin, DetailView):
|
|||||||
payment_mode += " %s\n" %(m[1])
|
payment_mode += " %s\n" %(m[1])
|
||||||
|
|
||||||
data += [[payment_mode]]
|
data += [[payment_mode]]
|
||||||
|
|
||||||
data += [["%s : %s" % (_("Debtor") if nature == 'CREDIT' else _("Creditor"), target), ""]]
|
data += [["%s : %s" % (_("Debtor") if nature == 'CREDIT' else _("Creditor"), target), ""]]
|
||||||
|
|
||||||
data += [["%s \n%s" % (_("Comment:"), remark)]]
|
data += [["%s \n%s" % (_("Comment:"), remark)]]
|
||||||
|
|
||||||
t = Table(data, colWidths=[(width-90*2)/2]*2, rowHeights=[20, 20, 70, 20, 80])
|
t = Table(data, colWidths=[(width-90*2)/2]*2, rowHeights=[20, 20, 70, 20, 80])
|
||||||
t.setStyle(TableStyle([
|
t.setStyle(TableStyle([
|
||||||
('ALIGN',(0,0),(-1,-1),'CENTER'),
|
('ALIGN',(0,0),(-1,-1),'CENTER'),
|
||||||
@ -524,11 +524,11 @@ class RefoundAccountView(FormView):
|
|||||||
def create_selling(self):
|
def create_selling(self):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
uprice = self.customer.customer.amount
|
uprice = self.customer.customer.amount
|
||||||
main_club_counter = Counter.objects.get(name=settings.SITH_COUNTER_REFOUND[1])
|
refound_club_counter = Counter.objects.get(id=settings.SITH_COUNTER_REFOUND_ID)
|
||||||
main_club = main_club_counter.club
|
refound_club = refound_club_counter.club
|
||||||
s = Selling(label=_('Refound account'), unit_price=uprice,
|
s = Selling(label=_('Refound account'), unit_price=uprice,
|
||||||
quantity=1, seller=self.operator,
|
quantity=1, seller=self.operator,
|
||||||
customer=self.customer.customer,
|
customer=self.customer.customer,
|
||||||
club=main_club, counter=main_club_counter,
|
club=refound_club, counter=refound_club_counter,
|
||||||
product=Product.objects.get(code=settings.SITH_COUNTER_REFOUND_PRODUCT[1]))
|
product=Product.objects.get(id=settings.SITH_PRODUCT_REFOUND_ID))
|
||||||
s.save()
|
s.save()
|
||||||
|
@ -74,7 +74,6 @@ class Command(BaseCommand):
|
|||||||
self.reset_index("counter")
|
self.reset_index("counter")
|
||||||
Counter(name="Eboutic", club=main_club, type='EBOUTIC').save()
|
Counter(name="Eboutic", club=main_club, type='EBOUTIC').save()
|
||||||
Counter(name="AE", club=main_club, type='OFFICE').save()
|
Counter(name="AE", club=main_club, type='OFFICE').save()
|
||||||
Counter(name=settings.SITH_COUNTER_REFOUND[1], club=main_club, type='OFFICE').save()
|
|
||||||
|
|
||||||
home_root.view_groups = [Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first()]
|
home_root.view_groups = [Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first()]
|
||||||
club_root.view_groups = [Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first()]
|
club_root.view_groups = [Group.objects.filter(name=settings.SITH_MAIN_MEMBERS_GROUP).first()]
|
||||||
@ -254,6 +253,9 @@ Cette page vise à documenter la syntaxe *Markdown* utilisée sur le site.
|
|||||||
troll = Club(name="Troll Penché", unix_name="troll",
|
troll = Club(name="Troll Penché", unix_name="troll",
|
||||||
address="Terre Du Milieu", parent=main_club)
|
address="Terre Du Milieu", parent=main_club)
|
||||||
troll.save()
|
troll.save()
|
||||||
|
refound = Club(name="Carte AE", unix_name="carte_ae",
|
||||||
|
address="Jamais imprimée", parent=main_club)
|
||||||
|
refound.save()
|
||||||
|
|
||||||
# Counters
|
# Counters
|
||||||
Customer(user=skia, account_id="6568j", amount=0).save()
|
Customer(user=skia, account_id="6568j", amount=0).save()
|
||||||
@ -274,9 +276,12 @@ Cette page vise à documenter la syntaxe *Markdown* utilisée sur le site.
|
|||||||
mde.products.add(barb)
|
mde.products.add(barb)
|
||||||
mde.products.add(cble)
|
mde.products.add(cble)
|
||||||
mde.save()
|
mde.save()
|
||||||
refound = Product(name=settings.SITH_COUNTER_REFOUND_PRODUCT[2], code=settings.SITH_COUNTER_REFOUND_PRODUCT[1], purchase_price="0", selling_price="0",
|
|
||||||
special_selling_price="0", club=main_club)
|
refound_counter = Counter(name="Carte AE", club=refound, type='OFFICE')
|
||||||
refound.save()
|
refound_counter.save()
|
||||||
|
refound_product = Product(name="remboursement", code="REMBOURS", purchase_price="0", selling_price="0",
|
||||||
|
special_selling_price="0", club=refound)
|
||||||
|
refound_product.save()
|
||||||
|
|
||||||
# Accounting test values:
|
# Accounting test values:
|
||||||
BankAccount(name="AE TG", club=main_club).save()
|
BankAccount(name="AE TG", club=main_club).save()
|
||||||
|
@ -257,6 +257,11 @@ SITH_GROUP_BANNED_COUNTER_ID = 7
|
|||||||
SITH_GROUP_BANNED_SUBSCRIPTION_ID = 8
|
SITH_GROUP_BANNED_SUBSCRIPTION_ID = 8
|
||||||
SITH_GROUP_SAS_ADMIN_ID = 9
|
SITH_GROUP_SAS_ADMIN_ID = 9
|
||||||
|
|
||||||
|
SITH_CLUB_REFOUND_ID = 89
|
||||||
|
SITH_COUNTER_REFOUND_ID = 38
|
||||||
|
SITH_PRODUCT_REFOUND_ID = 5
|
||||||
|
|
||||||
|
|
||||||
# SAS variables
|
# SAS variables
|
||||||
SITH_SAS_ROOT_DIR_ID = 4
|
SITH_SAS_ROOT_DIR_ID = 4
|
||||||
|
|
||||||
@ -313,10 +318,6 @@ SITH_COUNTER_BANK = [
|
|||||||
('LA-POSTE', 'La Poste'),
|
('LA-POSTE', 'La Poste'),
|
||||||
]
|
]
|
||||||
|
|
||||||
SITH_COUNTER_REFOUND = (88, 'Carte AE')
|
|
||||||
|
|
||||||
SITH_COUNTER_REFOUND_PRODUCT = (1899, 'REMBOURS', 'Remboursement')
|
|
||||||
|
|
||||||
# Defines which product type is the refilling type, and thus increases the account amount
|
# Defines which product type is the refilling type, and thus increases the account amount
|
||||||
SITH_COUNTER_PRODUCTTYPE_REFILLING = 11
|
SITH_COUNTER_PRODUCTTYPE_REFILLING = 11
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user