The use case for this presentation will be a plant nursery implementation. During this session we'll present several powerful abstract classes from Odoo
Empower your App by Inheriting from Odoo MixinsOdoo
Empower your App by Inheriting from Odoo Mixins. Let us recode everything from scratch! Or not.
Thibault Delavallee, Software Engineer, RD Marketing Team Leader, Odoo
Based on work from Yannick Tivisse, Martin Trigaux, and Damien Bouvy.
The Odoo Framework is quite expressive, many add-ons can express a lot of business logic just by defining models (in Python) and template/views (in XML). This is fine for most cases, but there is a limit to what you can do. To overcome this limit, you need to extend the Odoo web client in Javascript. Version 12 will feature a new large refactoring of the web client, and this training is a good opportunity to learn where Odoo is going.
Empower your App by Inheriting from Odoo MixinsOdoo
Empower your App by Inheriting from Odoo Mixins. Let us recode everything from scratch! Or not.
Thibault Delavallee, Software Engineer, RD Marketing Team Leader, Odoo
Based on work from Yannick Tivisse, Martin Trigaux, and Damien Bouvy.
The Odoo Framework is quite expressive, many add-ons can express a lot of business logic just by defining models (in Python) and template/views (in XML). This is fine for most cases, but there is a limit to what you can do. To overcome this limit, you need to extend the Odoo web client in Javascript. Version 12 will feature a new large refactoring of the web client, and this training is a good opportunity to learn where Odoo is going.
Introduces important facts and tools to help you get starting with performance improvement.
Learn to monitor and analyze important metrics, then you can start digging and improving.
Includes useful munin probes, predefined SQL queries to investigate your database's performance, and a top 5 of the most common performance problems in custom Apps.
By Olivier Dony - Lead Developer & Community Manager, OpenERP
Odoo Online platform: architecture and challengesOdoo
A short introduction to the technical architecture of the Odoo Online platform, including the advanced integrated features (instant DNS, email gateways, etc.), and the technical aspect of the SLA.
By Olivier Dony - Lead Developer & Community Manager, OpenERP
Odoo ORM Methods | Object Relational Mapping in Odoo15 Celine George
ORM(Object Relational Mapping) is a concept or technique which acts as a bridge between your programming language and your database. Object Relational Mapping helps to execute SQL queries without writing them explicitly. Once the ORM is configured in an application, the user can use the OOP concepts like classes and objects to interact with the database. ORM methods are one of its strong features which helps in executing SQL queries without writing them down explicitly. With the help of ORM methods, the user can implement the OOPS concepts to interact with the database. Odoo creates and manages tables for us inside the database. Thus reducing our work of creation of tables using the queries.
Deploying Moodle With High Availability and auto-scale on Microsoft Azure pla...Somaroy Gabbita
Moodle Installation on Microsoft Azure - Linux Platform
Create a Linux Virtual Machine to use as a Template to autoscale moodle for peak loads and optimize azure spending
Introduces important facts and tools to help you get starting with performance improvement.
Learn to monitor and analyze important metrics, then you can start digging and improving.
Includes useful munin probes, predefined SQL queries to investigate your database's performance, and a top 5 of the most common performance problems in custom Apps.
By Olivier Dony - Lead Developer & Community Manager, OpenERP
Odoo Online platform: architecture and challengesOdoo
A short introduction to the technical architecture of the Odoo Online platform, including the advanced integrated features (instant DNS, email gateways, etc.), and the technical aspect of the SLA.
By Olivier Dony - Lead Developer & Community Manager, OpenERP
Odoo ORM Methods | Object Relational Mapping in Odoo15 Celine George
ORM(Object Relational Mapping) is a concept or technique which acts as a bridge between your programming language and your database. Object Relational Mapping helps to execute SQL queries without writing them explicitly. Once the ORM is configured in an application, the user can use the OOP concepts like classes and objects to interact with the database. ORM methods are one of its strong features which helps in executing SQL queries without writing them down explicitly. With the help of ORM methods, the user can implement the OOPS concepts to interact with the database. Odoo creates and manages tables for us inside the database. Thus reducing our work of creation of tables using the queries.
Deploying Moodle With High Availability and auto-scale on Microsoft Azure pla...Somaroy Gabbita
Moodle Installation on Microsoft Azure - Linux Platform
Create a Linux Virtual Machine to use as a Template to autoscale moodle for peak loads and optimize azure spending
Angular.JS is a modern Javascript MVC Framework that was built from the ground up by a team of Googlers, sponsored by Google itself. Angular.JS allows web developers a clear separation between logic and view, and greatly improves the ability to reuse the code by using things such as Directives, Services, Components.Angular.JS smart templating engine also allows to minimize the HTML code, During the presentation, you'll learn some medium-advanced usages of Angular.JS, how to use it, tips & tricks that will make your app amazing.
A Web Framework that shortens the Time it takes to develop software in at least an Order of Magnitude. while also tremendously minimizing Effort Pain, Time waste, Complexity, Cost of change & more
Webinar topic: Customise Odoo addons modules
Presenter: Achmad Mardiansyah
In this webinar series, We are discussing Customise Odoo addons modules
Please share your feedback or webinar ideas here: http://bit.ly/glcfeedback
Check our schedule for future events: https://www.glcnetworks.com/en/schedule/
Follow our social media for updates: Facebook, Instagram, YouTube Channel, and telegram also discord
Recording available on Youtube
https://youtu.be/lvkOxprEzi4
Presented to the LA JUG. Covers the CRUD operations, indexes, relationships, and transactions with the datastore, memcache, deployment, testing, and more. Content is likely very outdated. 2 hours with Q&A.
(Note that contents may be highly outdated by now.)
The presentation was made to colleagues at Zyxware Technologies. While the company has always tried to make quality its centre piece and has been diligently following good practices to ensure quality, this was the first attempt to articulate a Zyxware perspective on quality of software.The perspective is informed by the imperatives of a software services company.
Iterative Methodology for Personalization Models OptimizationSonya Liberman
Describing the iterative process of optimizing personalized content recommendation models, starting from user preferences optimization to a spark-based large-scale modular machine learning framework.
Developing new feature in Joomla - Joomladay UK 2016Peter Martin
Presentation "The Category Item Counter - developing a new feature" at Joomladay UK 2016 on February 13th in London, UK.
How does a new feature end up in Joomla? Peter talked about the new Category Item Counter feature that will be available in Joomla 3.5:
* the purpose of the feature
* where & how the idea for the "Nice" feature originated
* how the community helped to develop this feature
* how Joomla's development cycle works, including patch testing procedure, and who's Travis?
* the problems with differences in core components
* the hidden secret of com_categories
* how to add a Category Item Counter to your own component
Presentation video: http://www.youtube.com/watch?v=CK_tYC-Yy_c?t=45s
Develop an App with the Odoo Framework or How to Implement a Plant Nursery in a Few Minutes.
Yannick Tivisse, Software Engineer, RD4HR Team Leader, Odoo
Presentation made for Google Developer Day Vietnam. It is an quick and advanced overview of AngularJS modern JavaScript MVC framework. Learn some of the main features as well as other concepts around Angular.JS like SEO, Tooling, Best Practices.
This presentation targets people implementing Odoo and making custom developments. During this presentation, you will learn how Odoo Studio can be used as a prototyping tool for developers. More specifically, you will understand how to use it to prepare custom developments and how it will help you save both time & money.
Discover all the different features of Odoo Studio and how they will make your work easier!
Through different case studies, you will learn how to use Odoo Studio version 12 to create and customize Odoo apps in order to better fit your business needs.
Odoo Experience 2018 - GDPR: How Odoo Can Help You with ComplieanceElínAnna Jónasdóttir
Since May 25th, 2018, the General Data Protection Regulation (GDPR) has come into effect, opening a new era of data protection and privacy. Everyone has heard and read a lot of information about GDPR, but it can be difficult to understand exactly what it means for you, in practical terms, what you should do to be compliant with the new rules, and how Odoo can help you with this daunting task.
After covering the key concepts of GDPR, this talk will review the most common processes a business needs to implement under GDPR. Based on our experience at Odoo SA, we'll discuss how Odoo can help you in practice to become compliant, from the data mapping step to the processing of data subject requests.
Odoo Experience 2018 - How to Break Odoo Security (or how to prevent it)ElínAnna Jónasdóttir
Recent years have seen a steady increase in the digital threats faced by businesses, small and large alike. The security of business and personal data becomes more and more important every day, and the arrival of new regulation such as GDPR adds legal burden to the existing business risk.
XSS, CSRF, SQL injection, broken authentication, data leak, and so on. All kinds of security problems happen every day, even to the biggest companies. We can't stop that, but we can at least prepare for it, by carefully considering the risks, and integrating best practices into daily coding tasks.
Before trying to break it, the talk will first describe the Odoo Security Model, with a quick recap of the key features built into the framework to help developers design secure Apps.
Then we'll explore a few real-life coding examples. We'll show how the security features are used in practice, and how they can be defeated if the developers are not careful, compromising the whole security of the system. Analyzing these examples will give substance and context to the security primitives, and help new and experienced developers integrate best practices into their development workflow.
Odoo Experience 2018 - Speed Up Credit Collection with Automated Follow-UpsElínAnna Jónasdóttir
During this talk, we will see how the automated follow-ups evolved to be even more user-friendly with a brand new view, new functionalities and a new integration possibility.
Odoo Experience 2018 - Organize Your Operations in a Startup EnvironmentElínAnna Jónasdóttir
A startup is always running full speed! You need a powerful IT architecture to support it:
- Build a community,
- Come up with an offer very quickly,
- Service delivery & tracking,
- Methodic invoicing with a good follow-up,
- Reactive customer support (live chat, video chat),
- Rating, etc.
During this presentation we'll cover all of this and more!
Odoo Experience 2018 - How a Feedback Loop Helps to Fine-Tune Your Manufactu...ElínAnna Jónasdóttir
This talk is addressed to Odoo's customers that want to use the application "Quality". We will cover how you can get feedback from your quality application to improve your manufacturing processes in general. During the presentation, we will see how we can trigger quality checks and how we can deal with quality alerts. The talk will consist of a demo of the quality application and how it can in general improve your manufacturing processes by reducing the scrap orders, providing better quality goods delivered to your clients, and check the quality of the goods you receive from your suppliers.
Odoo Experience 2018 - Successful Import of Big Data with an Efficient ToolElínAnna Jónasdóttir
During this presentation people will learn how to build easier and better import strategies, and the focus will be on:
1) The understanding of the tool odoo_csv_import, focused on the available options of the load process (no data transformation)
2) How to solve two difficulties that only this tool can handle easily:
- How to import big data
- How to import specific cases of data relationships
Odoo Experience 2018 - Inventory: Advanced Flow with the New BarcodeElínAnna Jónasdóttir
This talk may interest beginner and expert users who want to work with a barcode scanner. The version and edition covered will be Odoo 12, Enterprise only.
Join the talk to discover the new barcode interface. You will learn how to to use it to treat transfers and inventory adjustments efficiently. Furthermore, you will everything that's new in Odoo V12 related to barcode scanning.
Discover what Easypost is, and how an integration with Easypost could be useful for your business. This talk is intended for all users, from beginners to experts. During this session and live demo, you'll learn how you can easily integrate Odoo with Easypost.
This presentation, created by Syed Faiz ul Hassan, explores the profound influence of media on public perception and behavior. It delves into the evolution of media from oral traditions to modern digital and social media platforms. Key topics include the role of media in information propagation, socialization, crisis awareness, globalization, and education. The presentation also examines media influence through agenda setting, propaganda, and manipulative techniques used by advertisers and marketers. Furthermore, it highlights the impact of surveillance enabled by media technologies on personal behavior and preferences. Through this comprehensive overview, the presentation aims to shed light on how media shapes collective consciousness and public opinion.
Mastering the Concepts Tested in the Databricks Certified Data Engineer Assoc...SkillCertProExams
• For a full set of 760+ questions. Go to
https://skillcertpro.com/product/databricks-certified-data-engineer-associate-exam-questions/
• SkillCertPro offers detailed explanations to each question which helps to understand the concepts better.
• It is recommended to score above 85% in SkillCertPro exams before attempting a real exam.
• SkillCertPro updates exam questions every 2 weeks.
• You will get life time access and life time free updates
• SkillCertPro assures 100% pass guarantee in first attempt.
Collapsing Narratives: Exploring Non-Linearity • a micro report by Rosie WellsRosie Wells
Insight: In a landscape where traditional narrative structures are giving way to fragmented and non-linear forms of storytelling, there lies immense potential for creativity and exploration.
'Collapsing Narratives: Exploring Non-Linearity' is a micro report from Rosie Wells.
Rosie Wells is an Arts & Cultural Strategist uniquely positioned at the intersection of grassroots and mainstream storytelling.
Their work is focused on developing meaningful and lasting connections that can drive social change.
Please download this presentation to enjoy the hyperlinks!
6. ● Mixin class: extracts transversal features
● AbstractModel: no table, only for definition
● offer features through inheritance
● e.g. messaging mechanism, customer satisfaction request, ...
15. ● Communication & Organization
○ Discuss on a document, send mailings
○ Schedule activities
● Marketing
○ Get customer satisfaction insights
○ Track campaigns and mediums
● Website
○ Manage document publication
○ Promote pages
16. ● Communication & Organization
○ Discuss on a document, send mailings
○ Schedule activities
● Marketing
○ Get customer satisfaction insights
○ Track campaigns and mediums
● Website
○ Manage document publication
○ Promote pages
● mail.thread
● mail.activity.mixin
● rating.mixin
● utm.mixin
● portal, website.published
● website.seo.metadata
17. ● Features of mixins
● How to implement them
● Code bits
● Live result
● Documentation ?
○ Odoo code
○ Documentation
○ https://github.com/tivisse/odoodays-2018
18.
19. ● Add messaging to any class
● Auto-interfacing with e-mail
● How to use:
○ inherit mail.thread
○ add widgets
○ have fun !
20. ● Add messaging to any class
● Auto-interfacing with e-mail
● How to use:
○ Inherit mail.thread
○ Add widgets
○ Have fun !
class Plant(models.Model):
_name = 'nursery.plant'
_description = 'Plant'
_inherit = ['mail.thread']
<div class="oe_chatter">
<field name="message_follower_ids"
widget="mail_followers"/>
<field name="message_ids"
widget="mail_thread"/>
</div>
{
'name': Plant Nursery,
'depends': ['mail'],
}
21. ● Messages linked to a document class Message(models.Model):
_name = 'mail.message'
_description = 'Message'
model = fields.Char(...)
res_id = fields.Integer(...)
notified_partner_ids = fields.Many2Many(...)
def create(self, values):
msg = super()
msg._notify()
return msg
def _notify(self):
followers = self.get_followers()
followers.notify()
followers.send_mail()
class Plant(models.Model):
_inherit = ['mail.thread']
# coming from mail.thread inheritance
message_ids = fields.One2many(...)
22. ● Messages linked to a document
● Communication through Chatter
class MailThread(models.AbstractModel):
_name = 'mail.thread'
message_ids = fields.One2many(...)
def message_post(self, subject, body, **kw):
self.env['mail.message'].create({
'model': self.model,
'res_id': self.res_id})
class Plant(models.Model):
_name = 'nursery.plant'
_inherit = ['mail.thread']
def message_post(self, subject, body, **kw):
super()
23. ● Messages linked to a document
● Communication through Chatter
● Followers management
class MailThread(models.AbstractModel):
_name = 'mail.thread'
message_follower_ids = fields.One2many(...)
def message_subscribe(self, partners, channels):
# add followers and listeners
Follower.create(partners)
class Plant(models.Model):
_name = 'nursery.plant'
_inherit = ['mail.thread']
def message_subscribe(self, partners, channels):
super()
24. ● Process and route incoming emails
● Ensure thread detection
● App-specific behavior on new thread
or on update
class MailThread(models.AbstractModel):
_name = 'mail.thread'
def message_process(self, email):
# process email values
def message_route(self, message):
# heuristics when incoming email detected
class Plant(models.Model):
_name = 'nursery.plant'
_inherit = ['mail.thread']
def message_new(self, message):
# do sthg when creating from email
super()
def message_update(self, message):
# do sthg when incoming email
super()
25. ● Activities management on
document
● Interfacing with Chatter
● How to use:
○ inherit mail.activity.mixin
○ add widgets
○ have much fun !
class Plant(models.Model):
_name = 'nursery.plant'
_description = 'Plant'
_inherit = ['mail.thread', 'mail.activity.mixin']
<div class="oe_chatter">
<field name="message_ids" widget="mail_thread"/>
<field name="activity_ids" widget="mail_activity"/>
</div>
{
'name': Plant Nursery,
'depends': ['mail'],
}
26. ● Activities management on
document
● Activity-based state
● Filters
class Plant(models.Model):
_name = 'nursery.plant'
_description = 'Plant'
_inherit = ['mail.thread', 'mail.activity.mixin']
# coming from mail.activity inheritance
activity_ids = fields.One2many('mail.activity')
activity_state = fields.Selection([
('overdue', 'Overdue'),
('today', 'Today'),
('planned', 'Planned')])
27. ● Automatic activity
(re)scheduling or closing
● Specify a responsible on a
given business flow
class MailActivityMixin(models.AbstractModel):
_name = 'mail.activity.mixin'
def activity_schedule(self, type, date):
# Schedule an activity
def activity_feedback(self, feedback):
# Set activities as done
def activity_unlink(self):
# Delete activities
class Order(models.Model):
_name = 'nursery.order'
_inherit = ['mail.thread', 'mail.activity.mixin']
def create(self, vals):
res = super()
res.activity_schedule()
28. ● Automatic activity
(re)scheduling or closing
● Specify a responsible on a
given business flow
class Order(models.Model):
_name = 'nursery.order'
_inherit = ['mail.thread', 'mail.activity.mixin']
@api.model
def create(self, vals):
res = super(Order, self).create(vals)
res.activity_schedule(
'mail.mail_activity_data_todo',
user_id=self.env.ref('base.user_demo').id,
date_deadline=fields.Date.today() + relativedelta(days=1),
summary=_('Pack the order'))
return res
def action_confirm(self):
if self.state != 'draft':
return
self.activity_feedback(['mail.mail_activity_data_todo'])
return self.write({
'state': 'open',
'date_open': fields.Datetime.now(),
})
31. ● Add rating on any class
● Request rating via
email/route
● Analyse your ratings
● How to use:
○ It’s a bit of work
class Plant(models.Model):
_name = 'nursery.plant'
_description = 'Plant'
_inherit = ['mail.thread', 'rating.mixin']
{
'name': Plant Nursery,
'depends': ['rating']
}
class RatingMixin(models.AbstractModel):
_name = 'rating.mixin'
rating_ids = fields.One2many('rating.rating', ...)
rating_last_value = fields.Float(...)
rating_last_feedback = fields.Text(...)
rating_count = fields.Integer(...)
32. ● Rated partner (user_id.partner_id field)
○ rating_get_rated_partner_id
○ In our case, nothing to do
class RatingMixin(models.AbstractModel):
_name = 'rating.mixin'
def rating_get_rated_partner_id(self):
if hasattr(self, 'user_id') and self.user_id.partner_id:
return self.user_id.partner_id
return self.env['res.partner']
33. ● Rated partner (user_id.partner_id field)
○ rating_get_rated_partner_id
● Customer (partner_id field)
○ rating_get_partner_id
○ Need to override
class RatingMixin(models.AbstractModel):
_name = 'rating.mixin'
def rating_get_partner_id(self):
if self.customer_id.partner_id:
return self.customer_id.partner_id
return self.env['res.partner']
class Customer(models.Model):
_name = 'nursery.customer'
partner_id = fields.Many2one('res.partner')
class Order(models.Model):
_name = 'nursery.order'
def rating_get_partner_id(self):
if self.customer_id.partner_id:
return self.customer_id.partner_id
return self.env['res.partner']
47. ● Control visibility of documents
● Add fields
○ published
○ URL (slug)
● Access rights & route
management still up to you !
class Plant(models.Model):
_name = 'nursery.plant'
_description = 'Plant'
_inherit = ['website.published.mixin']
{
'name': Plant Nursery,
'depends': ['website'],
}
class WebsitePublishedMixin(models.AbstractModel):
_name = "website.published.mixin"
website_published = fields.Boolean('')
website_url = fields.Char(compute='_compute_website_url')
@api.multi
def _compute_website_url(self):
for record in self:
record.website_url = '#'
48. ● Control visibility of documents
● Wesite URL: computed field
○ -> slug (/plant/tree-1)
● Backend: use website_button
○ -> jump to website_url
<button class="oe_stat_button"
name="website_publish_button"
type="object" icon="fa-globe">
<field name="website_published"
widget="website_button"/>
</button>
from odoo.addons.http_routing.models.ir_http import slug
class Plant(models.Model):
_name = 'nursery.plant'
_inherit = ['website.published.mixin']
def _compute_website_url(self):
for plant in self:
plant.website_url = '/plant/%s' % slug(plant)
49. ● publish_management widget
● Link backend / frontend
○ Give action to execute
<t t-call="website.publish_management">
<t t-set="object" t-value="plant"/>
<t t-set="publish_edit" t-value="True"/>
<t t-set="action"
t-value="'plant_nursery.action_nursery_plant"/>
</t>
50. ● Restrict document to a specific
website
● Add website_id
● Add a method to be used in
routes
class Plant(models.Model):
_name = 'nursery.plant'
_description = 'Plant'
_inherit = ['website.multi.mixin']
{
'name': Plant Nursery,
'depends': ['website'],
}
class WebsiteMultiMixin(models.AbstractModel):
_name = 'website.multi.mixin'
website_id = fields.Many2one('website')
@api.multi
def can_access_from_current_website(self, website_id=False):
# Specify if the record can be accessed on this website
51. ● Publish document on a specific
website
● Add website_id
● Add a method
_compute_website_published
class Plant(models.Model):
_name = 'nursery.plant'
_description = 'Plant'
_inherit = ['website.published.multi.mixin']
{
'name': Plant Nursery,
'depends': ['website'],
}
class WebsitePublishedMultiMixin(models.AbstractModel):
_name = 'website.published.multi.mixin'
website_id = fields.Many2one('website')
website_published = fields.Boolean(compute='_compute_website_published')
def _compute_website_published(self):
# Specify if the record is published on this website
52. ● Document - and App- specific
portal url computation
class Plant(models.Model):
_name = 'nursery.plant'
_description = 'Plant'
_inherit = ['portal.mixin']
{
'name': Plant Nursery,
'depends': ['portal'],
}
53. ● Document - and App- specific
portal url computation
● Generic URL computation
○ /mail/view controller
○ access_token
○ partner_id
○ integration with auth_signup
class PortalMixin(models.AbstractModel):
_name = "portal.mixin"
access_url = fields.Char(compute='_compute_access_url')
access_token = fields.Char('Security Token')
access_warning = fields.Text(compute="_compute_access_warning")
def _compute_access_warning(self):
# Set a warning text if the record can't be shared
access_warning = ''
def _compute_access_url(self):
# Set the URL to reach the record on portal
record.access_url = '#'
54. ● Document - and App- specific
portal url computation
● In your App
○ Portal Implementation...
○ access_token definition
○ Share button
● /mail/view controller check and
redirection to portal
class PortalMixin(models.AbstractModel):
_name = "portal.mixin"
access_url = fields.Char(compute='_compute_access_url')
access_token = fields.Char('Security Token')
access_warning = fields.Text(compute="_compute_access_warning")
def _compute_access_warning(self):
# Set a warning text if the record can't be shared
access_warning = ''
def _compute_access_url(self):
# Set the URL to reach the record on portal
record.access_url = '#'
<header>
<button name="%(portal.portal_share_action)d" string="Share"
type="action" class="oe_highlight oe_read_only"/>
</header>
58. ● Characterize / filter messages
● Subtype definition (XML)
○ model specific (e.g. plant)
○ default / hidden
● Use in code: message_post
class Plant(models.Model):
_name = 'nursery.plant'
_inherit = ['mail.thread']
def write(self, values)::
res = super()
if 'price' in values:
self.message_post('Price Updated', subtype='plant_price')
return res
<record id="plant_price" model="mail.message.subtype">
<field name="name">Price Updated</field>
<field name="res_model">nursery.plant</field>
<field name="default" eval="True"/>
<field name="hidden" eval="False"/>
<field name="description">Price Updated</field>
</record>
59. ● Track value change
● track_visibility on field
○ onchange
○ Always
○ True
● Automatic logging
class Plant(models.Model):
_name = 'nursery.plant'
_inherit = ['mail.thread']
price = fields.Float('Price', track_visibility=True)
60. ● Warn on some specific value
change
● Link a set of tracking and a
subtype
○ _track_subtype
○ return xml_id
● Message with tracking generated
with the subtype
○ allow people to be notified
class Plant(models.Model):
_name = 'nursery.plant'
_inherit = ['mail.thread', 'rating.mixin']
price = fields.Float('Price',
track_visibility='onchange')
def _track_subtype(self, values):
if 'price' in values:
return 'plant_nursery.plant_price'
return super()
61. class Plant(models.Model):
_name = 'nursery.plant'
_inherit = ['mail.thread', 'rating.mixin']
price = fields.Float('Price',
track_visibility='onchange')
def _track_template(self, values):
res = super()
if 'price' in values:
res['price'] = (
'plant_price_template',
options)
return res
● Email on some specific value change
● Link a set of tracking and an
automatic mailing
○ _track_template
○ give a mail.template and options
● Template rendered and sent
○ Force mailing to people
● Ultra power: add rating in template
62. ● Email integrated with mailgateway
● Purpose: create / update thread in a
given model
● Owner: record defining the alias
● Example
○ alias on category
○ creating XMas quote
class MailAlias(models.AbstractModel):
_name = 'mail.alias'
name = fields.Char('Email')
# record creation / update
model = fields.Char('Model')
thread_id = fields.Integer('Update specific record')
# record owner
parent_model = fields.Char('Owner model')
parent_thread_id = fields.Integer('Owner ID')
63. ● mail.alias.mixin
● add alias_id field
● Specify what do do with alias by
overriding methods
class Category(models.Model):
_name = 'plant.category'
_inherit = ['mail.alias.mixin']
def get_alias_model_name(self, values):
return 'nursery.order'
def get_alias_values(self):
values = super()
values['alias_defaults'] = {}
return values
class MailAlias(models.AbstractModel):
_name = 'mail.alias.mixin'
_inherit = {'mail.alias' : 'alias_id'}
alias_id = fields.Many2one('Alias')
66. #odooexperience
Based on work from Thibault DELAVALLEE and Martin TRIGAUX, that was based on work from Damien BOUVY
https://github.com/tivisse/odoodays-2018
EXPERIENCE
2018