示例#1
0
def summary_accounting(xfer):
    if WrapAction.is_permission(xfer.request, 'accounting.change_chartsaccount'):
        row = xfer.get_max_row() + 1
        lab = XferCompLabelForm('accountingtitle')
        lab.set_value_as_infocenter(_("Bookkeeping"))
        lab.set_location(0, row, 4)
        xfer.add_component(lab)
        try:
            year = FiscalYear.get_current()
            lbl = XferCompLabelForm("accounting_year")
            lbl.set_value_center(six.text_type(year))
            lbl.set_location(0, row + 1, 4)
            xfer.add_component(lbl)
            lbl = XferCompLabelForm("accounting_result")
            lbl.set_value_center(year.total_result_text)
            lbl.set_location(0, row + 2, 4)
            xfer.add_component(lbl)
        except LucteriosException as lerr:
            lbl = XferCompLabelForm("accounting_error")
            lbl.set_value_center(six.text_type(lerr))
            lbl.set_location(0, row + 1, 4)
            xfer.add_component(lbl)
            btn = XferCompButton("accounting_conf")
            btn.set_action(xfer.request, Configuration.get_action(_("conf."), ""), close=CLOSE_NO)
            btn.set_location(0, row + 2, 4)
            xfer.add_component(btn)
        lab = XferCompLabelForm('accountingend')
        lab.set_value_center('{[hr/]}')
        lab.set_location(0, row + 3, 4)
        xfer.add_component(lab)
        return True
    else:
        return False
示例#2
0
def conf_wizard_accounting(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("accounting_params", 21))
        wizard_ident.append(("accounting_fiscalyear", 22))
        wizard_ident.append(("accounting_journal", 23))
    elif (xfer is not None) and (wizard_ident == "accounting_params"):
        xfer.add_title(_("Diacamma accounting"), _('Parameters'), _('Configuration of accounting parameters'))
        select_account_system(xfer)
        fill_params(xfer, True)
    elif (xfer is not None) and (wizard_ident == "accounting_fiscalyear"):
        xfer.add_title(_("Diacamma accounting"), _('Fiscal year list'), _('Configuration of fiscal years'))
        xfer.fill_grid(5, FiscalYear, 'fiscalyear', FiscalYear.objects.all())
        try:
            current_year = FiscalYear.get_current()
            nb_account = len(ChartsAccount.objects.filter(year=current_year))
            lbl = XferCompLabelForm('nb_account')
            lbl.set_value(_("Total of charts of accounts in current fiscal year: %d") % nb_account)
            lbl.set_location(0, 10)
            xfer.add_component(lbl)
            if nb_account == 0:
                xfer.item = ChartsAccount()
                xfer.item.year = current_year
                btn = XferCompButton('initialfiscalyear')
                btn.set_location(1, 10)
                btn.set_action(xfer.request, ActionsManage.get_action_url(ChartsAccount.get_long_name(), 'AccountInitial', xfer), close=CLOSE_NO)
                xfer.add_component(btn)
        except LucteriosException as lerr:
            lbl = XferCompLabelForm('nb_account')
            lbl.set_value(six.text_type(lerr))
            lbl.set_location(0, 10, 2)
            xfer.add_component(lbl)
    elif (xfer is not None) and (wizard_ident == "accounting_journal"):
        xfer.add_title(_("Diacamma accounting"), _('Journals'), _('Configuration of journals'))
        xfer.fill_grid(5, Journal, 'journal', Journal.objects.all())
示例#3
0
文件: editors.py 项目: Diacamma2/asso
 def edit(self, xfer):
     from diacamma.invoice.views import ArticleList
     row_init = xfer.get_max_row() + 3
     btn = XferCompButton("btn_article")
     btn.set_location(3, row_init, 2)
     btn.set_action(xfer.request, ArticleList.get_action(_('Articles'), 'diacamma.invoice/images/article.png'), close=CLOSE_NO)
     xfer.add_component(btn)
示例#4
0
 def _entryline_editor(self, xfer, serial_vals, debit_rest, credit_rest):
     last_row = xfer.get_max_row() + 5
     lbl = XferCompLabelForm('sep1')
     lbl.set_location(0, last_row, 6)
     lbl.set_value("{[center]}{[hr/]}{[/center]}")
     xfer.add_component(lbl)
     lbl = XferCompLabelForm('sep2')
     lbl.set_location(1, last_row + 1, 5)
     lbl.set_value_center(_("Add a entry line"))
     xfer.add_component(lbl)
     entry_line = EntryLineAccount()
     entry_line.editor.edit_line(xfer, 0, last_row + 2, debit_rest, credit_rest)
     if entry_line.has_account:
         btn = XferCompButton('entrybtn')
         btn.set_location(3, last_row + 5)
         btn.set_action(xfer.request, ActionsManage.get_action_url(
             'accounting.EntryLineAccount', 'Add', xfer), close=CLOSE_YES)
         xfer.add_component(btn)
     self.item.editor.show(xfer)
     grid_lines = xfer.get_components('entrylineaccount')
     xfer.remove_component('entrylineaccount')
     new_grid_lines = XferCompGrid('entrylineaccount_serial')
     new_grid_lines.set_model(self.item.get_entrylineaccounts(serial_vals), None, xfer)
     new_grid_lines.set_location(grid_lines.col, grid_lines.row, grid_lines.colspan + 2, grid_lines.rowspan)
     new_grid_lines.add_action_notified(xfer, EntryLineAccount)
     xfer.add_component(new_grid_lines)
     nb_lines = len(new_grid_lines.record_ids)
     return nb_lines
示例#5
0
文件: views.py 项目: Lucterios2/core
def summary_dummy(xfer):
    if not hasattr(xfer, 'add_component'):
        return True
    else:
        row = xfer.get_max_row() + 1
        lab = XferCompLabelForm('dummytitle')
        lab.set_value_as_infocenter("Dummy")
        lab.set_location(0, row, 4)
        xfer.add_component(lab)
        lbl = XferCompLabelForm('dummy_time')
        lbl.set_color('blue')
        lbl.set_location(0, row + 1, 4)
        lbl.set_centered()
        lbl.set_value(datetime.now().ctime())
        xfer.add_component(lbl)

        btn = XferCompButton('btnscheduler')
        btn.set_action(xfer.request, AddSchedulerTask.get_action('Task', ''))
        btn.set_location(0, row + 2, 4)
        xfer.add_component(btn)
        lbl = XferCompLabelForm('dummy-value')
        lbl.set_location(0, row + 3, 4)
        lbl.set_value(Params.getvalue('dummy-value'))
        xfer.add_component(lbl)
        return True
示例#6
0
def fill_params(xfer):
    param_lists = ["event-degree-text", "event-subdegree-enable",
                   "event-subdegree-text", "event-comment-text"]
    Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1, nb_col=1)
    btn = XferCompButton('editparam')
    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, 'nb_col': 1})
    xfer.add_component(btn)
示例#7
0
 def show(self, xfer):
     AbstractContactEditor.show(self, xfer)
     obj_user = xfer.get_components('user')
     obj_user.colspan = 2
     xfer.tab = obj_user.tab
     btn = XferCompButton('userbtn')
     btn.is_mini = True
     btn.set_location(obj_user.col + 2, obj_user.row, 1, 1)
     if self.item.user is None:
         act = ActionsManage.get_action_url('CORE.LucteriosUser', 'UserAdd',
                                            xfer)
         act.set_value("", "images/add.png")
         btn.set_action(xfer.request,
                        act,
                        modal=FORMTYPE_MODAL,
                        close=CLOSE_NO)
     else:
         act = ActionsManage.get_action_url('CORE.LucteriosUser', 'Edit',
                                            xfer)
         act.set_value("", "images/edit.png")
         btn.set_action(xfer.request,
                        act,
                        modal=FORMTYPE_MODAL,
                        close=CLOSE_NO,
                        params={
                            'user_actif': six.text_type(self.item.user.id),
                            'IDENT_READ': 'YES'
                        })
     xfer.add_component(btn)
示例#8
0
    def _get_from_custom(self, request, *args, **kwargs):
        dlg = XferContainerCustom()
        dlg.request = self.request
        dlg.is_view_right = self.is_view_right
        dlg.caption = self.caption
        dlg.extension = self.extension
        dlg.action = self.action
        img_title = XferCompImage('img_title')
        img_title.set_location(0, 0, 1, 2)
        img_title.set_value(self.traitment_data[0])
        dlg.add_component(img_title)

        lbl = XferCompLabelForm("info")
        lbl.set_location(1, 0)
        dlg.add_component(lbl)
        if self.getparam("RELOAD") is not None:
            lbl.set_value(six.text_type(self.traitment_data[2]))
            dlg.add_action(WrapAction(_("Close"), "images/close.png"))
        else:
            lbl.set_value_center("{[br/]}" +
                                 six.text_type(self.traitment_data[1]))
            btn = XferCompButton("Next")
            btn.set_location(1, 1)
            btn.set_size(50, 300)
            btn.set_action(self.request,
                           self.return_action(_('Traitment...'), ""),
                           params={"RELOAD": "YES"})
            btn.java_script = "parent.refresh()"
            dlg.params["RELOAD"] = "YES"
            dlg.add_component(btn)
            dlg.add_action(WrapAction(_("Cancel"), "images/cancel.png"))
        return dlg.get_post(request, *args, **kwargs)
示例#9
0
文件: views.py 项目: Diacamma2/asso
def add_account_subscription(current_contact, xfer):
    if Params.getvalue("member-subscription-mode") > 0:
        current_subscription = Subscription.objects.filter(adherent_id=current_contact.id, season=Season.current_season())
        if len(current_subscription) == 0:
            xfer.new_tab(_('002@Subscription'))
            row = xfer.get_max_row() + 1
            btn = XferCompButton('btnnewsubscript')
            btn.set_location(1, row)
            btn.set_action(xfer.request, SubscriptionAddForCurrent.get_action(
                _('Subscription'), 'diacamma.member/images/adherent.png'), close=CLOSE_NO)
            xfer.add_component(btn)
示例#10
0
 def add_folder_buttons(self, new_col, new_row):
     btn = XferCompButton('btnFolder')
     btn.set_location(new_col, new_row + 2)
     btn.set_action(self.request, FolderAddModify.get_action(_('add'), "images/add.png"),
                    modal=FORMTYPE_MODAL, close=CLOSE_NO)
     self.add_component(btn)
     if self.current_folder > 0:
         btn = XferCompButton('btnEditFolder')
         btn.set_location(new_col + 1, new_row + 2, 1)
         btn.set_action(self.request, FolderAddModify.get_action(_('edit'), "images/edit.png"),
                        modal=FORMTYPE_MODAL, close=CLOSE_NO, params={'folder': six.text_type(self.current_folder)})
         self.add_component(btn)
示例#11
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)
示例#12
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)
示例#13
0
    def _get_from_custom(self, request, *args, **kwargs):
        dlg = XferContainerCustom()
        dlg.request = self.request
        dlg.is_view_right = self.is_view_right
        dlg.caption = self.caption
        dlg.extension = self.extension
        dlg.action = self.action
        img_title = XferCompImage('img_title')
        img_title.set_location(0, 0, 1, 2)
        img_title.set_value(self.traitment_data[0])
        dlg.add_component(img_title)

        lbl = XferCompLabelForm("info")
        lbl.set_location(1, 0)
        dlg.add_component(lbl)
        if self.getparam("RELOAD") is not None:
            lbl.set_value(
                "{[br/]}{[center]}" + six.text_type(self.traitment_data[2]) + "{[/center]}")
            dlg.add_action(WrapAction(_("Close"), "images/close.png"), {})
        else:
            lbl.set_value(
                "{[br/]}{[center]}" + six.text_type(self.traitment_data[1]) + "{[/center]}")
            btn = XferCompButton("Next")
            btn.set_location(1, 1)
            btn.set_size(50, 300)
            btn.set_action(self.request, self.get_action(
                _('Traitment...'), ""), {'params': {"RELOAD": "YES"}})
            btn.java_script = "parent.refresh()"
            dlg.params["RELOAD"] = "YES"
            dlg.add_component(btn)
            dlg.add_action(WrapAction(_("Cancel"), "images/cancel.png"), {})
        return dlg.get(request, *args, **kwargs)
示例#14
0
文件: editors.py 项目: htwalid/syndic
    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
示例#15
0
文件: editors.py 项目: loudubewe/core
 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()
示例#16
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
示例#17
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)
示例#18
0
文件: views.py 项目: Diacamma2/syndic
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
示例#19
0
def conf_wizard_mailing(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("mailing_params", 52))
    elif (xfer is not None) and (wizard_ident == "mailing_params"):
        xfer.add_title(_("Lucterios mailing"), _("Mailing parameters"))
        lbl = XferCompLabelForm("nb_mail_send")
        lbl.set_location(1, xfer.get_max_row() + 1)
        xfer.add_component(lbl)
        if will_mail_send():
            lbl.set_value(_('email properly configured'))
        else:
            lbl.set_value(_('email not configured'))
        btn = XferCompButton("btnconf")
        btn.set_location(3, xfer.get_max_row())
        btn.set_action(xfer.request, Configuration.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)
示例#20
0
 def show(self, xfer):
     xfer.tab = 0
     old_item = xfer.item
     xfer.item = self.item.contact.get_final_child()
     xfer.filltab_from_model(1, 1, True, ['address', ('postal_code', 'city'), 'country', ('tel1', 'tel2')])
     btn = XferCompButton('show')
     btn.set_location(2, 5, 3, 1)
     modal_name = xfer.item.__class__.get_long_name()
     field_id = xfer.item.__class__.__name__.lower()
     if field_id == 'legalentity':
         field_id = 'legal_entity'
     btn.set_action(xfer.request, ActionsManage.get_action_url(modal_name, 'Show', xfer), close=CLOSE_NO,
                    params={field_id: six.text_type(xfer.item.id)})
     xfer.add_component(btn)
     xfer.item = old_item
     Signal.call_signal("third_addon", self.item, xfer)
