#### Get current user id
`user_id = self.env.user.id`
#### Get config parameter
`self.env['ir.config_parameter'].get_param('paramenter.name')`
#### Add attachment
`model.message_post('Note',attachments=[('filename.txt', 'file raw data not encoded with base64')])`
#### Unique constraint
` _sql_constraints = [('product_tmpl_id_api', 'unique(name, api_provider)',
'Each api is allowed to have 1 product_tmpl_id!')]`
#### Send email
```
email_template = self.env['mail.template'].search([('id', '=', id], limit=1)
email_template.send_mail(model.id)
```