Exemple #1
0
    def edit(self, xfer):
        set_comp = xfer.get_components('set')
        set_comp.set_select_query(Set.objects.filter(is_active=True))
        xfer.get_components('price').prec = Params.getvalue(
            "accounting-devise-prec")
        old_account = xfer.get_components("expense_account")
        xfer.remove_component("expense_account")
        sel_account = XferCompSelect("expense_account")
        sel_account.description = old_account.description
        sel_account.set_location(old_account.col, old_account.row,
                                 old_account.colspan, old_account.rowspan)
        for item in FiscalYear.get_current().chartsaccount_set.all().filter(
                code__regex=current_system_account().get_expence_mask(
                )).order_by('code'):
            sel_account.select_list.append((item.code, six.text_type(item)))
        sel_account.set_value(self.item.expense_account)
        xfer.add_component(sel_account)

        self.item.year = FiscalYear.get_current()
        btn = XferCompButton('add_account')
        btn.set_location(old_account.col + 1, old_account.row)
        btn.set_is_mini(True)
        btn.set_action(xfer.request,
                       ActionsManage.get_action_url('accounting.ChartsAccount',
                                                    'AddModify', xfer),
                       close=CLOSE_NO,
                       modal=FORMTYPE_MODAL,
                       params={'year': self.item.year.id})
        xfer.add_component(btn)
        xfer.get_components("set").colspan = old_account.colspan + 1
        xfer.get_components("designation").colspan = old_account.colspan + 1
        xfer.get_components("price").colspan = old_account.colspan + 1
Exemple #2
0
 def fillresponse_add_title(self):
     XferSearchEditor.fillresponse_add_title(self)
     modelname = self.model.get_long_name()
     saved_list = SavedCriteria.objects.filter(modelname=modelname)
     new_row = self.get_max_row()
     sel = XferCompSelect('saved_criteria')
     sel.description = _("saved criteria")
     sel.set_location(1, new_row + 1, 3)
     sel.set_needed(False)
     sel.set_select_query(saved_list)
     sel.set_action(self.request,
                    self.return_action(),
                    close=CLOSE_NO,
                    modal=FORMTYPE_REFRESH)
     self.add_component(sel)
     if len(self.criteria_list) > 0:
         from lucterios.CORE.views import SavedCriteriaAddModify
         btn = XferCompButton('btn_saved_criteria')
         btn.set_location(4, new_row + 1, 2)
         btn.set_is_mini(True)
         btn.set_action(self.request,
                        SavedCriteriaAddModify.get_action("+", ""),
                        close=CLOSE_NO,
                        params={
                            'modelname': modelname,
                            'criteria': self.getparam('CRITERIA', '')
                        })
         self.add_component(btn)
     if self.getparam('saved_criteria', 0) != 0:
         saved_item = SavedCriteria.objects.get(
             id=self.getparam('saved_criteria', 0))
         self.params['CRITERIA'] = saved_item.criteria
         self.read_criteria_from_params()
Exemple #3
0
    def add_legalentity(self, legal_entity):
        self.new_tab(_("Legal entity"))
        self.item = legal_entity
        fields = LegalEntity.get_show_fields()
        self.fill_from_model(1, 1, True, fields[_('001@Identity')])
        self.get_components('name').colspan = 2
        self.get_components('structure_type').colspan = 2
        img_path = get_user_path(
            "contacts", "Image_%s.jpg" % legal_entity.abstractcontact_ptr_id)
        img = XferCompImage('logoimg')
        if exists(img_path):
            img.type = 'jpg'
            img.set_value(readimage_to_base64(img_path))
        else:
            img.set_value(
                get_icon_path("lucterios.contacts/images/NoImage.png"))
        img.set_location(0, 2, 1, 6)
        self.add_component(img)

        btn = XferCompButton('btn_edit')
        btn.set_is_mini(True)
        btn.set_location(4, 1, 1, 2)
        btn.set_action(self.request, CurrentLegalEntityModify.get_action(
            _('Edit'), "images/edit.png"), modal=FORMTYPE_MODAL, close=CLOSE_NO, params={'legal_entity': legal_entity.id})
        self.add_component(btn)
Exemple #4
0
    def show_third(self, xfer, right=""):
        xfer.params["supporting"] = self.item.id
        third = xfer.get_components("third")
        third.colspan -= 2
        if WrapAction.is_permission(xfer.request, right):
            btn = XferCompButton("change_third")
            btn.set_location(third.col + third.colspan, third.row)
            btn.set_action(
                xfer.request,
                ActionsManage.get_action_url("payoff.Supporting", "Third", xfer),
                modal=FORMTYPE_MODAL,
                close=CLOSE_NO,
                params={"code_mask": self.item.get_third_mask()},
            )
            xfer.add_component(btn)

        if self.item.third is not None:
            btn = XferCompButton("show_third")
            btn.set_is_mini(True)
            btn.set_location(third.col + third.colspan + 1, third.row)
            btn.set_action(
                xfer.request,
                ActionsManage.get_action_url("accounting.Third", "Show", xfer),
                modal=FORMTYPE_MODAL,
                close=CLOSE_NO,
                params={"third": self.item.third.id},
            )
            xfer.add_component(btn)
        lbl = XferCompLabelForm("info")
        lbl.set_color("red")
        lbl.set_location(1, xfer.get_max_row() + 1, 4)
        lbl.set_value(self.item.get_info_state())
        xfer.add_component(lbl)
