5 from openerp.osv import osv, fields
8 class Projet(osv.Model):
10 _name = "projet.projet"
13 "name": fields.char(string="Title", size=64, required=True),
14 "description": fields.text(string="Description"),
15 "domaines": fields.many2many("projet.domaine",
16 "projet_projet_domaine_rel",
19 "structures": fields.many2many("projet.structure",
20 "projet_projet_structure_rel",
23 "structures_moe": fields.many2many("projet.structure",
24 "projet_projet_structure_rel",
27 domain=[('role_mo_id.type_mo', '=', "MOE")]),
28 "structures_moa": fields.many2many("projet.structure",
29 "projet_projet_structure_rel",
32 domain=[('role_mo_id.type_mo', '=', "MOA")]),
33 "team_members": fields.many2many("projet.teammember",
34 "projet_projet_teammember_rel",
36 string="Team Members"),
37 "modules": fields.one2many("projet.module",
40 "chantiers": fields.one2many("projet.chantier",
43 "paliers": fields.one2many("projet.palier",
46 "phases": fields.one2many("projet.phase",
49 "evolutions":fields.one2many("projet.evolution",
52 "moe_id": fields.many2one("projet.moe", string="MoE", required=True),
53 "moa_id": fields.many2one("projet.moa", string="MoA", required=True),
54 "main_domain": fields.many2one("projet.domaine",
55 string="Domaine principal"),
56 "main_structure": fields.many2one("projet.structure",
57 string="Structure principale"),
61 class Evolution(osv.Model):
62 _name = "projet.evolution"
64 _priorites = [("incontournable", "Incontournable"),
65 ("necessaire", "Nécéssaire"),
68 _statuts = [("cree", "Crée"), ("encours", "En cours"),
69 ("termine", "Terminé"), ("abandonne", "Abandonné"),
70 ("suspendu", "Suspendu")]
73 "pid": fields.integer(string="PID"),
74 "name": fields.char(string="Title", size=64, required=True),
75 "description": fields.text(string="Description"),
76 "objectif": fields.text(string="Objectif"),
77 "commentaire": fields.text(string="Commentaire"),
78 "keywords": fields.text(string="Mots clés"),
79 "priorite": fields.selection(_priorites, string="Priorité"),
80 "statut": fields.selection(_statuts, string="Statut"),
81 "charges": fields.one2many("projet.charge",
84 "module_id": fields.many2one("projet.module",
86 "chantier_id": fields.many2one("projet.chantier",
88 "palier_id": fields.many2one("projet.palier",
90 "phase_id": fields.many2one("projet.phase",
92 "projet_id": fields.many2one("projet.projet",
97 class Structure(osv.Model):
99 _name = "projet.structure"
101 _statuts = [("actif", "Actif"), ("inactif", "Inactif")]
104 "name": fields.char(string="Title", size=64, required=True),
105 "code": fields.char(string="Code", size=8, required=True),
106 "description": fields.text(string="Description"),
107 "parent_id": fields.many2one("projet.structure", string="Parent_id"),
108 "statut": fields.selection(_statuts, string="Statut"),
109 "role_mo_id":fields.many2one("projet.role_mo", string="Role MO"),
110 "projets": fields.many2many("projet.projet",
111 "projet_projet_structure_rel",
117 class Role_MO(osv.Model):
118 _name = "projet.role_mo"
120 _statuts = [("actif", "Actif"), ("inactif", "Inactif")]
122 _types_mo = [("MOE", "MOE"), ("MOA", "MOA")]
125 "name": fields.char(string="Title", size=64, required=True),
126 "code": fields.char(string="Code", size=8, required=True),
127 "description": fields.text(string="Description"),
128 "statut": fields.selection(_statuts, string="Statut"),
129 "type_mo": fields.selection(_types_mo, string="Type de MO", required=True),
130 "structures": fields.one2many("projet.structure",
133 "mo_ids": fields.one2many("projet.mo",
138 class Module(osv.Model):
139 _name = "projet.module"
142 "name": fields.char(string="Title", size=64, required=True),
143 "description": fields.text(string="Description"),
144 "projet_id": fields.many2one("projet.projet",
147 "evolutions": fields.one2many("projet.evolution",
153 class Domaine(osv.Model):
154 _name = "projet.domaine"
156 _statuts = [("actif", "Actif"), ("inactif", "Inactif")]
159 "name": fields.char(string="Title", size=64, required=True),
160 "code": fields.char(string="Code", size=8),
161 "description": fields.text(string="Description"),
162 "ordre": fields.integer(string="Ordre"),
163 "parent_id": fields.many2one("projet.domaine", string="Parent_id"),
164 "statut": fields.selection(_statuts, string="Statut"),
165 "projets": fields.many2many("projet.projet",
166 "projet_projet_structure_rel",
172 class Teammember(osv.Model):
173 _name = "projet.teammember"
175 _inherit = "res.partner"
178 "projets": fields.many2many("projet.projet",
179 "projet_projet_teammember_rel",
182 "charges": fields.one2many("projet.projet",
188 class Type_Phase(osv.Model):
189 _name = "projet.type_phase"
191 _statuts = [("actif", "Actif"), ("inactif", "Inactif")]
194 "name": fields.char(string="Title", size=64, required=True),
195 "description": fields.text(string="Description"),
196 "statut": fields.selection(_statuts, string="Statut"),
200 class Phase(osv.Model):
201 _name = "projet.phase"
203 _statuts = [("actif", "Actif"), ("inactif", "Inactif")]
207 "name": fields.char(string="Title", size=64, required=True),
208 "description": fields.text(string="Description"),
209 "statut": fields.selection(_statuts, string="Statut"),
210 "type_phase_id": fields.many2one("projet.type_phase",
211 string="Type phase"),
212 "projet_id": fields.many2one("projet.projet",
215 "charges": fields.one2many("projet.charge",
218 "evolutions": fields.one2many("projet.evolution",
220 string="Evolutions"),
221 "palier_id": fields.many2one("projet.palier",
225 #TODO trouver un nom a cette chose
226 class qqch(osv.Model):
227 _name = "projet.qqch"
229 _statuts = [("cree", "Crée"), ("encours", "En cours"),
230 ("termine", "Terminé"), ("abandonne", "Abandonné"),
231 ("suspendu", "Suspendu"), ("generique", "Générique")]
234 "name": fields.char(string="Title", size=64, required=True),
235 "description": fields.text(string="Description"),
236 "commentaire": fields.text(string="Commentaire"),
237 "statut": fields.selection(_statuts, string="Statut"),
238 "version": fields.char(string="Version", size=16),
239 "date_jalon": fields.date(sring="Jalon"),
240 "date_init_deb": fields.date(sring="Date initiale début"),
241 "date_init_fin": fields.date(sring="Date initiale de fin"),
242 "date_plan_deb": fields.date(string="Date plannifiée début"),
243 "date_plan_fin": fields.date(string="Date plannifiée de fin"),
244 "date_reel_deb": fields.date(string="Data réelle début"),
245 "date_reel_fin": fields.date(string="Data réelle fin"),
250 "date_init_deb_before_date_init_fin",
251 "CHECK(date_init_deb<> date_init_fin)",
252 "The date_init_deb should be previous date_init_fin",
255 "date_plan_deb_before_date_plan_fin",
256 "CHECK(date_plan_deb <> date_plan_fin)",
257 "The date_plan_deb should be previous date_plan_fin",
260 "date_reel_deb_before_date_reel_fin",
261 "CHECK(date_reel_deb<> date_reel_fin)",
262 "The date_reel_deb should be previous date_reel_fin",
267 class Chantier(osv.Model):
268 _name = "projet.chantier"
270 _inherit = "projet.qqch"
273 "projet_id": fields.many2one("projet.projet",
276 "evolutions": fields.one2many("projet.evolution",
278 string="Evolutions"),
282 class Palier(osv.Model):
283 _name = "projet.palier"
285 _types_palier = [("normal", "Normal"), ("exceptionnel", "Exceptionnel"),
286 ("correctif", "Correctif"), ("autre", "Autre")]
288 _inherit = "projet.qqch"
291 "type_palier": fields.selection(_types_palier, string="Type"),
292 "projet_id": fields.many2one("projet.projet",
295 "evolutions": fields.one2many("projet.evolution",
297 string="Evolutions"),
298 "phases": fields.one2many("projet.phase",
304 class Charge(osv.Model):
305 _name = "projet.charge"
308 "name": fields.char(string="Title", size=64, required=True),
309 "description": fields.text(string="Description"),
310 "teammember_id": fields.many2one("projet.teammember",
311 string="Team Member",
313 "phase_id": fields.many2one("projet.phase",
316 "evolution_id": fields.many2one("projet.evolution",
319 "mo_id": fields.many2one("projet.mo",
326 _choses = [("primaire", "Primaire"),
327 ("secondaire", "Secondaire"),
328 ("generique", "Générique")]
331 "name": fields.char(string="Title"),
332 "description": fields.text(string="Description"),
333 "chose": fields.selection(_choses, string="Chose", required=True),
334 "role_mo_id": fields.many2one("projet.role_mo", string="Role"),
335 "charges": fields.one2many("projet.charge",
341 "chose": "generique"}
344 class moe(osv.Model):
346 _inherit = "projet.mo"
349 "projets": fields.one2many("projet.projet",
355 class moa(osv.Model):
357 _inherit = "projet.mo"
360 "projets": fields.one2many("projet.projet",