示例#1
0
 def fillresponse(self, limit_date=''):
     if limit_date == '':
         dlg = self.create_custom()
         img = XferCompImage('img')
         img.set_value(self.icon_path())
         img.set_location(0, 0, 1, 6)
         dlg.add_component(img)
         lbl = XferCompLabelForm('lb_limit_date')
         lbl.set_value_as_name(_('limit date'))
         lbl.set_location(1, 1, 1)
         dlg.add_component(lbl)
         limite_date = XferCompDate('limit_date')
         limite_date.set_needed(True)
         limite_date.set_value((date.today() - timedelta(weeks=25)))
         limite_date.set_location(1, 2, 1)
         dlg.add_component(limite_date)
         dlg.add_action(self.get_action(TITLE_OK, 'images/ok.png'), params={"SAVE": "YES"})
         dlg.add_action(WrapAction(TITLE_CANCEL, 'images/cancel.png'))
     else:
         third_ids = [val_third['third'] for val_third in EntryLineAccount.objects.filter(
             entry__date_value__gt=limit_date, third__gt=0).values('third')]
         for third in Third.objects.filter(status=0):
             if third.id not in third_ids:
                 third.status = 1
                 third.save()
示例#2
0
文件: views.py 项目: Diacamma2/syndic
    def fillresponse(self, begin_date, end_date):
        self.item.set_dates(begin_date, end_date)
        lbl = XferCompLabelForm('lbl_begin_date')
        lbl.set_value_as_name(_('initial date'))
        lbl.set_location(1, 0)
        self.add_component(lbl)
        date_init = XferCompDate("begin_date")
        date_init.set_needed(True)
        date_init.set_value(self.item.date_begin)
        date_init.set_location(2, 0)
        date_init.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
        self.add_component(date_init)
        lbl = XferCompLabelForm('lbl_end_date')
        lbl.set_value_as_name(_('current date'))
        lbl.set_location(3, 0)
        self.add_component(lbl)
        date_end = XferCompDate("end_date")
        date_end.set_needed(True)
        date_end.set_value(self.item.date_end)
        date_end.set_location(4, 0)
        date_end.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
        self.add_component(date_end)

        XferShowEditor.fillresponse(self)
        self.add_action(ActionsManage.get_action_url('payoff.Supporting', 'Show', self),
                        close=CLOSE_NO, params={'item_name': self.field_id}, pos_act=0)
        self.add_action(ActionsManage.get_action_url('payoff.Supporting', 'Email', self),
                        close=CLOSE_NO, params={'item_name': self.field_id}, pos_act=0)
示例#3
0
 def _add_season_comp(self, xfer, row):
     season = self.item.season
     if self.item.subscriptiontype.duration == 0:  # annually
         lbl = XferCompLabelForm("seasondates")
         lbl.set_location(1, row)
         lbl.set_value(
             "%s => %s" %
             (formats.date_format(season.begin_date, "SHORT_DATE_FORMAT"),
              formats.date_format(season.end_date, "SHORT_DATE_FORMAT")))
         lbl.description = _('annually')
         xfer.add_component(lbl)
     elif self.item.subscriptiontype.duration == 1:  # periodic
         sel = XferCompSelect('period')
         sel.set_needed(True)
         sel.set_select_query(season.period_set.all())
         sel.set_location(1, row)
         sel.description = _('period')
         xfer.add_component(sel)
     elif self.item.subscriptiontype.duration == 2:  # monthly
         sel = XferCompSelect('month')
         sel.set_needed(True)
         sel.set_select(season.get_months())
         sel.set_location(1, row)
         sel.description = _('month')
         xfer.add_component(sel)
     elif self.item.subscriptiontype.duration == 3:  # calendar
         begindate = XferCompDate('begin_date')
         begindate.set_needed(True)
         begindate.set_value(season.date_ref)
         begindate.set_location(1, row)
         begindate.description = _('begin date')
         xfer.add_component(begindate)
