X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=projet.py;h=f37b9579efecdd5802a35751587eac618c8e7fb2;hb=2be62670d519494aad2e45f78a2bbdac4fa9b337;hp=90a40d69352e49795272f9f0f04eceacf0010cc2;hpb=289fd756682d0be824e1841e44b027e376d6b61b;p=OpenERP%2Fcmmi.git diff --git a/projet.py b/projet.py index 90a40d6..f37b957 100644 --- a/projet.py +++ b/projet.py @@ -5,6 +5,7 @@ from openerp.osv import osv, fields +# ================================== PROJET ================================= # class Projet(osv.Model): _name = "cmmi.projet" @@ -82,6 +83,9 @@ class Projet(osv.Model): _columns = { "name": fields.char(string="Title", size=64, required=True), "description": fields.text(string="Description"), + "use_chantier": fields.boolean(string="Utilisation de la notion de chantier ?"), + "use_palier": fields.boolean(string="Utilisation de la notion de palier ?"), + # Backrefs "domains": fields.one2many("cmmi.projet.domaine", "project_id", @@ -110,7 +114,6 @@ class Projet(osv.Model): "evolutions": fields.one2many("cmmi.evolution", "projet_id", string="Evolutions"), - # TODO: faire un champs fonction qui renvoie uniquement les domaines sélectionnés # Champs fonction rapatriant les mo ou domaine principaux "moe_id": fields.function(_get_main_moe, @@ -128,6 +131,11 @@ class Projet(osv.Model): string="Phases sélectionnées"), } + _defaults = { + "use_chantier": True, + "use_palier": True, + } + def create(self, cr, uid, vals, context=None): project_id = osv.Model.create(self, cr, uid, vals, context=context) @@ -163,6 +171,7 @@ class Projet(osv.Model): +# ============================= PROJET DOMAINE ============================== # class ProjetDomaine(osv.Model): _name = "cmmi.projet.domaine" @@ -222,6 +231,7 @@ class ProjetDomaine(osv.Model): +# =============================== PROJET MOE ================================ # class ProjetMoe(osv.Model): _name = "cmmi.projet.moe" @@ -280,6 +290,7 @@ class ProjetMoe(osv.Model): +# =============================== PROJET MOA ================================ # class ProjetMoa(osv.Model): _name = "cmmi.projet.moa" @@ -338,21 +349,18 @@ class ProjetMoa(osv.Model): +# =============================== PROJET PHASE ============================== # class ProjetPhase(osv.Model): _name = "cmmi.projet.phase" _description = "Rattachement des Phases aux projets" - 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.phase_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, + "name": fields.related("phase_id", + "name", + read_only=True, + type="char", + relation="cmmi.phase", string="Nom de la phase"), "phase_id": fields.many2one("cmmi.phase", string="Phase", @@ -365,6 +373,7 @@ class ProjetPhase(osv.Model): +# ============================ PROJET TEAM MEMBER =========================== # class ProjetTeammember(osv.Model): _name = "cmmi.projet.teammember"