Beispiel #1
0
    def submit_success(self, appstruct):
        log.debug("Submitting invoice add")
        appstruct = get_invoice_dbdatas(appstruct)

        # Since the call to get_next_invoice_number commits the current
        # transaction, it needs to be called before creating our invoice, to
        # avoid missing arguments errors
        snumber = self.context.get_next_invoice_number()

        invoice = Invoice()
        invoice.project = self.context
        invoice.owner = self.request.user
        invoice = merge_session_with_post(invoice, appstruct["invoice"])
        invoice.set_sequence_number(snumber)
        invoice.set_number()
        invoice.set_name()
        try:
            invoice = self.set_task_status(invoice)
            # Line handling
            invoice = add_lines_to_invoice(invoice, appstruct)
            self.dbsession.add(invoice)
            self.dbsession.flush()
            self.session.flash(u"La facture a bien été ajoutée.")
        except Forbidden, err:
            self.request.session.flash(err.message, queue='error')
Beispiel #2
0
    def submit_success(self, appstruct):
        log.debug("Submitting invoice add")
        appstruct = get_invoice_dbdatas(appstruct)

        # Since the call to get_next_invoice_number commits the current
        # transaction, it needs to be called before creating our invoice, to
        # avoid missing arguments errors
        snumber = self.context.get_next_invoice_number()

        invoice = Invoice()
        invoice.project = self.context
        invoice.owner = self.request.user
        invoice = merge_session_with_post(invoice, appstruct["invoice"])
        invoice.set_sequence_number(snumber)
        invoice.set_number()
        invoice.set_name()
        try:
            invoice = self.set_task_status(invoice)
            # Line handling
            invoice = add_lines_to_invoice(invoice, appstruct)
            self.dbsession.add(invoice)
            self.dbsession.flush()
            self.session.flash(u"La facture a bien été ajoutée.")
        except Forbidden, err:
            self.request.session.flash(err.message, queue='error')
Beispiel #3
0
    def submit_success(self, appstruct):
        log.debug("Submitting invoice add")
        appstruct = get_invoice_dbdatas(appstruct)

        customer_id = appstruct["task"]['customer_id']
        customer = Customer.get(customer_id)

        invoice = Invoice(
            self.context.company,
            customer,
            self.context,
            self.context.phases[0],
            self.request.user,
        )
        invoice = merge_session_with_post(
            invoice,
            appstruct["task"]
        )
        try:
            invoice = self.set_task_status(invoice)
            # Line handling
            invoice = add_lines_to_invoice(invoice, appstruct)
            self.dbsession.add(invoice)
            self.dbsession.flush()
            self.session.flash(u"La facture a bien été ajoutée.")
        except Forbidden, err:
            self.request.session.flash(err.message, queue='error')