示例#21
0
文件: views.py 项目: Diacamma2/syndic
def summary_condo(xfer):
    is_right = WrapAction.is_permission(xfer.request, 'condominium.change_set')
    owners = get_owners(xfer.request)
    if is_right or (len(owners) == 1):
        row = xfer.get_max_row() + 1
        lab = XferCompLabelForm('condotitle')
        lab.set_value_as_infocenter(_('Condominium'))
        lab.set_location(0, row, 4)
        xfer.add_component(lab)
    if len(owners) == 1:
        lab = XferCompLabelForm('condoowner')
        lab.set_value(_('You are a owner'))
        lab.set_location(0, row + 1, 2)
        xfer.add_component(lab)
        grid = XferCompGrid("part")
        grid.set_model(owners[0].partition_set.filter(set__is_active=True), ["set", "value", (_("ratio"), 'ratio')])
        grid.set_location(0, row + 2, 4)
        grid.set_size(200, 500)
        xfer.add_component(grid)
    if is_right:
        row = xfer.get_max_row() + 1
        nb_set = len(Set.objects.filter(is_active=True))
        nb_owner = len(Owner.objects.all())
        lab = XferCompLabelForm('condoinfo')
        lab.set_value_as_header(_("There are %(set)d classes of loads for %(owner)d owners") % {'set': nb_set, 'owner': nb_owner})
        lab.set_location(0, row + 1, 4)
        xfer.add_component(lab)
        if Params.getvalue("condominium-old-accounting"):
            lab = XferCompLabelForm('condoconvinfo')
            lab.set_value_as_header(_("Your condominium account is not in respect of French law{[newline]}An conversion is necessary."))
            lab.set_color('red')
            lab.set_location(0, row + 2, 4)
            xfer.add_component(lab)
            btn = XferCompButton('condoconv')
            btn.set_location(0, row + 3, 4)
            btn.set_action(xfer.request, CondominiumConvert.get_action(_('Convertion ...'), ""), close=CLOSE_NO)
            xfer.add_component(btn)
    if is_right or (len(owners) == 1):
        row = xfer.get_max_row() + 1
        lab = XferCompLabelForm('condosep')
        lab.set_value_as_infocenter("{[hr/]}")
        lab.set_location(0, row, 4)
        xfer.add_component(lab)
        return True
    else:
        return False
示例#22
0
def conf_wizard_document(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("document_params", 55))
    elif (xfer is not None) and (wizard_ident == "document_params"):
        xfer.add_title(_("Lucterios documents"), _("Parameters"))
        lbl = XferCompLabelForm("nb_folder")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': Folder._meta.verbose_name_plural, 'count': len(Folder.objects.all())})
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_doc")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(TEXT_TOTAL_NUMBER % {'name': Document._meta.verbose_name_plural, 'count': len(Document.objects.all())})
        xfer.add_component(lbl)
        btn = XferCompButton("btnconf")
        btn.set_location(4, xfer.get_max_row() - 1, 1, 2)
        btn.set_action(xfer.request, FolderList.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)
示例#23
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)
示例#24
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
示例#25
0
    def show(self, xfer):
        xfer.params['supporting'] = self.item.id
        third = xfer.get_components('thirdtotal')
        xfer.tab = third.tab
        btn = XferCompButton('show_third')
        btn.set_location(third.col + third.colspan, third.row)
        act_btn = ActionsManage.get_action_url('accounting.Third', 'Show',
                                               xfer)
        if act_btn is not None:
            act_btn.caption = _('third')
        btn.set_action(xfer.request,
                       act_btn,
                       modal=FORMTYPE_MODAL,
                       close=CLOSE_NO,
                       params={'third': self.item.third.id})
        btn.rowspan = 2
        xfer.add_component(btn)

        lots = xfer.get_components('propertylot')
        lots.actions = []
        lots.delete_header('owner')

        if hasattr(xfer.item.third.contact.get_final_child(),
                   'structure_type'):
            contact = xfer.get_components('ownercontact')
            xfer.tab = contact.tab
            old_item = xfer.item
            xfer.item = old_item.third.contact.get_final_child()
            xfer.filltab_from_model(contact.col, contact.row + 1, True,
                                    ['responsability_set'])
            xfer.item = old_item

        self._show_entryline(xfer)
        self._show_current_class_loads(xfer)
        self._show_call_payoff(xfer)
示例#26
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)
示例#27
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')
示例#28
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()
示例#29
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"])
示例#30
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)
示例#31
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)
示例#32
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)
示例#33
0
 def fillresponse(self, field_id):
     if field_id is not None:
         self.field_id = field_id
     if hasattr(self.item, 'abstractcontact_ptr_id'):
         XferShowEditor.fillresponse(self)
     else:
         img = XferCompImage('img')
         img.set_value(self.icon_path())
         img.set_location(0, 0, 1, 3)
         self.add_component(img)
         lbl = XferCompLabelForm('title')
         lbl.set_value_as_title(_('this contact is inconstitant, you must to be promote it !'))
         lbl.set_location(1, 0)
         self.add_component(lbl)
         btn = XferCompButton('btn_promote')
         btn.set_location(1, 1)
         btn.set_action(self.request, ObjectPromote.get_action(_('Promote'), "images/config.png"), modal=FORMTYPE_MODAL,
                        close=CLOSE_YES, params={'modelname': self.model.get_long_name(), 'field_id': self.field_id})
         self.add_component(btn)
