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",
174 class Teammember(osv.Model):
175 _name = "projet.teammember"
177 _inherit = "res.partner"
180 "projets": fields.many2many("projet.projet",
181 "projet_projet_teammember_rel",
184 "charges": fields.one2many("projet.projet",
190 class Type_Phase(osv.Model):
191 _name = "projet.type_phase"
193 _statuts = [("actif", "Actif"), ("inactif", "Inactif")]
196 "name": fields.char(string="Title", size=64, required=True),
197 "description": fields.text(string="Description"),
198 "statut": fields.selection(_statuts, string="Statut"),
202 class Phase(osv.Model):
203 _name = "projet.phase"
205 _statuts = [("actif", "Actif"), ("inactif", "Inactif")]
209 "name": fields.char(string="Title", size=64, required=True),
210 "description": fields.text(string="Description"),
211 "statut": fields.selection(_statuts, string="Statut"),
212 "type_phase_id": fields.many2one("projet.type_phase",
213 string="Type phase"),
214 "projet_id": fields.many2one("projet.projet",
217 "charges": fields.one2many("projet.charge",
220 "evolutions": fields.one2many("projet.evolution",
222 string="Evolutions"),
223 "palier_id": fields.many2one("projet.palier",
227 #TODO trouver un nom a cette chose
228 class qqch(osv.Model):
229 _name = "projet.qqch"
231 _statuts = [("cree", "Crée"), ("encours", "En cours"),
232 ("termine", "Terminé"), ("abandonne", "Abandonné"),
233 ("suspendu", "Suspendu"), ("generique", "Générique")]
236 "name": fields.char(string="Title", size=64, required=True),
237 "description": fields.text(string="Description"),
238 "commentaire": fields.text(string="Commentaire"),
239 "statut": fields.selection(_statuts, string="Statut"),
240 "version": fields.char(string="Version", size=16),
241 "date_jalon": fields.date(string="Jalon"),
242 "date_init_deb": fields.date(string="Date initiale début"),
243 "date_init_fin": fields.date(string="Date initiale de fin"),
244 "date_plan_deb": fields.date(string="Date plannifiée début"),
245 "date_plan_fin": fields.date(string="Date plannifiée de fin"),
246 "date_reel_deb": fields.date(string="Data réelle début"),
247 "date_reel_fin": fields.date(string="Data réelle fin"),
252 "date_init_deb_before_date_init_fin",
253 "CHECK(date_init_deb<> date_init_fin)",
254 "The date_init_deb should be previous date_init_fin",
257 "date_plan_deb_before_date_plan_fin",
258 "CHECK(date_plan_deb <> date_plan_fin)",
259 "The date_plan_deb should be previous date_plan_fin",
262 "date_reel_deb_before_date_reel_fin",
263 "CHECK(date_reel_deb<> date_reel_fin)",
264 "The date_reel_deb should be previous date_reel_fin",
269 class Chantier(osv.Model):
270 _name = "projet.chantier"
272 _inherit = "projet.qqch"
275 "projet_id": fields.many2one("projet.projet",
278 "evolutions": fields.one2many("projet.evolution",
280 string="Evolutions"),
284 class Palier(osv.Model):
285 _name = "projet.palier"
287 _types_palier = [("normal", "Normal"), ("exceptionnel", "Exceptionnel"),
288 ("correctif", "Correctif"), ("autre", "Autre")]
290 _inherit = "projet.qqch"
293 "type_palier": fields.selection(_types_palier, string="Type"),
294 "projet_id": fields.many2one("projet.projet",
297 "evolutions": fields.one2many("projet.evolution",
299 string="Evolutions"),
300 "phases": fields.one2many("projet.phase",
306 class Charge(osv.Model):
307 _name = "projet.charge"
310 "name": fields.char(string="Title", size=64, required=True),
311 "description": fields.text(string="Description"),
312 "teammember_id": fields.many2one("projet.teammember",
313 string="Team Member",
315 "phase_id": fields.many2one("projet.phase",
318 "evolution_id": fields.many2one("projet.evolution",
321 "mo_id": fields.many2one("projet.mo",
328 _choses = [("primaire", "Primaire"),
329 ("secondaire", "Secondaire"),
330 ("generique", "Générique")]
333 "name": fields.char(string="Title"),
334 "description": fields.text(string="Description"),
335 "chose": fields.selection(_choses, string="Chose", required=True),
336 "role_mo_id": fields.many2one("projet.role_mo", string="Role"),
337 "charges": fields.one2many("projet.charge",
343 "chose": "generique"}
346 class moe(osv.Model):
348 _inherit = "projet.mo"
351 "projets": fields.one2many("projet.projet",
357 class moa(osv.Model):
359 _inherit = "projet.mo"
362 "projets": fields.one2many("projet.projet",