summaryrefslogtreecommitdiff
path: root/addons/pad_project/models/project.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/pad_project/models/project.py')
-rw-r--r--addons/pad_project/models/project.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/addons/pad_project/models/project.py b/addons/pad_project/models/project.py
index abc0342671a..c3392a7d243 100644
--- a/addons/pad_project/models/project.py
+++ b/addons/pad_project/models/project.py
@@ -16,6 +16,18 @@ class ProjectTask(models.Model):
string="Availability of collaborative pads",
readonly=True)
+ @api.onchange('use_pad')
+ def _onchange_use_pads(self):
+ """ Copy the content in the pad when the user change the project of the task to the one with no pads enabled.
+
+ This case is when the use_pad becomes False and we have already generated the url pad,
+ that is the description_pad field contains the url of the pad.
+ """
+ if not self.use_pad and self.description_pad:
+ vals = {'description_pad': self.description_pad}
+ self._set_pad_to_field(vals)
+ self.description = vals['description']
+
@api.model
def create(self, vals):
# When using quick create, the project_id is in the context, not in the vals