Exemple #5
0
 def fillresponse_add_title(self):
     XferSearchEditor.fillresponse_add_title(self)
     modelname = self.model.get_long_name()
     saved_list = SavedCriteria.objects.filter(modelname=modelname)
     new_row = self.get_max_row()
     lbl = XferCompLabelForm('lbl_saved_criteria')
     lbl.set_location(1, new_row + 1)
     lbl.set_value_as_name(_("saved criteria"))
     self.add_component(lbl)
     sel = XferCompSelect('saved_criteria')
     sel.set_location(2, new_row + 1, 2)
     sel.set_needed(False)
     sel.set_select_query(saved_list)
     sel.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
     self.add_component(sel)
     if len(self.criteria_list) > 0:
         from lucterios.CORE.views import SavedCriteriaAddModify
         btn = XferCompButton('btn_saved_criteria')
         btn.set_location(4, new_row + 1, 2)
         btn.set_is_mini(True)
         btn.set_action(self.request, SavedCriteriaAddModify.get_action("+", ""), close=CLOSE_NO,
                        params={'modelname': modelname, 'criteria': self.getparam('CRITERIA', '')})
         self.add_component(btn)
     if self.getparam('saved_criteria', 0) != 0:
         saved_item = SavedCriteria.objects.get(
             id=self.getparam('saved_criteria', 0))
         self.params['CRITERIA'] = saved_item.criteria
         self.read_criteria_from_params()
Exemple #6
0
def fill_params(xfer, param_lists=None, smallbtn=False):
    if param_lists is None:
        param_lists = [
            "member-team-enable", "member-team-text", "member-activite-enable",
            "member-activite-text", "member-age-enable",
            "member-licence-enabled", "member-filter-genre", "member-numero",
            "member-birth", "member-fields", "member-subscription-message"
        ]
    if len(param_lists) >= 3:
        nb_col = 2
    else:
        nb_col = 1
    Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1, nb_col=nb_col)

    comp_fields = xfer.get_components("member-fields")
    if comp_fields is not None:
        comp_fields.value = "{[br/]}".join([
            six.text_type(fields_title[1])
            for fields_title in Adherent.get_default_fields_title()
        ])

    btn = XferCompButton('editparam')
    btn.set_is_mini(smallbtn)
    btn.set_location(3, xfer.get_max_row() + 1)
    btn.set_action(xfer.request,
                   CategoryParamEdit.get_action(TITLE_MODIFY,
                                                'images/edit.png'),
                   close=CLOSE_NO,
                   params={
                       'params': param_lists,
                       'nb_col': nb_col
                   })
    xfer.add_component(btn)
Exemple #7
0
    def edit(self, xfer):
        if xfer.item.id is None:
            third = xfer.get_components('third')
            xfer.remove_component('third')
            xfer.remove_component('lbl_third')
            lbl = XferCompLabelForm('lbl_third')
            lbl.set_location(third.col - 1, third.row)
            lbl.set_value_as_name(_('third'))
            xfer.add_component(lbl)

            sel = XferCompSelect('third')
            sel.needed = True
            sel.set_location(third.col, third.row)
            owner_third_ids = []
            for owner in Owner.objects.all():
                owner_third_ids.append(owner.third_id)
            items = Third.objects.all().exclude(id__in=owner_third_ids).distinct()
            items = sorted(items, key=lambda t: six.text_type(t))
            sel.set_select_query(items)
            xfer.add_component(sel)
            btn = XferCompButton('add_third')
            btn.set_location(3, 0)
            btn.set_is_mini(True)
            btn.set_action(xfer.request, ActionsManage.get_action_url('accounting.Third', 'Add', xfer), close=CLOSE_NO,
                           modal=FORMTYPE_MODAL, params={'new_account': Params.getvalue('condominium-default-owner-account')})
            xfer.add_component(btn)
        else:
            xfer.change_to_readonly('third')
Exemple #8
0
    def add_legalentity(self, legal_entity):
        self.new_tab(_("Legal entity"))
        self.item = legal_entity
        fields = LegalEntity.get_show_fields()
        self.fill_from_model(1, 1, True, fields[_('001@Identity')])
        self.get_components('name').colspan = 2
        self.get_components('structure_type').colspan = 2
        img_path = get_user_path(
            "contacts", "Image_%s.jpg" % legal_entity.abstractcontact_ptr_id)
        img = XferCompImage('logoimg')
        if exists(img_path):
            img.type = 'jpg'
            img.set_value(readimage_to_base64(img_path))
        else:
            img.set_value(
                get_icon_path("lucterios.contacts/images/NoImage.png"))
        img.set_location(0, 2, 1, 6)
        self.add_component(img)

        btn = XferCompButton('btn_edit')
        btn.set_is_mini(True)
        btn.set_location(4, 1, 1, 2)
        btn.set_action(self.request,
                       CurrentLegalEntityModify.get_action(
                           _('Edit'), "images/edit.png"),
                       modal=FORMTYPE_MODAL,
                       close=CLOSE_NO,
                       params={'legal_entity': legal_entity.id})
        self.add_component(btn)