示例#4
0
文件: views.py 项目: htwalid/syndic
    def fillresponse(self, begin_date, end_date):
        self.item.set_dates(begin_date, end_date)
        date_init = XferCompDate("begin_date")
        date_init.set_needed(True)
        date_init.set_value(self.item.date_begin)
        date_init.set_location(1, 0)
        date_init.description = _('initial date')
        date_init.set_action(self.request,
                             self.get_action(),
                             close=CLOSE_NO,
                             modal=FORMTYPE_REFRESH)
        self.add_component(date_init)
        date_end = XferCompDate("end_date")
        date_end.set_needed(True)
        date_end.set_value(self.item.date_end)
        date_end.set_location(3, 0)
        date_end.description = _('current date')
        date_end.set_action(self.request,
                            self.get_action(),
                            close=CLOSE_NO,
                            modal=FORMTYPE_REFRESH)
        self.add_component(date_end)

        XferShowEditor.fillresponse(self)
        self.add_action(ActionsManage.get_action_url('payoff.Supporting',
                                                     'Show', self),
                        close=CLOSE_NO,
                        params={'item_name': self.field_id},
                        pos_act=0)
        self.add_action(ActionsManage.get_action_url('payoff.Supporting',
                                                     'Email', self),
                        close=CLOSE_NO,
                        params={'item_name': self.field_id},
                        pos_act=0)
示例#5
0
文件: views.py 项目: julienM77/syndic
    def fillresponse(self, begin_date, end_date):
        self.item.set_dates(begin_date, end_date)
        date_init = XferCompDate("begin_date")
        date_init.set_needed(True)
        date_init.set_value(self.item.date_begin)
        date_init.set_location(1, 0)
        date_init.description = _('initial date')
        date_init.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
        self.add_component(date_init)
        date_end = XferCompDate("end_date")
        date_end.set_needed(True)
        date_end.set_value(self.item.date_end)
        date_end.set_location(2, 0)
        date_end.description = _('current date')
        date_end.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
        self.add_component(date_end)
        img = XferCompImage('img')
        img.set_value(self.icon_path())
        img.set_location(0, 0, 1, 6)
        self.add_component(img)
        self.fill_from_model(1, 1, True, [((_('name'), 'third'),)])
        grid = XferCompGrid('loadcount')
        grid.set_model(self.item.loadcount_set.all(), None)
        grid.set_location(1, 2, 2)
        self.add_component(grid)

        self.add_action(WrapAction(_('Close'), 'images/close.png'))
示例#6
0
 def edit(self, xfer):
     date = XferCompDate('begin_date')
     date.set_location(1, 0)
     date.set_needed(True)
     date.description = _('begin date')
     val = Period.objects.all().aggregate(Max('end_date'))
     if ('end_date__max' in val.keys()) and (val['end_date__max']
                                             is not None):
         date.set_value(val['end_date__max'] + timedelta(days=1))
     xfer.add_component(date)
示例#7
0
文件: editors.py 项目: Diacamma2/asso
 def edit(self, xfer):
     lbl = XferCompLabelForm('lbl_begin_date')
     lbl.set_value_as_name(_('begin date'))
     lbl.set_location(1, 0)
     xfer.add_component(lbl)
     date = XferCompDate('begin_date')
     date.set_location(2, 0)
     date.set_needed(True)
     val = Period.objects.all().aggregate(Max('end_date'))
     if ('end_date__max' in val.keys()) and (val['end_date__max'] is not None):
         date.set_value(val['end_date__max'] + timedelta(days=1))
     xfer.add_component(date)
