Ejemplo n.º 1
0
 def fillresponse(self, limit_date=''):
     if limit_date == '':
         dlg = self.create_custom()
         img = XferCompImage('img')
         img.set_value(self.icon_path())
         img.set_location(0, 0, 1, 6)
         dlg.add_component(img)
         lbl = XferCompLabelForm('lb_limit_date')
         lbl.set_value_as_name(_('limit date'))
         lbl.set_location(1, 1, 1)
         dlg.add_component(lbl)
         limite_date = XferCompDate('limit_date')
         limite_date.set_needed(True)
         limite_date.set_value((date.today() - timedelta(weeks=25)))
         limite_date.set_location(1, 2, 1)
         dlg.add_component(limite_date)
         dlg.add_action(self.get_action(TITLE_OK, 'images/ok.png'), params={"SAVE": "YES"})
         dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
     else:
         third_ids = [val_third['third'] for val_third in EntryLineAccount.objects.filter(
             entry__date_value__gt=limit_date, third__gt=0).values('third')]
         for third in Third.objects.filter(status=0):
             if third.id not in third_ids:
                 third.status = 1
                 third.save()
Ejemplo n.º 2
0
 def fillresponse(self, costaccounting=0):
     if self.getparam("SAVE") is None:
         dlg = self.create_custom()
         icon = XferCompImage('img')
         icon.set_location(0, 0, 1, 6)
         icon.set_value(self.icon_path())
         dlg.add_component(icon)
         lbl = XferCompLabelForm('lb_costaccounting')
         lbl.set_value_as_name(CostAccounting._meta.verbose_name)
         lbl.set_location(1, 1)
         dlg.add_component(lbl)
         sel = XferCompSelect('costaccounting')
         sel.set_select_query(CostAccounting.objects.filter(status=0))
         if self.item is not None:
             sel.set_value(self.item.costaccounting_id)
         sel.set_location(1, 2)
         dlg.add_component(sel)
         dlg.add_action(self.get_action(_('Ok'), 'images/ok.png'), params={"SAVE": "YES"})
         dlg.add_action(WrapAction(_('Cancel'), 'images/cancel.png'))
     else:
         if costaccounting == 0:
             new_cost = None
         else:
             new_cost = CostAccounting.objects.get(id=costaccounting)
         for item in self.items:
             if (item.costaccounting is None) or (item.costaccounting.status == 0):
                 item.costaccounting = new_cost
                 item.save()
Ejemplo n.º 3
0
 def fillresponse(self, year=0):
     current_year = FiscalYear.objects.get(id=year)
     if self.getparam("CONFIRME") is None:
         nb_entry_noclose = current_year.check_to_close()
         text_confirm = six.text_type(_('close-fiscal-year-confirme'))
         if nb_entry_noclose > 0:
             if nb_entry_noclose == 1:
                 text_confirm += six.text_type(_('warning, entry no validated'))
             else:
                 text_confirm += six.text_type(_('warning, %d entries no validated') % nb_entry_noclose)
         dlg = self.create_custom(self.model)
         img = XferCompImage('img')
         img.set_value(self.icon_path())
         img.set_location(0, 0)
         dlg.add_component(img)
         lbl = XferCompLabelForm('title')
         lbl.set_value_as_title(self.caption)
         lbl.set_location(1, 0)
         dlg.add_component(lbl)
         lab = XferCompLabelForm('info')
         lab.set_value(text_confirm)
         lab.set_location(0, 1, 4)
         dlg.add_component(lab)
         signal_and_lock.Signal.call_signal("finalize_year", dlg)
         dlg.add_action(self.get_action(TITLE_OK, 'images/ok.png'), modal=FORMTYPE_MODAL, close=CLOSE_YES, params={'CONFIRME': 'YES'})
         dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
     else:
         signal_and_lock.Signal.call_signal("finalize_year", self)
         current_year.closed()
