Beispiel #1
0
 def fillresponse_add_title(self):
     XferSearchEditor.fillresponse_add_title(self)
     modelname = self.model.get_long_name()
     saved_list = SavedCriteria.objects.filter(modelname=modelname)
     new_row = self.get_max_row()
     sel = XferCompSelect('saved_criteria')
     sel.description = _("saved criteria")
     sel.set_location(1, new_row + 1, 3)
     sel.set_needed(False)
     sel.set_select_query(saved_list)
     sel.set_action(self.request,
                    self.return_action(),
                    close=CLOSE_NO,
                    modal=FORMTYPE_REFRESH)
     self.add_component(sel)
     if len(self.criteria_list) > 0:
         from lucterios.CORE.views import SavedCriteriaAddModify
         btn = XferCompButton('btn_saved_criteria')
         btn.set_location(4, new_row + 1, 2)
         btn.set_is_mini(True)
         btn.set_action(self.request,
                        SavedCriteriaAddModify.get_action("+", ""),
                        close=CLOSE_NO,
                        params={
                            'modelname': modelname,
                            'criteria': self.getparam('CRITERIA', '')
                        })
         self.add_component(btn)
     if self.getparam('saved_criteria', 0) != 0:
         saved_item = SavedCriteria.objects.get(
             id=self.getparam('saved_criteria', 0))
         self.params['CRITERIA'] = saved_item.criteria
         self.read_criteria_from_params()
Beispiel #2
0
 def fillresponse_add_title(self):
     XferSearchEditor.fillresponse_add_title(self)
     modelname = self.model.get_long_name()
     saved_list = SavedCriteria.objects.filter(modelname=modelname)
     new_row = self.get_max_row()
     lbl = XferCompLabelForm('lbl_saved_criteria')
     lbl.set_location(1, new_row + 1)
     lbl.set_value_as_name(_("saved criteria"))
     self.add_component(lbl)
     sel = XferCompSelect('saved_criteria')
     sel.set_location(2, new_row + 1, 2)
     sel.set_needed(False)
     sel.set_select_query(saved_list)
     sel.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
     self.add_component(sel)
     if len(self.criteria_list) > 0:
         from lucterios.CORE.views import SavedCriteriaAddModify
         btn = XferCompButton('btn_saved_criteria')
         btn.set_location(4, new_row + 1, 2)
         btn.set_is_mini(True)
         btn.set_action(self.request, SavedCriteriaAddModify.get_action("+", ""), close=CLOSE_NO,
                        params={'modelname': modelname, 'criteria': self.getparam('CRITERIA', '')})
         self.add_component(btn)
     if self.getparam('saved_criteria', 0) != 0:
         saved_item = SavedCriteria.objects.get(
             id=self.getparam('saved_criteria', 0))
         self.params['CRITERIA'] = saved_item.criteria
         self.read_criteria_from_params()
Beispiel #3
0
 def fillresponse(self):
     self.action_list = []
     if self.final_class is not None:
         self.add_action(self.final_class.get_action(TITLE_OK, "images/ok.png"))
     model_current = self.getparam('modelname')
     if model_current is None:
         self.model = self.inital_model
     else:
         self.model = apps.get_model(model_current)
     self.field_id = self.model.__name__.lower()
     if self.field_id == 'legalentity':
         self.field_id = 'legal_entity'
     self.item = self.model()
     XferSearchEditor.fillresponse(self)
     self.remove_component('title')
     lbl = XferCompLabelForm('modelname_lbl')
     lbl.set_value_as_title(_('model'))
     lbl.set_location(1, 0)
     self.add_component(lbl)
     selected_model = XferCompSelect('modelname')
     selected_model.set_value(model_current)
     selected_model.set_select(self.inital_model.get_select_contact_type())
     selected_model.set_location(2, 0, 3)
     selected_model.set_action(self.request, self.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO)
     self.add_component(selected_model)
     if self.select_class is not None:
         grid = self.get_components(self.field_id)
         grid.add_action(self.request, self.select_class.get_action(_("Select"), "images/ok.png"),
                         close=CLOSE_YES, unique=self.mode_select, params={'pkname': self.field_id}, pos_act=0)
