Beispiel #1
0
    def find_deadline_from_invoice(cls, business, invoice):
        """
        Find the deadline having this invoice attached to it

        :param obj business: The parent Business
        :param obj invoice: The associated Invoice
        """
        from autonomie.models.project.business import BusinessPaymentDeadline
        result = BusinessPaymentDeadline.query().filter_by(
            invoice_id=invoice.id).filter_by(business_id=business.id).first()
        return result
    def find_deadline_from_invoice(cls, business, invoice):
        """
        Find the deadline having this invoice attached to it

        :param obj business: The parent Business
        :param obj invoice: The associated Invoice
        """
        from autonomie.models.project.business import BusinessPaymentDeadline
        result = BusinessPaymentDeadline.query().filter_by(
            invoice_id=invoice.id
        ).filter_by(
            business_id=business.id
        ).first()
        return result
Beispiel #3
0
 def _add_deposit_deadline(cls, business, estimation):
     """
     Add a deposit deadline to a business
     """
     deposit = estimation.deposit
     if not deposit:
         return business
     from autonomie.models.project.business import BusinessPaymentDeadline
     query = BusinessPaymentDeadline.query()
     query = query.filter_by(business_id=business.id)
     query = query.filter_by(estimation_id=estimation.id)
     query = query.filter_by(deposit=True)
     if query.count() == 0:
         business.payment_deadlines.append(
             BusinessPaymentDeadline(
                 business_id=business.id,
                 estimation_id=estimation.id,
                 deposit=True,
             ))
         DBSESSION().merge(business)
     return business
 def _add_deposit_deadline(cls, business, estimation):
     """
     Add a deposit deadline to a business
     """
     deposit = estimation.deposit
     if not deposit:
         return business
     from autonomie.models.project.business import BusinessPaymentDeadline
     query = BusinessPaymentDeadline.query()
     query = query.filter_by(business_id=business.id)
     query = query.filter_by(estimation_id=estimation.id)
     query = query.filter_by(deposit=True)
     if query.count() == 0:
         business.payment_deadlines.append(
             BusinessPaymentDeadline(
                 business_id=business.id,
                 estimation_id=estimation.id,
                 deposit=True,
             )
         )
         DBSESSION().merge(business)
     return business