Ejemplo n.º 4
0
 def fillresponse(self, legal_entity=0, name_filter=''):
     self.item.legal_entity = LegalEntity.objects.get(id=legal_entity)
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 3)
     self.add_component(img)
     self.fill_from_model(1, 0, True, ['legal_entity'])
     comp = XferCompEdit('filter')
     comp.set_value(name_filter)
     comp.set_action(self.request, self.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
     comp.set_location(1, 2)
     comp.description = _('Filtrer by name')
     comp.is_default = True
     self.add_component(comp)
     identfilter = []
     if name_filter != "":
         identfilter = [Q(firstname__icontains=name_filter) | Q(lastname__icontains=name_filter)]
     items = Individual.objects.filter(*identfilter).distinct()
     grid = XferCompGrid('individual')
     grid.set_model(items, None, self)
     grid.set_location(1, 3)
     grid.description = _('individual')
     grid.add_action(self.request, ResponsabilityModify.get_action(_("Select"), "images/ok.png"),
                     modal=FORMTYPE_MODAL, close=CLOSE_YES, unique=SELECT_SINGLE, params={"SAVE": "YES"})
     grid.add_action(self.request, IndividualShow.get_action(_("Show"), "images/edit.png"),
                     modal=FORMTYPE_MODAL, close=CLOSE_NO, unique=SELECT_SINGLE)
     grid.add_action(self.request, IndividualAddModify.get_action(TITLE_ADD, "images/add.png"),
                     modal=FORMTYPE_MODAL, close=CLOSE_NO)
     self.add_component(grid)
Ejemplo n.º 5
0
 def fillresponse(self):
     img = XferCompImage('img')
     img.set_value(get_icon_path('lucterios.contacts/images/account.png'))
     img.set_location(0, 0, 1, 2)
     self.add_component(img)
     lab = XferCompLabelForm("title")
     lab.set_value_as_title(_('View my account.'))
     lab.set_location(1, 0, 2)
     self.add_component(lab)
     try:
         self.item = Individual.objects.get(user=self.request.user)
         self.item = self.item.get_final_child()
         self.model = Individual
         self.field_id = 'individual'
         self.params['individual'] = six.text_type(self.item.id)
         self.add_action(AccountAddModify.get_action(_("Edit"), "images/edit.png"), close=CLOSE_NO)
         is_individual = True
     except ObjectDoesNotExist:
         self.item = LucteriosUser.objects.get(id=self.request.user.id)
         self.add_action(UsersEdit.get_action(_("Edit"), "images/edit.png"),
                         close=CLOSE_NO, params={'user_actif': six.text_type(self.request.user.id)})
         is_individual = False
     self.fill_from_model(1, 1, True)
     if is_individual:
         legal_entities = LegalEntity.objects.filter(responsability__individual=self.item).exclude(id=1)
         if len(legal_entities) == 1:
             self.add_legalentity(legal_entities[0])
         elif len(legal_entities) > 1:
             self.add_legalentities(legal_entities)
         signal_and_lock.Signal.call_signal("add_account", self.item, self)
     self.add_action(WrapAction(_("Close"), "images/close.png"))
Ejemplo n.º 6
0
 def _create_custom_for_profit(self, year, custom, val_profit):
     from lucterios.framework.xfercomponents import XferCompImage, XferCompLabelForm, XferCompSelect
     from diacamma.accounting.models import format_devise
     if val_profit > 0.0001:
         type_profit = 'bénéfice'
     else:
         type_profit = 'déficite'
     img = XferCompImage("img")
     img.set_location(0, 0)
     img.set_value(get_icon_path("diacamma.accounting/images/account.png"))
     custom.add_component(img)
     lbl = XferCompLabelForm("title")
     lbl.set_value_as_headername("Bénéfices et Pertes")
     lbl.set_location(1, 0)
     custom.add_component(lbl)
     text = "{[i]}Vous avez un %s de %s.{[br/]}Vous devez definir sur quel compte l'affecter.{[br/]}{[/i]}" % (
         type_profit, format_devise(val_profit, 4))
     text += "{[br/]}En validant, vous commencerez '%s'{[br/]}{[br/]}{[i]}{[u]}Attention:{[/u]} Votre report à nouveau doit être totalement fait.{[/i]}" % six.text_type(
         year)
     lbl = XferCompLabelForm("info")
     lbl.set_value(text)
     lbl.set_location(0, 1, 2)
     custom.add_component(lbl)
     sel_cmpt = []
     for account in year.chartsaccount_set.all().filter(code__startswith='10').order_by('code'):
         sel_cmpt.append((account.id, six.text_type(account)))
     sel = XferCompSelect("profit_account")
     sel.set_select(sel_cmpt)
     sel.set_location(1, 2)
     custom.add_component(sel)
     return custom
Ejemplo n.º 7
0
    def fillresponse(self):
        XferContainerCustom.fillresponse(self)
        self.new_tab(_('EMail configuration'))
        img = XferCompImage('img_conf')
        img.set_value(self.icon_path())
        img.set_location(0, 0, 1, 6)
        self.add_component(img)

        conf_params = ['mailing-smtpserver', 'mailing-smtpport',
                       'mailing-smtpsecurity', 'mailing-smtpuser', 'mailing-smtppass',
                       'mailing-delay-batch', 'mailing-nb-by-batch']
        Params.fill(self, conf_params, 1, 1)
        btn = XferCompButton('editparam')
        btn.set_location(3, 1, 1, 5)
        btn.set_action(self.request, ParamEdit.get_action(_('Modify'), 'images/edit.png'), close=CLOSE_NO, params={'params': conf_params})
        self.add_component(btn)
        if will_mail_send():
            btn = XferCompButton('tryemail')
            btn.set_location(1, 10, 2)
            btn.set_action(self.request, SendEmailTry.get_action(_('Send'), ''), close=CLOSE_NO)
            self.add_component(btn)

        self.new_tab(_('Default message'))
        img = XferCompImage('img_msg')
        img.set_value(self.icon_path())
        img.set_location(0, 0, 1, 6)
        self.add_component(img)

        msg_params = ['mailing-msg-connection']
        Params.fill(self, msg_params, 1, 1)
        btn = XferCompButton('editmsg')
        btn.set_location(1, 10, 2)
        btn.set_action(self.request, ParamEdit.get_action(_('Modify'), 'images/edit.png'), close=CLOSE_NO, params={'params': msg_params})
        self.add_component(btn)
Ejemplo n.º 8
0
Archivo: views.py Proyecto: povtux/core
 def fillresponse(self):
     img_title = XferCompImage('img')
     img_title.set_location(0, 0, 1, 6)
     img_title.set_value(self.icon_path())
     self.add_component(img_title)
     lab = XferCompLabelForm('title')
     lab.set_location(1, 0, 2)
     lab.set_value_as_title(_("Print models"))
     self.add_component(lab)
     self.fill_from_model(1, 1, False, ['name'])
     self.fill_from_model(1, 2, True, ['kind'])
     self.item.mode = int(self.item.mode)
     if self.item.kind == 1:
         self.fill_from_model(1, 3, False, ['mode'])
         self.get_components('mode').set_action(
             self.request, self.get_action('', ''), {'modal': FORMTYPE_REFRESH, 'close': CLOSE_NO})
         if (self.item.mode == 1) and (self.item.value[:6] != '<model'):
             self.item.value = "<model>\n<body>\n<text>%s</text></body>\n</model>" % self.item.value
     if self.item.kind == 0:
         self._fill_listing_editor()
     elif (self.item.kind == 1) and (self.item.mode == 0):
         self._fill_label_editor()
     elif (self.item.kind == 2) or ((self.item.kind == 1) and (self.item.mode == 1)):
         self._fill_report_editor()
     self.add_action(
         PrintModelSave.get_action(_("ok"), "images/ok.png"), {})
     self.add_action(WrapAction(_('cancel'), 'images/cancel.png'), {})
Ejemplo n.º 9
0
    def fillresponse(self):
        if self.getparam('SAVE') is None:
            dlg = self.create_custom()
            dlg.item = self.item
            img = XferCompImage('img')
            img.set_value(self.icon_path())
            img.set_location(0, 0, 1, 3)
            dlg.add_component(img)
            lbl = XferCompLabelForm('title')
            lbl.set_value_as_title(self.caption)
            lbl.set_location(1, 0, 6)
            dlg.add_component(lbl)

            dlg.fill_from_model(1, 1, False, desc_fields=['parent'])
            parent = dlg.get_components('parent')
            parent.colspan = 3

            self.add_components(dlg)
            dlg.add_action(self.get_action(TITLE_OK, "images/ok.png"), close=CLOSE_YES, params={'SAVE': 'YES'})
            dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
        else:
            if self.getparam("parent", 0) != 0:
                self.item = Folder.objects.get(id=self.getparam("parent", 0))
            else:
                self.item = Folder()
            self.run_archive()
Ejemplo n.º 10
0
Archivo: views.py Proyecto: povtux/core
    def fillresponse(self):
        img = XferCompImage('img')
        img.set_value(self.icon_path())
        img.set_location(0, 0, 1, 3)
        self.add_component(img)

        lbl = XferCompLabelForm('lbl_oldpass')
        lbl.set_location(1, 0, 1, 1)
        lbl.set_value_as_name(_("old password"))
        self.add_component(lbl)
        pwd = XferCompPassword('oldpass')
        pwd.set_location(2, 0, 1, 1)
        self.add_component(pwd)

        lbl = XferCompLabelForm('lbl_newpass1')
        lbl.set_location(1, 1, 1, 1)
        lbl.set_value_as_name(_("new password"))
        self.add_component(lbl)
        pwd = XferCompPassword('newpass1')
        pwd.set_location(2, 1, 1, 1)
        self.add_component(pwd)

        lbl = XferCompLabelForm('lbl_newpass2')
        lbl.set_location(1, 2, 1, 1)
        lbl.set_value_as_name(_("new password (again)"))
        self.add_component(lbl)
        pwd = XferCompPassword('newpass2')
        pwd.set_location(2, 2, 1, 1)
        self.add_component(pwd)

        self.add_action(
            ModifyPassword.get_action(_('Ok'), 'images/ok.png'), {})
        self.add_action(WrapAction(_('Cancel'), 'images/cancel.png'), {})
Ejemplo n.º 11
0
    def fillresponse(self, item_name='', subject='', message='', model=0, withpayment=False):
        if item_name != '':
            self.item = Supporting.objects.get(id=self.getparam(item_name, 0))
        self.item = self.item.get_final_child()
        if self.getparam("OK") is None:
            dlg = self.create_custom()
            icon = XferCompImage('img')
            icon.set_location(0, 0, 1, 6)
            icon.set_value(self.icon_path())
            dlg.add_component(icon)
            lbl = XferCompLabelForm('lb_subject')
            lbl.set_value_as_name(_('subject'))
            lbl.set_location(1, 1)
            dlg.add_component(lbl)
            lbl = XferCompEdit('subject')
            lbl.set_value(six.text_type(self.item))
            lbl.set_location(2, 1)
            dlg.add_component(lbl)
            lbl = XferCompLabelForm('lb_message')
            lbl.set_value_as_name(_('message'))
            lbl.set_location(1, 2)
            dlg.add_component(lbl)
            contact = self.item.third.contact.get_final_child()
            lbl = XferCompMemo('message')
            lbl.set_value(Params.getvalue('payoff-email-message') % {
                          'name': contact.get_presentation(), 'doc': self.item.get_docname()})
            lbl.with_hypertext = True
            lbl.set_size(130, 450)
            lbl.set_location(2, 2)
            dlg.add_component(lbl)
            selectors = PrintModel.get_print_selector(
                2, self.item.__class__)[0]
            lbl = XferCompLabelForm('lb_model')
            lbl.set_value_as_name(selectors[1])
            lbl.set_location(1, 3)
            dlg.add_component(lbl)
            sel = XferCompSelect('model')
            sel.set_select(selectors[2])
            sel.set_location(2, 3)
            dlg.add_component(sel)

            if self.item.payoff_have_payment() and (len(PaymentMethod.objects.all()) > 0):
                lbl = XferCompLabelForm('lb_withpayment')
                lbl.set_value_as_name(_('add payment methods in email'))
                lbl.set_location(1, 4)
                dlg.add_component(lbl)
                sel = XferCompCheck('withpayment')
                sel.set_value(True)
                sel.set_location(2, 4)
                dlg.add_component(sel)

            dlg.add_action(self.get_action(TITLE_OK, 'images/ok.png'), params={"OK": "YES"})
            dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
        else:
            html_message = "<html>"
            html_message += message.replace('{[newline]}', '<br/>\n').replace('{[', '<').replace(']}', '>')
            if self.item.payoff_have_payment() and withpayment:
                html_message += get_html_payment(self.request.META.get('HTTP_REFERER', self.request.build_absolute_uri()), self.language, self.item)
            html_message += "</html>"
            self.item.send_email(subject, html_message, model)
Ejemplo n.º 12
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)
Ejemplo n.º 13
0
 def fill_header(self, payer, reference):
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0)
     self.add_component(img)
     lbl = XferCompLabelForm('title')
     lbl.set_value_as_title(_("select cheque to deposit"))
     lbl.set_location(1, 0, 3)
     self.add_component(lbl)
     lbl = XferCompLabelForm('lbl_payer')
     lbl.set_value_as_name(_("payer contains"))
     lbl.set_location(0, 1)
     self.add_component(lbl)
     edt = XferCompEdit('payer')
     edt.set_value(payer)
     edt.set_location(1, 1)
     edt.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
     self.add_component(edt)
     lbl = XferCompLabelForm('lbl_reference')
     lbl.set_value_as_name(_("reference contains"))
     lbl.set_location(2, 1)
     self.add_component(lbl)
     edt = XferCompEdit('reference')
     edt.set_value(reference)
     edt.set_location(3, 1)
     edt.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
     self.add_component(edt)
