Пример #1
0
 def save(self, key, value):
     year = get_selected_year()
     if key == 'buyer_id':
         buyer = Member.get(value)
         for allotment in self.context.allotments:
             allotment.member = buyer
         SaleHistory.create(seller_id=self.context.id, buyer_id=buyer.id)
         self.context.leaving_year = year
         Booking.create(banking_account_id=2,
                        booking_day=datetime.date.today(),
                        purpose='Aufnahmebeitrag',
                        value=-250000,
                        member_id=buyer.id,
                        kind_id=13,
                        accounting_year=year)
     else:
         sale = (SaleHistory.query().filter(
             SaleHistory.date == datetime.date.today()).filter(
                 SaleHistory.seller_id == self.context.id)).one()
         buyer = Member.get(sale.buyer_id)
         query = dict(
             transfer_member_due='Mitgliedsbeitrag {}'.format(year),
             transfer_advance_pay_one='Energieabschlag I',
             transfer_advance_pay_two='Energieabschlag II',
             transfer_energy_bill='Energieabrechnung',
             transfer_assignment_due='Arbeitsstunden {}'.format(year))[key]
         for booking in (Booking.query().filter(
                 Booking.accounting_year == year).filter(
                     Booking.purpose.ilike('%{}%'.format(query))).filter(
                         Booking.member == self.context)).all():
             booking.member = buyer
     return True
Пример #2
0
 def update(self):
     account = (BankingAccount.query().filter(
         BankingAccount.number == '1')).one()
     kind = (BookingKind.query().filter(
         BookingKind.title == 'Mitgliedsbeitrag')).one()
     year = get_selected_year()
     for member, fee_data in get_membership_fees(year).items():
         parcel_numbers = fee_data['parcel_number']
         parcel_size = fee_data['parcel_size']
         fee = fee_data['membership_fee']
         Booking.create(
             banking_account=account,
             purpose=(f'Mitgliedsbeitrag {year} Flurstück {parcel_numbers} '
                      f'({parcel_size}qm)'),
             value=0 - fee,
             accounting_year=year,
             booking_day=datetime.date(int(year), 3, 31),
             member=member,
             kind=kind)
Пример #3
0
def test_split_booking_failure_5(database):
    from sw.allotmentclub import Booking
    booking = Booking.create()
    assert booking.split(0) == 'Neuer Wert muss größer oder kleiner 0 sein.'
Пример #4
0
def test_split_booking_failure_4(database):
    from sw.allotmentclub import Booking
    booking = Booking.create(value=-10)
    assert booking.split(20) == 'Neuer Wert muss negativ sein.'
Пример #5
0
def test_split_booking_failure_2(database):
    from sw.allotmentclub import Booking
    booking = Booking.create(value=-10)
    assert booking.split(-20) == 'Neuer Wert ist zu klein.'
Пример #6
0
def test_split_booking_failure_1(database):
    from sw.allotmentclub import Booking
    booking = Booking.create(value=10)
    assert booking.split(20) == 'Neuer Wert ist zu groß.'