Exemple #9
0
    def fillresponse_show_criteria(self):
        criteria_text_list = self.get_text_search()
        label = XferCompLabelForm('labelsearchDescTitle')
        if len(criteria_text_list) > 0:
            label.set_value_as_info("Your criteria of search")
            label.set_location(0, 17, 2, 4)
        else:
            label.set_value_as_infocenter("No criteria of search")
            label.set_location(0, 17, 4)
        self.add_component(label)

        row = 17
        for criteria_id, criteria_text in criteria_text_list.items():
            label = XferCompLabelForm('labelSearchText_' + criteria_id)
            label.set_value(criteria_text)
            label.set_location(2, row, 2)
            self.add_component(label)
            comp = XferCompButton("searchButtonDel_" + criteria_id)
            comp.set_is_mini(True)
            comp.set_location(4, row)
            comp.set_action(self.request,
                            self.get_action("", "images/delete.png"),
                            modal=FORMTYPE_REFRESH,
                            close=CLOSE_NO,
                            params={'ACT': criteria_id})
            self.add_component(comp)
            row += 1
Exemple #10
0
def conf_wizard_contacts(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("contacts_current", 5))
        wizard_ident.append(("contacts_params", 40))
        wizard_ident.append(("contacts_responsable", 41))
    elif (xfer is not None) and (wizard_ident == "contacts_current"):
        xfer.add_title(_("Lucterios contacts"), _("Our details"), _('configure our details'))
        xfer.model = LegalEntity
        xfer.item = LegalEntity.objects.get(id=1)
        xfer.fill_from_model(1, xfer.get_max_row() + 1, True, desc_fields=LegalEntity.get_show_fields()[_('001@Identity')])
        xfer.remove_component('structure_type')
        btn = XferCompButton("btnconf")
        btn.set_location(2, xfer.get_max_row() + 1)
        btn.set_is_mini(True)
        btn.set_action(xfer.request, CurrentStructureAddModify.get_action('', "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)
    elif (xfer is not None) and (wizard_ident == "contacts_params"):
        xfer.add_title(_("Lucterios contacts"), _("Contacts configuration"), _('configure your contacts'))
        param_lists = ['contacts-mailtoconfig', 'contacts-createaccount']
        Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1)
        btn = XferCompButton('editparam')
        btn.set_location(4, xfer.get_max_row())
        btn.set_is_mini(True)
        btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO,
                       params={'params': param_lists})
        xfer.add_component(btn)
        lbl = XferCompLabelForm("nb_function")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': Function._meta.verbose_name_plural, 'count': len(Function.objects.all())})
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_structuretype")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': StructureType._meta.verbose_name_plural, 'count': len(StructureType.objects.all())})
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_customfield")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': CustomField._meta.verbose_name_plural, 'count': len(CustomField.objects.all())})
        xfer.add_component(lbl)
        btn = XferCompButton("btnconf")
        btn.set_location(4, xfer.get_max_row() - 2, 1, 3)
        btn.set_action(xfer.request, Configuration.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)

        lbl = XferCompLabelForm("nb_legalentity")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': LegalEntity._meta.verbose_name_plural, 'count': len(LegalEntity.objects.all())})
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_individual")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': Individual._meta.verbose_name_plural, 'count': len(Individual.objects.all())})
        xfer.add_component(lbl)
        btn = XferCompButton("btnimport")
        btn.set_location(4, xfer.get_max_row() - 1, 1, 2)
        btn.set_action(xfer.request, ContactImport.get_action(_("Contact import"), "images/add.png"), close=CLOSE_NO, params={'step': 0})
        xfer.add_component(btn)
    elif (xfer is not None) and (wizard_ident == "contacts_responsable"):
        xfer.add_title(_("Lucterios contacts"), _('associates'), _('configure your association'))
        xfer.params['legal_entity'] = 1
        xfer.fill_grid(5, Responsability, "responsability", Responsability.objects.filter(legal_entity_id=1))
Exemple #11
0
def add_auditlogs_button(xfer, model, posx, posy):
    if xfer.with_auditlog_btn and LucteriosLogEntry.objects.get_for_model(model).count() > 0:
        btn = XferCompButton('auditlogbtn')
        btn.set_action(xfer.request, ActionsManage.get_action_url(LucteriosLogEntry.get_long_name(), 'Show', xfer),
                       modal=FORMTYPE_MODAL, close=CLOSE_NO, params={'model': model.get_long_name()})
        btn.set_is_mini(True)
        btn.set_location(posx, posy)
        xfer.add_component(btn)
Exemple #12
0
def fill_params(xfer, is_mini=False):
    param_lists = ['payoff-cash-account', 'payoff-bankcharges-account', 'payoff-email-message']
    Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1)
    btn = XferCompButton('editparam')
    btn.set_is_mini(is_mini)
    btn.set_location(1, xfer.get_max_row() + 1, 2, 1)
    btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO, params={'params': param_lists})
    xfer.add_component(btn)
Exemple #13
0
def fill_params(xfer, is_mini=False):
    xfer.params['params'] = ['accounting-devise', 'accounting-devise-iso', 'accounting-devise-prec', 'accounting-sizecode']
    Params.fill(xfer, xfer.params['params'], 1, xfer.get_max_row() + 1)
    btn = XferCompButton('editparam')
    btn.set_is_mini(is_mini)
    btn.set_location(1, xfer.get_max_row() + 1, 2, 1)
    btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO)
    xfer.add_component(btn)