Ejemplo n.º 14
0
 def fillresponse(self):
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 3)
     self.add_component(img)
     self.fill_from_model(1, 0, False, ['username'])
     self.add_action(IndividualUserValid.get_action(_('Ok'), 'images/ok.png'))
     self.add_action(WrapAction(_('Cancel'), 'images/cancel.png'))
Ejemplo n.º 15
0
 def fillresponse_add_title(self):
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0)
     self.add_component(img)
     lbl = XferCompLabelForm('title')
     lbl.set_value_as_title(self.caption)
     lbl.set_location(1, 0)
     self.add_component(lbl)
Ejemplo n.º 16
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)
Ejemplo n.º 17
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)
Ejemplo n.º 18
0
 def _fill_functions(self):
     self.new_tab(_("Functions and responsabilities"))
     img = XferCompImage('imgFunction')
     img.set_value(get_icon_path('lucterios.contacts/images/function.png'))
     img.set_location(0, 0)
     self.add_component(img)
     img = XferCompLabelForm('titleFunction')
     img.set_value_as_title(_("Functions list"))
     img.set_location(1, 0)
     self.add_component(img)
     self.fill_grid(0, Function, "function", Function.objects.all())
Ejemplo n.º 19
0
 def _fill_structuretype(self):
     self.new_tab(_("Structure type"))
     img = XferCompImage('imgType')
     img.set_value(get_icon_path('lucterios.contacts/images/category.png'))
     img.set_location(0, 0)
     self.add_component(img)
     img = XferCompLabelForm('titleType')
     img.set_value_as_title(_('Structure types list'))
     img.set_location(1, 0)
     self.add_component(img)
     self.fill_grid(0, StructureType, "structure_type", StructureType.objects.all())
Ejemplo n.º 20
0
 def _fill_customfield(self):
     self.new_tab(_("Custom field"))
     img = XferCompImage('imgField')
     img.set_value(get_icon_path('lucterios.contacts/images/fields.png'))
     img.set_location(0, 0)
     self.add_component(img)
     img = XferCompLabelForm('titleField')
     img.set_value_as_title(_('custom field list'))
     img.set_location(1, 0)
     self.add_component(img)
     self.fill_grid(0, CustomField, "custom_field", CustomField.get_filter(AbstractContact))
Ejemplo n.º 21
0
Archivo: views.py Proyecto: povtux/core
 def fillresponse(self, params=(), nb_col=1):
     img_title = XferCompImage('img')
     img_title.set_location(0, 0)
     img_title.set_value(self.icon_path())
     self.add_component(img_title)
     lab = XferCompLabelForm('title')
     lab.set_location(1, 0, 2 * nb_col)
     lab.set_value_as_title(_("Edition of parameters"))
     self.add_component(lab)
     Params.fill(self, params, 1, 1, False, nb_col)
     self.add_action(ParamSave.get_action(_('Ok'), 'images/ok.png'), {})
     self.add_action(WrapAction(_('Cancel'), 'images/cancel.png'), {})
Ejemplo n.º 22
0
 def fillresponse(self):
     if self.item.id is None:
         raise LucteriosException(IMPORTANT, _("This record not exist!\nRefresh your application."))
     max_row = self.get_max_row() + 1
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 6)
     self.add_component(img)
     self.fill_from_model(1, max_row, True)
     for act, opt in ActionsManage.get_actions(ActionsManage.ACTION_IDENT_SHOW, self, key=action_list_sorted):
         self.add_action(act, **opt)
     self.add_action(WrapAction(_('Close'), 'images/close.png'))
Ejemplo n.º 23
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)
Ejemplo n.º 24
0
 def fillresponse(self):
     if self.is_new:
         self.caption = self.caption_add
     else:
         self.caption = self.caption_modify
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 6)
     self.add_component(img)
     self.fill_from_model(1, 0, False)
     if len(self.actions) == 0:
         self.add_action(
             self.get_action(_('Ok'), 'images/ok.png'), {'params': {"SAVE": "YES"}})
         self.add_action(WrapAction(_('Cancel'), 'images/cancel.png'), {})
Ejemplo n.º 25
0
 def fill_header(self):
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 2)
     self.add_component(img)
     select_year = self.getparam('fiscal_year')
     lbl = XferCompLabelForm('lbl_title')
     lbl.set_value_as_headername(_('Statistics in date of %s') % formats.date_format(date.today(), "DATE_FORMAT"))
     lbl.set_location(1, 0, 2)
     self.add_component(lbl)
     self.item.fiscal_year = FiscalYear.get_current(select_year)
     self.fill_from_model(1, 1, False, ['fiscal_year'])
     fiscal_year = self.get_components('fiscal_year')
     fiscal_year.set_needed(True)
     fiscal_year.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
