Skip to content

Commit

Permalink
Merge pull request #77 from gisce/imp_pre_certificats
Browse files Browse the repository at this point in the history
Pass poweremail mailbox ID
  • Loading branch information
eberloso authored Apr 9, 2020
2 parents b7f05a5 + 28307ab commit f7c34ed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions poweremail_mailbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def send_this_mail(self, cr, uid, ids=None, context=None):
headers['In-Reply-To'] = mails[-1].pem_message_id
ctx = context.copy()
ctx.update({'MIME_subtype': values['mail_type'] or False})
ctx['poweremail_id'] = id
if not values.get('pem_body_html') and not values.get('pem_body_text'):
raise osv.except_osv(
_('Error'),
Expand All @@ -187,6 +188,10 @@ def send_this_mail(self, cr, uid, ids=None, context=None):
_("The email must have a sending account.")
)

if ctx.get("poweremail_mailbox_fields"):
for val_to_read in ctx.get("poweremail_mailbox_fields"):
ctx[val_to_read] = self.read(cr, uid, id, [val_to_read])[val_to_read]

result = core_obj.send_mail(
cr, uid, [values['pem_account_id'][0]], {
'To': values['pem_to'],
Expand Down
1 change: 1 addition & 0 deletions poweremail_send_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ def get_end_value(id, value):
'state':'na',
'mail_type':'multipart/alternative' #Options:'multipart/mixed','multipart/alternative','text/plain','text/html'
}
vals.update(context.get("extra_vals", {}))
if screen_vals['signature']:
signature = self.pool.get('res.users').read(cr, uid, uid, ['signature'], context)['signature']
if signature:
Expand Down
1 change: 1 addition & 0 deletions poweremail_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,7 @@ def _generate_mailbox_item_from_template(self,
mailbox_values['pem_body_text'] += "\n--\n"+sign
if mailbox_values['pem_body_html']:
mailbox_values['pem_body_html'] += sign
mailbox_values.update(context.get("extra_vals", {}))
mailbox_id = self.pool.get('poweremail.mailbox').create(
cursor,
user,
Expand Down

0 comments on commit f7c34ed

Please sign in to comment.