[FIX] rating_*: domain on m2o for rating mail template

Rating is implemented for project.issue, but it is
impossible to set a template on the stage since the
domain force the mail.template to be declared on
project.task.

We use the same mecanism as `mail_template_id`
declared on project.stage.task in project
module. The list of available template on the stage
form view will be the ones for issue and task like
mail_template_id.
This commit is contained in:
Jérome Maes
2016-10-13 14:50:06 +02:00
parent 27dc061bf1
commit 740be5842c
2 changed files with 14 additions and 1 deletions
+4 -1
View File
@@ -7,10 +7,13 @@ class ProjectTaskType(models.Model):
_inherit = 'project.task.type'
def _default_domain_rating_template_id(self):
return [('model', '=', 'project.task')]
rating_template_id = fields.Many2one(
'mail.template',
string='Rating Email Template',
domain=[('model', '=', 'project.task')],
domain=lambda self: self._default_domain_rating_template_id(),
help="Select an email template. An email will be sent to the customer when the task reach this step.")
auto_validation_kanban_state = fields.Boolean('Automatic kanban status', default=False,
help="Automatically modify the kanban state when the customer reply to the feedback for this stage.\n"
@@ -25,6 +25,16 @@ class ProjectIssue(models.Model):
return super(ProjectIssue, self).rating_apply(rate, token=token, feedback=feedback, subtype="rating_project_issue.mt_issue_rating")
class Stage(models.Model):
_inherit = ['project.task.type']
def _default_domain_rating_template_id(self):
domain = super(Stage, self)._default_domain_rating_template_id()
return ['|'] + domain + [('model', '=', 'project.issue')]
class Project(models.Model):
_inherit = "project.project"