Ejemplo n.º 26
0
 def fillresponse(self):
     if self.is_new:
         self.caption = self.caption_add
     else:
         self.caption = self.caption_modify
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 6)
     self.add_component(img)
     self.fill_from_model(1, 0, False)
     if len(self.actions) == 0:
         self.add_action(self.get_action(TITLE_OK, 'images/ok.png'), params={"SAVE": "YES"})
     for act, opt in ActionsManage.get_actions(ActionsManage.ACTION_IDENT_EDIT, self, key=action_list_sorted):
         self.add_action(act, **opt)
     self.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
Ejemplo n.º 27
0
Archivo: views.py Proyecto: povtux/core
 def fillresponse(self):
     img_title = XferCompImage('img')
     img_title.set_location(0, 0, 1, 10)
     img_title.set_value(self.icon_path())
     self.add_component(img_title)
     lab = XferCompLabelForm('title')
     lab.set_location(1, 0, 3)
     lab.set_value(
         '{[br/]}{[center]}{[b]}{[u]}%s{[/u]}{[/b]}{[/center]}' % _("Software configuration"))
     self.add_component(lab)
     self.params['params'] = []
     signal_and_lock.Signal.call_signal("config", self)
     self.add_action(
         ParamEdit.get_action(_('Modify'), 'images/edit.png'), {'close': 0})
     self.add_action(WrapAction(_('Close'), 'images/close.png'), {})
Ejemplo n.º 28
0
 def fillresponse(self):
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0)
     self.add_component(img)
     lbl = XferCompLabelForm('title')
     lbl.set_value_as_title(self.caption)
     lbl.set_location(1, 0)
     self.add_component(lbl)
     self.fillresponse_header()
     self.fillresponse_body()
     if self.model is not None:
         for act, opt in ActionsManage.get_actions(ActionsManage.ACTION_IDENT_LIST, self, key=action_list_sorted):
             self.add_action(act, **opt)
     self.add_action(WrapAction(TITLE_CLOSE, 'images/close.png'))
Ejemplo n.º 29
0
 def fillresponse(self):
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 3)
     self.add_component(img)
     self.item = self.item.current_subscription
     if self.item is None:
         raise LucteriosException(IMPORTANT, _("no subscription!"))
     self.fill_from_model(
         1, 0, True, ['adherent', 'season', 'subscriptiontype'])
     row = self.get_max_row() + 1
     for lic in self.item.license_set.all():
         lbl = XferCompLabelForm('lbl_sep_%d' % lic.id)
         lbl.set_location(1, row, 2)
         lbl.set_value("{[hr/]}")
         self.add_component(lbl)
         row += 1
         if Params.getvalue("member-team-enable"):
             lbl = XferCompLabelForm('lblteam_%d' % lic.id)
             lbl.set_value_as_name(Params.getvalue("member-team-text"))
             lbl.set_location(1, row)
             self.add_component(lbl)
             lbl = XferCompLabelForm('team_%d' % lic.id)
             lbl.set_value(six.text_type(lic.team))
             lbl.set_location(2, row)
             self.add_component(lbl)
             row += 1
         if Params.getvalue("member-activite-enable"):
             lbl = XferCompLabelForm('lblactivity_%d' % lic.id)
             lbl.set_value_as_name(Params.getvalue("member-activite-text"))
             lbl.set_location(1, row)
             self.add_component(lbl)
             lbl = XferCompLabelForm('activity_%d' % lic.id)
             lbl.set_value(six.text_type(lic.activity))
             lbl.set_location(2, row)
             self.add_component(lbl)
             row += 1
         lbl = XferCompLabelForm('lblvalue_%d' % lic.id)
         lbl.set_value_as_name(_('value'))
         lbl.set_location(1, row)
         self.add_component(lbl)
         lbl = XferCompEdit('value_%d' % lic.id)
         lbl.set_value(lic.value)
         lbl.set_location(2, row)
         self.add_component(lbl)
         row += 1
     self.add_action(AdherentLicenseSave.get_action(TITLE_OK, 'images/ok.png'))
     self.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
Ejemplo n.º 30
0
 def fillresponse(self):
     max_row = self.get_max_row() + 1
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 6)
     self.add_component(img)
     self.fill_from_model(1, max_row, True)
     for action_item in self.action_list:
         act_type, title, icon, close = action_item[:4]
         if len(action_item) > 4:
             params = action_item[4]
         else:
             params = {}
         self.add_action(ActionsManage.get_act_changed(
             self.model.__name__, act_type, title, icon), {'close': close, 'params': params})
     self.add_action(WrapAction(_('Close'), 'images/close.png'), {})
Ejemplo n.º 31
0
 def fillresponse(self):
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0)
     self.add_component(img)
     lbl = XferCompLabelForm('title')
     lbl.set_value_as_title(self.caption)
     lbl.set_location(1, 0)
     self.add_component(lbl)
     self.fillresponse_header()
     self.fillresponse_body()
     if self.model is not None:
         for act_type, title, icon in self.action_list:
             self.add_action(ActionsManage.get_act_changed(
                 self.model.__name__, act_type, title, icon), {'close': CLOSE_NO})
     self.add_action(WrapAction(_('Close'), 'images/close.png'), {})
Ejemplo n.º 32
0
 def fillresponse(self):
     self.params['legal_entity'] = '1'
     img = XferCompImage('img')
     img.set_value(get_icon_path('lucterios.contacts/images/fields.png'))
     img.set_location(0, 0, 1, 2)
     self.add_component(img)
     lab = XferCompLabelForm("title")
     lab.set_value_as_title(_('Our structure and its management'))
     lab.set_location(1, 0, 4)
     self.add_component(lab)
     self.fill_from_model(1, 1, True)
     self.add_action(CurrentStructureAddModify.get_action(
         _("Edit"), "images/edit.png"), close=CLOSE_NO)
     self.add_action(CurrentStructurePrint.get_action(
         _("Print"), "images/print.png"), close=CLOSE_NO)
     self.add_action(WrapAction(_("Close"), "images/close.png"))
Ejemplo n.º 33
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)
Ejemplo n.º 34
0
    def fill_header(self):
        self.item = FiscalYear.get_current(self.getparam("year"))
        new_begin = convert_date(self.getparam("begin"), self.item.begin)
        new_end = convert_date(self.getparam("end"), self.item.end)
        if (new_begin >= self.item.begin) and (new_end <= self.item.end):
            self.item.begin = new_begin
            self.item.end = new_end
        img = XferCompImage('img')
        img.set_value(self.current_image())
        if not img.value.startswith('/static/'):
            img.type = 'jpg'
        img.set_location(0, 0, 1, 5)
        self.add_component(img)

        if self.item.last_fiscalyear is not None:
            lbl = XferCompLabelForm('year_1')
            lbl.set_location(1, 0, 3)
            lbl.description = _('year N-1')
            lbl.set_value(six.text_type(self.item.last_fiscalyear))
            self.add_component(lbl)
        select_year = XferCompSelect(self.field_id)
        select_year.set_location(1, 1, 3)
        select_year.set_select_query(FiscalYear.objects.all())
        select_year.description = _('year N')
        select_year.set_value(self.item.id)
        select_year.set_needed(True)
        select_year.set_action(self.request,
                               self.__class__.get_action(),
                               close=CLOSE_NO,
                               modal=FORMTYPE_REFRESH)
        self.add_component(select_year)
        self.filter = Q(entry__year=self.item)
        self.lastfilter = Q(entry__year=self.item.last_fiscalyear)