示例#34
0
 def show(self, xfer):
     xfer.params['supporting'] = self.item.id
     third = xfer.get_components('third')
     xfer.tab = third.tab
     btn = XferCompButton('show_third')
     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)
     lblpartition = xfer.get_components('lbl_partition_set')
     lblpartition.value = _("current class loads")
     partition = xfer.get_components('partition')
     partition.actions = []
     partition.delete_header('owner')
     lots = xfer.get_components('propertylot')
     lots.actions = []
     lots.delete_header('owner')
     callfunds = xfer.get_components('callfunds')
     callfunds.actions = []
     callfunds.add_action(xfer.request, ActionsManage.get_action_url('condominium.CallFunds', 'Show', xfer), close=CLOSE_NO, unique=SELECT_SINGLE)
示例#35
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)
示例#36
0
    def add_document(self):
        old_item = self.item
        self.model = DocumentContainer
        self.item = DocumentContainer()
        last_row = self.get_max_row() + 5
        lbl = XferCompLabelForm('sep1')
        lbl.set_location(0, last_row, 6)
        lbl.set_value("{[center]}{[hr/]}{[/center]}")
        self.add_component(lbl)
        lbl = XferCompLabelForm('sep2')
        lbl.set_location(0, last_row + 1, 2)
        lbl.set_value_as_infocenter(_("Add document"))
        self.add_component(lbl)

        self.fill_from_model(0, last_row + 3, False)
        self.remove_component('parent')

        btn_doc = XferCompButton('adddoc')
        btn_doc.set_location(1, last_row + 4)
        btn_doc.set_action(self.request,
                           DocumentAddModify.get_action(
                               TITLE_ADD, 'images/add.png'),
                           params={
                               'parent': self.current_folder,
                               'SAVE': 'YES'
                           },
                           close=CLOSE_NO)
        self.add_component(btn_doc)

        self.model = AbstractContainer
        self.item = old_item
示例#37
0
def summary_dummy(xfer):
    if not hasattr(xfer, 'add_component'):
        return True
    else:
        row = xfer.get_max_row() + 1
        lab = XferCompLabelForm('dummytitle')
        lab.set_value_as_infocenter("Dummy")
        lab.set_location(0, row, 4)
        xfer.add_component(lab)
        lbl = XferCompLabelForm('dummy_time')
        lbl.set_color('blue')
        lbl.set_location(0, row + 1, 4)
        lbl.set_centered()
        lbl.set_value(datetime.now())
        lbl.set_format('H')
        xfer.add_component(lbl)

        btn = XferCompButton('btnscheduler')
        btn.set_action(xfer.request, AddSchedulerTask.get_action('Task', ''))
        btn.set_location(0, row + 2, 4)
        xfer.add_component(btn)
        lbl = XferCompLabelForm('dummy-value')
        lbl.set_location(0, row + 3, 4)
        lbl.set_value(Params.getvalue('dummy-value'))
        xfer.add_component(lbl)
        return True
示例#38
0
 def show(self, xfer):
     LucteriosEditor.show(self, xfer)
     obj_addr = xfer.get_components('address')
     xfer.tab = obj_addr.tab
     new_col = obj_addr.col
     xfer.move(obj_addr.tab, 1, 0)
     img_path = get_user_path(
         "contacts", "Image_%s.jpg" % self.item.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(new_col, obj_addr.row, 1, 6)
     xfer.add_component(img)
     if WrapAction.is_permission(xfer.request,
                                 'contacts.add_abstractcontact'):
         if (len(self.item.__class__.get_select_contact_type(False)) > 0):
             btn = XferCompButton('btn_promote')
             btn.set_location(new_col + 1, xfer.get_max_row() + 1, 4)
             btn.set_action(xfer.request,
                            ObjectPromote.get_action(
                                _('Promote'), "images/config.png"),
                            modal=FORMTYPE_MODAL,
                            close=CLOSE_YES,
                            params={
                                'modelname': xfer.model.get_long_name(),
                                'field_id': xfer.field_id
                            })
             xfer.add_component(btn)
     signal_and_lock.Signal.call_signal("show_contact", self.item, xfer)
示例#39
0
def conf_wizard_document(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("document_params", 55))
    elif (xfer is not None) and (wizard_ident == "document_params"):
        xfer.add_title(_("Lucterios documents"), _("Parameters"))
        lbl = XferCompLabelForm("nb_folder")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': Folder._meta.verbose_name_plural,
                'count': len(Folder.objects.all())
            })
        xfer.add_component(lbl)
        lbl = XferCompLabelForm("nb_doc")
        lbl.set_location(1, xfer.get_max_row() + 1)
        lbl.set_value(
            TEXT_TOTAL_NUMBER % {
                'name': Document._meta.verbose_name_plural,
                'count': len(Document.objects.all())
            })
        xfer.add_component(lbl)
        btn = XferCompButton("btnconf")
        btn.set_location(4, xfer.get_max_row() - 1, 1, 2)
        btn.set_action(xfer.request,
                       FolderList.get_action(TITLE_MODIFY, "images/edit.png"),
                       close=CLOSE_NO)
        xfer.add_component(btn)
