Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

How to feeding a field with template by selecting a drop down list

Subscribe

Get notified when there's activity on this post

This question has been flagged
v8dropdownlistemail_template
5189 Views
Avatar
NASHMIN YEGANEH

Hello!

Actually i would try to feeding a field (the field is "note = fields.Text") with email templates, so to do this i need to a drop down field + a templates data made in email.templates module + codes to putting it in my field in custom module.
so please any one know how to do this in that way?

version is 8

Many thanks for your kindly answers friends :)

this is part of my code to help get what i meant

********************************************************

class ResLetter(models.Model):
"""A register class to log all movements regarding letters"""
_name = 'res.letter'
_description = "Log of Letter Movements"
_inherit = 'mail.thread'

number = fields.Char(
help="Auto Generated Number of letter.",
default="/")
name = fields.Text(
string='Subject',
help="Subject of letter.")
move = fields.Selection(
[('in', 'و'), ('out', 'OUT')],
help="Incoming or Outgoing Letter.",
readonly=True,
default=lambda self: self.env.context.get('move', 'in'))

state = fields.Selection(
[
('draft', 'Draft'),
('sent', 'Sent'),
('rec', 'Received'),
('rec_bad', 'Received Damage'),
('rec_ret', 'Received But Returned'),
('cancel', 'Cancelled'),
],
default='draft',
readonly=True,
copy=False,
track_visibility='onchange',
help="""
* Draft: not confirmed yet.\n
* Sent: has been sent, can't be modified anymore.\n
* Received: has arrived.\n
* Received Damage: has been received with damages.\n
* Received But Returned: has been received but returned.\n
* Cancel: has been cancelled, can't be sent anymore."""
)

date = fields.Date(
string='Letter Date',
help='The letter\'s date.',
default=fields.Date.today)
snd_date = fields.Date(
string='Sent Date',
help='The date the letter was sent.')
rec_date = fields.Date(
string='Received Date',
help='The date the letter was received.')

def default_recipient(self):
move_type = self.env.context.get('move', False)
if move_type == 'in':
return self.env.user.company_id.partner_id

def default_sender(self):
move_type = self.env.context.get('move', False)
if move_type == 'out':
return self.env.user.company_id.partner_id

recipient_partner_id = fields.Many2one(
'res.partner',
string='Recipient',
track_visibility='onchange',
# required=True, TODO: make it required in 9.0
default=default_recipient)
sender_partner_id = fields.Many2one(
'res.partner',
string='Sender',
track_visibility='onchange',
# required=True, TODO: make it required in 9.0
default=default_sender)
note = fields.Text(
string='Delivery Notes',
help='Indications for the delivery officer.')

channel_id = fields.Many2one(
'letter.channel',
string="Channel",
help='Sent / Receive Source')

category_ids = fields.Many2many(
'letter.category',
string="Tags",
help="Classification of Document.")

folder_id = fields.Many2one(
'letter.folder',
string='Folder',
help='Folder which contains letter.')

type_id = fields.Many2one(
'letter.type',
string="Type",
help="Type of Letter, Depending upon size.")

weight = fields.Float(help='Weight (in KG)')
size = fields.Char(help='Size of the package.')

track_ref = fields.Char(
string='Tracking Reference',
help="Reference Number used for Tracking.")
orig_ref = fields.Char(
string='Original Reference',
help="Reference Number at Origin.")
expeditor_ref = fields.Char(
string='Expeditor Reference',
help="Reference Number used by Expeditor.")

parent_id = fields.Many2one(
'res.letter',
string='Parent',
groups='lettermgmt.group_letter_thread')
child_line = fields.One2many(
'res.letter',
'parent_id',
string='Letter Lines',
groups='lettermgmt.group_letter_thread')

reassignment_ids = fields.One2many(
'letter.reassignment',
'letter_id',
string='Reassignment lines',
help='Reassignment users and comments',
groups='lettermgmt.group_letter_reasignment')

# This field seems to be unused. TODO: Remove it?
extern_partner_ids = fields.Many2many(
'res.partner',
string='Recipients')

@api.model
def create(self, vals):
if ('number' not in vals) or (vals.get('number') in ('/', False)):
sequence = self.env['ir.sequence']
move_type = vals.get('move', self.env.context.get(
'default_move', self.env.context.get('move', 'in')))
vals['number'] = sequence.get('%s.letter' % move_type)
return super(ResLetter, self).create(vals)

@api.one
def action_cancel(self):
""" Put the state of the letter into Cancelled """
self.write({'state': 'cancel'})
return True

@api.one
def action_cancel_draft(self):
""" Go from cancelled state to draf state """
self.write({'state': 'draft'})
return True

@api.one
def action_send(self):
""" Put the state of the letter into sent """
self.write({
'state': 'sent',
'snd_date': self.snd_date or fields.Date.today()
})
return True

@api.one
def action_received(self):
""" Put the state of the letter into Received """
self.write({
'state': 'rec',
'rec_date': self.rec_date or fields.Date.today()
})
return True

@api.one
def action_rec_ret(self):
""" Put the state of the letter into Received but Returned """
self.write({
'state': 'rec_ret',
'rec_date': self.rec_date or fields.Date.today()
})
return True

@api.one
def action_rec_bad(self):
""" Put the state of the letter into Received but Damaged """
self.write({
'state': 'rec_bad',
'rec_date': self.rec_date or fields.Date.today()
})
return True
0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
how to call email templates with a custom module Solved
v8 email_template selectable
Avatar
Avatar
Avatar
Avatar
4
Nov 19
14608
Email template is failed to render ? [SOLVED] Solved
v8 sale.order email_template
Avatar
Avatar
Avatar
Avatar
4
Jan 19
33083
is it possible to use QWeb template when define a email template?
v8 qweb email_template
Avatar
Avatar
1
Sep 16
4634
Default Outgoing server can't be recognize while using email templates in Odoo V8.
v8 email_template outgoing_server
Avatar
0
Mar 15
4465
How to send Partner Mass Mail to partner and parters contacts, v8. Solved
mail v8 emailtemplate email_template
Avatar
Avatar
Avatar
Avatar
4
Jun 18
10927
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now