def submit_success(self, appstruct): log.debug("Submitting estimation add") appstruct = get_estimation_dbdatas(appstruct) # Next estimation number for current project snumber = self.context.get_next_estimation_number() estimation = Estimation() estimation.project = self.context estimation.owner = self.request.user estimation = merge_session_with_post(estimation, appstruct["estimation"]) estimation.set_sequence_number(snumber) estimation.set_number() estimation.set_name() try: estimation = self.set_task_status(estimation) # Line handling estimation = add_lines_to_estimation(estimation, appstruct) self.dbsession.add(estimation) self.dbsession.flush() self.session.flash(u"Le devis a bien été ajoutée.") except Forbidden, err: self.request.session.flash(err.message, queue='error')