Beispiel #1
0
def finalizeyear_condo(xfer):
    year = FiscalYear.get_current(xfer.getparam('year'))
    if year is not None:
        ventilate = xfer.getparam("ventilate", 0)
        if xfer.observer_name == "core.custom":
            if year.check_to_close() > 0:
                raise LucteriosException(
                    IMPORTANT, _("This fiscal year has entries not closed!"))
            result = year.total_revenue - year.total_expense
            if abs(result) > 0.001:
                row = xfer.get_max_row() + 1
                lbl = XferCompLabelForm('title_condo')
                lbl.set_value(
                    _('This fiscal year has a result no null equals to %s.') %
                    get_amount_from_format_devise(result, 7))
                lbl.set_location(0, row, 2)
                xfer.add_component(lbl)
                lbl = XferCompLabelForm('question_condo')
                lbl.set_value(_('Where do you want to ventilate this amount?'))
                lbl.set_location(0, row + 1)
                xfer.add_component(lbl)
                sel_cmpt = [('0', _("For each owner"))]
                for account in year.chartsaccount_set.filter(
                        type_of_account=2).order_by('code'):
                    sel_cmpt.append((account.id, str(account)))
                sel = XferCompSelect("ventilate")
                sel.set_select(sel_cmpt)
                sel.set_value(ventilate)
                sel.set_location(1, row + 1)
                xfer.add_component(sel)
        elif xfer.observer_name == "core.acknowledge":
            Owner.ventilate_pay_all(year.begin, year.end)
            for set_cost in year.setcost_set.filter(year=year,
                                                    set__is_active=True,
                                                    set__type_load=0):
                if ventilate == 0:
                    current_system_condo().ventilate_costaccounting(
                        year, set_cost.set, set_cost.cost_accounting,
                        DEFAULT_ACCOUNT_CURRENT,
                        Params.getvalue("condominium-current-revenue-account"))
                set_cost.cost_accounting.close()
            current_system_condo().ventilate_result(year, ventilate)
Beispiel #2
0
def reportlastyear_after_condo(xfer):
    Owner.ventilate_pay_all()