Skip to content
Extraits de code Groupes Projets

Comparer les révisions

Les modifications sont affichées comme si la révision source était fusionnée avec la révision cible. En savoir plus sur la comparaison des révisions.

Source

Sélectionner le projet cible
No results found
Sélectionner une révision Git
  • 12.0
1 résultat

Cible

Sélectionner le projet cible
  • lefilament/adefpat/adefpat_project
1 résultat
Sélectionner une révision Git
  • 12.0
1 résultat
Afficher les modifications
Validations sur la source (2)
......@@ -4,7 +4,7 @@ env:
# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
parserOptions:
ecmaVersion: 2017
ecmaVersion: 2019
overrides:
- files:
......
......@@ -15,7 +15,6 @@ build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
......
......@@ -27,6 +27,11 @@ repos:
entry: found forbidden files; remove them
language: fail
files: "\\.rej$"
- id: en-po-files
name: en.po files cannot exist
entry: found a en.po file
language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- repo: https://github.com/oca/maintainer-tools
rev: ab1d7f6
hooks:
......@@ -46,7 +51,7 @@ repos:
- --remove-duplicate-keys
- --remove-unused-variables
- repo: https://github.com/psf/black
rev: 20.8b1
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
......@@ -96,32 +101,28 @@ repos:
- id: pyupgrade
args: ["--keep-percent-format"]
- repo: https://github.com/PyCQA/isort
rev: 5.5.1
rev: 5.12.0
hooks:
- id: isort
name: isort except __init__.py
args:
- --settings=.
exclude: /__init__\.py$
- repo: https://gitlab.com/PyCQA/flake8
- repo: https://github.com/PyCQA/flake8
rev: 3.8.3
hooks:
- id: flake8
name: flake8
additional_dependencies: ["flake8-bugbear==20.1.4"]
- repo: https://github.com/PyCQA/pylint
rev: pylint-2.5.3
- repo: https://github.com/OCA/pylint-odoo
rev: 7.0.2
hooks:
- id: pylint
- id: pylint_odoo
name: pylint with optional checks
args:
- --rcfile=.pylintrc
- --exit-zero
verbose: true
additional_dependencies: &pylint_deps
- pylint-odoo==3.5.0
- id: pylint
name: pylint with mandatory checks
- id: pylint_odoo
args:
- --rcfile=.pylintrc-mandatory
additional_dependencies: *pylint_deps
[MASTER]
load-plugins=pylint_odoo
score=n
......@@ -73,6 +75,7 @@ enable=anomalous-backslash-in-string,
invalid-commit,
missing-manifest-dependency,
missing-newline-extrafiles,
missing-readme,
no-utf8-coding-comment,
odoo-addons-relative-import,
old-api7-method-defined,
......
[MASTER]
load-plugins=pylint_odoo
score=n
......
......@@ -3,7 +3,7 @@
from datetime import datetime, timedelta
from odoo import api, fields, models
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
from odoo.tools.misc import xlwt
......@@ -484,18 +484,19 @@ class Project(models.Model):
"Nombre d'entreprises concernées par la création"
"d'une nouvelle activité collective"
)
number_struct_proj = fields.Integer(
"Nombre de projets structurants définis"
)
number_struct_proj = fields.Integer("Nombre de projets structurants définis")
number_mean_people_inv = fields.Integer(
"Nombre moyen de personnes sollicitées hors du"
"groupe de travail (enquête, réunion publique)"
)
number_comp_created_at = fields.Integer("Nombre d'entreprises créées (AT)")
number_comp_terr = fields.Integer("Nombre d'entreprises accompagnées (TERR)")
number_day_period = fields.Float(
"Nb jours sur période", compute="_compute_number_day_period", default=0.0)
"Nb jours sur période", compute="_compute_number_day_period", default=0.0
)
number_hour_period = fields.Float(
"Nb heures sur période", compute="_compute_number_day_period", default=0.0)
"Nb heures sur période", compute="_compute_number_day_period", default=0.0
)
@api.depends("date_ca")
@api.multi
......@@ -607,10 +608,12 @@ class Project(models.Model):
@api.multi
def _compute_number_gap_members(self):
for project in self:
project.number_gap_members = sum(
project.reunion_ids.mapped("number_participants")) / len(
project.reunion_ids
) if project.reunion_ids else 0
project.number_gap_members = (
sum(project.reunion_ids.mapped("number_participants"))
/ len(project.reunion_ids)
if project.reunion_ids
else 0
)
@api.multi
def _compute_number_day_period(self):
......@@ -622,8 +625,10 @@ class Project(models.Model):
period_end = fields.Date.to_date(self.env.context.get("period_end"))
for project in self:
days = project.task_ids.filtered(
lambda t: t.date_deadline and t.date_deadline >= period_start
and t.date_deadline <= period_end).mapped("duree_hr")
lambda t: t.date_deadline
and t.date_deadline >= period_start
and t.date_deadline <= period_end
).mapped("duree_hr")
project.number_day_period = sum(days)
project.number_hour_period = sum(days) * 7
......@@ -762,10 +767,9 @@ class AdefpatReunionGAP(models.Model):
self.env.context["default_project_id"]
)
if project_id.exists().membre_ids:
participant_ids = project_id.membre_ids.mapped(lambda p: (0, 0, {
"member_id": p.id,
"present": False
}))
participant_ids = project_id.membre_ids.mapped(
lambda p: (0, 0, {"member_id": p.id, "present": False})
)
self.update({"participant_ids": participant_ids})
return participant_ids
......@@ -784,13 +788,13 @@ class AdefpatReunionGAP(models.Model):
comodel_name="res.partner.reunion.gap",
inverse_name="gap_id",
string="Participants",
default=_default_participant_ids
default=_default_participant_ids,
)
number_participants = fields.Integer(
string="Moyenne de participants",
compute="_compute_number_participants",
group_operator="avg",
store=True
store=True,
)
@api.depends("participant_ids", "participant_ids.present")
......@@ -933,7 +937,8 @@ class AdefpatPorteursProjets(models.Model):
related="project_id.departement", string="Département"
)
number_hour_period = fields.Float(
"Nb heures sur période", compute="_compute_hour_period", default=0.0)
"Nb heures sur période", compute="_compute_hour_period", default=0.0
)
# ------------------------------------------------------
# Constrains
......@@ -943,8 +948,10 @@ class AdefpatPorteursProjets(models.Model):
for pp in self:
if not pp.task_id and not pp.project_id:
raise ValidationError(
_(
"Un porteur de projet doit être associé à une tâche ou un projet."
)
)
@api.depends("porteur_id")
def _compute_commune(self):
......@@ -963,12 +970,15 @@ class AdefpatPorteursProjets(models.Model):
for line in self:
if line.project_id:
task_ids = line.project_id.task_ids.filtered(
lambda t: t.date_deadline and t.date_deadline >= period_start
and t.date_deadline <= period_end)
lambda t: t.date_deadline
and t.date_deadline >= period_start
and t.date_deadline <= period_end
)
days = []
for task in task_ids:
participant_ids = task.participant_ids.filtered(
lambda p: p.h_theoriques)
lambda p: p.h_theoriques
)
if line.porteur_id in participant_ids.mapped("porteur_id"):
days.append(task.duree_hr * 7)
line.number_hour_period = sum(days)
......
......@@ -255,47 +255,70 @@
<separator string="Critères CA" />
<div class="row">
<div class="col-7 border-right">
<label for="type_beneficiaire" style="font-weight: bold;"/>
<label
for="type_beneficiaire"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;"><field
name="type_beneficiaire"
/></div>
<div
class="col-5"
style="padding-right: 48px;"
><field name="type_beneficiaire" /></div>
</div>
<div class="row">
<div class="col-7 border-right">
<label for="objectif_projet" style="font-weight: bold;"/>
<label
for="objectif_projet"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;"><field
name="objectif_projet"
/></div>
<div
class="col-5"
style="padding-right: 48px;"
><field name="objectif_projet" /></div>
</div>
<div class="row">
<div class="col-7 border-right">
<label for="secteur_crit" style="font-weight: bold;"/>
<label
for="secteur_crit"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;"><field
name="secteur_crit"
/></div>
<div
class="col-5"
style="padding-right: 48px;"
><field name="secteur_crit" /></div>
</div>
<div class="row">
<div class="col-7 border-right">
<label for="taille" style="font-weight: bold;"/>
<label
for="taille"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;"><field
name="taille"
/></div>
<div
class="col-5"
style="padding-right: 48px;"
><field name="taille" /></div>
</div>
<div class="row">
<div class="col-7 border-right">
<label for="objectif_formation" style="font-weight: bold;"/>
<label
for="objectif_formation"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;"><field
name="objectif_formation"
/></div>
<div
class="col-5"
style="padding-right: 48px;"
><field name="objectif_formation" /></div>
</div>
<div class="row">
<div class="col-7 border-right">
<label for="type_formation" style="font-weight: bold;"/>
<label
for="type_formation"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;">
<field name="type_formation" />
......@@ -303,14 +326,20 @@
</div>
<div class="row">
<div class="col-7 border-right">
<label for="encadrement" style="font-weight: bold;"/>
<label
for="encadrement"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;">
<field name="encadrement" /></div>
</div>
<div class="row">
<div class="col-7 border-right">
<label for="bpi" style="font-weight: bold;"/>
<label
for="bpi"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;">
<field name="bpi" />
......@@ -318,7 +347,10 @@
</div>
<div class="row">
<div class="col-7 border-right">
<label for="nb_emplois" style="font-weight: bold;"/>
<label
for="nb_emplois"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;">
<field name="nb_emplois" />
......@@ -326,7 +358,10 @@
</div>
<div class="row">
<div class="col-7 border-right">
<label for="type_accompagnement" style="font-weight: bold;" />
<label
for="type_accompagnement"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;">
<field name="type_accompagnement" />
......@@ -337,7 +372,10 @@
attrs="{'invisible': [('type_accompagnement', '!=', 'individualise')], 'required': [('type_accompagnement', '!=', 'individualise')]}"
>
<div class="col-7 border-right">
<label for="nb_activité" style="font-weight: bold;" />
<label
for="nb_activité"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;">
<field name="nb_activité" />
......@@ -348,7 +386,10 @@
attrs="{'invisible': [('type_accompagnement', '!=', 'territoriaux')], 'required': [('type_accompagnement', '!=', 'territoriaux')]}"
>
<div class="col-7 border-right">
<label for="nb_coll" style="font-weight: bold;" />
<label
for="nb_coll"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;">
<field name="nb_coll" />
......@@ -359,18 +400,38 @@
attrs="{'invisible': [('type_accompagnement', '!=', 'territoriaux')], 'required': [('type_accompagnement', '!=', 'territoriaux')]}"
>
<div class="col-7 border-right">
<label for="nb_citoyens" style="font-weight: bold;" />
<label
for="nb_citoyens"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;">
<field name="nb_citoyens" />
</div>
</div>
<div
class="row"
attrs="{'invisible': [('type_accompagnement', '!=', 'territoriaux')], 'required': [('type_accompagnement', '!=', 'territoriaux')]}"
>
<div class="col-7 border-right">
<label
for="number_comp_terr"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;">
<field name="number_comp_terr" />
</div>
</div>
<div
class="row"
attrs="{'invisible': [('type_accompagnement', '!=', 'interentreprises')], 'required': [('type_accompagnement', '!=', 'interentreprises')]}"
>
<div class="col-7 border-right">
<label for="nb_entreprises" style="font-weight: bold;" />
<label
for="nb_entreprises"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;">
<field name="nb_entreprises" />
......@@ -378,7 +439,10 @@
</div>
<div class="row">
<div class="col-7 border-right">
<label for="est_suite" style="font-weight: bold;" />
<label
for="est_suite"
style="font-weight: bold;"
/>
</div>
<div class="col-5" style="padding-right: 48px;">
<field name="est_suite" />
......@@ -639,7 +703,11 @@
</sheet>
</form>
</field>
<field name="reunion_ids" widget="one2many" context="{'default_project_id': active_id}">
<field
name="reunion_ids"
widget="one2many"
context="{'default_project_id': active_id}"
>
<tree string="Réunions GAP">
<field name="date" />
<field name="number_participants" readonly="True" />
......@@ -908,10 +976,7 @@
<field name="od_ids" widget="many2many_tags" />
<field name="departement" />
<field name="type_convention_id" />
<field
name="financement_adefpat"
string="budget - facturation"
/>
<field name="financement_adefpat" string="budget - facturation" />
<field name="objectif_formation" />
<field name="bpi" widget="boolean_integer" />
<field name="type_accompagnement" />
......@@ -948,8 +1013,11 @@
<field name="name">Nouveaux Projets par année</field>
<field name="res_model">project.project</field>
<field name="view_mode">tree</field>
<field name="view_ids" eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('view_adefpat_new_project_reporting_tree')})]"/>
<field
name="view_ids"
eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('view_adefpat_new_project_reporting_tree')})]"
/>
<field name="context">{'group_by': 'date_ca:year'}</field>
</record>
......