Beispiel #4
0
 def fillresponse(self):
     self.action_list = []
     if self.final_class is not None:
         self.add_action(
             self.final_class.get_action(TITLE_OK, "images/ok.png"))
     model_current = self.getparam('modelname')
     if model_current is None:
         self.model = self.inital_model
     else:
         self.model = apps.get_model(model_current)
     self.field_id = self.model.__name__.lower()
     if self.field_id == 'legalentity':
         self.field_id = 'legal_entity'
     self.item = self.model()
     XferSearchEditor.fillresponse(self)
     self.remove_component('title')
     selected_model = XferCompSelect('modelname')
     selected_model.set_value(model_current)
     selected_model.set_select(self.inital_model.get_select_contact_type())
     selected_model.set_location(1, 0, 4)
     selected_model.set_action(self.request,
                               self.get_action(),
                               modal=FORMTYPE_REFRESH,
                               close=CLOSE_NO)
     selected_model.description = _('model')
     self.add_component(selected_model)
     if self.select_class is not None:
         grid = self.get_components(self.field_id)
         grid.add_action(self.request,
                         self.select_class.get_action(
                             _("Select"), "images/ok.png"),
                         close=CLOSE_YES,
                         unique=self.mode_select,
                         params={'pkname': self.field_id},
                         pos_act=0)
Beispiel #5
0
 def fillresponse(self):
     XferSearchEditor.fillresponse(self)
     self.item.editor.add_email_selector(self, 0, self.get_max_row() + 1, 5)
     if WrapAction.is_permission(self.request, 'contacts.add_abstractcontact'):
         self.get_components(self.field_id).add_action(self.request, ObjectMerge.get_action(_("Merge"), "images/clone.png"),
                                                       close=CLOSE_NO, unique=SELECT_MULTI, params={'modelname': self.model.get_long_name(), 'field_id': self.field_id})
     self.add_action(AbstractContactFindDouble.get_action(_("duplicate"), "images/clone.png"),
                     params={'modelname': self.model.get_long_name(), 'field_id': self.field_id}, pos_act=0)
Beispiel #6
0
 def fillresponse(self):
     XferSearchEditor.fillresponse(self)
     self.item.editor.add_email_selector(self, 0, self.get_max_row() + 1, 5)
     if WrapAction.is_permission(self.request, 'contacts.add_abstractcontact'):
         self.get_components(self.field_id).add_action(self.request, ObjectMerge.get_action(_("Merge"), "images/clone.png"),
                                                       close=CLOSE_NO, unique=SELECT_MULTI, params={'modelname': self.model.get_long_name(), 'field_id': self.field_id})
     self.add_action(AbstractContactFindDouble.get_action(_("duplicate"), "images/clone.png"),
                     params={'modelname': self.model.get_long_name(), 'field_id': self.field_id}, pos_act=0)
Beispiel #7
0
 def fillresponse(self):
     XferSearchEditor.fillresponse(self)
     if self.select_class is not None:
         grid = self.get_components(self.field_id)
         grid.add_action(self.request,
                         self.select_class.get_action(
                             _("Select"), "images/ok.png"),
                         close=CLOSE_YES,
                         unique=self.mode_select,
                         pos_act=0)
Beispiel #8
0
 def get_text_search(self):
     criteria_desc = XferSearchEditor.get_text_search(self)
     if notfree_mode_connect():
         if self.filter is None:
             self.filter = Q()
         self.filter = self.filter & (Q(folder=None) | Q(
             folder__viewer__in=self.request.user.groups.all()))
     return criteria_desc
Beispiel #9
0
 def fillresponse(self):
     XferSearchEditor.fillresponse(self)
     if self.select_class is not None:
         grid = self.get_components(self.field_id)
         grid.add_action(self.request, self.select_class.get_action(_("Select"), "images/ok.png"),
                         close=CLOSE_YES, unique=self.mode_select, pos_act=0)