Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

send by email in odoo 14

def action_send_email(self):
   '''
   This function opens a window to compose an email, with the emai template message loaded by default
   '''
   
   self.ensure_one()
   ir_model_data = self.env['ir.model.data']
   try:
       template_id = 
           ir_model_data.get_object_reference('test_email', 'email_template')[1]
   except ValueError:
       template_id = False
   try:
       compose_form_id = ir_model_data.get_object_reference('mail', 'email_compose_message_wizard_form')[1]
   except ValueError:
       compose_form_id = False
   ctx = {
       'default_model': 'test.email',
       'default_res_id': self.ids[0],
       'default_use_template': bool(template_id),
       'default_template_id': template_id,
       'default_composition_mode': 'comment',
   }
   return {
       'name': _('Compose Email'),
       'type': 'ir.actions.act_window',
       'view_mode': 'form',
       'res_model': 'mail.compose.message',
       'views': [(compose_form_id, 'form')],
       'view_id': compose_form_id,
       'target': 'new',
       'context': ctx,
   }
Comment

PREVIOUS NEXT
Code Example
Python :: list average python recursion 
Python :: dnpy notify 
Python :: preallocate numpy array 
Python :: merge csv files into one 
Python :: how to make a half pyramid in python 
Python :: kaggle set utility script 
Python :: get_type_display 
Python :: how to end if else statement in python 
Python :: lxml etree fromstring find 
Python :: 405 Method Not Allowed When Redirecting in Flask within POST route 
Python :: Wtforms: How to generate blank value using select fields with dynamic choice values 
Python :: get type of enum variable python 
Python :: _tkinter.TclError: invalid command name ".!canvas" 
Python :: python go back one using abspath 
Python :: clock replacement algorithm python 
Python :: ring raise an exception 
Python :: can you make a class in a class python 
Python :: how to insert a character into a string in python 
Python :: matplotlib plot dpi - change format to svg 
Python :: matplotlib doesnt show suptitle 
Python :: create a separate dataframe with the columns 
Python :: matplotlib pie chart move autotext 
Python :: ffmpeg python get total frames 
Python :: set constructor python 
Python :: discord.py reply to message 
Python :: prime numbers from 1 to 100 in python 
Python :: tkinter call action to py file 
Python :: checking if the variable storing same value in python 
Python :: input character in python like getchar in c 
Python :: how to get key stroke pygame 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =