Compare commits
13 Commits
16.0-pre-r
...
imp-progre
Author | SHA1 | Date | |
---|---|---|---|
|
335821bb0b | ||
|
e6a9d83a8a | ||
|
6af8c3a866 | ||
|
84c22445bd | ||
|
be1818654e | ||
|
b474f94211 | ||
|
34759aefdc | ||
|
e24be51568 | ||
|
e312cc390a | ||
|
3027877e72 | ||
|
b1ce9d52f7 | ||
|
457728e5fc | ||
|
9518e06541 |
@@ -1 +1,2 @@
|
||||
from . import models
|
||||
from . import models
|
||||
from . import wizards
|
||||
|
@@ -12,18 +12,19 @@
|
||||
"summary": "Module containing base fields and views for studies",
|
||||
# any module necessary for this one to work correctly
|
||||
"depends": [
|
||||
"base",
|
||||
"partner_firstname"
|
||||
"base",
|
||||
"partner_firstname"
|
||||
],
|
||||
"qweb": [],
|
||||
"external_dependencies": {
|
||||
"python": [],
|
||||
},
|
||||
# always loaded
|
||||
"data": [
|
||||
# "security/security.xml",
|
||||
"data/studies_base_data.xml",
|
||||
"security/ir.model.access.csv",
|
||||
"data": [
|
||||
# "security/security.xml",
|
||||
"data/studies_base_data.xml",
|
||||
"security/ir.model.access.csv",
|
||||
"wizards/create_progress_status.xml",
|
||||
"views/study_config_views.xml",
|
||||
"views/study_study_views.xml",
|
||||
"views/study_progress_status_views.xml",
|
||||
@@ -41,4 +42,4 @@
|
||||
# and independently installed. Used for synergetic or glue modules.
|
||||
"auto_install": False,
|
||||
"application": False,
|
||||
}
|
||||
}
|
||||
|
@@ -172,7 +172,7 @@
|
||||
</record>
|
||||
|
||||
<record id="study_questionnaire_subject_type_PRACTITIONER" model="study.questionnaire.subject.type">
|
||||
<field name="name">Praticient</field>
|
||||
<field name="name">Praticien</field>
|
||||
<field name="value">PRACTITIONER</field>
|
||||
</record>
|
||||
|
||||
|
@@ -34,3 +34,17 @@ class StudyParticipant(models.Model):
|
||||
updated = fields.Datetime("Date mise à jour")
|
||||
|
||||
active = fields.Boolean("Actif", default=True)
|
||||
|
||||
@api.depends("write_date")
|
||||
def _compute_updated(self):
|
||||
for record in self:
|
||||
## XXXb0g : the following two lines are to be removed when all records will have been updated during migration
|
||||
# if record.updated:
|
||||
# continue
|
||||
record.updated = record.write_date
|
||||
|
||||
@api.depends("create_date")
|
||||
def _compute_created(self):
|
||||
for record in self:
|
||||
if not record.created:
|
||||
record.created = record.create_date
|
||||
|
@@ -17,6 +17,11 @@ class StudyProgressStatus(models.Model):
|
||||
('ACTIVE-BUT-NOT-RECRUITING', 'Active mais ne recrute plus'),
|
||||
('COMPLETED', 'Terminée'),
|
||||
('WITHDRAWN', 'Annulé')], string="Avancement de l'étude")
|
||||
actual = fields.Boolean("Statut actuel")
|
||||
actual = fields.Boolean("Statut actuel", compute="_compute_actual")
|
||||
date_begin = fields.Datetime("Date de début de l'état")
|
||||
date_end = fields.Datetime("Date de fin de l'état")
|
||||
|
||||
@api.depends("date_end")
|
||||
def _compute_actual(self):
|
||||
for record in self:
|
||||
record.actual = (record.date_end is False) or (record.state == "COMPLETED")
|
||||
|
@@ -34,3 +34,17 @@ class StudyQuestionnaireResponse(models.Model):
|
||||
updated = fields.Datetime("Date mise à jour")
|
||||
|
||||
active = fields.Boolean("Actif", default=True)
|
||||
|
||||
@api.depends("write_date")
|
||||
def _compute_updated(self):
|
||||
for record in self:
|
||||
## XXXb0g : the following two lines are to be removed when all records will have been updated during migration
|
||||
# if record.updated:
|
||||
# continue
|
||||
record.updated = record.write_date
|
||||
|
||||
@api.depends("create_date")
|
||||
def _compute_created(self):
|
||||
for record in self:
|
||||
if not record.created:
|
||||
record.created = record.create_date
|
||||
|
@@ -19,7 +19,8 @@ class StudyStudy(models.Model):
|
||||
"study.progress.status",
|
||||
string="Avancement de l'étude",
|
||||
domain="[('study_id', '=', id)]",
|
||||
) # should be computed to actual progress status
|
||||
compute="_compute_progress_status_id",
|
||||
)
|
||||
progress_status = fields.One2many(
|
||||
"study.progress.status", "study_id", "All progress status"
|
||||
)
|
||||
@@ -83,6 +84,7 @@ class StudyStudy(models.Model):
|
||||
updated = fields.Datetime(
|
||||
"Updated", readonly=True, compute="_compute_updated", store=True
|
||||
)
|
||||
active = fields.Boolean("Actif", default=True)
|
||||
|
||||
@api.depends("create_date")
|
||||
def _compute_created(self):
|
||||
@@ -96,19 +98,28 @@ class StudyStudy(models.Model):
|
||||
_logger.info(f"Record ID: {record.id}, write_date: {record.write_date}")
|
||||
record.updated = record.write_date
|
||||
|
||||
active = fields.Boolean("Actif", default=True)
|
||||
@api.depends("progress_status")
|
||||
def _compute_progress_status_id(self):
|
||||
for record in self:
|
||||
unfinished_progress_status = record.progress_status.filtered(
|
||||
lambda x: x.actual == True
|
||||
)
|
||||
record.progress_status_id = (
|
||||
unfinished_progress_status.id
|
||||
if len(unfinished_progress_status) == 1
|
||||
else None
|
||||
)
|
||||
|
||||
def copy(self, default=None):
|
||||
default = dict(default or {}, identifier_primary_id=None)
|
||||
return super().copy(default)
|
||||
|
||||
|
||||
@api.depends("title", "name")
|
||||
def name_get(self):
|
||||
result = []
|
||||
for study in self:
|
||||
if not study.name:
|
||||
result.append((study.id, study.title))
|
||||
else:
|
||||
result.append((study.id, f"[{study.name}] {study.title}"))
|
||||
return result
|
||||
@api.depends("title", "name")
|
||||
def name_get(self):
|
||||
result = []
|
||||
for study in self:
|
||||
if not study.name:
|
||||
result.append((study.id, study.title))
|
||||
else:
|
||||
result.append((study.id, f"[{study.name}] {study.title}"))
|
||||
return result
|
||||
|
@@ -22,4 +22,5 @@ access_study_questionnaire_status_admin,study.questionnaire.status.admin,model_s
|
||||
access_study_participant_progress_status_admin,study.participant.progress.status.admin,model_study_participant_progress_status,base.group_user,1,1,1,1
|
||||
access_study_participant_state_admin,study.participant.state.admin,model_study_participant_state,base.group_user,1,1,1,1
|
||||
access_study_questionnaire_response_progress_status_admin,study.questionnaire.response.progress.status.admin,model_study_questionnaire_response_progress_status,base.group_user,1,1,1,1
|
||||
access_study_author_admin,study.author.admin,model_study_author,base.group_user,1,1,1,1
|
||||
access_study_author_admin,study.author.admin,model_study_author,base.group_user,1,1,1,1
|
||||
access_create_progress_status_wizard,create_progress_status_wizard.access,model_create_progress_status,base.group_user,1,1,1,0
|
||||
|
|
@@ -3,13 +3,13 @@
|
||||
<!-- TREE VIEW -->
|
||||
<record id="view_study_participant_tree" model="ir.ui.view">
|
||||
<field name="name">study.participant.tree</field>
|
||||
<field name="model">study.participant</field>
|
||||
<field name="model">study.participant</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Participants">
|
||||
<field name="part_of"/>
|
||||
<field name="subject"/>
|
||||
<field name="firstname"/>
|
||||
<field name="lastname"/>
|
||||
<tree string="Participants">
|
||||
<field name="part_of"/>
|
||||
<field name="subject"/>
|
||||
<field name="firstname"/>
|
||||
<field name="lastname"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -17,7 +17,7 @@
|
||||
<!-- FORM VIEW -->
|
||||
<record id="view_study_participant_form" model="ir.ui.view">
|
||||
<field name="name">study.participant.form</field>
|
||||
<field name="model">study.participant</field>
|
||||
<field name="model">study.participant</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Participant">
|
||||
<header>
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<!-- big buttons -->
|
||||
</div>
|
||||
|
||||
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<label for="identifier_primary_id" string="Idientifiant Seintinelles" /><field name="identifier_primary_id" />
|
||||
@@ -43,7 +43,7 @@
|
||||
<field name="firstname" />
|
||||
</group>
|
||||
<group name="participant_right">
|
||||
|
||||
|
||||
</group>
|
||||
</group>
|
||||
<group name="participation" string="Participation">
|
||||
@@ -51,30 +51,30 @@
|
||||
<field name="progress_status" />
|
||||
<field name="state" />
|
||||
</group>
|
||||
<group name="participation_right">
|
||||
<group name="participation_right">
|
||||
<field name="identifier" />
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
<group name="technique" string="Technique">
|
||||
<group name="technique_left">
|
||||
<field name="create_date" />
|
||||
<field name="write_date" />
|
||||
<field name="created" />
|
||||
<field name="updated" />
|
||||
</group>
|
||||
<group name="technique_right">
|
||||
</group>
|
||||
</group>
|
||||
|
||||
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ACTIONS -->
|
||||
<record id="action_study_participant" model="ir.actions.act_window">
|
||||
<field name="name">Participants</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">study.participant</field>
|
||||
<field name="res_model">study.participant</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
@@ -61,8 +61,8 @@
|
||||
</group>
|
||||
<group name="technique" string="Technique">
|
||||
<group name="technique_left">
|
||||
<field name="create_date" />
|
||||
<field name="write_date" />
|
||||
<field name="created" />
|
||||
<field name="updated" />
|
||||
</group>
|
||||
<group name="technique_right">
|
||||
</group>
|
||||
|
@@ -22,7 +22,12 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Étude">
|
||||
<header>
|
||||
<!-- action buttons -->
|
||||
<!-- action buttons -->
|
||||
<button name="%(action_create_progress_status_wizard)d"
|
||||
string="Update Status"
|
||||
class="oe_highlight"
|
||||
type="action"
|
||||
/>
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
@@ -41,7 +46,7 @@
|
||||
<group name="study_status_left">
|
||||
<field name="period_start" />
|
||||
<field name="period_end" />
|
||||
<field name="progress_status_id" />
|
||||
<field name="progress_status_id" options="{'no_open': True}" />
|
||||
</group>
|
||||
<group name="study_status_right">
|
||||
|
||||
@@ -96,6 +101,16 @@
|
||||
<page string="Notes" name="notes">
|
||||
<field name="note" />
|
||||
</page>
|
||||
<page string="Progress status" name="progress_status" groups="base.group_no_one">
|
||||
<field name="progress_status" nolabel="1">
|
||||
<tree create="false" delete="false" default_order="date_begin DESC" >
|
||||
<field name="state" />
|
||||
<field name="date_begin" />
|
||||
<field name="date_end" />
|
||||
<field name="actual" />
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
</form>
|
||||
@@ -116,13 +131,21 @@
|
||||
<field name="model">study.study</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Études">
|
||||
<field name="title" string="Nom de l'étude" />
|
||||
<field name="name" string="Acronyme" />
|
||||
<field name="active" string="Actif" />
|
||||
<field name="description" string="Description" />
|
||||
<field name="identifier_author" string="ID Plateforme" />
|
||||
<field name="identifier_primary_id" string="Seintinelles ID"/>
|
||||
<field name="period_start" string="Date de début" />
|
||||
<field name="keywords" string="Mots-clés" />
|
||||
<field name="name" string="Acronyme" />
|
||||
<field name="period_end" string="Date de fin" />
|
||||
<field name="period_start" string="Date de début" />
|
||||
<field name="phase" string="Phase" />
|
||||
<field name="progress_status_id" string="Statut" />
|
||||
<field name="region" string="Région" />
|
||||
<field name="title" string="Nom de l'étude" />
|
||||
<field name="version" string="Version" />
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
</odoo>
|
||||
|
1
studies_base/wizards/__init__.py
Normal file
1
studies_base/wizards/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import create_progress_status
|
28
studies_base/wizards/create_progress_status.py
Normal file
28
studies_base/wizards/create_progress_status.py
Normal file
@@ -0,0 +1,28 @@
|
||||
from datetime import datetime
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class CreateProgressStatus(models.TransientModel):
|
||||
_name = "create.progress.status"
|
||||
_description = "create Progress Status"
|
||||
|
||||
state = fields.Selection([
|
||||
('DRAFT', 'Brouillon'),
|
||||
('NOT-YET-RECRUITING', 'À venir'),
|
||||
('RECRUITING', 'En cours de recrutement'),
|
||||
('ACTIVE-BUT-NOT-RECRUITING', 'Active mais ne recrute plus'),
|
||||
('COMPLETED', 'Terminée'),
|
||||
('WITHDRAWN', 'Annulé')], string="Avancement de l'étude")
|
||||
|
||||
|
||||
def create_progress_status(self):
|
||||
study = self.env["study.study"].browse(self._context.get("active_ids"))
|
||||
study.progress_status_id.date_end = datetime.now()
|
||||
values = {
|
||||
"study_id": study.id,
|
||||
"state": self.state,
|
||||
"date_begin": datetime.now(),
|
||||
"date_end": None,
|
||||
}
|
||||
self.env["study.progress.status"].create(values)
|
||||
study.write({"updated": datetime.now()})
|
30
studies_base/wizards/create_progress_status.xml
Normal file
30
studies_base/wizards/create_progress_status.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="create_progress_status_wizard_view_form" model="ir.ui.view">
|
||||
<field name="name">create.progress.status.wizard.view.form</field>
|
||||
<field name="model">create.progress.status</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Update study progress status">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="state" />
|
||||
</group>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button string="Update" name="create_progress_status" type="object"
|
||||
class="btn-primary" />
|
||||
<button string="Cancel" class="btn-secondary" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record
|
||||
id="action_create_progress_status_wizard" model="ir.actions.act_window">
|
||||
<field name="name">Create Progress Status</field>
|
||||
<field name="res_model">create.progress.status</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="create_progress_status_wizard_view_form" />
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</odoo>
|
Reference in New Issue
Block a user