In this commit some reorganization is performed within mail compose message code. Purpose is to reorder a bit methods by main usage: onchange, CRUD, actions, values generation with rendering and template management. Some renaming is performed on action methods, notably send_mail that has some impact on sub-addons. Finally we also set onchange and sub-onchange methods private. No functional change should be implied by this commit. LINKS Task ID-2377974 Community PR odoo/odoo#61467 Enterprise PR odoo/enterprise#14633
16 lines
641 B
Python
16 lines
641 B
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models
|
|
|
|
|
|
class MailComposeMessage(models.TransientModel):
|
|
_inherit = 'mail.compose.message'
|
|
|
|
def _action_send_mail(self, **kwargs):
|
|
for wizard in self:
|
|
if self._context.get('mark_coupon_as_sent') and wizard.model == 'coupon.coupon' and wizard.partner_ids:
|
|
# Mark coupon as sent in sudo, as helpdesk users don't have the right to write on coupons
|
|
self.env[wizard.model].sudo().browse(wizard.res_id).state = 'sent'
|
|
return super()._action_send_mail(**kwargs)
|