Exemple #14
0
def conf_wizard_core(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("core_home", 0))
        wizard_ident.append(("core_users", 100))
    elif (xfer is not None) and (wizard_ident == "core_home"):
        initial_wizard = Params.getvalue("CORE-Wizard")
        param_wizard = xfer.getparam("CORE-Wizard", initial_wizard)
        if initial_wizard != param_wizard:
            Parameter.change_value("CORE-Wizard", param_wizard)
            Params.clear()
        lbl = XferCompLabelForm('title')
        lbl.set_centered()
        lbl.set_value_as_info(six.text_type(settings.APPLIS_NAME))
        lbl.set_location(0, 3, 6)
        xfer.add_component(lbl)
        lbl = XferCompImage('img')
        lbl.type = 'jpg'
        lbl.set_value(settings.APPLIS_LOGO)
        lbl.set_location(2, 4, 2)
        xfer.add_component(lbl)
        lbl = XferCompLabelForm('home')
        lbl.set_value(_('This wizard will help you to configure this software.'))
        lbl.set_location(0, 5, 6)
        xfer.add_component(lbl)
        Params.fill(xfer, ['CORE-Wizard'], 1, 6, False)
        check = xfer.get_components("CORE-Wizard")
        check.set_action(xfer.request, xfer.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        lbl = XferCompLabelForm('lbl_wizard')
        lbl.set_value_as_name(check.description)
        lbl.set_location(2, 6)
        xfer.add_component(lbl)
        check.description = ""
    elif (xfer is not None) and (wizard_ident == "core_users"):
        xfer.add_title(six.text_type(settings.APPLIS_NAME), _("Groups and users"))
        param_lists = ['CORE-connectmode', 'CORE-Wizard']
        Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1)
        btn = XferCompButton('editparam')
        btn.set_location(4, xfer.get_max_row())
        btn.set_is_mini(True)
        btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO,
                       params={'params': param_lists})
        xfer.add_component(btn)
        lbl = XferCompLabelForm("nb_user")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': LucteriosUser._meta.verbose_name_plural, 'count': len(LucteriosUser.objects.all())})
        xfer.add_component(lbl)
        btn = XferCompButton("btnusers")
        btn.set_location(4, xfer.get_max_row())
        btn.set_action(xfer.request, UsersList.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)
        lbl = XferCompLabelForm("nb_group")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': LucteriosGroup._meta.verbose_name_plural, 'count': len(LucteriosGroup.objects.all())})
        xfer.add_component(lbl)
        btn = XferCompButton("btngroups")
        btn.set_location(4, xfer.get_max_row())
        btn.set_action(xfer.request, GroupsList.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)
Exemple #15
0
def fill_params(self, is_mini=False, new_params=False):
    system_condo = current_system_condo()
    param_lists = system_condo.get_config_params(new_params)
    Params.fill(self, param_lists, 1, self.get_max_row() + 1, nb_col=2)
    btn = XferCompButton('editparam')
    btn.set_location(1, self.get_max_row() + 1, 2, 1)
    btn.set_is_mini(is_mini)
    btn.set_action(self.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO,
                   params={'params': param_lists})
    self.add_component(btn)
Exemple #16
0
def fill_params(xfer, param_lists=None, is_mini=False):
    if param_lists is None:
        param_lists = ['invoice-vat-mode', 'invoice-default-sell-account',
                       'invoice-vatsell-account', 'invoice-reduce-account', 'invoice-account-third']
    Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1)
    btn = XferCompButton('editparam')
    btn.set_is_mini(is_mini)
    btn.set_location(1, xfer.get_max_row() + 1, 2, 1)
    btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO, params={'params': param_lists})
    xfer.add_component(btn)
Exemple #17
0
def editbudget_condo(xfer):
    if xfer.getparam('set') is not None:
        cost = xfer.getparam('cost_accounting')
        if cost is not None:
            set_item = Set.objects.get(id=xfer.getparam('set', 0))
            title_cost = xfer.get_components('title_cost')
            xfer.remove_component('title_year')
            year = xfer.getparam('year', 0)
            select_year = XferCompSelect('year')
            select_year.set_location(1, title_cost.row - 1)
            select_year.set_select_query(FiscalYear.objects.all())
            select_year.set_value(year)
            select_year.description = _('year')
            select_year.set_needed(set_item.type_load == Set.TYPELOAD_CURRENT)
            select_year.set_action(xfer.request,
                                   xfer.__class__.get_action(),
                                   close=CLOSE_NO,
                                   modal=FORMTYPE_REFRESH)
            xfer.add_component(select_year)
            btn = XferCompButton('confyear')
            btn.set_location(2, title_cost.row - 1)
            btn.set_action(xfer.request,
                           ActionsManage.get_action_url(
                               FiscalYear.get_long_name(), 'configuration',
                               xfer),
                           close=CLOSE_NO)
            btn.set_is_mini(True)
            xfer.add_component(btn)
            if year != 0:
                current_year = FiscalYear.get_current(year)
                xfer.params['readonly'] = str(
                    current_year.status == FiscalYear.STATUS_FINISHED)
                if set_item.type_load == 0:
                    if len(set_item.setcost_set.filter(
                            year=current_year)) == 0:
                        set_item.create_new_cost(year=current_year.id)
                    setcost_item = set_item.setcost_set.filter(
                        year=current_year)[0]
                else:
                    setcost_item = set_item.setcost_set.filter(year=None)[0]
                cost_item = setcost_item.cost_accounting
                xfer.params['cost_accounting'] = cost_item.id
                title_cost.set_value("{[b]}%s{[/b]} : %s" %
                                     (_('cost accounting'), cost_item))
            else:
                year = None
                xfer.params['readonly'] = 'True'
                cost_item = CostAccounting.objects.get(id=cost)
            if (cost_item.status
                    == CostAccounting.STATUS_OPENED) and not xfer.getparam(
                        'readonly', False):
                set_item.change_budget_product(cost_item, year)
    if xfer.getparam('type_of_account') is not None:
        xfer.params['readonly'] = 'True'
    return
