Skip to content

Instantly share code, notes, and snippets.

@nhomar
Created June 8, 2020 16:04
Show Gist options
  • Save nhomar/1a307f5cd244bc7d3f5737d14371f3fb to your computer and use it in GitHub Desktop.
Save nhomar/1a307f5cd244bc7d3f5737d14371f3fb to your computer and use it in GitHub Desktop.
Force an specific mail server
# Available variables:
# - env: Odoo Environment on which the action is triggered
# - model: Odoo Model of the record on which the action is triggered; is a void recordset
# - record: record on which the action is triggered; may be be void
# - records: recordset of all records on which the action is triggered in multi-mode; may be void
# - time, datetime, dateutil, timezone: useful Python libraries
# - log: log(message, level='info'): logging function to record debug information in ir.logging table
# - Warning: Warning Exception to use with raise
# To return an action, assign: action = {...}
if record.mailing_id:
msg = "%s-%s" %(record.mail_server_id.name, record.mail_server_id.id)
log(msg, level='MAILING')
record.write({'mail_server_id': 3})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment