Public release from ruodoo-project: 19.0 - 2026-07-26 21:17:35 UTC
This commit is contained in:
27
tier_communications/wizard/tier_move_to_mailbox_wizard.py
Normal file
27
tier_communications/wizard/tier_move_to_mailbox_wizard.py
Normal file
@ -0,0 +1,27 @@
|
||||
from odoo import _, fields, models
|
||||
|
||||
|
||||
class TierMoveToMailboxWizard(models.TransientModel):
|
||||
_name = 'tier.move.to.mailbox.wizard'
|
||||
_description = 'Переместить сообщение в ящик'
|
||||
|
||||
message_id = fields.Many2one('mail.message', string='Сообщение', required=True)
|
||||
mailbox_ids = fields.Many2many(
|
||||
'tier.mailbox',
|
||||
string='Ящики',
|
||||
help='Выберите ящики, в которые нужно поместить это сообщение.',
|
||||
)
|
||||
|
||||
def action_confirm(self):
|
||||
"""Apply mailbox assignment to the message."""
|
||||
self.ensure_one()
|
||||
message = self.message_id
|
||||
# Remove existing mailbox tags
|
||||
message.mailbox_tag_ids.unlink()
|
||||
# Create new ones
|
||||
for mailbox in self.mailbox_ids:
|
||||
self.env['tier.mailbox.tag'].create({
|
||||
'mailbox_id': mailbox.id,
|
||||
'message_id': message.id,
|
||||
})
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
Reference in New Issue
Block a user