[IMP] Saving survey data

bzr revid: rim@openerp.com-20131216073743-j0sdavdqprp2xawl
This commit is contained in:
Richard Mathot (OpenERP) 2013-12-16 08:37:43 +01:00
parent be090d5a40
commit efd748c4ca
2 changed files with 22 additions and 22 deletions

View File

@ -1025,7 +1025,7 @@ class survey_user_input_line(osv.osv):
'page_id': question.page_id.id, 'page_id': question.page_id.id,
'survey_id': question.survey_id.id, 'survey_id': question.survey_id.id,
} }
if answer_tag in post: if answer_tag in post and post[answer_tag].strip() != '':
vals.update({'answer_type': 'date', 'value_date': post[answer_tag]}) vals.update({'answer_type': 'date', 'value_date': post[answer_tag]})
else: else:
vals.update({'skipped': True}) vals.update({'skipped': True})
@ -1039,26 +1039,26 @@ class survey_user_input_line(osv.osv):
self.create(cr, uid, vals, context=context) self.create(cr, uid, vals, context=context)
return True return True
# def save_line_simple_choice(self, cr, uid, user_input_id, question, post, answer_tag, context=None): def save_line_simple_choice(self, cr, uid, user_input_id, question, post, answer_tag, context=None):
# vals = { vals = {
# 'user_input_id': user_input_id, 'user_input_id': user_input_id,
# 'question_id': question.id, 'question_id': question.id,
# 'page_id': question.page_id.id, 'page_id': question.page_id.id,
# 'survey_id': question.survey_id.id, 'survey_id': question.survey_id.id,
# } }
# if answer_tag in post: if answer_tag in post and post[answer_tag].strip() != '':
# vals.update({'answer_type': 'date', 'value_date': post[answer_tag]}) vals.update({'answer_type': 'date', 'value_date': post[answer_tag]})
# else: else:
# vals.update({'skipped': True}) vals.update({'skipped': True})
# old_uil = self.search(cr, uid, [('user_input_id', '=', user_input_id), old_uil = self.search(cr, uid, [('user_input_id', '=', user_input_id),
# ('survey_id', '=', question.survey_id.id), ('survey_id', '=', question.survey_id.id),
# ('question_id', '=', question.id)], ('question_id', '=', question.id)],
# context=context) context=context)
# if old_uil: if old_uil:
# self.write(cr, uid, old_uil[0], vals, context=context) self.write(cr, uid, old_uil[0], vals, context=context)
# else: else:
# self.create(cr, uid, vals, context=context) self.create(cr, uid, vals, context=context)
# return True return True
def dict_keys_startswith(dictionary, string): def dict_keys_startswith(dictionary, string):

View File

@ -147,7 +147,7 @@
</template> </template>
<template id="numerical_box" name="Numerical box"> <template id="numerical_box" name="Numerical box">
<input type="number" step="1" class="form-control" t-att-name="prefix"/> <input type="number" class="form-control" t-att-name="prefix"/>
</template> </template>
<template id="datetime" name="Datetime box"> <template id="datetime" name="Datetime box">