示例#40
0
 def fillresponse(self, field_id):
     if field_id is not None:
         self.field_id = field_id
     if hasattr(self.item, 'abstractcontact_ptr_id'):
         XferShowEditor.fillresponse(self)
     else:
         img = XferCompImage('img')
         img.set_value(self.icon_path())
         img.set_location(0, 0, 1, 3)
         self.add_component(img)
         lbl = XferCompLabelForm('title')
         lbl.set_value_as_title(
             _('this contact is inconstitant, you must to be promote it !'))
         lbl.set_location(1, 0)
         self.add_component(lbl)
         btn = XferCompButton('btn_promote')
         btn.set_location(1, 1)
         btn.set_action(self.request,
                        ObjectPromote.get_action(_('Promote'),
                                                 "images/config.png"),
                        modal=FORMTYPE_MODAL,
                        close=CLOSE_YES,
                        params={
                            'modelname': self.model.get_long_name(),
                            'field_id': self.field_id
                        })
         self.add_component(btn)
示例#41
0
 def fillresponse_header(self):
     self.new_tab(_('Parameters'))
     fill_params(self)
     btn = XferCompButton('checkowner')
     btn.set_location(3, self.get_max_row(), 2, 1)
     btn.set_action(self.request, CondominiumCheckOwner.get_action(_('check owner'), 'diacamma.condominium/images/owner.png'), close=CLOSE_NO)
     self.add_component(btn)
     self.new_tab(_('Links'))
示例#42
0
def show_contact_accounting(contact, xfer):
    if WrapAction.is_permission(xfer.request, 'accounting.change_entryaccount'):
        main_third = None
        thirds = Third.objects.filter(contact_id=contact.id)
        if len(thirds) > 1:
            main_third = thirds[0]
            alias_third = []
            for third in thirds:
                if third.id != main_third.id:
                    alias_third.append(third)
            main_third.merge_objects(alias_third)
        elif len(thirds) == 1:
            main_third = thirds[0]
        if main_third is not None:
            xfer.new_tab(_("Financial"))
            xfer.item = main_third
            xfer.filltab_from_model(0, 0, True, ["status", ((_('total'), 'total'),)])
            btn = XferCompButton('show_third')
            btn.set_location(0, 50, 2)
            btn.set_action(xfer.request, ActionsManage.get_action_url('accounting.Third', 'Show', xfer),
                           modal=FORMTYPE_MODAL, close=CLOSE_NO, params={"third": six.text_type(main_third.id)})
            xfer.add_component(btn)
            xfer.item = contact