Exemple #18
0
    def edit(self, xfer):
        if xfer.item.id is None:
            new_account = []
            if Params.getvalue("condominium-old-accounting"):
                new_account.append(
                    Params.getvalue("condominium-default-owner-account"))
            else:
                for num_account in LIST_DEFAULT_ACCOUNTS:
                    new_account.append(
                        Params.getvalue("condominium-default-owner-account%d" %
                                        num_account))
            sel = XferCompSelect('third')
            sel.needed = True
            sel.description = _('third')
            sel.set_location(1, 0)
            owner_third_ids = []
            for owner in Owner.objects.all():
                owner_third_ids.append(owner.third_id)
            items = Third.objects.filter(
                accountthird__code__regex=current_system_account(
                ).get_societary_mask()).exclude(
                    id__in=owner_third_ids).distinct()
            items = sorted(items, key=lambda t: str(t))
            sel.set_select_query(items)
            xfer.add_component(sel)
            btn = XferCompButton('add_third')
            btn.set_location(3, 0)
            btn.set_is_mini(True)
            btn.set_action(xfer.request,
                           ActionsManage.get_action_url(
                               'accounting.Third', 'Add', xfer),
                           close=CLOSE_NO,
                           modal=FORMTYPE_MODAL,
                           params={'new_account': ';'.join(new_account)})
            xfer.add_component(btn)
            xfer.filltab_from_model(1,
                                    xfer.get_max_row() + 1, False,
                                    ["information"])
        else:
            old_item = xfer.item
            xfer.item = old_item.third.contact.get_final_child()
            xfer.filltab_from_model(1, 0, False, xfer.item.get_edit_fields())
            CustomField.edit_fields(xfer, 1)

            xfer.item = old_item.third.get_final_child()
            xfer.filltab_from_model(1,
                                    xfer.get_max_row() + 1, False,
                                    xfer.item.get_edit_fields())
            CustomField.edit_fields(xfer, 1)

            xfer.item = old_item
            xfer.filltab_from_model(1,
                                    xfer.get_max_row() + 1, False,
                                    ["information"])
Exemple #19
0
def add_auditlog_button(xfer, instance, posx, posy):
    if xfer.with_auditlog_btn and LucteriosLogEntry.objects.get_for_object(instance).count() > 0:
        btn = XferCompButton('auditlogbtn')
        btn.set_action(xfer.request, ActionsManage.get_action_url(LucteriosLogEntry.get_long_name(), 'Show', xfer),
                       modal=FORMTYPE_MODAL, close=CLOSE_NO, params={'model': instance.__class__.get_long_name(),
                                                                     'objid': instance.id})
        btn.set_is_mini(True)
        btn.set_location(posx, posy)
        if xfer.tab > 0:
            xfer.tab = 1
        xfer.add_component(btn)
Exemple #20
0
def fill_params(xfer, param_lists=None, smallbtn=False):
    if param_lists is None:
        param_lists = ["member-team-enable", "member-team-text", "member-activite-enable", "member-activite-text", "member-age-enable",
                       "member-licence-enabled", "member-filter-genre", "member-numero", "member-birth", "member-connection", "member-subscription-mode", "member-subscription-message"]
    if len(param_lists) >= 3:
        nb_col = 2
    else:
        nb_col = 1
    Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1, nb_col=nb_col)
    btn = XferCompButton('editparam')
    btn.set_is_mini(smallbtn)
    btn.set_location(3, xfer.get_max_row() + 1)
    btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'),
                   close=CLOSE_NO, params={'params': param_lists, 'nb_col': nb_col})
    xfer.add_component(btn)
Exemple #21
0
 def show_third_ex(self, xfer):
     xfer.params["supporting"] = self.item.id
     third = xfer.get_components("third")
     third.colspan -= 1
     if self.item.third is not None:
         btn = XferCompButton("show_third")
         btn.set_is_mini(True)
         btn.set_location(third.col + third.colspan, third.row)
         btn.set_action(
             xfer.request,
             ActionsManage.get_action_url("accounting.Third", "Show", xfer),
             modal=FORMTYPE_MODAL,
             close=CLOSE_NO,
             params={"third": self.item.third.id},
         )
         xfer.add_component(btn)
Exemple #22
0
    def edit(self, xfer):
        if xfer.item.id is None:
            sel = XferCompSelect('third')
            sel.needed = True
            sel.description = _('third')
            sel.set_location(1, 0)
            owner_third_ids = []
            for owner in Owner.objects.all():
                owner_third_ids.append(owner.third_id)
            items = Third.objects.all().exclude(
                id__in=owner_third_ids).distinct()
            items = sorted(items, key=lambda t: six.text_type(t))
            sel.set_select_query(items)
            xfer.add_component(sel)
            btn = XferCompButton('add_third')
            btn.set_location(3, 0)
            btn.set_is_mini(True)
            btn.set_action(
                xfer.request,
                ActionsManage.get_action_url('accounting.Third', 'Add', xfer),
                close=CLOSE_NO,
                modal=FORMTYPE_MODAL,
                params={
                    'new_account':
                    Params.getvalue('condominium-default-owner-account')
                })
            xfer.add_component(btn)
            xfer.filltab_from_model(1,
                                    xfer.get_max_row() + 1, False,
                                    ["information"])
        else:
            old_item = xfer.item
            xfer.item = old_item.third.contact.get_final_child()
            xfer.filltab_from_model(1, 0, False, xfer.item.get_edit_fields())
            CustomField.edit_fields(xfer, 1)

            xfer.item = old_item.third.get_final_child()
            xfer.filltab_from_model(1,
                                    xfer.get_max_row() + 1, False,
                                    xfer.item.get_edit_fields())
            CustomField.edit_fields(xfer, 1)

            xfer.item = old_item
            xfer.filltab_from_model(1,
                                    xfer.get_max_row() + 1, False,
                                    ["information"])