示例#8
0
文件: views.py 项目: julienM77/syndic
 def fillresponse(self, begin_date, end_date):
     self.item.set_dates(begin_date, end_date)
     date_init = XferCompDate("begin_date")
     date_init.set_needed(True)
     date_init.set_value(self.item.date_begin)
     date_init.set_location(1, 0)
     date_init.description = _('initial date')
     date_init.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
     self.add_component(date_init)
     date_end = XferCompDate("end_date")
     date_end.set_needed(True)
     date_end.set_value(self.item.date_end)
     date_end.set_location(3, 0)
     date_end.description = _('current date')
     date_end.set_action(self.request, self.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
     self.add_component(date_end)
     XferShowEditor.fillresponse(self)
示例#9
0
文件: views.py 项目: Diacamma2/asso
    def fillresponse_header(self):
        row = self.get_max_row() + 1
        team = self.getparam("team", ())
        activity = self.getparam("activity", ())
        genre = self.getparam("genre", 0)
        age = self.getparam("age", ())
        status = self.getparam("status", -1)
        dateref = convert_date(
            self.getparam("dateref", ""), Season.current_season().date_ref)

        if Params.getvalue("member-age-enable"):
            lbl = XferCompLabelForm('lblage')
            lbl.set_value_as_name(_("Age"))
            lbl.set_location(0, row)
            self.add_component(lbl)
            sel = XferCompCheckList('age')
            sel.set_select_query(Age.objects.all())
            sel.set_value(age)
            sel.set_location(1, row, 1, 2)
            self.add_component(sel)

        if Params.getvalue("member-team-enable"):
            lbl = XferCompLabelForm('lblteam')
            lbl.set_value_as_name(Params.getvalue("member-team-text"))
            lbl.set_location(2, row)
            self.add_component(lbl)
            sel = XferCompCheckList('team')
            sel.set_select_query(Team.objects.all())
            sel.set_value(team)
            sel.set_location(3, row, 1, 2)
            self.add_component(sel)

        if Params.getvalue("member-activite-enable"):
            lbl = XferCompLabelForm('lblactivity')
            lbl.set_value_as_name(Params.getvalue("member-activite-text"))
            lbl.set_location(4, row)
            self.add_component(lbl)
            sel = XferCompCheckList('activity')
            sel.set_select_query(Activity.objects.all())
            sel.set_value(activity)
            sel.set_location(5, row, 1, 2)
            self.add_component(sel)

        lbl = XferCompLabelForm('lbldateref')
        lbl.set_value_as_name(_("reference date"))
        lbl.set_location(6, row)
        self.add_component(lbl)

        dtref = XferCompDate('dateref')
        dtref.set_value(dateref)
        dtref.set_needed(True)
        dtref.set_location(7, row, 2)
        self.add_component(dtref)

        if Params.getvalue("member-filter-genre"):
            lbl = XferCompLabelForm('lblgenre')
            lbl.set_value_as_name(_("genre"))
            lbl.set_location(6, row + 1)
            self.add_component(lbl)
            sel = XferCompSelect('genre')
            list_genre = list(self.item.get_field_by_name('genre').choices)
            list_genre.insert(0, (0, '---'))
            sel.set_select(list_genre)
            sel.set_location(7, row + 1)
            sel.set_value(genre)
            self.add_component(sel)

        lbl = XferCompLabelForm('lblstatus')
        lbl.set_value_as_name(_("status"))
        lbl.set_location(6, row + 2)
        self.add_component(lbl)
        sel = XferCompSelect('status')
        list_status = list(Subscription.get_field_by_name('status').choices)
        del list_status[0]
        del list_status[-2]
        del list_status[-1]
        list_status.insert(0, (-1, '%s & %s' % (_('building'), _('valid'))))
        sel.set_select(list_status)
        sel.set_location(7, row + 2)
        sel.set_value(status)
        self.add_component(sel)

        btn = XferCompButton('btndateref')
        btn.set_location(8, row + 1, 1, 2)
        btn.set_action(self.request, self.get_action(_('Refresh'), ''),
                       modal=FORMTYPE_REFRESH, close=CLOSE_NO)
        self.add_component(btn)
示例#10
0
文件: editors.py 项目: Diacamma2/asso
 def edit(self, xfer):
     autocreate = xfer.getparam('autocreate', 0) == 1
     xfer.change_to_readonly("adherent")
     cmp_status = xfer.get_components('status')
     if autocreate:
         if Params.getvalue("member-subscription-mode") == 2:
             status = 1
         else:
             status = 0
         cmp_status.set_value(status)
         xfer.change_to_readonly("status")
         xfer.params['status'] = status
     elif self.item.id is None:
         del cmp_status.select_list[0]
         del cmp_status.select_list[-2]
         del cmp_status.select_list[-1]
     else:
         xfer.change_to_readonly("status")
     last_subscription = self.item.adherent.last_subscription
     cmp_subscriptiontype = xfer.get_components('subscriptiontype')
     if (self.item.id is not None) or autocreate:
         xfer.change_to_readonly('season')
     else:
         cmp_season = xfer.get_components('season')
         if self.item.season_id is None:
             self.item.season = Season.current_season()
             cmp_season.set_value(self.item.season.id)
         cmp_season.set_action(xfer.request, xfer.get_action(),
                               close=CLOSE_NO, modal=FORMTYPE_REFRESH)
         if (last_subscription is not None) and (xfer.getparam('subscriptiontype') is None):
             cmp_subscriptiontype.set_value(
                 last_subscription.subscriptiontype.id)
     if self.item.subscriptiontype_id is None:
         if len(cmp_subscriptiontype.select_list) == 0:
             raise LucteriosException(IMPORTANT, _("No subscription type defined!"))
         cmp_subscriptiontype.get_reponse_xml()
         self.item.subscriptiontype = SubscriptionType.objects.get(
             id=cmp_subscriptiontype.value)
     cmp_subscriptiontype.set_action(xfer.request, xfer.get_action(), close=CLOSE_NO, modal=FORMTYPE_REFRESH)
     row = xfer.get_max_row() + 1
     season = self.item.season
     if self.item.subscriptiontype.duration == 0:  # annually
         lbl = XferCompLabelForm("lbl_seasondates")
         lbl.set_location(1, row)
         lbl.set_value_as_name(_('annually'))
         xfer.add_component(lbl)
         lbl = XferCompLabelForm("seasondates")
         lbl.set_location(2, row)
         lbl.set_value("%s => %s" % (formats.date_format(
             season.begin_date, "SHORT_DATE_FORMAT"), formats.date_format(season.end_date, "SHORT_DATE_FORMAT")))
         xfer.add_component(lbl)
     elif self.item.subscriptiontype.duration == 1:  # periodic
         lbl = XferCompLabelForm("lbl_period")
         lbl.set_location(1, row)
         lbl.set_value_as_name(_('period'))
         xfer.add_component(lbl)
         sel = XferCompSelect('period')
         sel.set_needed(True)
         sel.set_select_query(season.period_set.all())
         sel.set_location(2, row)
         xfer.add_component(sel)
     elif self.item.subscriptiontype.duration == 2:  # monthly
         lbl = XferCompLabelForm("lbl_month")
         lbl.set_location(1, row)
         lbl.set_value_as_name(_('month'))
         xfer.add_component(lbl)
         sel = XferCompSelect('month')
         sel.set_needed(True)
         sel.set_select(season.get_months())
         sel.set_location(2, row)
         xfer.add_component(sel)
     elif self.item.subscriptiontype.duration == 3:  # calendar
         lbl = XferCompLabelForm("lbl_begin_date")
         lbl.set_location(1, row)
         lbl.set_value_as_name(_('begin date'))
         xfer.add_component(lbl)
         begindate = XferCompDate('begin_date')
         begindate.set_needed(True)
         begindate.set_value(season.date_ref)
         begindate.set_location(2, row)
         xfer.add_component(begindate)
     if self.item.id is None:
         xfer.item = License()
         if last_subscription is not None:
             licenses = last_subscription.license_set.all()
             if len(licenses) > 0:
                 xfer.item = licenses[0]
         xfer.fill_from_model(1, row + 1, False)
         xfer.item = self.item
         team = xfer.get_components('team')
         if team is not None:
             team.set_needed(True)
         activity = xfer.get_components('activity')
         if activity is not None:
             activity.set_needed(True)