Ejemplo n.º 35
0
 def fillresponse(self, model='', objid=0):
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 6)
     self.add_component(img)
     self.model = apps.get_model(model)
     if objid != 0:
         self.item = self.model.objects.get(id=objid)
         fieldnames = []
         for fieldname in self.model.get_default_fields():
             if isinstance(fieldname, tuple):
                 fieldnames.append(fieldname[1])
             else:
                 fieldnames.append(fieldname)
         self.fill_from_model(1, 0, True, desc_fields=fieldnames)
         log_items = LucteriosLogEntry.objects.get_for_object(self.item)
     else:
         content_type = ContentType.objects.get_for_model(self.model)
         lbl = XferCompLabelForm('ModelName')
         lbl.set_value_as_header(six.text_type(content_type))
         lbl.description = _("content type")
         lbl.set_location(1, 0, 2)
         self.add_component(lbl)
         log_items = LucteriosLogEntry.objects.get_for_model(self.model)
     grid = XferCompGrid(self.field_id)
     grid.set_model(log_items, None, self)
     grid.set_location(1, self.get_max_row() + 1, 2)
     grid.set_size(200, 500)
     self.add_component(grid)
Ejemplo n.º 36
0
 def fillresponse(self):
     img_title = XferCompImage('img')
     img_title.set_location(0, 0, 1, 6)
     img_title.set_value(self.icon_path())
     self.add_component(img_title)
     lab = XferCompLabelForm('title')
     lab.set_location(1, 0, 2)
     lab.set_value_as_title(_("Print models"))
     self.add_component(lab)
     self.fill_from_model(2, 1, False, ['name'])
     self.fill_from_model(2, 2, True, ['kind'])
     self.item.mode = int(self.item.mode)
     if self.item.kind == 1:
         self.fill_from_model(2, 3, False, ['mode'])
         self.get_components('mode').set_action(self.request, self.get_action('', ''), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
         if (self.item.mode == 1) and (self.item.value[:6] != '<model'):
             self.item.value = "<model>\n<body>\n<text>%s</text></body>\n</model>" % self.item.value
     if self.item.kind == 0:
         self._fill_listing_editor()
     elif (self.item.kind == 1) and (self.item.mode == 0):
         self._fill_label_editor()
     elif (self.item.kind == 2) or ((self.item.kind == 1) and (self.item.mode == 1)):
         self._fill_report_editor()
     for act, opt in ActionsManage.get_actions(ActionsManage.ACTION_IDENT_EDIT, self, key=action_list_sorted):
         self.add_action(act, **opt)
     self.add_action(WrapAction(TITLE_CLOSE, 'images/close.png'))
Ejemplo n.º 37
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)
Ejemplo n.º 38
0
 def fillresponse(self, owner, begin_date, end_date):
     currentowner = Owner.objects.get(id=owner)
     currentowner.set_dates(begin_date, end_date)
     if self.getparam('SAVE') is None:
         dlg = self.create_custom(model=Payoff)
         dlg.item.supporting = self.RefundSupporting(currentowner)
         dlg.item.date = currentowner.default_date()
         dlg.params['supportings'] = ''
         img = XferCompImage('img')
         img.set_value(self.icon_path())
         img.set_location(0, 0, 1, 6)
         dlg.add_component(img)
         dlg.fill_from_model(1, 0, False)
         dlg.add_action(self.return_action(TITLE_OK, 'images/ok.png'),
                        params={"SAVE": "YES"})
         dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
     else:
         Payoff.multi_save([currentowner.id],
                           -1 * self.getparam('amount', 0.0),
                           self.getparam('mode', Payoff.MODE_CASH), '',
                           self.getparam('reference', ''),
                           self.getparam('bank_account', None),
                           self.getparam('date',
                                         currentowner.default_date()),
                           self.getparam('fee_bank',
                                         0.0), Payoff.REPARTITION_BYDATE)
Ejemplo n.º 39
0
    def fillresponse(self):
        if self.getparam('SAVE') is None:
            dlg = self.create_custom()
            dlg.item = self.item
            img = XferCompImage('img')
            img.set_value(self.icon_path())
            img.set_location(0, 0, 1, 3)
            dlg.add_component(img)
            lbl = XferCompLabelForm('title')
            lbl.set_value_as_title(self.caption)
            lbl.set_location(1, 0, 6)
            dlg.add_component(lbl)

            dlg.fill_from_model(1, 1, False, desc_fields=['parent'])
            parent = dlg.get_components('parent')
            parent.colspan = 3

            self.add_components(dlg)
            dlg.add_action(self.get_action(TITLE_OK, "images/ok.png"), {
                'close': CLOSE_YES,
                'params': {
                    'SAVE': 'YES'
                }
            })
            dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'), {})
        else:
            if self.getparam("parent", 0) != 0:
                self.item = Folder.objects.get(id=self.getparam("parent", 0))
            else:
                self.item = Folder()
            self.run_archive()
Ejemplo n.º 40
0
    def fillresponse(self):
        if self.getparam('SAVE') is None:
            dlg = self.create_custom(self.model)
            dlg.item = self.item
            img = XferCompImage('img')
            img.set_value(self.icon_path())
            img.set_location(0, 0, 1, 3)
            dlg.add_component(img)
            lbl = XferCompLabelForm('title')
            lbl.set_value_as_title(self.caption)
            lbl.set_location(1, 0, 6)
            dlg.add_component(lbl)

            lbl = XferCompLabelForm('lbl_import_model')
            lbl.set_value_as_name(_("file to load"))
            lbl.set_location(1, 1)
            dlg.add_component(lbl)
            upload = XferCompUpLoad('import_model')
            upload.compress = False
            upload.http_file = True
            upload.maxsize = 128 * 1024 * 1024  # 128Mo
            upload.add_filter('.mdl')
            upload.set_location(2, 1)
            dlg.add_component(upload)

            dlg.add_action(self.get_action(TITLE_OK, "images/ok.png"), close=CLOSE_YES, params={'SAVE': 'YES'})
            dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
        else:
            if 'import_model' in self.request.FILES.keys():
                upload_file = self.request.FILES['import_model']
                if self.item.import_file(upload_file):
                    self.message(_('Model loaded'))
Ejemplo n.º 41
0
 def fillresponse(self):
     legal = LegalEntity.objects.get(id=1)
     if self.getparam('CONFIRME') is None:
         dlg = self.create_custom()
         img = XferCompImage('img')
         img.set_value(self.icon_path())
         img.set_location(0, 0, 1, 3)
         dlg.add_component(img)
         lbl = XferCompLabelForm('lbl_title')
         lbl.set_location(1, 0, 2)
         lbl.set_value_as_header(self.caption)
         dlg.add_component(lbl)
         email = XferCompEdit('recipient')
         email.set_location(1, 1)
         email.set_value(legal.email)
         email.mask = r"[^@]+@[^@]+\.[^@]+"
         email.description = _("email")
         dlg.add_component(email)
         dlg.add_action(self.get_action(TITLE_OK, "images/ok.png"),
                        close=CLOSE_YES,
                        params={'CONFIRME': 'YES'})
         dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
     else:
         abs_url = self.request.META.get(
             'HTTP_REFERER', self.request.build_absolute_uri()).split('/')
         self.item.http_root_address = '/'.join(abs_url[:-2])
         send_email([self.getparam('recipient')],
                    self.item.subject,
                    self.item.email_content,
                    files=self.item.attach_files)
         self.message(_("EMail send, check it."))