Exemple #23
0
    def fillresponse_search_values(self):
        comp = XferCompButton("searchButtonAdd")
        comp.is_default = True
        comp.set_is_mini(True)
        comp.set_location(4, 10, 1, 7)
        comp.set_action(self.request,
                        self.get_action("", "images/add.png"),
                        modal=FORMTYPE_REFRESH,
                        close=CLOSE_NO,
                        params={'ACT': 'ADD'})
        self.add_component(comp)

        comp = XferCompDate("searchValueDate")
        comp.set_needed(True)
        comp.set_location(3, 11)
        comp.set_size(20, 200)
        self.add_component(comp)
        comp = XferCompFloat("searchValueFloat")
        comp.set_needed(True)
        comp.set_location(3, 12)
        comp.set_size(20, 200)
        self.add_component(comp)
        comp = XferCompEdit("searchValueStr")
        comp.set_location(3, 13)
        comp.set_size(20, 200)
        self.add_component(comp)
        comp = XferCompCheckList("searchValueList")
        comp.set_location(3, 14)
        comp.set_size(80, 200)
        self.add_component(comp)
        comp = XferCompCheck("searchValueBool")
        comp.set_location(3, 15)
        comp.set_size(20, 200)
        self.add_component(comp)
        comp = XferCompTime("searchValueTime")
        comp.set_needed(True)
        comp.set_location(3, 16)
        comp.set_size(20, 200)
        self.add_component(comp)

        label = XferCompLabelForm('labelsearchSep')
        label.set_value("")
        label.set_size(1, 200)
        label.set_location(3, 17)
        self.add_component(label)
Exemple #24
0
    def fill_current_folder(self, new_col, new_row):
        lbl = XferCompLabelForm('title_folder')
        if self.current_folder > 0:
            folder_obj = FolderContainer.objects.get(id=self.current_folder)
            lbl.set_value(folder_obj.get_title())
            folder_description = folder_obj.description
        else:
            folder_obj = None
            lbl.set_value('>')
            folder_description = ""
        lbl.set_location(new_col, new_row)
        lbl.description = _("current folder:")
        self.add_component(lbl)

        lbl = XferCompLabelForm('desc_folder')
        lbl.set_value_as_header(folder_description)
        lbl.set_location(new_col, new_row + 1)
        self.add_component(lbl)

        if self.current_folder > 0:
            btn_return = XferCompButton('return')
            btn_return.set_location(new_col + 1, new_row)
            btn_return.set_is_mini(True)
            btn_return.set_action(self.request,
                                  self.get_action('', 'images/left.png'),
                                  params={
                                      'current_folder':
                                      self.item.parent_id
                                      if self.item.parent_id is not None else 0
                                  },
                                  modal=FORMTYPE_REFRESH,
                                  close=CLOSE_NO)
            self.add_component(btn_return)

            btn_edit = XferCompButton('edit')
            btn_edit.set_location(new_col + 1, new_row + 1)
            btn_edit.set_is_mini(True)
            btn_edit.set_action(self.request,
                                FolderAddModify.get_action(
                                    '', 'images/edit.png'),
                                params={'folder': self.current_folder},
                                close=CLOSE_NO)
            self.add_component(btn_edit)
        return folder_obj
Exemple #25
0
    def fillresponse_search_values(self):
        comp = XferCompButton("searchButtonAdd")
        comp.set_is_mini(True)
        comp.set_location(4, 10, 1, 7)
        comp.set_action(self.request, self.get_action("", "images/add.png"),
                        {'modal': FORMTYPE_REFRESH, 'close': CLOSE_NO, 'params': {'ACT': 'ADD'}})
        self.add_component(comp)

        comp = XferCompDate("searchValueDate")
        comp.set_needed(True)
        comp.set_location(3, 11)
        comp.set_size(20, 200)
        self.add_component(comp)
        comp = XferCompFloat("searchValueFloat")
        comp.set_needed(True)
        comp.set_location(3, 12)
        comp.set_size(20, 200)
        self.add_component(comp)
        comp = XferCompEdit("searchValueStr")
        comp.set_location(3, 13)
        comp.set_size(20, 200)
        self.add_component(comp)
        comp = XferCompCheckList("searchValueList")
        comp.set_location(3, 14)
        comp.set_size(80, 200)
        self.add_component(comp)
        comp = XferCompCheck("searchValueBool")
        comp.set_location(3, 15)
        comp.set_size(20, 200)
        self.add_component(comp)
        comp = XferCompTime("searchValueTime")
        comp.set_needed(True)
        comp.set_location(3, 16)
        comp.set_size(20, 200)
        self.add_component(comp)

        label = XferCompLabelForm('labelsearchSep')
        label.set_value("")
        label.set_size(1, 200)
        label.set_location(3, 17)
        self.add_component(label)
