# 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( "Date de 1er contact") 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') cfd_id = fields.Many2one('res.users', string="CFD") # 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") 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', readonly=False) firstname = fields.Char( related='partner_id.firstname', string="Prénom", readonly=False) commune = fields.Char( related='partner_id.city', string="Commune", readonly=False) mobile = fields.Char( related='partner_id.mobile', string="Mobile", readonly=False) fixe = fields.Char( related='partner_id.phone', string="Fixe", readonly=False) email = fields.Char( related='partner_id.email', string="Email", readonly=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', string="Nom") firstname = fields.Char( related='partner_id.firstname', string="Prénom") commune = fields.Char( related='partner_id.city', string="Commune") mobile = fields.Char( related='partner_id.mobile', string="Mobile") fixe = fields.Char( related='partner_id.phone', string="Fixe") email = fields.Char( related='partner_id.email', string="Email") reference = fields.Selection([ ('reference', 'Référencé'), ('prereference', 'Pré-Référencé'), ('dereference', 'Dé-Référencé')], related='partner_id.reference', string="Référencement") date_cdc = fields.Date("Date d'envoi du CDC") # cout_journée = fields.Monetary("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', string="Nom") firstname = fields.Char( related='partner_id.firstname', string="Prénom") commune = fields.Char( related='partner_id.city', string="Commune") mobile = fields.Char( related='partner_id.mobile', string="Mobile") fixe = fields.Char( related='partner_id.phone', string="Fixe") email = fields.Char( related='partner_id.email', string="Email") statut = fields.Selection( [], string="Statut") eligible = fields.Boolean( string="Eligible")