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-dkim-private-path', 'mailing-dkim-selector', '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)
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)
def fillresponse_show_criteria(self): criteria_text_list = self.get_text_search() label = XferCompLabelForm('labelsearchDescTitle') if len(criteria_text_list) > 0: label.set_value_as_info("Your criteria of search") label.set_location(0, 17, 2, 4) else: label.set_value_as_infocenter("No criteria of search") label.set_location(0, 17, 4) self.add_component(label) row = 17 for criteria_id, criteria_text in criteria_text_list.items(): label = XferCompLabelForm('labelSearchText_' + criteria_id) label.set_value(criteria_text) label.set_location(2, row, 2) self.add_component(label) comp = XferCompButton("searchButtonDel_" + criteria_id) comp.set_is_mini(True) comp.set_location(4, row) comp.set_action(self.request, self.get_action("", "images/delete.png"), modal=FORMTYPE_REFRESH, close=CLOSE_NO, params={'ACT': criteria_id}) self.add_component(comp) row += 1
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)
def add_document(self): old_item = self.item self.model = DocumentContainer self.item = DocumentContainer() last_row = self.get_max_row() + 5 lbl = XferCompLabelForm('sep1') lbl.set_location(0, last_row, 6) lbl.set_value("{[center]}{[hr/]}{[/center]}") self.add_component(lbl) lbl = XferCompLabelForm('sep2') lbl.set_location(0, last_row + 1, 2) lbl.set_value_as_infocenter(_("Add document")) self.add_component(lbl) self.fill_from_model(0, last_row + 3, False) self.remove_component('parent') btn_doc = XferCompButton('adddoc') btn_doc.set_location(1, last_row + 4) btn_doc.set_action(self.request, DocumentAddModify.get_action( TITLE_ADD, 'images/add.png'), params={ 'parent': self.current_folder, 'SAVE': 'YES' }, close=CLOSE_NO) self.add_component(btn_doc) self.model = AbstractContainer self.item = old_item
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)
def fill_params(xfer, param_lists=None, smallbtn=False): if param_lists is None: param_lists = [ "member-team-enable", "member-team-text", "member-activite-enable", "member-activite-text", "member-age-enable", "member-licence-enabled", "member-filter-genre", "member-numero", "member-birth", "member-fields", "member-subscription-message" ] if len(param_lists) >= 3: nb_col = 2 else: nb_col = 1 Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1, nb_col=nb_col) comp_fields = xfer.get_components("member-fields") if comp_fields is not None: comp_fields.value = "{[br/]}".join([ six.text_type(fields_title[1]) for fields_title in Adherent.get_default_fields_title() ]) btn = XferCompButton('editparam') btn.set_is_mini(smallbtn) btn.set_location(3, xfer.get_max_row() + 1) btn.set_action(xfer.request, CategoryParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO, params={ 'params': param_lists, 'nb_col': nb_col }) xfer.add_component(btn)
def summary_dummy(xfer): if not hasattr(xfer, 'add_component'): return True else: row = xfer.get_max_row() + 1 lab = XferCompLabelForm('dummytitle') lab.set_value_as_infocenter("Dummy") lab.set_location(0, row, 4) xfer.add_component(lab) lbl = XferCompLabelForm('dummy_time') lbl.set_color('blue') lbl.set_location(0, row + 1, 4) lbl.set_centered() lbl.set_value(datetime.now()) lbl.set_format('H') xfer.add_component(lbl) btn = XferCompButton('btnscheduler') btn.set_action(xfer.request, AddSchedulerTask.get_action('Task', '')) btn.set_location(0, row + 2, 4) xfer.add_component(btn) lbl = XferCompLabelForm('dummy-value') lbl.set_location(0, row + 3, 4) lbl.set_value(Params.getvalue('dummy-value')) xfer.add_component(lbl) return True
def fillresponse_add_title(self): XferSearchEditor.fillresponse_add_title(self) modelname = self.model.get_long_name() saved_list = SavedCriteria.objects.filter(modelname=modelname) new_row = self.get_max_row() sel = XferCompSelect('saved_criteria') sel.description = _("saved criteria") sel.set_location(1, new_row + 1, 3) sel.set_needed(False) sel.set_select_query(saved_list) sel.set_action(self.request, self.return_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH) self.add_component(sel) if len(self.criteria_list) > 0: from lucterios.CORE.views import SavedCriteriaAddModify btn = XferCompButton('btn_saved_criteria') btn.set_location(4, new_row + 1, 2) btn.set_is_mini(True) btn.set_action(self.request, SavedCriteriaAddModify.get_action("+", ""), close=CLOSE_NO, params={ 'modelname': modelname, 'criteria': self.getparam('CRITERIA', '') }) self.add_component(btn) if self.getparam('saved_criteria', 0) != 0: saved_item = SavedCriteria.objects.get( id=self.getparam('saved_criteria', 0)) self.params['CRITERIA'] = saved_item.criteria self.read_criteria_from_params()
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)
def conf_wizard_document(wizard_ident, xfer): if isinstance(wizard_ident, list) and (xfer is None): wizard_ident.append(("document_params", 55)) elif (xfer is not None) and (wizard_ident == "document_params"): xfer.add_title(_("Lucterios documents"), _("Parameters")) lbl = XferCompLabelForm("nb_folder") lbl.set_location(1, xfer.get_max_row() + 1) lbl.set_value( TEXT_TOTAL_NUMBER % { 'name': Folder._meta.verbose_name_plural, 'count': len(Folder.objects.all()) }) xfer.add_component(lbl) lbl = XferCompLabelForm("nb_doc") lbl.set_location(1, xfer.get_max_row() + 1) lbl.set_value( TEXT_TOTAL_NUMBER % { 'name': Document._meta.verbose_name_plural, 'count': len(Document.objects.all()) }) xfer.add_component(lbl) btn = XferCompButton("btnconf") btn.set_location(4, xfer.get_max_row() - 1, 1, 2) btn.set_action(xfer.request, FolderList.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO) xfer.add_component(btn)
def show(self, xfer): AbstractContactEditor.show(self, xfer) obj_user = xfer.get_components('user') obj_user.colspan = 2 xfer.tab = obj_user.tab btn = XferCompButton('userbtn') btn.is_mini = True btn.set_location(obj_user.col + 2, obj_user.row, 1, 1) if self.item.user is None: act = ActionsManage.get_action_url('CORE.LucteriosUser', 'UserAdd', xfer) act.set_value("", "images/add.png") btn.set_action(xfer.request, act, modal=FORMTYPE_MODAL, close=CLOSE_NO) else: act = ActionsManage.get_action_url('CORE.LucteriosUser', 'Edit', xfer) act.set_value("", "images/edit.png") btn.set_action(xfer.request, act, modal=FORMTYPE_MODAL, close=CLOSE_NO, params={ 'user_actif': six.text_type(self.item.user.id), 'IDENT_READ': 'YES' }) xfer.add_component(btn)
def show(self, xfer): xfer.params['supporting'] = self.item.id third = xfer.get_components('thirdtotal') xfer.tab = third.tab btn = XferCompButton('show_third') btn.set_location(third.col + third.colspan, third.row) act_btn = ActionsManage.get_action_url('accounting.Third', 'Show', xfer) if act_btn is not None: act_btn.caption = _('third') btn.set_action(xfer.request, act_btn, modal=FORMTYPE_MODAL, close=CLOSE_NO, params={'third': self.item.third.id}) btn.rowspan = 2 xfer.add_component(btn) lots = xfer.get_components('propertylot') lots.actions = [] lots.delete_header('owner') if hasattr(xfer.item.third.contact.get_final_child(), 'structure_type'): contact = xfer.get_components('ownercontact') xfer.tab = contact.tab old_item = xfer.item xfer.item = old_item.third.contact.get_final_child() xfer.filltab_from_model(contact.col, contact.row + 1, True, ['responsability_set']) xfer.item = old_item self._show_entryline(xfer) self._show_current_class_loads(xfer) self._show_call_payoff(xfer)
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)
def edit(self, xfer): set_comp = xfer.get_components('set') set_comp.set_select_query(Set.objects.filter(is_active=True)) xfer.get_components('price').prec = Params.getvalue( "accounting-devise-prec") old_account = xfer.get_components("expense_account") xfer.remove_component("expense_account") sel_account = XferCompSelect("expense_account") sel_account.description = old_account.description sel_account.set_location(old_account.col, old_account.row, old_account.colspan, old_account.rowspan) for item in FiscalYear.get_current().chartsaccount_set.all().filter( code__regex=current_system_account().get_expence_mask( )).order_by('code'): sel_account.select_list.append((item.code, six.text_type(item))) sel_account.set_value(self.item.expense_account) xfer.add_component(sel_account) self.item.year = FiscalYear.get_current() btn = XferCompButton('add_account') btn.set_location(old_account.col + 1, old_account.row) btn.set_is_mini(True) btn.set_action(xfer.request, ActionsManage.get_action_url('accounting.ChartsAccount', 'AddModify', xfer), close=CLOSE_NO, modal=FORMTYPE_MODAL, params={'year': self.item.year.id}) xfer.add_component(btn) xfer.get_components("set").colspan = old_account.colspan + 1 xfer.get_components("designation").colspan = old_account.colspan + 1 xfer.get_components("price").colspan = old_account.colspan + 1
def fillresponse_header(self): self.new_tab(_('Parameters')) fill_params(self) btn = XferCompButton('checkowner') btn.set_location(3, self.get_max_row(), 2, 1) btn.set_action(self.request, CondominiumCheckOwner.get_action(_('check owner'), 'diacamma.condominium/images/owner.png'), close=CLOSE_NO) self.add_component(btn) self.new_tab(_('Links'))
def add_auditlogs_button(xfer, model, posx, posy): if xfer.with_auditlog_btn and LucteriosLogEntry.objects.get_for_model(model).count() > 0: btn = XferCompButton('auditlogbtn') btn.set_action(xfer.request, ActionsManage.get_action_url(LucteriosLogEntry.get_long_name(), 'Show', xfer), modal=FORMTYPE_MODAL, close=CLOSE_NO, params={'model': model.get_long_name()}) btn.set_is_mini(True) btn.set_location(posx, posy) xfer.add_component(btn)
def add_folder_buttons(self, new_col, new_row): btn = XferCompButton('btnFolder') btn.set_location(new_col, new_row + 2) btn.set_action(self.request, FolderAddModify.get_action(_('add'), "images/add.png"), modal=FORMTYPE_MODAL, close=CLOSE_NO) self.add_component(btn) if self.current_folder > 0: btn = XferCompButton('btnEditFolder') btn.set_location(new_col + 1, new_row + 2, 1) btn.set_action( self.request, FolderAddModify.get_action(_('edit'), "images/edit.png"), modal=FORMTYPE_MODAL, close=CLOSE_NO, params={'folder': six.text_type(self.current_folder)}) self.add_component(btn)
def fill_current_folder(self, new_col, new_row): lbl = XferCompLabelForm('title_folder') if self.current_folder > 0: folder_obj = FolderContainer.objects.get(id=self.current_folder) lbl.set_value(folder_obj.get_title()) folder_description = folder_obj.description else: folder_obj = None lbl.set_value('>') folder_description = "" lbl.set_location(new_col, new_row) lbl.description = _("current folder:") self.add_component(lbl) lbl = XferCompLabelForm('desc_folder') lbl.set_value_as_header(folder_description) lbl.set_location(new_col, new_row + 1) self.add_component(lbl) if self.current_folder > 0: btn_return = XferCompButton('return') btn_return.set_location(new_col + 1, new_row) btn_return.set_is_mini(True) btn_return.set_action(self.request, self.get_action('', 'images/left.png'), params={ 'current_folder': self.item.parent_id if self.item.parent_id is not None else 0 }, modal=FORMTYPE_REFRESH, close=CLOSE_NO) self.add_component(btn_return) btn_edit = XferCompButton('edit') btn_edit.set_location(new_col + 1, new_row + 1) btn_edit.set_is_mini(True) btn_edit.set_action(self.request, FolderAddModify.get_action( '', 'images/edit.png'), params={'folder': self.current_folder}, close=CLOSE_NO) self.add_component(btn_edit) return folder_obj
def fill_params(self, is_mini=False, new_params=False): system_condo = current_system_condo() param_lists = system_condo.get_config_params(new_params) Params.fill(self, param_lists, 1, self.get_max_row() + 1, nb_col=2) btn = XferCompButton('editparam') btn.set_location(1, self.get_max_row() + 1, 2, 1) btn.set_is_mini(is_mini) btn.set_action(self.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO, params={'params': param_lists}) self.add_component(btn)
def editbudget_condo(xfer): if xfer.getparam('set') is not None: cost = xfer.getparam('cost_accounting') if cost is not None: set_item = Set.objects.get(id=xfer.getparam('set', 0)) title_cost = xfer.get_components('title_cost') xfer.remove_component('title_year') year = xfer.getparam('year', 0) select_year = XferCompSelect('year') select_year.set_location(1, title_cost.row - 1) select_year.set_select_query(FiscalYear.objects.all()) select_year.set_value(year) select_year.description = _('year') select_year.set_needed(set_item.type_load == Set.TYPELOAD_CURRENT) select_year.set_action(xfer.request, xfer.__class__.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH) xfer.add_component(select_year) btn = XferCompButton('confyear') btn.set_location(2, title_cost.row - 1) btn.set_action(xfer.request, ActionsManage.get_action_url( FiscalYear.get_long_name(), 'configuration', xfer), close=CLOSE_NO) btn.set_is_mini(True) xfer.add_component(btn) if year != 0: current_year = FiscalYear.get_current(year) xfer.params['readonly'] = str( current_year.status == FiscalYear.STATUS_FINISHED) if set_item.type_load == 0: if len(set_item.setcost_set.filter( year=current_year)) == 0: set_item.create_new_cost(year=current_year.id) setcost_item = set_item.setcost_set.filter( year=current_year)[0] else: setcost_item = set_item.setcost_set.filter(year=None)[0] cost_item = setcost_item.cost_accounting xfer.params['cost_accounting'] = cost_item.id title_cost.set_value("{[b]}%s{[/b]} : %s" % (_('cost accounting'), cost_item)) else: year = None xfer.params['readonly'] = 'True' cost_item = CostAccounting.objects.get(id=cost) if (cost_item.status == CostAccounting.STATUS_OPENED) and not xfer.getparam( 'readonly', False): set_item.change_budget_product(cost_item, year) if xfer.getparam('type_of_account') is not None: xfer.params['readonly'] = 'True' return
def add_auditlog_button(xfer, instance, posx, posy): if xfer.with_auditlog_btn and LucteriosLogEntry.objects.get_for_object(instance).count() > 0: btn = XferCompButton('auditlogbtn') btn.set_action(xfer.request, ActionsManage.get_action_url(LucteriosLogEntry.get_long_name(), 'Show', xfer), modal=FORMTYPE_MODAL, close=CLOSE_NO, params={'model': instance.__class__.get_long_name(), 'objid': instance.id}) btn.set_is_mini(True) btn.set_location(posx, posy) if xfer.tab > 0: xfer.tab = 1 xfer.add_component(btn)
def edit(self, xfer): if xfer.item.id is None: new_account = [] if Params.getvalue("condominium-old-accounting"): new_account.append( Params.getvalue("condominium-default-owner-account")) else: for num_account in LIST_DEFAULT_ACCOUNTS: new_account.append( Params.getvalue("condominium-default-owner-account%d" % num_account)) sel = XferCompSelect('third') sel.needed = True sel.description = _('third') sel.set_location(1, 0) owner_third_ids = [] for owner in Owner.objects.all(): owner_third_ids.append(owner.third_id) items = Third.objects.filter( accountthird__code__regex=current_system_account( ).get_societary_mask()).exclude( id__in=owner_third_ids).distinct() items = sorted(items, key=lambda t: str(t)) sel.set_select_query(items) xfer.add_component(sel) btn = XferCompButton('add_third') btn.set_location(3, 0) btn.set_is_mini(True) btn.set_action(xfer.request, ActionsManage.get_action_url( 'accounting.Third', 'Add', xfer), close=CLOSE_NO, modal=FORMTYPE_MODAL, params={'new_account': ';'.join(new_account)}) xfer.add_component(btn) xfer.filltab_from_model(1, xfer.get_max_row() + 1, False, ["information"]) else: old_item = xfer.item xfer.item = old_item.third.contact.get_final_child() xfer.filltab_from_model(1, 0, False, xfer.item.get_edit_fields()) CustomField.edit_fields(xfer, 1) xfer.item = old_item.third.get_final_child() xfer.filltab_from_model(1, xfer.get_max_row() + 1, False, xfer.item.get_edit_fields()) CustomField.edit_fields(xfer, 1) xfer.item = old_item xfer.filltab_from_model(1, xfer.get_max_row() + 1, False, ["information"])
def edit(self, xfer): from diacamma.invoice.views import ArticleList row_init = xfer.get_max_row() + 3 btn = XferCompButton("btn_article") btn.set_location(3, row_init, 2) btn.set_action(xfer.request, ArticleList.get_action( _('Articles'), 'diacamma.invoice/images/article.png'), close=CLOSE_NO) xfer.add_component(btn)
def summary_condo(xfer): if not hasattr(xfer, 'add_component'): return WrapAction.is_permission(xfer, 'condominium.change_set') else: if WrapAction.is_permission(xfer.request, 'condominium.change_set'): row = xfer.get_max_row() + 1 lab = XferCompLabelForm('condotitle') lab.set_value_as_infocenter(_('Condominium')) lab.set_location(0, row, 4) xfer.add_component(lab) nb_set = len(Set.objects.filter(is_active=True)) nb_owner = len(Owner.objects.all()) lab = XferCompLabelForm('condoinfo') lab.set_value_as_header( _("There are %(set)d classes of loads for %(owner)d owners") % { 'set': nb_set, 'owner': nb_owner }) lab.set_location(0, row + 1, 4) xfer.add_component(lab) if Params.getvalue("condominium-old-accounting"): lab = XferCompLabelForm('condoconvinfo') lab.set_value_as_header( _("Your condominium account is not in respect of French law{[newline]}An conversion is necessary." )) lab.set_color('red') lab.set_location(0, row + 2, 4) xfer.add_component(lab) btn = XferCompButton('condoconv') btn.set_location(0, row + 3, 4) btn.set_action(xfer.request, CondominiumConvert.get_action( _('Convertion ...'), ""), close=CLOSE_NO) xfer.add_component(btn) if hasattr(settings, "DIACAMMA_MAXOWNER"): lbl = XferCompLabelForm("limit_owner") lbl.set_value( _('limitation: %d owners allowed') % getattr(settings, "DIACAMMA_MAXOWNER")) lbl.set_italic() lbl.set_location(0, row + 4, 4) xfer.add_component(lbl) row = xfer.get_max_row() + 1 lab = XferCompLabelForm('condosep') lab.set_value_as_infocenter("{[hr/]}") lab.set_location(0, row, 4) xfer.add_component(lab) return True else: return False
def _show_current_class_loads(self, xfer): partition = xfer.get_components('partition') partition.actions = [] partition.description = _("current class loads") partition.delete_header('owner') xfer.tab = partition.tab row = xfer.get_max_row() + 1 btn = XferCompButton('show_load_count') btn.set_location(partition.col, row) btn.set_action(xfer.request, ActionsManage.get_action_url('condominium.Owner', 'LoadCount', xfer), modal=FORMTYPE_MODAL, close=CLOSE_NO) xfer.add_component(btn)
def header_title(self, step, steplist): if step > 0: btn = XferCompButton("prec_wizard") btn.set_location(0, 0) btn.set_is_mini(True) btn.set_action(self.request, self.get_action(_("Prec"), "images/left.png"), modal=FORMTYPE_REFRESH, close=CLOSE_NO, params={'step': step - 1}) self.add_component(btn) lbl = XferCompLabelForm('progress') lbl.set_centered() lbl.set_value_as_name(_("progress steps: %(current)d/%(max)d") % {'current': step + 1, "max": len(steplist)}) lbl.set_location(1, 0, 4) self.add_component(lbl) if step < (len(steplist) - 1): btn = XferCompButton("next_wizard") btn.set_location(5, 0) btn.set_is_mini(True) btn.set_action(self.request, self.get_action(_("Next"), "images/right.png"), modal=FORMTYPE_REFRESH, close=CLOSE_NO, params={'step': step + 1}) self.add_component(btn) lbl = XferCompLabelForm('sep1') lbl.set_value("{[hr/]}") lbl.set_location(0, 1, 6) self.add_component(lbl)
def conf_wizard_mailing(wizard_ident, xfer): if isinstance(wizard_ident, list) and (xfer is None): wizard_ident.append(("mailing_params", 52)) elif (xfer is not None) and (wizard_ident == "mailing_params"): xfer.add_title(_("Lucterios mailing"), _("Mailing parameters")) lbl = XferCompLabelForm("nb_mail_send") lbl.set_location(1, xfer.get_max_row() + 1) xfer.add_component(lbl) if will_mail_send(): lbl.set_value(_('email properly configured')) else: lbl.set_value(_('email not configured')) btn = XferCompButton("btnconf") btn.set_location(3, xfer.get_max_row()) btn.set_action(xfer.request, Configuration.get_action(TITLE_MODIFY, "images/edit.png"), close=CLOSE_NO) xfer.add_component(btn)
def summary_core(xfer): if not hasattr(xfer, 'add_component'): return right_show_wizard(xfer) and (get_wizard_step_list() != '') and ConfigurationWizard.get_action().check_permission(xfer) elif right_show_wizard(xfer.request): steplist = get_wizard_step_list() if steplist != '': btn = XferCompButton("conf_wizard") btn.set_location(0, xfer.get_max_row() + 1, 4) btn.set_action(xfer.request, ConfigurationWizard.get_action( _("Wizard"), "images/config.png"), close=CLOSE_NO, params={'steplist': steplist}) btn.java_script = """if (typeof Singleton().hide_wizard === 'undefined') { current.actionPerformed(); Singleton().hide_wizard = 1; } """ xfer.add_component(btn)
def fill_params(xfer): param_lists = [ "event-degree-enable", "event-degree-text", "event-subdegree-enable", "event-subdegree-text", "event-comment-text" ] Params.fill(xfer, param_lists, 1, xfer.get_max_row() + 1, nb_col=1) btn = XferCompButton('editparam') btn.set_location(1, xfer.get_max_row() + 1, 2, 1) btn.set_action(xfer.request, ParamEdit.get_action(TITLE_MODIFY, 'images/edit.png'), close=CLOSE_NO, params={ 'params': param_lists, 'nb_col': 1 }) xfer.add_component(btn)