Exemple #26
0
    def fillresponse(self):
        XferListEditor.fillresponse(self)
        obj_doc = self.get_components('container')
        new_col = obj_doc.col
        new_row = obj_doc.row
        obj_doc.colspan = 2
        self.move_components('container', 0, 2)
        self.fill_current_folder(new_col, new_row)

        if isinstance(self.item, DocumentContainer):
            btn_doc = XferCompButton('doc')
            btn_doc.set_location(new_col, new_row + 4)
            btn_doc.set_is_mini(True)
            btn_doc.set_action(self.request,
                               DocumentShow.get_action('', ''),
                               params={'document': self.item.id},
                               close=CLOSE_NO)
            btn_doc.java_script = "current.actionPerformed();"
            self.add_component(btn_doc)
        elif folder_notreadonly_condition(self):
            self.add_document()
Exemple #27
0
 def header_title(self, step, steplist):
     if step > 0:
         btn = XferCompButton("prec_wizard")
         btn.set_location(0, 0)
         btn.set_is_mini(True)
         btn.set_action(self.request, self.get_action(_("Prec"), "images/left.png"),
                        modal=FORMTYPE_REFRESH, close=CLOSE_NO, params={'step': step - 1})
         self.add_component(btn)
     lbl = XferCompLabelForm('progress')
     lbl.set_centered()
     lbl.set_value_as_name(_("progress steps: %(current)d/%(max)d") % {'current': step + 1, "max": len(steplist)})
     lbl.set_location(1, 0, 4)
     self.add_component(lbl)
     if step < (len(steplist) - 1):
         btn = XferCompButton("next_wizard")
         btn.set_location(5, 0)
         btn.set_is_mini(True)
         btn.set_action(self.request, self.get_action(_("Next"), "images/right.png"),
                        modal=FORMTYPE_REFRESH, close=CLOSE_NO, params={'step': step + 1})
         self.add_component(btn)
     lbl = XferCompLabelForm('sep1')
     lbl.set_value("{[hr/]}")
     lbl.set_location(0, 1, 6)
     self.add_component(lbl)
Exemple #28
0
    def fillresponse_show_criteria(self):
        criteria_text_list = self.get_text_search()
        label = XferCompLabelForm('labelsearchDescTitle')
        if len(criteria_text_list) > 0:
            label.set_value_as_info("Your criteria of search")
            label.set_location(0, 17, 2, 4)
        else:
            label.set_value_as_infocenter("No criteria of search")
            label.set_location(0, 17, 4)
        self.add_component(label)

        row = 17
        for criteria_id, criteria_text in criteria_text_list.items():
            label = XferCompLabelForm('labelSearchText_' + criteria_id)
            label.set_value(criteria_text)
            label.set_location(2, row, 2)
            self.add_component(label)
            comp = XferCompButton("searchButtonDel_" + criteria_id)
            comp.set_is_mini(True)
            comp.set_location(4, row)
            comp.set_action(self.request, self.get_action("", "images/delete.png"), {
                            'modal': FORMTYPE_REFRESH, 'close': CLOSE_NO, 'params': {'ACT': criteria_id}})
            self.add_component(comp)
            row += 1
Exemple #29
0
    def edit(self, xfer):
        set_comp = xfer.get_components('set')
        set_comp.set_select_query(Set.objects.filter(is_active=True))
        xfer.get_components('price').prec = Params.getvalue(
            "accounting-devise-prec")
        old_account = xfer.get_components("expense_account")
        xfer.remove_component("expense_account")
        sel_account = XferCompSelect("expense_account")
        sel_account.set_location(old_account.col, old_account.row, old_account.colspan, old_account.rowspan)
        for item in FiscalYear.get_current().chartsaccount_set.all().filter(code__regex=current_system_account().get_expence_mask()).order_by('code'):
            sel_account.select_list.append((item.code, six.text_type(item)))
        sel_account.set_value(self.item.expense_account)
        xfer.add_component(sel_account)

        self.item.year = FiscalYear.get_current()
        btn = XferCompButton('add_account')
        btn.set_location(old_account.col + 1, old_account.row)
        btn.set_is_mini(True)
        btn.set_action(xfer.request, ActionsManage.get_action_url('accounting.ChartsAccount', 'AddModify', xfer),
                       close=CLOSE_NO, modal=FORMTYPE_MODAL, params={'year': self.item.year.id})
        xfer.add_component(btn)
        xfer.get_components("set").colspan = old_account.colspan + 1
        xfer.get_components("designation").colspan = old_account.colspan + 1
        xfer.get_components("price").colspan = old_account.colspan + 1