示例#43
0
 def show(self, xfer):
     LucteriosEditor.show(self, xfer)
     obj_addr = xfer.get_components('address')
     xfer.tab = obj_addr.tab
     new_col = obj_addr.col
     xfer.move(obj_addr.tab, 1, 0)
     img_path = get_user_path("contacts", "Image_%s.jpg" % self.item.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(new_col, obj_addr.row, 1, 6)
     xfer.add_component(img)
     if WrapAction.is_permission(xfer.request, 'contacts.add_abstractcontact'):
         if (len(self.item.__class__.get_select_contact_type(False)) > 0):
             btn = XferCompButton('btn_promote')
             btn.set_location(new_col + 1, xfer.get_max_row() + 1, 4)
             btn.set_action(xfer.request, ObjectPromote.get_action(_('Promote'), "images/config.png"), modal=FORMTYPE_MODAL,
                            close=CLOSE_YES, params={'modelname': xfer.model.get_long_name(), 'field_id': xfer.field_id})
             xfer.add_component(btn)
     signal_and_lock.Signal.call_signal("show_contact", self.item, xfer)
示例#44
0
文件: editors.py 项目: htwalid/syndic
    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"])
示例#45
0
文件: editors.py 项目: Diacamma2/asso
    def show(self, xfer):
        IndividualEditor.show(self, xfer)
        if xfer.getparam('adherent') is None:
            xfer.params['adherent'] = xfer.getparam('individual', 0)
        if xfer.getparam('individual') is None:
            xfer.params['individual'] = xfer.getparam('adherent', 0)
        img = xfer.get_components('img')
        img.set_value(get_icon_path("diacamma.member/images/adherent.png"))

        if xfer.item.current_subscription is not None:
            xfer.tab = 1
            row_init = xfer.get_max_row() + 1
            row = row_init + 1
            for doc in xfer.item.current_subscription.docadherent_set.all():
                lbl = XferCompLabelForm("lbl_doc_%d" % doc.id)
                lbl.set_value(six.text_type(doc.document))
                lbl.set_location(2, row)
                xfer.add_component(lbl)
                ckc = XferCompCheck("doc_%d" % doc.id)
                ckc.set_value(doc.value)
                ckc.set_location(3, row)
                xfer.add_component(ckc)
                row += 1
            if row != row_init + 1:
                lbl = XferCompLabelForm("lbl_doc_sep")
                lbl.set_value("{[hr/]}")
                lbl.set_location(1, row_init, 4)
                xfer.add_component(lbl)
                lbl = XferCompLabelForm("lbl_doc")
                lbl.set_value_as_name(_('documents needs'))
                lbl.set_location(1, row_init + 1)
                xfer.add_component(lbl)
                btn = XferCompButton("btn_doc")
                btn.set_location(4, row_init + 1, 1, row - row_init)
                btn.set_action(xfer.request, ActionsManage.get_action_url("member.Adherent", "Doc", xfer), close=CLOSE_NO)
                xfer.add_component(btn)
示例#46
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()
示例#47
0
 def show(self, xfer):
     AbstractContactEditor.show(self, xfer)
     obj_user = xfer.get_components('user')
     obj_user.colspan = 2
     xfer.tab = obj_user.tab
     btn = XferCompButton('userbtn')
     btn.is_mini = True
     btn.set_location(obj_user.col + 2, obj_user.row, 1, 1)
     if self.item.user is None:
         act = ActionsManage.get_action_url('CORE.LucteriosUser', 'UserAdd', xfer)
         act.set_value("", "images/add.png")
         btn.set_action(xfer.request, act, modal=FORMTYPE_MODAL, close=CLOSE_NO)
     else:
         act = ActionsManage.get_action_url('CORE.LucteriosUser', 'Edit', xfer)
         act.set_value("", "images/edit.png")
         btn.set_action(xfer.request, act, modal=FORMTYPE_MODAL, close=CLOSE_NO,
                        params={'user_actif': six.text_type(self.item.user.id), 'IDENT_READ': 'YES'})
     xfer.add_component(btn)
示例#48
0
 def edit(self, xfer):
     from diacamma.invoice.views import ArticleList
     row_init = xfer.get_max_row() + 3
     btn = XferCompButton("btn_article")
     btn.set_location(3, row_init, 2)
     btn.set_action(xfer.request,
                    ArticleList.get_action(
                        _('Articles'),
                        'diacamma.invoice/images/article.png'),
                    close=CLOSE_NO)
     xfer.add_component(btn)
示例#49
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)
示例#50
0
def summary_core(xfer):
    if not hasattr(xfer, 'add_component'):
        return right_show_wizard(xfer) and (get_wizard_step_list() != '') and ConfigurationWizard.get_action().check_permission(xfer)
    elif right_show_wizard(xfer.request):
        steplist = get_wizard_step_list()
        if steplist != '':
            btn = XferCompButton("conf_wizard")
            btn.set_location(0, xfer.get_max_row() + 1, 4)
            btn.set_action(xfer.request, ConfigurationWizard.get_action(
                _("Wizard"), "images/config.png"), close=CLOSE_NO, params={'steplist': steplist})
            btn.java_script = """if (typeof Singleton().hide_wizard === 'undefined') {
    current.actionPerformed();
    Singleton().hide_wizard = 1;
}
"""
            xfer.add_component(btn)