Ejemplo n.º 42
0
    def fillresponse(self, begin_date, end_date):
        self.item.set_dates(begin_date, end_date)
        date_init = XferCompDate("begin_date")
        date_init.set_needed(True)
        date_init.set_value(self.item.date_begin)
        date_init.set_location(1, 0)
        date_init.description = _('initial date')
        date_init.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
        self.add_component(date_init)
        date_end = XferCompDate("end_date")
        date_end.set_needed(True)
        date_end.set_value(self.item.date_end)
        date_end.set_location(2, 0)
        date_end.description = _('current date')
        date_end.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
        self.add_component(date_end)
        img = XferCompImage('img')
        img.set_value(self.icon_path())
        img.set_location(0, 0, 1, 6)
        self.add_component(img)
        self.fill_from_model(1, 1, True, [((_('name'), 'third'),)])
        grid = XferCompGrid('loadcount')
        grid.set_model(self.item.loadcount_set.all(), None)
        grid.set_location(1, 2, 2)
        self.add_component(grid)

        self.add_action(WrapAction(_('Close'), 'images/close.png'))
Ejemplo n.º 43
0
    def fillresponse(self):
        current_year = FiscalYear.get_current()
        if self.item.type_load == 0:
            for year_item in FiscalYear.objects.filter(
                    begin__gte=current_year.begin):
                costs = self.item.setcost_set.filter(year=year_item)
                if len(costs) == 0:
                    self.item.create_new_cost(year=year_item.id)

        img = XferCompImage('img')
        img.set_value(self.icon_path())
        img.set_location(0, 0)
        self.add_component(img)
        lbl = XferCompLabelForm('title')
        lbl.set_value_as_title(self.item.name)
        lbl.set_location(1, 0)
        self.add_component(lbl)
        self.fill_grid(
            0, CostAccounting, 'costaccounting',
            CostAccounting.objects.filter(
                setcost__set=self.item).order_by('-setcost__year__begin'))
        grid = self.get_components('costaccounting')
        grid.delete_header("is_default")
        new_actions = []
        grid = self.get_components('costaccounting')
        for grid_action in grid.actions:
            if grid_action[0].icon_path.endswith('images/print.png'):
                new_actions.append(grid_action)
        grid.actions = new_actions
        grid.add_action(self.request,
                        ClassCategoryBudget.get_action(),
                        close=CLOSE_NO,
                        unique=SELECT_SINGLE)
        self.add_action(WrapAction(TITLE_CLOSE, 'images/close.png'))
Ejemplo n.º 44
0
    def fillresponse(self):
        model_module = ".".join(self.item.model_associated().__module__.split('.')[:-1])
        if self.getparam('SAVE') is None:
            dlg = self.create_custom(self.model)
            dlg.item = self.item
            img = XferCompImage('img')
            img.set_value(self.icon_path())
            img.set_location(0, 0, 1, 3)
            dlg.add_component(img)
            lbl = XferCompLabelForm('title')
            lbl.set_value_as_title(self.caption)
            lbl.set_location(1, 0, 6)
            dlg.add_component(lbl)

            lbl = XferCompLabelForm('lbl_default_model')
            lbl.set_value_as_name(_("Model to reload"))
            lbl.set_location(1, 1)
            dlg.add_component(lbl)
            sel = XferCompSelect('default_model')
            sel.set_select(PrintModel.get_default_model(model_module, self.item.modelname, self.item.kind))
            sel.set_location(2, 1)
            dlg.add_component(sel)

            dlg.add_action(self.get_action(TITLE_OK, "images/ok.png"), close=CLOSE_YES, params={'SAVE': 'YES'})
            dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
        else:
            if self.item.load_model(model_module, self.getparam("default_model", ""), is_default=None):
                self.message(_('Model reloaded'))
Ejemplo n.º 45
0
 def fillresponse(self, ventilate=False):
     msg = self.item.check_close()
     if msg is not None:
         if self.getparam('CLOSE') is None:
             dlg = self.create_custom(self.model)
             img = XferCompImage('img')
             img.set_value(self.icon_path())
             img.set_location(0, 0)
             dlg.add_component(img)
             lbl = XferCompLabelForm('title')
             lbl.set_value_as_title(self.caption)
             lbl.set_location(1, 0, 2)
             dlg.add_component(lbl)
             lbl = XferCompLabelForm('info')
             lbl.set_value(_('This class load has a difference of %s between those call of funds and those expenses.') % msg)
             lbl.set_location(1, 1)
             dlg.add_component(lbl)
             lbl = XferCompCheck('ventilate')
             lbl.set_value(ventilate)
             lbl.set_location(1, 2)
             lbl.description = 'Do you want to ventilate this amount for each owner?'
             dlg.add_component(lbl)
             dlg.add_action(self.get_action(TITLE_OK, 'images/ok.png'), modal=FORMTYPE_MODAL, close=CLOSE_YES, params={'CLOSE': 'YES'})
             dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
         else:
             if self.item.type_load == 0:
                 self.item.close_current(ventilate)
             else:
                 self.item.close_exceptional(ventilate)
     elif self.confirme(_('Do you want to close this class load?')):
         if self.item.type_load == 0:
             self.item.close_current()
         else:
             self.item.close_exceptional()
Ejemplo n.º 46
0
 def fillresponse(self, legal_entity=0, name_filter=''):
     self.item.legal_entity = LegalEntity.objects.get(id=legal_entity)
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 3)
     self.add_component(img)
     self.fill_from_model(1, 0, True, ['legal_entity'])
     comp = XferCompEdit('filter')
     comp.set_value(name_filter)
     comp.set_action(self.request, self.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
     comp.set_location(1, 2)
     comp.description = _('Filtrer by name')
     comp.is_default = True
     self.add_component(comp)
     identfilter = []
     if name_filter != "":
         identfilter = [
             Q(firstname__icontains=name_filter) | Q(lastname__icontains=name_filter)]
     items = Individual.objects.filter(
         *identfilter)
     grid = XferCompGrid('individual')
     grid.set_model(items, None, self)
     grid.set_location(1, 3)
     grid.description = _('individual')
     grid.add_action(self.request, ResponsabilityModify.get_action(_("Select"), "images/ok.png"),
                     modal=FORMTYPE_MODAL, close=CLOSE_YES, unique=SELECT_SINGLE, params={"SAVE": "YES"})
     grid.add_action(self.request, IndividualShow.get_action(_("Show"), "images/edit.png"),
                     modal=FORMTYPE_MODAL, close=CLOSE_NO, unique=SELECT_SINGLE)
     grid.add_action(self.request, IndividualAddModify.get_action(TITLE_ADD, "images/add.png"),
                     modal=FORMTYPE_MODAL, close=CLOSE_NO)
     self.add_component(grid)
Ejemplo n.º 47
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)
Ejemplo n.º 48
0
 def fillresponse(self):
     if not will_mail_send():
         raise LucteriosException(IMPORTANT, _('Bad email parameter!'))
     legal = LegalEntity.objects.get(id=1)
     if self.getparam('CONFIRME') is None:
         dlg = self.create_custom()
         img = XferCompImage('img')
         img.set_value(self.icon_path())
         img.set_location(0, 0, 1, 3)
         dlg.add_component(img)
         lbl = XferCompLabelForm('lbl_title')
         lbl.set_location(1, 0, 2)
         lbl.set_value_as_header(self.caption)
         dlg.add_component(lbl)
         email = XferCompEdit('recipient')
         email.set_location(1, 1)
         email.set_value(legal.email)
         email.mask = r"[^@]+@[^@]+\.[^@]+"
         email.description = _("email")
         dlg.add_component(email)
         dlg.add_action(self.get_action(TITLE_OK, "images/ok.png"), close=CLOSE_YES, params={'CONFIRME': 'YES'})
         dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
     else:
         address = []
         address.append("")
         address.append("")
         address.append(six.text_type(legal))
         address.append(legal.address)
         address.append("%s %s" % (legal.postal_code, legal.city))
         message = _('EMail sent to check configuration')
         message += "{[br/]}".join(address).replace('{[newline]}', "{[br/]}").replace("\n", '{[br/]}')
         bad_sended = send_email(self.getparam('recipient'), _("EMail try"), "<html><body>%s</body></html>" % message.replace('{[', '<').replace(']}', '>'))
         if len(bad_sended) != 0:
             raise EmailException(bad_sended)
         self.message(_("EMail send, check it."))
