X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=mo.py;h=eccd906b5b813c81d3263066a905d67b0354c69b;hb=cc68a2ee5f3669ba144259eaf3722e86c2f23cd0;hp=1873041e26020ab2957422d6772b4a0c47e5becf;hpb=b4791d6f7f07de3f94fbbcd341628ce789f856bd;p=OpenERP%2Fcmmi.git diff --git a/mo.py b/mo.py index 1873041..eccd906 100644 --- a/mo.py +++ b/mo.py @@ -11,10 +11,12 @@ MOA = Maîtrise d'ouvrage (ceux qui demandent et contrôlent) from openerp.osv import osv, fields -class Role_MO(osv.Model): +class RoleMO(osv.Model): """Role MO: différents types de MOE et MOA""" - _name = "projet.role_mo" + _name = "cmmi.mo.role" + + _description = "Rattachement des MOs et des roles." _statuts = [("actif", "Actif"), ("inactif", "Inactif")] @@ -25,54 +27,68 @@ class Role_MO(osv.Model): "code": fields.char(string="Code", size=8, required=True), "description": fields.text(string="Description"), "statut": fields.selection(_statuts, string="Statut"), - "type_mo": fields.selection(_types_mo, string="Type de MO", required=True), - "structures": fields.one2many("projet.structure", - "role_mo_id", - string="MOs"), - "mo_ids": fields.one2many("projet.mo", - "role_mo_id", - string="MOs"), + "type_mo": fields.selection(_types_mo, + string="Type de MO", + required=True), + "mo_ids": fields.one2many("cmmi.mo", #TODO: à vérifier si pas de bugs + "role_mo_id", + string="MOs"), } -class mo(osv.Model): - _name = "projet.mo" +class Mo(osv.Model): + _name = "cmmi.mo" + + _description = "Table de reference des MOs." - _choses = [("primaire", "Primaire"), - ("secondaire", "Secondaire"), - ("generique", "Générique")] + _rangs = [("primaire", "Primaire"), + ("secondaire", "Secondaire"), + ("generique", "Générique")] _columns = { "name": fields.char(string="Title"), "description": fields.text(string="Description"), - "chose": fields.selection(_choses, string="Chose", required=True), - "role_mo_id": fields.many2one("projet.role_mo", string="Role"), - "charges": fields.one2many("projet.charge", - "mo_id", - string="Charges"), + "rang": fields.selection(_rangs, string="Rang", required=True), + "role_mo_id": fields.many2one("cmmi.mo.role", string="Role"), +# "charges": fields.one2many("cmmi.evolution.charge", # TODO: Faire l'association teammember MO plutôt que MO. +# "mo_id", +# string="Charges"), } _defaults = { - "chose": "generique"} + "rang": "primaire"} + + +class Moe(osv.Model): + _name = "cmmi.mo.moe" + _description = "Table de referencement des MOEs." -class moe(osv.Model): - _name = "projet.moe" - _inherit = "projet.mo" + _inherit = "cmmi.mo" _columns = { - "projets": fields.one2many("projet.projet", - "moe_id", - string="Projets"), + "role_mo_id": fields.many2one("cmmi.mo.role", + string="Role", + domain=[("type_mo", "=", "MOE")]), + "projets": fields.one2many("cmmi.projet", + "moe_id", + string="Projets"), } -class moa(osv.Model): - _name= "projet.moa" - _inherit = "projet.mo" + +class Moa(osv.Model): + _name = "cmmi.mo.moa" + + _description = "Table de referencement des MOAs." + + _inherit = "cmmi.mo" _columns = { - "projets": fields.one2many("projet.projet", - "moa_id", - string="Projets"), + "role_mo_id": fields.many2one("cmmi.mo.role", + string="Role", + domain=[("type_mo", "=", "MOA")]), + "projets": fields.one2many("cmmi.projet", + "moa_id", + string="Projets"), }