Exemple #30
0
    def selector_from_model(self, col, row, field_name):

        dep_field = self.item._meta.get_field(
            field_name)
        if (not dep_field.auto_created or dep_field.concrete) and (dep_field.is_relation and dep_field.many_to_many):
            if hasattr(self.item, field_name + "__titles"):
                title_available, title_chosen = getattr(
                    self.item, field_name + "__titles")
            else:
                title_available, title_chosen = _("Available"), _("Chosen")
            availables = get_corrected_setquery(
                dep_field.remote_field.model.objects.all())
            java_script_init, java_script_treat = self._get_scripts_for_selectors(
                field_name, availables)

            lbl = XferCompLabelForm('hd_' + field_name + '_available')
            lbl.set_location(col + 1, row, 1, 1)
            lbl.set_value_as_header(title_available)
            self.add_component(lbl)

            lista = XferCompCheckList(field_name + '_available')
            lista.set_location(col + 1, row + 1, 1, 5)
            lista.set_size(200, 250)
            self.add_component(lista)

            lbl = XferCompLabelForm('hd_' + field_name + '_chosen')
            lbl.set_location(col + 3, row, 1, 1)
            lbl.set_value_as_header(title_chosen)
            self.add_component(lbl)

            listc = XferCompCheckList(field_name + '_chosen')
            listc.set_location(col + 3, row + 1, 1, 5)
            listc.set_size(200, 250)
            self.add_component(listc)

            btn_idx = 0
            for (button_name, button_title, button_script) in [("addall", ">>", """
if (%(comp)s_current !== null) {
    %(comp)s_valid ='';
    for (var key in %(comp)s_dico) {
        if (%(comp)s_valid !== '')
            %(comp)s_valid +=';';
        %(comp)s_valid +=key;
    }
    parent.mContext.put('%(comp)s',%(comp)s_valid);
}
"""), ("add", ">", """
if (%(comp)s_current !== null) {
    var value = parent.get('%(comp)s_available').getValue();
    if (%(comp)s_valid !== '')
        %(comp)s_valid +=';';
    %(comp)s_valid +=value;
parent.mContext.put('%(comp)s',%(comp)s_valid);
}
"""), ("del", "<", """
if (%(comp)s_current !== null) {
    var values = parent.get('%(comp)s_chosen').getValue().split(';');
    var valid_list = %(comp)s_valid.split(';');
    %(comp)s_valid ='';
    for (var key in valid_list) {
        selected_val = valid_list[key];
        if (values.indexOf(selected_val) === -1) {
            if (%(comp)s_valid !== '')
                %(comp)s_valid +=';';
            %(comp)s_valid +=selected_val;
        }
    }
    parent.mContext.put('%(comp)s',%(comp)s_valid);
}
"""), ("delall", "<<", """
if (%(comp)s_current !== null) {
    %(comp)s_valid ='';
    parent.mContext.put('%(comp)s',%(comp)s_valid);
}
""")]:
                btn = XferCompButton(field_name + '_' + button_name)
                btn.set_action(
                    self.request, WrapAction(button_title, ""), {'close': CLOSE_NO})
                btn.set_location(col + 2, row + 1 + btn_idx, 1, 1)
                btn.set_is_mini(True)
                btn.java_script = java_script_init + \
                    button_script % {'comp': field_name} + java_script_treat
                self.add_component(btn)
                btn_idx += 1
Exemple #31
0
def conf_wizard_contacts(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("contacts_current", 5))
        wizard_ident.append(("contacts_params", 40))
        wizard_ident.append(("contacts_responsable", 41))
    elif (xfer is not None) and (wizard_ident == "contacts_current"):
        xfer.add_title(_("Lucterios contacts"), _("Our details"),
                       _('configure our details'))
        xfer.model = LegalEntity
        xfer.item = LegalEntity.objects.get(id=1)
        xfer.fill_from_model(
            1,
            xfer.get_max_row() + 1,
            True,
            desc_fields=LegalEntity.get_show_fields()[_('001@Identity')])
        xfer.remove_component('structure_type')
        btn = XferCompButton("btnconf")
        btn.set_location(2, xfer.get_max_row() + 1)
        btn.set_is_mini(True)
        btn.set_action(xfer.request,
                       CurrentStructureAddModify.get_action(
                           '', "images/edit.png"),
                       close=CLOSE_NO)
        xfer.add_component(btn)
    elif (xfer is not None) and (wizard_ident == "contacts_params"):
        xfer.add_title(_("Lucterios contacts"), _("Contacts configuration"),
                       _('configure your contacts'))
        param_lists = [
            'contacts-mailtoconfig', 'contacts-createaccount',
            'contacts-defaultgroup', 'contacts-size-page'
        ]
        Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1)
        btn = XferCompButton('editparam')
        btn.set_location(4, xfer.get_max_row())
        btn.set_is_mini(True)
        btn.set_action(xfer.request,
                       ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'),
                       close=CLOSE_NO,
                       params={'params': param_lists})
        xfer.add_component(btn)
        lbl = XferCompLabelForm("nb_function")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': Function._meta.verbose_name_plural,
                'count': len(Function.objects.all())
            })
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_structuretype")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': StructureType._meta.verbose_name_plural,
                'count': len(StructureType.objects.all())
            })
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_customfield")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': CustomField._meta.verbose_name_plural,
                'count': len(CustomField.objects.all())
            })
        xfer.add_component(lbl)
        btn = XferCompButton("btnconf")
        btn.set_location(4, xfer.get_max_row() - 2, 1, 3)
        btn.set_action(xfer.request,
                       Configuration.get_action(TITLE_MODIFY,
                                                "images/edit.png"),
                       close=CLOSE_NO)
        xfer.add_component(btn)

        lbl = XferCompLabelForm("nb_legalentity")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': LegalEntity._meta.verbose_name_plural,
                'count': len(LegalEntity.objects.all())
            })
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_individual")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': Individual._meta.verbose_name_plural,
                'count': len(Individual.objects.all())
            })
        xfer.add_component(lbl)
        btn = XferCompButton("btnimport")
        btn.set_location(4, xfer.get_max_row() - 1, 1, 2)
        btn.set_action(xfer.request,
                       ContactImport.get_action(_("Contact import"),
                                                "images/add.png"),
                       close=CLOSE_NO,
                       params={'step': 0})
        xfer.add_component(btn)
    elif (xfer is not None) and (wizard_ident == "contacts_responsable"):
        xfer.add_title(_("Lucterios contacts"), _('associates'),
                       _('configure your association'))
        xfer.params['legal_entity'] = 1
        xfer.fill_grid(5, Responsability, "responsability",
                       Responsability.objects.filter(legal_entity_id=1))