示例#51
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)
示例#52
0
文件: views.py 项目: htwalid/syndic
def summary_condo(xfer):
    if not hasattr(xfer, 'add_component'):
        return WrapAction.is_permission(xfer, 'condominium.change_set')
    else:
        if WrapAction.is_permission(xfer.request, 'condominium.change_set'):
            row = xfer.get_max_row() + 1
            lab = XferCompLabelForm('condotitle')
            lab.set_value_as_infocenter(_('Condominium'))
            lab.set_location(0, row, 4)
            xfer.add_component(lab)
            nb_set = len(Set.objects.filter(is_active=True))
            nb_owner = len(Owner.objects.all())
            lab = XferCompLabelForm('condoinfo')
            lab.set_value_as_header(
                _("There are %(set)d classes of loads for %(owner)d owners") %
                {
                    'set': nb_set,
                    'owner': nb_owner
                })
            lab.set_location(0, row + 1, 4)
            xfer.add_component(lab)
            if Params.getvalue("condominium-old-accounting"):
                lab = XferCompLabelForm('condoconvinfo')
                lab.set_value_as_header(
                    _("Your condominium account is not in respect of French law{[newline]}An conversion is necessary."
                      ))
                lab.set_color('red')
                lab.set_location(0, row + 2, 4)
                xfer.add_component(lab)
                btn = XferCompButton('condoconv')
                btn.set_location(0, row + 3, 4)
                btn.set_action(xfer.request,
                               CondominiumConvert.get_action(
                                   _('Convertion ...'), ""),
                               close=CLOSE_NO)
                xfer.add_component(btn)
            if hasattr(settings, "DIACAMMA_MAXOWNER"):
                lbl = XferCompLabelForm("limit_owner")
                lbl.set_value(
                    _('limitation: %d owners allowed') %
                    getattr(settings, "DIACAMMA_MAXOWNER"))
                lbl.set_italic()
                lbl.set_location(0, row + 4, 4)
                xfer.add_component(lbl)
            row = xfer.get_max_row() + 1
            lab = XferCompLabelForm('condosep')
            lab.set_value_as_infocenter("{[hr/]}")
            lab.set_location(0, row, 4)
            xfer.add_component(lab)
            return True
        else:
            return False
示例#53
0
 def _show_current_class_loads(self, xfer):
     partition = xfer.get_components('partition')
     partition.actions = []
     partition.description = _("current class loads")
     partition.delete_header('owner')
     xfer.tab = partition.tab
     row = xfer.get_max_row() + 1
     btn = XferCompButton('show_load_count')
     btn.set_location(partition.col, row)
     btn.set_action(xfer.request,
                    ActionsManage.get_action_url('condominium.Owner',
                                                 'LoadCount', xfer),
                    modal=FORMTYPE_MODAL,
                    close=CLOSE_NO)
     xfer.add_component(btn)
示例#54
0
def fill_params(xfer):
    param_lists = [
        "event-degree-enable", "event-degree-text", "event-subdegree-enable",
        "event-subdegree-text", "event-comment-text"
    ]
    Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1, nb_col=1)
    btn = XferCompButton('editparam')
    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,
                       'nb_col': 1
                   })
    xfer.add_component(btn)
示例#55
0
def conf_wizard_mailing(wizard_ident, xfer):
    if isinstance(wizard_ident, list) and (xfer is None):
        wizard_ident.append(("mailing_params", 52))
    elif (xfer is not None) and (wizard_ident == "mailing_params"):
        xfer.add_title(_("Lucterios mailing"), _("Mailing parameters"))
        lbl = XferCompLabelForm("nb_mail_send")
        lbl.set_location(1, xfer.get_max_row() + 1)
        xfer.add_component(lbl)
        if will_mail_send():
            lbl.set_value(_('email properly configured'))
        else:
            lbl.set_value(_('email not configured'))
        btn = XferCompButton("btnconf")
        btn.set_location(3, xfer.get_max_row())
        btn.set_action(xfer.request, Configuration.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO)
        xfer.add_component(btn)
示例#56
0
文件: views.py 项目: julienM77/syndic
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
示例#57
0
 def edit(self, xfer):
     IndividualEditor.edit(self, xfer)
     birthday = xfer.get_components('birthday')
     if birthday is not None:
         birthday.needed = True
     if (self.item.id is None) and (xfer.getparam(
             'legal_entity',
             0) == 0) and (Params.getobject("member-family-type")
                           is not None):
         genre = xfer.get_components('genre')
         genre.colspan -= 1
         btn = XferCompButton('famillybtn')
         btn.set_location(genre.col + genre.colspan, genre.row)
         btn.set_action(xfer.request,
                        ActionsManage.get_action_url(
                            'member.Adherent', 'familyAdherentAdd', xfer),
                        modal=FORMTYPE_MODAL,
                        close=CLOSE_YES)
         xfer.add_component(btn)
示例#58
0
 def fillresponse(self):
     XferListEditor.fillresponse(self)
     self.new_tab(_("Log setting"))
     row = self.get_max_row() + 1
     sel = XferCompCheckList('AuditLogSetting')
     sel.simple = 2
     sel.set_select(Signal.get_packages_of_signal('auditlog_register'))
     sel.set_value(Params.getvalue('CORE-AuditLog').split())
     sel.set_location(1, row, 3)
     sel.description = _('settings')
     self.add_component(sel)
     btn = XferCompButton('ChangeAL')
     btn.set_action(self.request,
                    AudiLogChange.get_action(TITLE_MODIFY,
                                             "images/edit.png"),
                    modal=FORMTYPE_MODAL,
                    close=CLOSE_NO)
     btn.set_location(2, row + 1)
     self.add_component(btn)
示例#59
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
示例#60
0
文件: xfersearch.py 项目: povtux/core
    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