Ejemplo n.º 49
0
    def fillresponse(self, show_only_failed=False):
        img = XferCompImage('img')
        img.set_value(self.icon_path())
        img.set_location(0, 0, 1, 6)
        self.add_component(img)
        begin = XferCompLabelForm('title')
        begin.set_location(1, 0, 2)
        begin.set_value_as_title(_('Transmission report'))
        self.add_component(begin)

        self.filltab_from_model(1, 1, True,
                                [((_('date begin of send'), 'date_begin'),
                                  (_('date end of send'), 'date_end')),
                                 ('emailsent_set', )])
        if not show_only_failed:
            grid = self.get_components('emailsent')
            grid.delete_header('error')

        check = XferCompCheck('show_only_failed')
        check.set_value(show_only_failed)
        check.description = _('Show only failed')
        check.set_location(1, 3, 2)
        check.set_action(self.request,
                         self.get_action(),
                         modal=FORMTYPE_REFRESH,
                         close=CLOSE_NO)
        self.add_component(check)

        show_only_failed
        self.add_action(WrapAction(_('Close'), 'images/close.png'))
Ejemplo n.º 50
0
 def fillresponse(self):
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 3)
     self.add_component(img)
     self.fill_from_model(1, 0, False, ['username'])
     self.add_action(IndividualUserValid.get_action(_('Ok'), 'images/ok.png'))
     self.add_action(WrapAction(_('Cancel'), 'images/cancel.png'))
Ejemplo n.º 51
0
 def fillresponse_add_title(self):
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0)
     self.add_component(img)
     lbl = XferCompLabelForm('title')
     lbl.set_value_as_title(self.caption)
     lbl.set_location(1, 0, 5)
     self.add_component(lbl)
Ejemplo n.º 52
0
 def fillresponse(self):
     self.caption = self.caption
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 6)
     self.add_component(img)
     self.fill_from_model(1, 0, True, ['name', 'type_load'])
     self.fill_from_model(1, 0, False, ['set_of_lots'])
     self.add_action(self.get_action(TITLE_OK, 'images/ok.png'), params={"SAVE": "YES"})
     self.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
Ejemplo n.º 53
0
 def fillresponse(self):
     if self.getparam("CONVERT") is None:
         dlg = self.create_custom()
         img = XferCompImage('img')
         img.set_value(self.icon_path())
         img.set_location(0, 0)
         dlg.add_component(img)
         lbl = XferCompLabelForm('title')
         lbl.set_value_as_title(self.caption)
         lbl.set_location(1, 0)
         dlg.add_component(lbl)
         year_list = [
             "{[i]} - %s{[/i]}" % year
             for year in FiscalYear.objects.filter(
                 status__in=(FiscalYear.STATUS_BUILDING,
                             FiscalYear.STATUS_RUNNING))
         ]
         lab = XferCompLabelForm('info')
         lab.set_value(
             _("This conversion tool will change your account to respect French law about condominium.{[br/]}For the no-closed fiscal years:{[newline]}%s{[newline]}It will do:{[newline]} - To change accounting code for each owners.{[newline]} - To de-validate all your entity.{[br/]} - To delete all entity link to call of funds or expenses.{[br/]} - To de-archive call of funds or expenses.{[br/]} - To generate correct account for call of funds or expenses.{[br/]}{[center]}{[u]}{[b]}Warning: This action is  definitive.{[/b]}{[/u]}{[center]}"
               ) % '{[br/]}'.join(year_list))
         lab.set_location(0, 1, 4)
         dlg.add_component(lab)
         dlg.new_tab(_("Third accounts"))
         self.fill_third_convert(dlg)
         dlg.new_tab(_("Parameters"))
         fill_params(dlg, True, True)
         dlg.add_action(self.return_action(TITLE_OK, 'images/ok.png'),
                        modal=FORMTYPE_MODAL,
                        close=CLOSE_YES,
                        params={'CONVERT': 'YES'})
         dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
     else:
         Parameter.change_value('condominium-old-accounting', False)
         Params.clear()
         try:
             thirds_convert = self.get_thirds_convert()
             for set_cost in SetCost.objects.filter(
                     year__status=2, cost_accounting__status=0):
                 set_cost.cost_accounting.is_protected = True
                 set_cost.cost_accounting.save()
                 if (set_cost.year.status == FiscalYear.STATUS_FINISHED
                     ) and (set_cost.cost_accounting.status
                            == CostAccounting.STATUS_OPENED):
                     set_cost.cost_accounting.close()
             for owner in Owner.objects.all():
                 owner.check_account()
             for year in FiscalYear.objects.filter(
                     status__in=(FiscalYear.STATUS_BUILDING,
                                 FiscalYear.STATUS_RUNNING)):
                 convert_accounting(year, thirds_convert)
         except BaseException:
             Params.clear()
             raise
         self.message(_("Data converted"))
Ejemplo n.º 54
0
 def fillresponse(self):
     if self.item.id is None:
         raise LucteriosException(IMPORTANT, _("This record not exist!\nRefresh your application."))
     max_row = self.get_max_row() + 1
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 6)
     self.add_component(img)
     self.fill_from_model(1, max_row, True)
     for act, opt in ActionsManage.get_actions(ActionsManage.ACTION_IDENT_SHOW, self, key=action_list_sorted):
         self.add_action(act, **opt)
     self.add_action(WrapAction(_('Close'), 'images/close.png'))
     add_auditlog_button(self, self.item, 0, max(6, self.get_max_row()) + 20)
