Newer
Older
# Copyright 2020 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import datetime, timedelta
from odoo import models, fields, api
class Project(models.Model):
_inherit = "project.project"
# Champs étape "Demande" => Vue générale
name_subtitle = fields.Char("Sous-titre")
first_contact_id = fields.Many2one(
'res.partner',
string='1er contact',
domain=[
('active', '=', True),
('is_company', '=', False)],
on_delete='restrict')
type_contact = fields.Selection([
('pdp', 'Porteur de projet'),
('adherent', 'Adhérent'),
('no_adherent', 'Non adhérent')],
string="Type contact")
date_first_contact = fields.Date(

Juliana
committed
"Date de 1er contact",
default=fields.Date.today)
prescripteur_id = fields.Many2one(
'res.partner',
string='Prescripteur',
domain=[
('active', '=', True),
('is_company', '=', False)],
on_delete='restrict')
prescripteur_company_id = fields.Many2one(
'res.partner',
string='Structure prescripteur',
domain=[
('active', '=', True),
('is_company', '=', True)],
on_delete='restrict')
porteurs_projets_ids = fields.Many2many(
comodel_name='res.partner.porteur.project',
relation='res_partner_porteur_project_rel',
column1='porteur_id',
column2='project_id',
string="Porteurs de projet")
description = fields.Text("Description")
territoire_id = fields.Many2one(
'res.partner',
string='Territoire',
domain=[
('active', '=', True),
('is_company', '=', True),
('type_structure_id', '!=', False)],
on_delete='restrict')

