From 2ffa234d3dd4dc9f9678d8a1c82612767aae7092 Mon Sep 17 00:00:00 2001 From: "Richard Mathot (OpenERP)" Date: Fri, 21 Mar 2014 15:54:34 +0100 Subject: [PATCH] [IMP] survey: - Kanban view refactoring - Move to Marketing menu [FIX] survey: - stages display bzr revid: rim@openerp.com-20140321145434-4l7wvpizqurdsj8v --- addons/survey/__openerp__.py | 3 +- addons/survey/data/survey_stages.xml | 8 ++-- addons/survey/survey.py | 27 +++++++++++- addons/survey/views/survey_views.xml | 81 +++++++++++++--------------------- 4 files changed, 61 insertions(+), 58 deletions(-) diff --git a/addons/survey/__openerp__.py b/addons/survey/__openerp__.py index 3df5ced..fd34141 100644 --- a/addons/survey/__openerp__.py +++ b/addons/survey/__openerp__.py @@ -36,7 +36,7 @@ sent mails with personal token for the invitation of the survey. 'summary': 'Create surveys, collect answers and print statistics', 'author': 'OpenERP SA', 'website': 'https://www.openerp.com/apps/survey/', - 'depends': ['email_template', 'mail', 'website', 'web_kanban_gauge', 'web_graph'], + 'depends': ['email_template', 'mail', 'website', 'web_kanban_gauge', 'web_graph', 'marketing'], 'data': [ 'security/survey_security.xml', 'security/ir.model.access.csv', @@ -56,5 +56,4 @@ sent mails with personal token for the invitation of the survey. 'application': True, 'sequence': 10, 'images': [], - 'css': ['static/src/css/survey.css'], } diff --git a/addons/survey/data/survey_stages.xml b/addons/survey/data/survey_stages.xml index c6ce63b..2482620 100644 --- a/addons/survey/data/survey_stages.xml +++ b/addons/survey/data/survey_stages.xml @@ -6,25 +6,25 @@ Draft - + In progress - + Closed - + Permanent - + diff --git a/addons/survey/survey.py b/addons/survey/survey.py index 8008e99..c330ea9 100644 --- a/addons/survey/survey.py +++ b/addons/survey/survey.py @@ -175,6 +175,31 @@ class survey_survey(osv.Model): ('positive_user_input_limit', 'CHECK (user_input_limit >= 0)', 'Automatic closing limit must be positive') } + def _read_group_stage_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None): + """ Read group customization in order to display all the stages in the + kanban view, even if they are empty """ + stage_obj = self.pool.get('survey.stage') + order = stage_obj._order + access_rights_uid = access_rights_uid or uid + + if read_group_order == 'stage_id desc': + order = '%s desc' % order + + stage_ids = stage_obj._search(cr, uid, [], order=order, access_rights_uid=access_rights_uid, context=context) + result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context) + + # restore order of the search + result.sort(lambda x, y: cmp(stage_ids.index(x[0]), stage_ids.index(y[0]))) + + fold = {} + for stage in stage_obj.browse(cr, access_rights_uid, stage_ids, context=context): + fold[stage.id] = stage.fold or False + return result, fold + + _group_by_full = { + 'stage_id': _read_group_stage_ids + } + # Public methods # def write(self, cr, uid, ids, vals, context=None): @@ -352,7 +377,7 @@ class survey_stage(osv.Model): 'name': fields.text(string="Name", required=True, translate=True), 'sequence': fields.integer(string="Sequence"), 'survey_open': fields.boolean(string="Display these surveys?"), - 'folded': fields.boolean(string="Folded column by default") + 'fold': fields.boolean(string="Folded column by default") } _defaults = { 'sequence': 1, diff --git a/addons/survey/views/survey_views.xml b/addons/survey/views/survey_views.xml index 0c9f28e..fe35ced 100644 --- a/addons/survey/views/survey_views.xml +++ b/addons/survey/views/survey_views.xml @@ -119,7 +119,8 @@