From b4791d6f7f07de3f94fbbcd341628ce789f856bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20CHAZALLET?= Date: Fri, 3 May 2013 09:05:10 +0200 Subject: [PATCH] =?utf8?q?S=C3=A9paration=20MO?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- __init__.py | 3 ++- mo.py | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ projet.py | 73 +++---------------------------------------------------- 3 files changed, 84 insertions(+), 70 deletions(-) create mode 100644 mo.py diff --git a/__init__.py b/__init__.py index ba79513..41faac9 100644 --- a/__init__.py +++ b/__init__.py @@ -1 +1,2 @@ -import projet \ No newline at end of file +import mo +import projet diff --git a/mo.py b/mo.py new file mode 100644 index 0000000..1873041 --- /dev/null +++ b/mo.py @@ -0,0 +1,78 @@ +#-*- coding: utf8 -*- +''' +Ce module contient tout ce qui est nécessaire pour qualifier une MO + +On distingue deux grands rôles qui sont les MOE et les MOA : + +MOE = Maîtrise d'oeuvre (ceuf qui font) +MOA = Maîtrise d'ouvrage (ceux qui demandent et contrôlent) +''' + +from openerp.osv import osv, fields + + +class Role_MO(osv.Model): + """Role MO: différents types de MOE et MOA""" + + _name = "projet.role_mo" + + _statuts = [("actif", "Actif"), ("inactif", "Inactif")] + + _types_mo = [("MOE", "MOE"), ("MOA", "MOA")] + + _columns = { + "name": fields.char(string="Title", size=64, required=True), + "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"), + } + + +class mo(osv.Model): + _name = "projet.mo" + + _choses = [("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"), + } + + _defaults = { + "chose": "generique"} + + +class moe(osv.Model): + _name = "projet.moe" + _inherit = "projet.mo" + + _columns = { + "projets": fields.one2many("projet.projet", + "moe_id", + string="Projets"), + } + + +class moa(osv.Model): + _name= "projet.moa" + _inherit = "projet.mo" + + _columns = { + "projets": fields.one2many("projet.projet", + "moa_id", + string="Projets"), + } diff --git a/projet.py b/projet.py index da2cdb4..0a00efb 100644 --- a/projet.py +++ b/projet.py @@ -3,7 +3,6 @@ ''' from openerp.osv import osv, fields -from gtk import TRUE class Projet(osv.Model): @@ -114,27 +113,6 @@ class Structure(osv.Model): } -class Role_MO(osv.Model): - _name = "projet.role_mo" - - _statuts = [("actif", "Actif"), ("inactif", "Inactif")] - - _types_mo = [("MOE", "MOE"), ("MOA", "MOA")] - - _columns = { - "name": fields.char(string="Title", size=64, required=True), - "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"), - } - class Module(osv.Model): _name = "projet.module" @@ -224,9 +202,8 @@ class Phase(osv.Model): string="Palier"), } -#TODO trouver un nom a cette chose -class qqch(osv.Model): - _name = "projet.qqch" +class mesurable(osv.Model): + _name = "projet.mesurable" _statuts = [("cree", "Crée"), ("encours", "En cours"), ("termine", "Terminé"), ("abandonne", "Abandonné"), @@ -269,7 +246,7 @@ class qqch(osv.Model): class Chantier(osv.Model): _name = "projet.chantier" - _inherit = "projet.qqch" + _inherit = "projet.mesurable" _columns = { "projet_id": fields.many2one("projet.projet", @@ -287,7 +264,7 @@ class Palier(osv.Model): _types_palier = [("normal", "Normal"), ("exceptionnel", "Exceptionnel"), ("correctif", "Correctif"), ("autre", "Autre")] - _inherit = "projet.qqch" + _inherit = "projet.mesurable" _columns = { "type_palier": fields.selection(_types_palier, string="Type"), @@ -321,45 +298,3 @@ class Charge(osv.Model): "mo_id": fields.many2one("projet.mo", string="Mo"), } - -class mo(osv.Model): - _name = "projet.mo" - - _choses = [("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"), - } - - _defaults = { - "chose": "generique"} - - -class moe(osv.Model): - _name = "projet.moe" - _inherit = "projet.mo" - - _columns = { - "projets": fields.one2many("projet.projet", - "moe_id", - string="Projets"), - } - - -class moa(osv.Model): - _name= "projet.moa" - _inherit = "projet.mo" - - _columns = { - "projets": fields.one2many("projet.projet", - "moa_id", - string="Projets"), - } -- 1.7.10.4