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['task'] ) 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')
def submit_success(self, appstruct): log.debug("Submitting estimation add") appstruct = get_estimation_dbdatas(appstruct) customer_id = appstruct["task"]['customer_id'] customer = Customer.get(customer_id) estimation = Estimation( self.context.company, customer, self.context, self.context.phases[0], self.request.user, ) estimation = merge_session_with_post( estimation, appstruct['task'] ) try: # Line handling estimation = add_lines_to_estimation(estimation, appstruct) self.dbsession.add(estimation) self.dbsession.flush() estimation = self.set_task_status(estimation) self.session.flash(u"Le devis a bien été ajouté.") except Forbidden, err: self.request.session.flash(err.message, queue='error')
def submit_success(self, appstruct): log.debug("Submitting estimation edit") appstruct = get_estimation_dbdatas(appstruct) # Since the call to get_next_estimation_number commits the current # transaction, it needs to be called before creating our estimation, to # avoid missing arguments errors estimation = self.context estimation = merge_session_with_post(estimation, appstruct["estimation"]) try: estimation = self.set_task_status(estimation) # Line handling estimation = add_lines_to_estimation(estimation, appstruct) estimation = self.dbsession.merge(estimation) self.dbsession.flush() self.session.flash(u"Le devis a bien été modifié.") except Forbidden, err: self.request.session.flash(err.message, queue='error')
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')