def fillresponse_header(self): contact_filter = self.getparam('filter', '') show_filter = self.getparam('show_filter', 0) lbl = XferCompLabelForm('lbl_filtre') lbl.set_value_as_name(_('Filtrer by contact')) lbl.set_location(0, 2) self.add_component(lbl) comp = XferCompEdit('filter') comp.set_value(contact_filter) comp.set_action(self.request, self.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO) comp.set_location(1, 2) self.add_component(comp) lbl = XferCompLabelForm('lbl_showing') lbl.set_value_as_name(_('Accounts displayed')) lbl.set_location(0, 3) self.add_component(lbl) edt = XferCompSelect("show_filter") edt.set_select([(0, _('Hide the account total of thirds')), (1, _('Show the account total of thirds')), (2, _('Filter any thirds unbalanced'))]) edt.set_value(show_filter) edt.set_location(1, 3) edt.set_action(self.request, self.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO) self.add_component(edt) if show_filter != 0: self.fieldnames = Third.get_other_fields() self.filter = Q(status=0) if contact_filter != "": q_legalentity = Q(contact__legalentity__name__icontains=contact_filter) q_individual = (Q(contact__individual__firstname__icontains=contact_filter) | Q(contact__individual__lastname__icontains=contact_filter)) self.filter &= (q_legalentity | q_individual)
def get_search_fields(cls): search_fields = [ "bill_type", "fiscal_year", "num", "date", "comment", "status"] for fieldname in Third.get_search_fields(): search_fields.append("third." + fieldname) for det_field in ["article.reference", "article.designation", "article.sell_account", "article.vat", "designation", "price", "unit", "quantity"]: search_fields.append("detail_set." + det_field) return search_fields
Lucterios is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Lucterios is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Lucterios. If not, see <http://www.gnu.org/licenses/>. ''' from __future__ import unicode_literals from django.utils.translation import ugettext_lazy as _ from diacamma.accounting.models import Third name = _("listing") kind = 0 modelname = Third.get_long_name() value = """210 297 12//%s//#contact.str 18//%s//#accountthird_set.code 13//%s//#total """ % (_("contact"), _('account'), _("total"))