Beispiel #1
0
    def record_payment(self, **kw):
        """
        Record a payment for the current expense
        """
        logger.debug("Recording a payment")
        resulted = kw.pop('resulted', False)

        payment = ExpensePayment()
        for key, value in kw.iteritems():
            setattr(payment, key, value)
        logger.info(u"Amount : {0}".format(payment.amount))
        self.payments.append(payment)

        user_id = kw.get('user_id')
        return self.check_resulted(force_resulted=resulted, user_id=user_id)
    def query(self, query_params_dict, form_name):
        """
            Retrieve the exports we want to export
        """
        query = ExpensePayment.query()

        if form_name == 'period_form':
            start_date = query_params_dict['start_date']
            end_date = query_params_dict['end_date']
            query = self._filter_date(query, start_date, end_date)

        elif form_name == 'expense_id_form':
            sheet_id = query_params_dict['sheet_id']
            query = self._filter_number(query, sheet_id)

        if 'exported' not in query_params_dict or \
                not query_params_dict.get('exported'):
            query = query.filter_by(exported=False)

        return query
Beispiel #3
0
    def query(self, query_params_dict, form_name):
        """
            Retrieve the exports we want to export
        """
        query = ExpensePayment.query()

        if form_name == 'period_form':
            start_date = query_params_dict['start_date']
            end_date = query_params_dict['end_date']
            query = self._filter_date(query, start_date, end_date)

        elif form_name == 'expense_id_form':
            sheet_id = query_params_dict['sheet_id']
            query = self._filter_number(query, sheet_id)

        if 'exported' not in query_params_dict or \
                not query_params_dict.get('exported'):
            query = query.filter_by(exported=False)

        return query