def default_setowner_fr(with_lots=True): if Params.getvalue("condominium-old-accounting"): create_account(['450'], 0, FiscalYear.get_current()) else: create_account(['4501', '4502', '4503', '4504', '4505'], 0, FiscalYear.get_current()) create_account(['120', '103', '105'], 2, FiscalYear.get_current()) create_account(['702'], 3, FiscalYear.get_current()) set1 = Set.objects.create(name="AAA", budget=1000, revenue_account='701', is_link_to_lots=with_lots, type_load=0) _set_budget(set1, '604', 1000) set2 = Set.objects.create(name="BBB", budget=100, revenue_account='701', type_load=0) _set_budget(set2, '604', 100) set3 = Set.objects.create(name="CCC", budget=500, revenue_account='702', type_load=1) _set_budget(set3, '604', 500) set4 = Set.objects.create(name="OLD", budget=100, revenue_account='702', type_load=1, is_active=False) _set_budget(set4, '602', 100) _create_owners(set1, set2, set3, set4, with_lots) Owner.check_all_account()
def ventilate_result(self, fiscal_year, ventilate): Owner.throw_not_allowed() self.check_account_config() result = fiscal_year.total_revenue - fiscal_year.total_expense if abs(result) > 0.001: total_part = PropertyLot.get_total_part() if total_part > 0: close_entry = EntryAccount( year=fiscal_year, designation=_("Ventilation for %s") % fiscal_year.toText, journal_id=5) close_entry.check_date() close_entry.save() if ventilate == 0: amount = 0 biggerowner_val = 0 biggerowner_line = None for owner in Owner.objects.all(): total = owner.propertylot_set.aggregate( sum=Sum('value')) if ('sum' in total.keys()) and (total['sum'] is not None): value = currency_round(result * total['sum'] / total_part) if abs(value) > 0.0001: owner_account = owner.third.get_account( fiscal_year, owner.get_third_mask(1)) last_line = EntryLineAccount.objects.create( account=owner_account, amount=-1 * value, entry=close_entry, third=owner.third) if biggerowner_val < total['sum']: biggerowner_val = total['sum'] biggerowner_line = last_line amount += value diff = currency_round(result - amount) if abs(diff) > 0.0001: biggerowner_line.amount -= diff biggerowner_line.save() else: EntryLineAccount.objects.create(account_id=ventilate, amount=result, entry=close_entry) reserve_account = ChartsAccount.get_account( Params.getvalue("condominium-current-revenue-account"), fiscal_year) EntryLineAccount.objects.create(account=reserve_account, amount=-1 * result, entry=close_entry) close_entry.closed()
def default_setowner_be(with_lots=True): create_account(['410000', '410100'], 0, FiscalYear.get_current()) create_account(['100000', '160000'], 2, FiscalYear.get_current()) create_account(['700100', '701100', '701200'], 3, FiscalYear.get_current()) set1 = Set.objects.create(name="AAA", is_link_to_lots=with_lots, type_load=0) _set_budget(set1, '602000', 1200) set2 = Set.objects.create(name="BBB", type_load=0) _set_budget(set2, '602000', 120) set3 = Set.objects.create(name="CCC", type_load=1) _set_budget(set3, '602000', 600) set4 = Set.objects.create(name="OLD", type_load=1, is_active=False) _set_budget(set4, '601000', 120) _create_owners(set1, set2, set3, set4, with_lots) Owner.check_all_account()
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)
def thirdaddon_condo(item, xfer): if WrapAction.is_permission(xfer.request, 'condominium.change_set'): try: owner = Owner.objects.get(third=item) xfer.new_tab(_('Condominium')) old_item = xfer.item xfer.item = owner xfer.filltab_from_model(0, 1, True, Owner.get_show_fields_in_third()) xfer.item = old_item btn = XferCompButton('condobtn') btn.set_location(0, 5, 2) btn.set_action(xfer.request, OwnerShow.get_action(TITLE_EDIT, 'images/edit.png'), close=CLOSE_NO, modal=FORMTYPE_MODAL, params={'owner': owner.id}) xfer.add_component(btn) except ObjectDoesNotExist: pass
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lucterios. If not, see <http://www.gnu.org/licenses/>. ''' from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from diacamma.condominium.models import Owner name = _("owner") kind = 2 modelname = Owner.get_long_name() value = """ <model hmargin="10.0" vmargin="10.0" page_width="210.0" page_height="297.0"> <header extent="25.0"> <text height="20.0" width="120.0" top="5.0" left="70.0" padding="1.0" spacing="0.0" border_color="black" border_style="" border_width="0.2" text_align="center" line_height="20" font_family="sans-serif" font_weight="" font_size="20"> {[b]}#OUR_DETAIL.name{[/b]} </text> <image height="25.0" width="30.0" top="0.0" left="10.0" padding="1.0" spacing="0.0" border_color="black" border_style="" border_width="0.2"> #OUR_DETAIL.image </image> </header> <bottom extent="10.0"> <text height="10.0" width="190.0" top="00.0" left="0.0" padding="1.0" spacing="0.0" border_color="black" border_style="" border_width="0.2" text_align="center" line_height="8" font_family="sans-serif" font_weight="" font_size="8"> {[italic]} #OUR_DETAIL.address - #OUR_DETAIL.postal_code #OUR_DETAIL.city - #OUR_DETAIL.tel1 #OUR_DETAIL.tel2 #OUR_DETAIL.email{[br/]}#OUR_DETAIL.identify_number {[/italic]}
def fillresponse(self): if self.confirme(_('Do you want to check account of owners?')): Owner.check_all_account()
def reportlastyear_after_condo(xfer): Owner.ventilate_pay_all()