Ejemplo n.º 55
0
    def create_dlg(self, username, legalentity):
        dlg = self.create_custom(self.model)
        img = XferCompImage('img')
        img.set_value(self.icon_path())
        img.set_location(0, 0, 1, 6)
        dlg.add_component(img)
        dlg.fill_from_model(1, 0, False,
                            ['genre', 'lastname', 'firstname', 'email'])
        dlg.get_components(
            'email'
        ).mask = '^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-_])+\.)+([a-zA-Z0-9]{2,4})+$'
        row = dlg.get_max_row() + 1
        lbl = XferCompLabelForm("username_lbl")
        lbl.set_location(1, row)
        lbl.set_value_as_name(_('username'))
        dlg.add_component(lbl)
        edt = XferCompEdit("username")
        edt.set_location(2, row)
        edt.set_needed(True)
        edt.set_value(username)
        dlg.add_component(edt)
        if Params.getvalue("contacts-createaccount") == 2:
            row = dlg.get_max_row() + 1
            lbl = XferCompLabelForm("legalentity_lbl")
            lbl.set_location(1, row)
            lbl.set_value_as_name(_("your structure name"))
            dlg.add_component(lbl)
            edt = XferCompEdit("legalentity")
            edt.set_location(2, row)
            edt.set_needed(True)
            edt.set_value(legalentity)
            dlg.add_component(edt)
        row = dlg.get_max_row() + 1
        lbl = XferCompLabelForm("captcha_lbl")
        lbl.set_location(1, row)
        lbl.set_value_as_name(_("captcha"))
        dlg.add_component(lbl)
        edt = XferCompCaptcha("captcha")
        edt.set_location(2, row)
        dlg.add_component(edt)

        lbl = XferCompLabelForm("error_lbl")
        lbl.set_location(2, row + 1)
        lbl.set_color('red')
        lbl.set_value(self.getparam('error', ''))
        dlg.add_component(lbl)
        dlg.add_action(self.get_action(_('Ok'), 'images/ok.png'),
                       params={"SAVE": "YES"})
        dlg.add_action(WrapAction(_('Cancel'), 'images/cancel.png'))
Ejemplo n.º 56
0
 def fillresponse(self):
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0)
     self.add_component(img)
     lbl = XferCompLabelForm('title')
     lbl.set_value_as_title(self.caption)
     lbl.set_location(1, 0)
     self.add_component(lbl)
     self.fillresponse_header()
     self.fillresponse_body()
     add_auditlogs_button(self, self.model, 0, self.get_max_row() + 20)
     if self.model is not None:
         for act, opt in ActionsManage.get_actions(ActionsManage.ACTION_IDENT_LIST, self, key=action_list_sorted):
             self.add_action(act, **opt)
     self.add_action(WrapAction(TITLE_CLOSE, 'images/close.png'))
Ejemplo n.º 57
0
 def fillresponse(self):
     if self.is_new:
         self.caption = self.caption_add
     else:
         self.caption = self.caption_modify
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 6)
     self.add_component(img)
     self.fill_from_model(1, 0, False)
     if len(self.actions) == 0:
         self.add_action(self.get_action(TITLE_OK, 'images/ok.png'), params={"SAVE": "YES"})
     for act, opt in ActionsManage.get_actions(ActionsManage.ACTION_IDENT_EDIT, self, key=action_list_sorted):
         self.add_action(act, **opt)
     self.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
     add_auditlog_button(self, self.item, 0, max(6, self.get_max_row()) + 20)
Ejemplo n.º 58
0
 def fill_dlg(self):
     self.item.can_be_valid()
     dlg = self.create_custom()
     dlg.item = self.item
     img = XferCompImage('img')
     img.set_value(self.icon_path())
     img.set_location(0, 0, 1, 3)
     dlg.add_component(img)
     lbl = XferCompLabelForm('title')
     lbl.set_value_as_title(self.caption)
     lbl.set_location(1, 0, 6)
     dlg.add_component(lbl)
     dlg.fill_from_model(1, 1, True, ['activity', 'date'])
     dlg.get_components('activity').colspan = 3
     dlg.get_components('date').colspan = 3
     lbl = XferCompLabelForm('sep')
     lbl.set_value("{[hr/]}")
     lbl.set_location(0, 4, 7)
     dlg.add_component(lbl)
     row_id = 5
     for participant in self.item.participant_set.all():
         lbl = XferCompLabelForm('name_%d' % participant.id)
         lbl.set_value_as_name(six.text_type(participant))
         lbl.set_location(0, row_id)
         dlg.add_component(lbl)
         lbl = XferCompLabelForm('current_%d' % participant.id)
         lbl.set_value(participant.current_degree)
         lbl.set_location(1, row_id)
         dlg.add_component(lbl)
         sel = XferCompSelect('degree_%d' % participant.id)
         sel.set_select_query(participant.allow_degree())
         sel.set_location(2, row_id)
         dlg.add_component(sel)
         if Params.getvalue("event-subdegree-enable") == 1:
             sel = XferCompSelect('subdegree_%d' % participant.id)
             sel.set_select_query(participant.allow_subdegree())
             sel.set_location(3, row_id)
             dlg.add_component(sel)
         edt = XferCompMemo('comment_%d' % participant.id)
         edt.set_value(participant.comment)
         edt.set_location(4, row_id)
         dlg.add_component(edt)
         row_id += 1
     dlg.add_action(self.get_action(TITLE_OK, "images/ok.png"),
                    close=CLOSE_YES,
                    params={'CONFIRME': 'YES'})
     dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
Ejemplo n.º 59
0
 def fillresponse(self):
     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(self.caption)
     lbl.set_location(1, 0, 6)
     self.add_component(lbl)
     zipdown = XferCompDownLoad('filename')
     zipdown.compress = False
     zipdown.http_file = True
     zipdown.maxsize = 0
     zipdown.set_value("%s.mdl" % self.item.name)
     zipdown.set_download(self.item.extract_file())
     zipdown.set_location(1, 15, 2)
     self.add_component(zipdown)
Ejemplo n.º 60
0
 def fillresponse(self):
     if self.getparam("CONFIRME") is None:
         dlg = self.create_custom()
         img = XferCompImage('img')
         img.set_value(self.icon_path())
         img.set_location(0, 0)
         dlg.add_component(img)
         lbl = XferCompLabelForm('title')
         lbl.set_value_as_title(self.caption)
         lbl.set_location(1, 0, 2)
         dlg.add_component(lbl)
         lbl = XferCompLabelForm('lbl_record')
         lbl.set_value_as_name(_('record'))
         lbl.set_location(1, 1)
         dlg.add_component(lbl)
         lbl = XferCompLabelForm('record')
         lbl.set_value(six.text_type(self.item))
         lbl.set_location(2, 1)
         dlg.add_component(lbl)
         lbl = XferCompLabelForm('lbl_current')
         lbl.set_value_as_name(_('current model'))
         lbl.set_location(1, 2)
         dlg.add_component(lbl)
         lbl = XferCompLabelForm('current')
         lbl.set_value(self.item.__class__._meta.verbose_name)
         lbl.set_location(2, 2)
         dlg.add_component(lbl)
         lbl = XferCompLabelForm('lbl_newmodel')
         lbl.set_value_as_name(_('new model'))
         lbl.set_location(1, 3)
         dlg.add_component(lbl)
         lbl = XferCompSelect('newmodel')
         lbl.set_select(self.item.__class__.get_select_contact_type(False))
         lbl.set_location(2, 3)
         dlg.add_component(lbl)
         dlg.add_action(self.get_action(_('Ok'), "images/ok.png"), close=CLOSE_YES, modal=FORMTYPE_MODAL, params={'CONFIRME': 'YES'})
         dlg.add_action(WrapAction(_("Cancel"), "images/cancel.png"))
     else:
         new_model = apps.get_model(self.getparam('newmodel'))
         field_id_name = "%s_ptr_id" % self.model.__name__.lower()
         new_object = new_model(**{field_id_name: self.item.pk})
         new_object.save()
         new_object.__dict__.update(self.item.__dict__)
         new_object.save()
         self.redirect_action(ActionsManage.get_action_url(self.model.get_long_name(), 'Show', self))