summaryrefslogtreecommitdiff
path: root/addons/project/models
diff options
context:
space:
mode:
authorjem-odoo <jem@openerp.com>2018-10-25 13:45:42 +0000
committerjem-odoo <jem@openerp.com>2018-12-04 12:48:19 +0000
commit52e2ec2ef99473dff705e4e8dd56a8be37e9ba24 (patch)
tree685928def9be46a8e7cdd0819ca4fdd813118e45 /addons/project/models
parent47479401cb3f685788d76abe01d3d2bc21ff11e3 (diff)
[IMP] project: make project use rating parent mixin
No functionnal changes are done in this commit. Everything stays the same, but use the parent mixin mecanism. Task-1903565
Diffstat (limited to 'addons/project/models')
-rw-r--r--addons/project/models/project.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/addons/project/models/project.py b/addons/project/models/project.py
index 611265f20b4..e9f85e37ba6 100644
--- a/addons/project/models/project.py
+++ b/addons/project/models/project.py
@@ -67,9 +67,10 @@ class ProjectTaskType(models.Model):
class Project(models.Model):
_name = "project.project"
_description = "Project"
- _inherit = ['portal.mixin', 'mail.alias.mixin', 'mail.thread']
+ _inherit = ['portal.mixin', 'mail.alias.mixin', 'mail.thread', 'rating.parent.mixin']
_order = "sequence, name, id"
_period_number = 5
+ _rating_satisfaction_days = False # takes all existing ratings
def get_alias_model_name(self, vals):
return vals.get('alias_model', 'project.task')
@@ -221,8 +222,6 @@ class Project(models.Model):
help="Project in which sub-tasks of the current project will be created. It can be the current project itself.")
# rating fields
- percentage_satisfaction_task = fields.Integer(
- compute='_compute_percentage_satisfaction_task', string="Happy % on Task", help="Satisfaction rate on task.", store=True, default=-1)
rating_request_deadline = fields.Datetime(compute='_compute_rating_request_deadline', store=True)
rating_status = fields.Selection([('stage', 'Rating when changing stage'), ('periodic', 'Periodical Rating'), ('no','No rating')], 'Customer(s) Ratings', help="How to get customer feedback?\n"
"- Rating when changing stage: an email will be sent when a task is pulled in another stage.\n"
@@ -250,12 +249,6 @@ class Project(models.Model):
project.access_warning = _(
"The project cannot be shared with the recipient(s) because the privacy of the project is too restricted. Set the privacy to 'Visible by following customers' in order to make it accessible by the recipient(s).")
- @api.depends('tasks.rating_ids.rating')
- def _compute_percentage_satisfaction_task(self):
- for project in self:
- activity = project.tasks.rating_get_grades()
- project.percentage_satisfaction_task = activity['great'] * 100 / sum(activity.values()) if sum(activity.values()) else -1
-
@api.depends('rating_status', 'rating_status_period')
def _compute_rating_request_deadline(self):
periods = {'daily': 1, 'weekly': 7, 'bimonthly': 15, 'monthly': 30, 'quarterly': 90, 'yearly': 365}