Juliana
committed
cfd_id = fields.Many2one(
'res.users',
string="CFD",
default=lambda self: self.env.user)
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Champs étape "Instruction" => Vue générale
od_id = fields.Many2one(
'res.partner',
string='OD',
domain=[
('active', '=', True),
('is_company', '=', True)],
on_delete='restrict')
animateur_id = fields.Many2one(
'res.partner',
string='Animateur',
domain=[
('active', '=', True),
('is_company', '=', False)],
on_delete='restrict')
type_convention_id = fields.Many2one(
'adefpat.type.convention',
string="Type de convention de financement")
date_ca = fields.Date("Date de CA pressenti")
date_start = fields.Date("Date de démarrage prévisionnel")
# list_photos_ids = fields.One2many('images')
# documents_ids = fields.One2many('ir.attachment', "Documents")
# Champs étape "Instruction" => Onglet Dossier
contexte = fields.Text("Contexte projet")
caract_beneficiaire = fields.Text("Caractéristiques du bénéficiaire")
historique = fields.Text("Historique & Aujourd’hui")
besoins_beneficiaires = fields.Text("Besoins des bénéficiaires")
objectifs_accompagnement = fields.Text("Objectifs d’accompagnement / compétences à acquérir (pour le bénéficiaire)")
competences_requises = fields.Text("Compétences requises pour le consultant formateur")
secteurs_requis = fields.Text("Secteurs d’éctivités dont la connaissance est requise pour le consultant formateur")
modalites_intervention = fields.Text("Modalités d'intervention")
modalites_facturation = fields.Text("Modalités de facturation")
modalites_reponse = fields.Text("Modalités de réponse")
# Infos dossier CA
type_beneficiaire = fields.Selection(
[],
string="Type de bénéficiaires")
objectif_projet = fields.Selection(
[],
string="Objectif projet")
secteur_crit = fields.Selection(
[],
string="Secteur d'activité")
taille = fields.Selection(
[],
string="Taille entreprise")
objectif_formation = fields.Selection(
[],
string="Objectif formation")
type_formation = fields.Selection(
[],
string="Type formation")
encadrement = fields.Selection(
[],
string="Encadrement Aides")
lieu = fields.Text("Lieu")
periode_realisation = fields.Text("Période de réalisation")
# duree_totale
# info_budget
# Champs étape "Instruction" => Onglet Consultation
consulant_ids = fields.Many2many(
comodel_name='res.partner.consultants.project',
relation='res_partner_consultants_project_rel',
column1='consultant_id',
column2='project_id',
string="Consultants")
# Champs étape "Instruction" => Onglet GAP
elu_referent_id = fields.Many2one(
'res.partner',
string='Élu référent',
domain=[
('active', '=', True),
('is_company', '=', False)],
on_delete='restrict')
membre_ids = fields.Many2many(
comodel_name='res.partner.membres.project',
relation='res_partner_membres_project_rel',
column1='membre_id',
column2='project_id',
string="Membres")
# documents_gap_ids = fields.One2many('ir.attachment', string="Documents GAP")
modalite_gap = fields.Text("Modalités GAP")
reunion_ids = fields.One2many('adefpat.reunion.gap', 'project_id', string="Réunions")
date_gap = fields.Date("Date du GAP")
# Champs étape "Prêt pour CA" => Onglet Général
num_dossier = fields.Char("Numéro de dossier")
@api.multi
def validate_ca(self):
for project in self:
project.num_dossier = datetime.strftime(datetime.today(), '%y') + self.env['ir.sequence'].next_by_code(
'increment_num_dossier')
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
class AdefpatTypeConvention(models.Model):
_name = 'adefpat.type.convention'
_description = 'Liste type de convetion'
name = fields.Char("Convention")
class AdefpatReunionGAP(models.Model):
_name = 'adefpat.reunion.gap'
_description = 'Réunions GAP'
name = fields.Char("Nom de la réunion")
# document_ids = fields.One2many('ir.attachment', string="Documents")
date = fields.Date("Date du GAP")
project_id = fields.Many2one(
'project.project',
string='Projet',
default=lambda self: self.env.context.get('default_project_id'))
class AdefpatMembresProjets(models.Model):
_name = 'res.partner.membres.project'
_description = 'Membres'
name = fields.Char("Nom du membre")
partner_id = fields.Many2one(
'res.partner',
string='Membre',
domain=[
('active', '=', True),
('is_company', '=', False)],
on_delete='restrict')
lastname = fields.Char(
related='partner_id.lastname',

Juliana
committed
string="Nom",
store=False)
firstname = fields.Char(
related='partner_id.firstname',
string="Prénom",

Juliana
committed
store=False)
commune = fields.Char(
related='partner_id.city',
string="Commune",

Juliana
committed
store=False)
mobile = fields.Char(
related='partner_id.mobile',
string="Mobile",

Juliana
committed
store=False)
fixe = fields.Char(
related='partner_id.phone',
string="Fixe",

Juliana
committed
store=False)
email = fields.Char(
related='partner_id.email',
string="Email",

Juliana
committed
store=False)
class AdefpatConsultantsProjets(models.Model):
_name = 'res.partner.consultants.project'
_description = 'Consultants'
name = fields.Char("Nom du consultant")
partner_id = fields.Many2one(
'res.partner',
string='Consultant',
domain=[
('active', '=', True),
('is_company', '=', False)],
on_delete='restrict')
lastname = fields.Char(
related='partner_id.lastname',

Juliana
committed
string="Nom",
store=False)

Juliana
committed
string="Prénom",
store=False)

Juliana
committed
string="Mobile",
store=False)

Juliana
committed
string="Email",
store=False)
reference = fields.Selection([
('reference', 'Référencé'),
('prereference', 'Pré-Référencé'),
('dereference', 'Dé-Référencé')],
related='partner_id.reference',

Juliana
committed
string="Référencement",
store=False)

Juliana
committed
cout_journée = fields.Float("Coût journée")
# document_ids = fields.One2many('ir.attachment', string="Documents Consultants")
date_selection = fields.Date("Date de sélection")
date_notification = fields.Date("Date de notification")
class AdefpatPorteursProjets(models.Model):
_name = 'res.partner.porteur.project'
_description = 'Porteurs de projets'
name = fields.Char("Nom du porteurs")
partner_id = fields.Many2one(
'res.partner',
string='Porteur de projet',
domain=[
('active', '=', True),
('is_company', '=', False)],
on_delete='restrict')
lastname = fields.Char(
related='partner_id.lastname',

Juliana
committed
string="Nom",
store=False)

Juliana
committed
string="Prénom",
store=False)

Juliana
committed
string="Commune",
store=False)

Juliana
committed
string="Mobile",
store=False)

Juliana
committed
string="Fixe",
store=False)

Juliana
committed
string="Email",
store=False)