[IMP] event_mail_attachment:
allow possibility to add several mail prefix
This commit is contained in:
@@ -20,15 +20,17 @@ class MailTemplate(models.Model):
|
|||||||
#add reports attached to event.registration or event.event from attachment name
|
#add reports attached to event.registration or event.event from attachment name
|
||||||
if template.event_attachment_name_prefix:
|
if template.event_attachment_name_prefix:
|
||||||
for res_id in template_res_ids:
|
for res_id in template_res_ids:
|
||||||
event_registration = self.env['event.registration'].browse(res_id)
|
event_registration = self.env['event.registration'].browse(res_id)
|
||||||
attachments = self.env['ir.attachment'].search([
|
attachments = self.env['ir.attachment']
|
||||||
('res_model','=','event.registration'),
|
for event_attachment_name_prefix in template.event_attachment_name_prefix.split(","):
|
||||||
('res_id','=',res_id),
|
attachments |= self.env['ir.attachment'].search([
|
||||||
('name','like',template.event_attachment_name_prefix)])
|
('res_model','=','event.registration'),
|
||||||
attachments |= self.env['ir.attachment'].search([
|
('res_id','=',res_id),
|
||||||
('res_model','=','event.event'),
|
('name','like',event_attachment_name_prefix)])
|
||||||
('res_id','=',event_registration.event_id.id),
|
attachments |= self.env['ir.attachment'].search([
|
||||||
('name','like',template.event_attachment_name_prefix)])
|
('res_model','=','event.event'),
|
||||||
|
('res_id','=',event_registration.event_id.id),
|
||||||
|
('name','like',event_attachment_name_prefix)])
|
||||||
|
|
||||||
attachments_res = [(attachment.name, attachment.datas) for attachment in attachments]
|
attachments_res = [(attachment.name, attachment.datas) for attachment in attachments]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user