You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
662 B

  1. # Copyright 2018 Eficent <http://www.eficent.com>
  2. # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
  3. from odoo import api, fields, models
  4. class MailActivity(models.Model):
  5. _inherit = 'mail.activity'
  6. done = fields.Boolean(default=False)
  7. state = fields.Selection(selection_add=[
  8. ('done', 'Done')], compute='_compute_state')
  9. date_done = fields.Date(
  10. 'Completed Date', index=True, readonly=True,
  11. )
  12. @api.depends('done')
  13. def _compute_state(self):
  14. super(MailActivity, self)._compute_state()
  15. for record in self.filtered(lambda activity: activity.done):
  16. record.state = 'done'