From 9cd9465271cb7dae51c38210bc2fcb81ed4b771e Mon Sep 17 00:00:00 2001 From: Alicia FLOREZ Date: Tue, 14 May 2013 09:20:58 +0200 Subject: [PATCH] Rajout de l'explosion des fichiers --- views/evolution.xml | 41 +++++++++++++++++++++++++++++++++ views/menu.xml | 43 +++++++++++++++++++++++++++++++++++ views/phase.xml | 45 ++++++++++++++++++++++++++++++++++++ wizards/moe.py | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 192 insertions(+) create mode 100644 views/evolution.xml create mode 100644 views/menu.xml create mode 100644 views/phase.xml create mode 100644 wizards/moe.py diff --git a/views/evolution.xml b/views/evolution.xml new file mode 100644 index 0000000..0b0f107 --- /dev/null +++ b/views/evolution.xml @@ -0,0 +1,41 @@ + + + + + + + evolution.form + cmmi.evolution + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/views/menu.xml b/views/menu.xml new file mode 100644 index 0000000..4bc7c12 --- /dev/null +++ b/views/menu.xml @@ -0,0 +1,43 @@ + + + + + + + + Liste des projets + cmmi.projet + tree,form + + + + Liste des domaines + cmmi.description.domaine + tree,form + + + + Liste des structures + cmmi.mo.structure + tree,form + + + + Liste des phases + cmmi.phase + tree,form + + + + + + + + + + + + + + + diff --git a/views/phase.xml b/views/phase.xml new file mode 100644 index 0000000..16cf02b --- /dev/null +++ b/views/phase.xml @@ -0,0 +1,45 @@ + + + + + + + + phase.form + cmmi.phase + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wizards/moe.py b/wizards/moe.py new file mode 100644 index 0000000..02fc908 --- /dev/null +++ b/wizards/moe.py @@ -0,0 +1,63 @@ +#-*- coding: utf8 -*- + +from openerp.osv import osv, fields + +class ProjetMoeWizard(osv.TransientModel): + + _name = "cmmi.projet.moe.wizard" + + def _moes_selection(self, cr, uid, context=None): + model_base = self.pool.get("cmmi.mo.moe") + model_proj = self.pool.get("cmmi.projet.domaine") + + if context is None or not context.has_key("project_id"): + return [] + + # recherche des lien entre le projet et les domaines + links_ids = model_proj.search( + cr, + uid, + [('project_id', '=', context["project_id"])], + context=context, + ) + + # récupérations des moes déjà sélectionnés pour le projet + excluded_ids = list(set([r['moe_id'][0] for r in model_proj.read( + cr, + uid, + links_ids, + fields=["moe_id"], + context=context + )])) + + # recherche des domaines autres que ceux déjà sélectionnés + domaines_ids = model_base.search( + cr, + uid, + [('id', 'not in', excluded_ids)], + context=context, + ) + + # renvoi des 2 uplets (id, name) + print [(r["id"], r["name"]) for r in model_base.read( + cr, + uid, + domaines_ids, + fields=["id", "name"], + context=context + )] + return [(r["id"], r["name"]) for r in model_base.read( + cr, + uid, + domaines_ids, + fields=["id", "name"], + context=context + )] + + _columns = { + "main": fields.boolean(string="Domaine principal ?"), + "project_id": fields.many2one("cmmi.projet", + string="Projet"), + "domaine_id": fields.selection(_domaines_selection, + string="Domaine"), + } \ No newline at end of file -- 1.7.10.4