From 7714ba7a9db96d51342931c44b57568e02b00b24 Mon Sep 17 00:00:00 2001 From: Alicia FLOREZ Date: Mon, 13 May 2013 18:03:59 +0200 Subject: [PATCH] =?utf8?q?Cr=C3=A9ation=20classe=20ProjetMoe?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- __openerp__.py | 3 +-- mo.py | 1 + projet.py | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/__openerp__.py b/__openerp__.py index eaba384..558e38e 100644 --- a/__openerp__.py +++ b/__openerp__.py @@ -10,11 +10,10 @@ 'views/wizards/domaine.xml', # Vues associées aux modèles 'views/projet.xml', - 'views/menu.xml', 'views/evolution.xml', 'views/phase.xml', # Menus - #TODO, + 'views/menu.xml', # Données 'datas/moe.xml', 'datas/moa.xml', diff --git a/mo.py b/mo.py index d8fe2f2..fa3599a 100644 --- a/mo.py +++ b/mo.py @@ -69,6 +69,7 @@ class Moe(osv.Model): } + class Moa(osv.Model): _name = "cmmi.mo.moa" _inherit = "cmmi.mo" diff --git a/projet.py b/projet.py index 39b2327..8758a83 100644 --- a/projet.py +++ b/projet.py @@ -113,3 +113,26 @@ class ProjetDomaine(osv.Model): self.write(cr, uid, current_id, {'main': True}, context=context) return {'value': {'main': True}} + + + +class ProjetMoe(osv.Model): + _name = "cmmi.projet.moe" + + def _get_name(self, cr, uid, ids, field_name=None, arg=None, context=None): + if isinstance(ids, (int, long)): + ids = [ids] + return dict([(i, r.domaine_id.name) for i, r in + zip(ids, self.browse(cr, uid, ids, context=context))]) + + _columns = { + "name": fields.function(_get_name, + type='char', + store=True, + string="Nom de la MOE"), + "main": fields.boolean(string="MOE principale ?"), + "project_id": fields.many2one("cmmi.projet", + string="Projet"), + "moe_id": fields.many2one("cmmi.mo.moe", + string="MOE"), + } \ No newline at end of file -- 1.7.10.4