def thirdaddon_invoice(item, xfer): if WrapAction.is_permission(xfer.request, 'invoice.change_bill'): try: FiscalYear.get_current() xfer.new_tab(_('Invoice')) current_filter, status_filter = _add_bill_filter(xfer, 1) current_filter &= Q(third=item) bills = Bill.objects.filter(current_filter) bill_grid = XferCompGrid('bill') bill_grid.set_model(bills, Bill.get_default_fields(status_filter), xfer) bill_grid.set_location(0, 2, 2) bill_grid.add_action(xfer.request, ActionsManage.get_action_url('invoice.Bill', 'Show', xfer), modal=FORMTYPE_MODAL, unique=SELECT_SINGLE, close=CLOSE_NO) xfer.add_component(bill_grid) except LucteriosException: pass
def _add_bill_filter(xfer, row): status_filter = xfer.getparam('status_filter', -1) lbl = XferCompLabelForm('lbl_filter') lbl.set_value_as_name(_('Filter by type')) lbl.set_location(0, row) xfer.add_component(lbl) dep_field = Bill.get_field_by_name('status') sel_list = list(dep_field.choices) sel_list.insert(0, (-1, _('building+valid'))) edt = XferCompSelect("status_filter") edt.set_select(sel_list) edt.set_value(status_filter) edt.set_location(1, row) edt.set_action(xfer.request, xfer.get_action(), modal=FORMTYPE_REFRESH, close=CLOSE_NO) xfer.add_component(edt) current_filter = Q() if status_filter >= 0: current_filter &= Q(status=status_filter) elif status_filter == -1: current_filter &= Q(status=0) | Q(status=1) return current_filter, status_filter
def fillresponse_header(self): self.filter, status_filter = _add_bill_filter(self, 3) self.fieldnames = Bill.get_default_fields(status_filter)
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.invoice.models import Bill name = _("payoff") kind = 2 modelname = Bill.get_long_name() value = """ <model hmargin="10.0" vmargin="10.0" page_width="210.0" page_height="297.0"> <header extent="25.0"> <text height="20.0" width="120.0" top="5.0" left="70.0" padding="1.0" spacing="0.0" border_color="black" border_style="" border_width="0.2" text_align="center" line_height="20" font_family="sans-serif" font_weight="" font_size="20"> {[b]}#OUR_DETAIL.name{[/b]} </text> <image height="25.0" width="30.0" top="0.0" left="10.0" padding="1.0" spacing="0.0" border_color="black" border_style="" border_width="0.2"> #OUR_DETAIL.image </image> </header> <bottom extent="10.0"> <text height="10.0" width="190.0" top="00.0" left="0.0" padding="1.0" spacing="0.0" border_color="black" border_style="" border_width="0.2" text_align="center" line_height="8" font_family="sans-serif" font_weight="" font_size="8"> {[italic]} #OUR_DETAIL.address - #OUR_DETAIL.postal_code #OUR_DETAIL.city - #OUR_DETAIL.tel1 #OUR_DETAIL.tel2 #OUR_DETAIL.email{[br/]}#OUR_DETAIL.identify_number {[/italic]}