From 289fd756682d0be824e1841e44b027e376d6b61b Mon Sep 17 00:00:00 2001 From: Alicia FLOREZ Date: Fri, 31 May 2013 12:22:09 +0200 Subject: [PATCH] =?utf8?q?Ajout=20d'un=20champ=20dans=20projet,=20permettant?= =?utf8?q?=20de=20r=C3=A9cup=C3=A9rer=20les=20phases=20s=C3=A9lectionn=C3=A9?= =?utf8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- projet.py | 15 +++++++++++++++ views/projet.xml | 3 +++ wizards/domaine.py | 4 ++-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/projet.py b/projet.py index 1b86edf..90a40d6 100644 --- a/projet.py +++ b/projet.py @@ -64,7 +64,18 @@ class Projet(osv.Model): break else: result[project.id] = "Any MOE is selected as main MOE yet" + return result + + def _get_phases_selectionnees(self, cr, uid, ids, field_name=None, arg=None, context=None): + result = {} + for projet in self.browse(cr, uid, ids, context=context): + res = [] + for phase in projet.phases: + #import pdb; pdb.set_trace() + if phase.selectionne: + res.append(phase.id) + result[projet.id] = res return result @@ -111,6 +122,10 @@ class Projet(osv.Model): "main_domain": fields.function(_get_main_domain, type="string", string="Domaine principal"), + "phases_selectionnees": fields.function(_get_phases_selectionnees, + type="one2many", + obj="cmmi.projet.phase", + string="Phases sélectionnées"), } diff --git a/views/projet.xml b/views/projet.xml index babaaef..0f06d54 100644 --- a/views/projet.xml +++ b/views/projet.xml @@ -117,6 +117,9 @@ + + + diff --git a/wizards/domaine.py b/wizards/domaine.py index ba926b4..510150c 100644 --- a/wizards/domaine.py +++ b/wizards/domaine.py @@ -103,7 +103,7 @@ class ProjetDomaineWizard(osv.TransientModel): # Fermer simplement la fenêtre return {'type': 'ir.actions.act_window_close'} - #----------------------------------------------------------------------- + #====================================================================== # # Renvoi vers la vue du modèle # return { # "type": 'ir.actions.act_window', @@ -114,7 +114,7 @@ class ProjetDomaineWizard(osv.TransientModel): # #'target': 'new', = pop-up # 'context': context, # } - #----------------------------------------------------------------------- + #====================================================================== _columns = { "main": fields.boolean(string="Domaine principal ?"), -- 1.7.10.4