예제 #1
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)
예제 #2
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"))
예제 #3
0
    def add_legalentity(self, legal_entity):
        self.new_tab(_("Legal entity"))
        self.item = legal_entity
        fields = LegalEntity.get_show_fields()
        self.fill_from_model(1, 1, True, fields[_('001@Identity')])
        self.get_components('name').colspan = 2
        self.get_components('structure_type').colspan = 2
        img_path = get_user_path(
            "contacts", "Image_%s.jpg" % legal_entity.abstractcontact_ptr_id)
        img = XferCompImage('logoimg')
        if exists(img_path):
            img.type = 'jpg'
            img.set_value(readimage_to_base64(img_path))
        else:
            img.set_value(
                get_icon_path("lucterios.contacts/images/NoImage.png"))
        img.set_location(0, 2, 1, 6)
        self.add_component(img)

        btn = XferCompButton('btn_edit')
        btn.set_is_mini(True)
        btn.set_location(4, 1, 1, 2)
        btn.set_action(self.request,
                       CurrentLegalEntityModify.get_action(
                           _('Edit'), "images/edit.png"),
                       modal=FORMTYPE_MODAL,
                       close=CLOSE_NO,
                       params={'legal_entity': legal_entity.id})
        self.add_component(btn)
예제 #4
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)
예제 #5
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
예제 #6
0
 def fillresponse(self):
     XferShowEditor.fillresponse(self)
     for action, _modal, _close, _select, params in self.actions:
         if (action.url_text == 'lucterios.mailing/messageTransition') and (
                 'TRANSITION' in params) and (params['TRANSITION']
                                              == 'sending'):
             action.icon_path = get_icon_path("mailing.png",
                                              action.url_text)
예제 #7
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))
예제 #8
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())
예제 #9
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())
예제 #10
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())
예제 #11
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())
예제 #12
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))
예제 #13
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"))
예제 #14
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"))
예제 #15
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)
예제 #16
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"))
예제 #17
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)
예제 #18
0
파일: editors.py 프로젝트: mdanielo44/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 Params.getobject("member-family-type") is not None:
            xfer.tab = 1
            row_init = xfer.get_max_row() + 1
            lbl = XferCompLabelForm("family")
            current_family = self.item.family
            if current_family is None:
                lbl.set_value(None)
            else:
                lbl.set_value(six.text_type(self.item.family))
            lbl.set_location(1, row_init, 2)
            lbl.description = _('family')
            xfer.add_component(lbl)
            btn = XferCompButton('famillybtn')
            btn.is_mini = True
            btn.set_location(3, row_init)
            if current_family is None:
                act = ActionsManage.get_action_url('member.Adherent',
                                                   'FamilyAdd', 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('contacts.LegalEntity',
                                                   'Show', xfer)
                act.set_value("", "images/edit.png")
                btn.set_action(
                    xfer.request,
                    act,
                    modal=FORMTYPE_MODAL,
                    close=CLOSE_NO,
                    params={'legal_entity': six.text_type(current_family.id)})
            xfer.add_component(btn)

        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():
                ckc = XferCompCheck("doc_%d" % doc.id)
                ckc.set_value(doc.value)
                ckc.set_location(2, row)
                ckc.description = six.text_type(doc.document)
                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)
예제 #19
0
 def fillresponse(self):
     XferShowEditor.fillresponse(self)
     for action, _modal, _close, _select, params in self.actions:
         if (action.url_text == 'lucterios.mailing/messageTransition') and ('TRANSITION' in params) and (params['TRANSITION'] == 'sending'):
             action.icon_path = get_icon_path("mailing.png", action.url_text)
예제 #20
0
 def icon_path(cls, icon_path=None):
     if icon_path is None:
         icon_path = getattr(cls, 'icon', '')
     res_icon_path = get_icon_path(icon_path, cls.url_text, cls.extension)
     return res_icon_path
예제 #21
0
파일: xferbasic.py 프로젝트: povtux/core
 def icon_path(cls, icon_path=None):
     if icon_path is None:
         icon_path = getattr(cls, 'icon', '')
     res_icon_path = get_icon_path(icon_path, cls.url_text, cls.extension)
     return res_icon_path