Toggle navigation

Javascript API

module web.GraphController
class GraphController(parent, model, renderer, params)
Parameters
method getContext() → Object

Returns the current mode, measure and groupbys, so we can restore the view when we save the current state in the search view, or when we add it to the dashboard.

Return Type
Object
method renderButtons([$node])

Render the buttons according to the GraphView.buttons and add listeners on it. Set this.$buttons with the produced jQuery element

Parameters
    $node (jQuery) – a jQuery node where the rendered buttons should be inserted $node may be undefined, in which case the GraphView does nothing
class GraphControllerParams()
attribute measures string[]
attribute isEmbedded boolean
attribute groupableFields, string[]
module pad.pad
class FieldPad(parent, name, record[, options])
Parameters

    parent (Widget)

    name (string) – The field name defined in the model

    record (Object) – A record object (result of the get method of a basic model)

    options (FieldPadOptions)

method commitChanges()

If we had to generate an url, we wait for the generation to be completed, so the current record will be associated with the correct pad url.

class FieldPadOptions()
attribute mode string

should be ‘readonly’ or ‘edit’

module web.contentdisposition

Stripped down to only parsing/decoding.

namespace
function parse(string) → ContentDisposition

Parse Content-Disposition header string.

Parameters
    string (string)
function parse(string) → ContentDisposition

Parse Content-Disposition header string.

Parameters
    string (string)
function ContentDisposition(type, parameters)

Class for parsed Content-Disposition header for v8 optimization

Parameters

    type (string)

    parameters (object)

module web.collections
Depends On
namespace
class Tree(data)
Extends
Parameters
    data (any) – the data associated to the root node

Allows to build a tree representation of a data.

method getData() → *

Returns the root’s associated data.

Return Type
any
method addChild(tree)

Adds a child tree.

Parameters
class Tree(data)
Extends
Parameters
    data (any) – the data associated to the root node

Allows to build a tree representation of a data.

method getData() → *

Returns the root’s associated data.

Return Type
any
method addChild(tree)

Adds a child tree.

Parameters
module web.ServiceProviderMixin
namespace ServiceProviderMixin
module mail.model.MultiUserChannel
class MultiUserChannel(params)
Extends
Parameters
method isMassMailing() → boolean

States whether this thread has the mass mailing setting active or not. This is a server-side setting, that determine the type of composer that is used (basic or extended composer).

Return Type
boolean
method unsubscribe() → $.Promise

Unsubscribes from channel

Returns
resolve when unsubscribed
Return Type
jQuery.Promise
class MultiUserChannelParams()
attribute data Object
attribute data.mass_mailing boolean
attribute data.public string
either ‘public’ or
‘private’
module web.CrashManager
class RedirectWarningHandler(parent, error)
Extends
Parameters

    parent

    error

Handle redirection warnings, which behave more or less like a regular warning, with an additional redirection button.

namespace ExceptionHandler

An interface to implement to handle exceptions. Register implementation in instance.web.crash_manager_registry.

function display()

Called to inform to display the widget, if necessary. A typical way would be to implement this interface in a class extending instance.web.Dialog and simply display the dialog in this method.

class CrashManager()
Extends
module pos_restaurant.multiprint
namespace
module mail.model.ThreadTypingMixin
namespace ThreadTypingMixin

Mixin for enabling the “is typing…” notification on a type of thread.

function getTypingMembersToText() → string

Get the text to display when some partners are typing something on the thread:

  • single typing partner:

    A is typing…
  • two typing partners:

    A and B are typing…
  • three or more typing partners:

    A, B and more are typing…

The choice of the members name for display is not random: it displays the user that have been typing for the longest time. Also, this function is hard-coded to display at most 2 partners. This limitation comes from how translation works in Odoo, for which unevaluated string cannot be translated.

Returns
list of members that are typing something on the thread (excluding the current user).
Return Type
string
function hasTypingNotification() → boolean

Threads with this mixin have the typing notification feature

Return Type
boolean
function registerTyping(params)

Register someone that is currently typing something in this thread. If this is the current user that is typing something, don’t do anything (we do not have to display anything)

This method is ignored if we try to register the current user.

Parameters
class RegisterTypingParams()
attribute partnerID integer
ID of the partner linked to the user
currently typing something on the thread.
function setMyselfTyping(params)

This method must be called when the user starts or stops typing something in the composer of the thread.

Parameters
class SetMyselfTypingParams()
attribute typing boolean

tell whether the current is typing or not.

function unregisterTyping(params)

Unregister someone from currently typing something in this thread.

Parameters
class UnregisterTypingParams()
attribute partnerID integer
ID of the partner related to the user
that is currently typing something
namespace ThreadTypingMixin

Mixin for enabling the “is typing…” notification on a type of thread.

function getTypingMembersToText() → string

Get the text to display when some partners are typing something on the thread:

  • single typing partner:

    A is typing…
  • two typing partners:

    A and B are typing…
  • three or more typing partners:

    A, B and more are typing…

The choice of the members name for display is not random: it displays the user that have been typing for the longest time. Also, this function is hard-coded to display at most 2 partners. This limitation comes from how translation works in Odoo, for which unevaluated string cannot be translated.

Returns
list of members that are typing something on the thread (excluding the current user).
Return Type
string
function hasTypingNotification() → boolean

Threads with this mixin have the typing notification feature

Return Type
boolean
function registerTyping(params)

Register someone that is currently typing something in this thread. If this is the current user that is typing something, don’t do anything (we do not have to display anything)

This method is ignored if we try to register the current user.

Parameters
class RegisterTypingParams()
attribute partnerID integer
ID of the partner linked to the user
currently typing something on the thread.
function setMyselfTyping(params)

This method must be called when the user starts or stops typing something in the composer of the thread.

Parameters
class SetMyselfTypingParams()
attribute typing boolean

tell whether the current is typing or not.

function unregisterTyping(params)

Unregister someone from currently typing something in this thread.

Parameters
class UnregisterTypingParams()
attribute partnerID integer
ID of the partner related to the user
that is currently typing something
module web.AbstractAction
Depends On
class AbstractAction(parent)
Extends
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.
method on_attach_callback()

Called each time the action is attached into the DOM.

method on_detach_callback()

Called each time the action is detached from the DOM.

method canBeRemoved() → Deferred

In some situations, we need confirmation from the controller that the current state can be destroyed without prejudice to the user. For example, if the user has edited a form, maybe we should ask him if we can discard all his changes when we switch to another action. In that case, the action manager will call this method. If the returned deferred is succesfully resolved, then we can destroy the current action, otherwise, we need to stop.

Returns
resolved if the action can be removed, rejected otherwise
Return Type
method getContext()

This function is called when the current context (~state) of the action should be known. For instance, if the action is a view controller, this may be useful to reinstantiate the view in the same state.

method giveFocus()

Gives the focus to the action

method renderButtons($node)

Renders the buttons to append, in most cases, to the control panel (in the bottom left corner). When the action is rendered in a dialog, those buttons might be moved to the dialog’s footer.

Parameters
    $node (jQuery)
module board.BoardView
class BoardView(viewInfo)
Extends
Parameters
    viewInfo
module website_rating_project.rating
Depends On
namespace
module web.GraphView
class GraphView(viewInfo, params)
Parameters

    viewInfo

    params

module web.AbstractWebClient
class AbstractWebClient(parent)
method set_title(title)

Sets the first part of the title of the window, dedicated to the current action.

Parameters
    title
method do_action()

When do_action is performed on the WebClient, forward it to the main ActionManager This allows to widgets that are not inside the ActionManager to perform do_action

method current_action_updated(action, controller)

Handler to be overridden, called each time the UI is updated by the ActionManager.

Parameters

    action (Object) – the action of the currently displayed controller

    controller (Object) – the currently displayed controller

module point_of_sale.chrome
namespace
module website_hr_recruitment.tour
namespace
module mail.model.MailFailure
class MailFailure(parent, data)
method getDocumentModel() → string

Get the document model that this mail failure is linked to.

Return Type
string
method getDocumentID() → integer

Get the document ID that this mail failure is linked to.

Return Type
integer
method getMessageID() → integer

Get the ID of the message that this mail failure is related to.

Return Type
integer
method getPreview() → Object

Get a valid object for the ‘mail.preview’ template

Return Type
Object
method isLinkedToDocument() → boolean

Tell whether the mail failure comes from a message in a document.

Return Type
boolean
class MailFailureData()
attribute last_message_date string
attribute message_id integer
attribute model string
attribute model_name string
attribute module_icon string
attribute notifications Array
attribute record_name string
attribute res_id integer
attribute uuid string
module mail.model.SearchableThread
class SearchableThread(params)
Extends
Parameters

This is a version of a thread that is handling a cache. Basically, this cache is an object indexed by stringified indexes. These indexes represent the domain of messages that match this domain.

Any threads that are instances of this Class can be used with a search view, in order to make searches on messages in a thread.

method getLastSeenMessageID() → integer|null

Get the last seen message for a given thread

Returns
last seen message ID (if any)
Return Type
integer or null
method hasMessages([options]) → boolean

Override so that a thread can tell whether there are message based on the domain.

Parameters
Return Type
boolean
class HasMessagesOptions()
attribute domain Array
function invalidateCaches()

Invalidate the caches of the thread

function isAllHistoryLoaded(domain) → boolean

State whether all messages have been loaded or not

Parameters
    domain (Array)
Return Type
boolean
function removeMessage(messageID)

Remove message with ID messageID from this thread

This is equivalent to removing this message from all the caches

Parameters
    messageID (integer)
function setLastSeenMessageID(messageID)

Set ‘messageID’ as the ID of the last message seen in this thread

Parameters
    messageID (integer)
class SearchableThreadParams()
attribute data Object
attribute data.seen_message_id integer
class SearchableThread(params)
Extends
Parameters

This is a version of a thread that is handling a cache. Basically, this cache is an object indexed by stringified indexes. These indexes represent the domain of messages that match this domain.

Any threads that are instances of this Class can be used with a search view, in order to make searches on messages in a thread.

method getLastSeenMessageID() → integer|null

Get the last seen message for a given thread

Returns
last seen message ID (if any)
Return Type
integer or null
method hasMessages([options]) → boolean

Override so that a thread can tell whether there are message based on the domain.

Parameters
Return Type
boolean
class HasMessagesOptions()
attribute domain Array
function invalidateCaches()

Invalidate the caches of the thread

function isAllHistoryLoaded(domain) → boolean

State whether all messages have been loaded or not

Parameters
    domain (Array)
Return Type
boolean
function removeMessage(messageID)

Remove message with ID messageID from this thread

This is equivalent to removing this message from all the caches

Parameters
    messageID (integer)
function setLastSeenMessageID(messageID)

Set ‘messageID’ as the ID of the last message seen in this thread

Parameters
    messageID (integer)
class SearchableThreadParams()
attribute data Object
attribute data.seen_message_id integer
module web.FiltersMenu
class FiltersMenu(parent, filters, fields)
Parameters

    parent (Widget)

    filters (Array<Object>) – list of filters (type IFilter below) interface IFilter { itemId: string; unique id associated with the filter domain: string; isPeriod: boolean fieldName: string; fieldName used to generate a domain in case isDate is true (and domain empty) description: string; label printed on screen groupId: string; isActive: boolean; (optional) determines if the filter is considered active isOpen: boolean; (optional) in case there are options the submenu presenting the options is opened or closed according to isOpen isRemovable: boolean; (optional) can be removed from menu options: array of objects with ‘optionId’ and ‘description’ keys; (optional) defaultOptionId: string refers to an optionId (optional) currentOptionId: string refers to an optionId that is activated if item is active (optional) }

    fields (Object)

module barcodes.BarcodeEvents
namespace
object BarcodeEvents instance of BarcodeEvents

Singleton that emits barcode_scanned events on core.bus

attribute ReservedBarcodePrefixes Array

List of barcode prefixes that are reserved for internal purposes

module auth_password_policy.Meter
class PasswordPolicyMeter(parent, required, recommended)
Extends
Parameters

    parent

    required

    recommended

method update(password)

Updates the meter with the information of the new password: computes the (required x recommended) score and sets the widget’s value as that

Parameters
    password (String)
module bus.BusService
class BusService()
method start()

This method is necessary in order for this Class to be used to instantiate services

method sendNotification(title, content[, callback])

Send a notification, and notify once per browser’s tab

Parameters

    title (string)

    content (string)

    callback (function) – if given callback will be called when user clicks on notification

method onNotification(receiver, func)

Register listeners on notifications received on this bus service

Parameters

    receiver (Object)

    func (function)

module web.ajax
namespace loadXML

Loads an XML file according to the given URL and adds its associated qweb templates to the given qweb engine. The function can also be used to get the deferred which indicates when all the calls to the function are finished.

Note: “all the calls” = the calls that happened before the current no-args one + the calls that will happen after but when the previous ones are not finished yet.

function loadLibs(libs) → Deferred

Loads the given js and css libraries. Note that the ajax loadJS and loadCSS methods don’t do anything if the given file is already loaded.

Parameters
Return Type
class LoadLibsLibs()
attribute cssLibs Array<string>
A list of css files, to be loaded in
parallel
function get_file(options) → boolean

Cooperative file download implementation, for ajaxy APIs.

Requires that the server side implements an httprequest correctly setting the fileToken cookie to the value provided as the token parameter. The cookie must be set on the / path and must not be httpOnly.

It would probably also be a good idea for the response to use a Content-Disposition: attachment header, especially if the MIME is a “known” type (e.g. text/plain, or for some browsers application/json

Parameters
Returns
a false value means that a popup window was blocked. This mean that we probably need to inform the user that something needs to be changed to make it work.
Return Type
boolean
class GetFileOptions()
attribute url String

used to dynamically create a form

attribute data Object

data to add to the form submission. If can be used without a form, in which case a form is created from scratch. Otherwise, added to form data

attribute form HTMLFormElement

the form to submit in order to fetch the file

attribute success Function

callback in case of download success

attribute error Function

callback in case of request error, provided with the error body

attribute complete Function

called after both success and error callbacks have executed

namespace loadCSS

Load css asynchronously: fetch it from the url parameter and add a link tag to <head>. If the url has already been requested and loaded, the promise will resolve immediately.

namespace ajax
namespace loadCSS

Load css asynchronously: fetch it from the url parameter and add a link tag to <head>. If the url has already been requested and loaded, the promise will resolve immediately.

namespace loadXML

Loads an XML file according to the given URL and adds its associated qweb templates to the given qweb engine. The function can also be used to get the deferred which indicates when all the calls to the function are finished.

Note: “all the calls” = the calls that happened before the current no-args one + the calls that will happen after but when the previous ones are not finished yet.

function loadLibs(libs) → Deferred

Loads the given js and css libraries. Note that the ajax loadJS and loadCSS methods don’t do anything if the given file is already loaded.

Parameters
Return Type
class LoadLibsLibs()
attribute cssLibs Array<string>
A list of css files, to be loaded in
parallel
function get_file(options) → boolean

Cooperative file download implementation, for ajaxy APIs.

Requires that the server side implements an httprequest correctly setting the fileToken cookie to the value provided as the token parameter. The cookie must be set on the / path and must not be httpOnly.

It would probably also be a good idea for the response to use a Content-Disposition: attachment header, especially if the MIME is a “known” type (e.g. text/plain, or for some browsers application/json

Parameters
Returns
a false value means that a popup window was blocked. This mean that we probably need to inform the user that something needs to be changed to make it work.
Return Type
boolean
class GetFileOptions()
attribute url String

used to dynamically create a form

attribute data Object

data to add to the form submission. If can be used without a form, in which case a form is created from scratch. Otherwise, added to form data

attribute form HTMLFormElement

the form to submit in order to fetch the file

attribute success Function

callback in case of download success

attribute error Function

callback in case of request error, provided with the error body

attribute complete Function

called after both success and error callbacks have executed

module web.dataComparisonUtils
namespace
module mail.Manager.Notification
class MailManager(parent)
Parameters
    parent
method addMessage(data)

For new posted message of current user in a document thread: store it in the localStorage to make it appear on the other tabs.

Note: ‘addMessage’ modifies the message in place (by setting the channel_id, so we must store the message in the localStorage before calling ‘addMessage’)

Parameters
class AddMessageData()
attribute author_id Array
[int, string] where int is server ID of
the author, and string is the name of the author.
attribute id integer

server ID of the message

attribute model string
the model name of the document that this
message is related to.
attribute res_id integer
the ID of the document that this message
is related to.
function createChannel(name, type) → $.Promise<integer>

Creates a channel, can be either a true channel or a DM chat based on type

Parameters

    name (integer or string) – id of partner (in case of dm) or name

    type (string) – [‘dm_chat’, ‘public’, ‘private’]

Returns
resolved with ID of the newly created channel
Return Type
jQuery.Promise<integer>
function getCannedResponses() → Array

Returns the list of canned responses A canned response is a pre-formatted text that is triggered with some keystrokes, such as with ‘:’.

Returns
array of Objects (mail.shortcode)
Return Type
Array
function getChannel(threadID) → mail.model.Channel|undefined

Returns a channel corresponding to the given id.

Parameters
    threadID (integer)
Returns
the channel, if it exists
Return Type
mail.model.Channel or undefined
function getChannels() → mail.model.Channel[]

Returns a list of channels

Returns
list of channels
Return Type
function getChannelPreviews() → $.Promise<Object[]>

Overrides to filter out the Support channel from the previews.

Returns
list of valid objects for mail.Preview template
Return Type
jQuery.Promise<Array<Object>>
function getDiscussMenuID() → integer

Returns the record id of ir.ui.menu for Discuss

Returns
record id
Return Type
integer
function getDMChatFromPartnerID(partnerID) → Object|undefined

Gets direct message channel

Parameters
    partnerID (integer)
Returns
channel
Return Type
Object or undefined
function getMailFailures() → mail.model.MailFailure[]

Returns a list of mail failures

Returns
list of mail failures
Return Type
function getMentionPartnerSuggestions() → Array<Object[]>

Get partners as mentions from a chatter Typically all employees as partner suggestions.

Return Type
Array<Array<Object>>
function getMessage(messageID) → mail.model.Message|undefined

Gets message from its ID

Parameters
    messageID (integer)
Returns
the matched message (if any)
Return Type
mail.model.Message or undefined
function getSystrayPreviews([filter]) → $.Promise<Object[]>

Returns the previews to display in the systray’s messaging menu.

Parameters
    filter=undefined (string) – specify ‘chat’ or ‘channels’ to only get previews for that type of threads
Returns
resolved with list of objects that have a valid format for rendering a messaging menu preview items.
Return Type
jQuery.Promise<Array<Object>>
function getModeratedChannelIDs() → integer[]

Get the list of channel IDs where the current user is a moderator

Return Type
Array<integer>
function getOdoobotID() → string

Get the OdooBot ID, which is the default authorID for transient messages

Return Type
string
function getThread(threadID) → mail.model.Thread|undefined

Returns thread matching provided ID, if any

Parameters
    threadID (string or integer)
Returns
the thread, if it exists
Return Type
mail.model.Thread or undefined
function getThreads() → mail.model.Thread[]

Returns a list of threads

Returns
list of threads
Return Type
function isMyselfModerator() → boolean

States whether the current user is a moderator or not

Return Type
boolean
function isReady() → $.Promise

States whether the mail manager is ready or not This is the case when it has fetched the initial state from the server, by means of the route ‘mail/init_messaging’

Return Type
jQuery.Promise
function joinChannel(channelID[, options]) → $.Promise<integer>

Join an existing channel See @createChannel to join a new channel

Parameters

    channelID (integer)

    options (Object) – options to be passed on channel add

Returns
resolved with channelID joined
Return Type
jQuery.Promise<integer>
function markMessagesAsRead(messageIDs) → $.Promise

Mark messages as read

Parameters
    messageIDs (Array) – list of messages IDs
Returns
resolved when messages have been marked as read on the server.
Return Type
jQuery.Promise
function openThread(threadID)

Open the thread window if discuss is not opened

Parameters
    threadID (integer or string)
function redirect(resModel, resID[, dmRedirectionCallback])

Special redirection handling for given model and id

If the model is res.partner, and there is a user associated with this partner which isn’t the current user, open the DM chat with this user. Otherwhise, open the record’s form view (if not current user’s).

Parameters

    resModel (string) – model to open

    resID (integer) – record to open

    dmRedirectionCallback (function) – only used if ‘res.partner’, a function that has a threadID as input

function removeMessageFromThreads(message)

Remove the message from all of its threads

Parameters
function searchPartner(searchVal, limit) → $.Promise<Object[]>

Search among prefetched partners, using the string ‘searchVal’

Parameters

    searchVal (string)

    limit (integer) – max number of found partners in the response

Returns
list of found partners (matching ‘searchVal’)
Return Type
jQuery.Promise<Array<Object>>
function unstarAll() → $.Promise

Unstars all messages from all channels

Return Type
jQuery.Promise
function getDocumentThread(model, resID) → integer

Returns a document thread corresponding to the given model and resID.

Parameters

    model (string) – of the document thread, if it exists

    resID

Returns
resID of the document thread, if it exists
Return Type
integer
function getOrAddDocumentThread(params) → mail.model.DocumentThread

Add a new document thread, or get if it exists already.

Also, if a name is provided for the document thread, it overwrites the previous one.

class GetOrAddDocumentThreadParams()
attribute message_ids interger[]
the list of message ids linked
to the document (if not given, they will be fetched before fetching the messages)
attribute name string
if provided, overwrites the name of the
existing document thread
attribute resID integer
attribute resModel string
function updateDocumentThreadState(threadID, state)

Updates the state of a given document thread (stored in localStorage). Garbage collects windows previously marked as ‘closed’ (assuming that the info has already been processed by the other tabs).

Parameters
class UpdateDocumentThreadStateState()
attribute name string

name of the document thread

attribute windowState string

(‘closed’, ‘folded’ or ‘open’)

function initSupport()

Initialises the Support: checks if there is a pending chat session between the user and Support, and if so, re-opens it. Note: we can’t directly override init(), because it is already called when the include is applied, so we use this hook instead (called at webclient startup)

function startPollingSupport([pollingDelay])

Initiates a longpoll with the server hosting the Support channel.

Parameters
    pollingDelay=POLL_TIMEOUT_DELAY (integer) – the longpolling timeout delay to set
function startSupportLivechat([channelState]) → Deferred

Opens the Support channel between a livechat operator from the Support database and the current user (if there is an available operator). Ensures to perform only once the request to create/retrieve the Support channel.

Parameters
    channelState=’open’ (string) – state of the Support channel (see CHANNEL_STATES for accepted values)
Return Type
function updateSupportChannelState(state)

Updates the state of the Support channel (stored in the localStorage).

Parameters
    state (string) – (‘closed’, ‘folded’ or ‘open’)
function openBlankThreadWindow()

Open the blank thread window (i.e. the thread window without any thread linked to it). Make it if there is no blank thread window yet.

function openDMChatWindowFromBlankThreadWindow(partnerID)

Open a DM chat in a thread window. This is useful when selecting a DM chatin the blank thread window, so that it replaces it with the DM chat window.

Parameters
    partnerID (integer)
function openThreadWindow(threadID[, options])

Open a thread in a thread window

Parameters
class OpenThreadWindowOptions()
attribute passively boolean
if set to true, open the thread
window without focusing the input and marking messages as read if it is not open yet, and do nothing otherwise.
attribute keepFoldState boolean
if set to true, keep the
fold state of the thread
function updateThreadWindow(threadID, options)

Called when a thread has its window state that has been changed, so its thread window view should be changed to match the model.

Parameters

    threadID (integer or string)

    options (UpdateThreadWindowOptions) – option to be applied on opening thread window, if the thread is detached

class UpdateThreadWindowOptions()
option to be applied on opening thread window, if
the thread is detached
attribute passively boolean
if set, the window will behave
passively.
module mail.model.AbstractThread
class AbstractThread(params)
Extends
Parameters

Abstract thread is the super class of all threads, either backend threads (which are compatible with mail service) or website livechats.

Abstract threads contain abstract messages

method addMessage(message)

Add a message to this thread.

Parameters
method fold(folded)

Updates the folded state of the thread

Parameters
    folded (boolean)
method getID() → integer|string

Get the ID of this thread

Return Type
integer or string
method getName() → string

Get the name of this thread. If the name of the thread has been created by the user from an input, it may be escaped.

Return Type
string
method getStatus() → string

Get the status of the thread (e.g. ‘online’, ‘offline’, etc.)

Return Type
string
method getTitle() → string

Returns the title to display in thread window’s headers.

Returns
the name of the thread by default (see @getName)
Return Type
string
method hasTypingNotification() → boolean

States whether this thread is compatible with the ‘is typing…’ feature. By default, threads do not have this feature active.

Return Type
boolean
method isFolded() → boolean

States whether this thread is folded or not.

Return Type
boolean
method markAsRead() → $.Promise

Mark the thread as read, which resets the unread counter to 0. This is only performed if the unread counter is not 0.

Return Type
jQuery.Promise
method postMessage() → $.Promise

Post a message on this thread

Returns
resolved with the message object to be sent to the server
Return Type
jQuery.Promise
method resetUnreadCounter()

Resets the unread counter of this thread to 0.

class AbstractThreadParams()
attribute data Object
attribute data.id integer|string

the ID of this thread

attribute data.name string

the name of this thread

attribute data.status string

the status of this thread

attribute parent Object
Object with the event-dispatcher mixin
(@see {web.mixins.EventDispatcherMixin})
class AbstractThread(params)
Extends
Parameters

Abstract thread is the super class of all threads, either backend threads (which are compatible with mail service) or website livechats.

Abstract threads contain abstract messages

method addMessage(message)

Add a message to this thread.

Parameters
method fold(folded)

Updates the folded state of the thread

Parameters
    folded (boolean)
method getID() → integer|string

Get the ID of this thread

Return Type
integer or string
method getName() → string

Get the name of this thread. If the name of the thread has been created by the user from an input, it may be escaped.

Return Type
string
method getStatus() → string

Get the status of the thread (e.g. ‘online’, ‘offline’, etc.)

Return Type
string
method getTitle() → string

Returns the title to display in thread window’s headers.

Returns
the name of the thread by default (see @getName)
Return Type
string
method hasTypingNotification() → boolean

States whether this thread is compatible with the ‘is typing…’ feature. By default, threads do not have this feature active.

Return Type
boolean
method isFolded() → boolean

States whether this thread is folded or not.

Return Type
boolean
method markAsRead() → $.Promise

Mark the thread as read, which resets the unread counter to 0. This is only performed if the unread counter is not 0.

Return Type
jQuery.Promise
method postMessage() → $.Promise

Post a message on this thread

Returns
resolved with the message object to be sent to the server
Return Type
jQuery.Promise
method resetUnreadCounter()

Resets the unread counter of this thread to 0.

class AbstractThreadParams()
attribute data Object
attribute data.id integer|string

the ID of this thread

attribute data.name string

the name of this thread

attribute data.status string

the status of this thread

attribute parent Object
Object with the event-dispatcher mixin
(@see {web.mixins.EventDispatcherMixin})
module sale_timesheet.ProjectPlan
class ProjectPlan(parent, action)
Parameters

    parent

    action

module web.RamStorage
class RamStorage()
method clear()

Removes all data from the storage

method getItem(key) → string

Returns the value associated with a given key in the storage

Parameters
    key (string)
Return Type
string
method removeItem(key)

Removes the given key from the storage

Parameters
    key (string)
method setItem(key, value)

Adds a given key-value pair to the storage, or update the value of the given key if it already exists

Parameters

    key (string)

    value (string)

module mail.model.Mailbox
class Mailbox(params)
Parameters

Mailboxes, called “static channels” in earlier version of Odoo, are threads that are not represented on the server. We can see them as “threads that are not conversations”. For instance, the well-known “Inbox” folder contains a list of messages, but the inbox does not represent a conversation: Inbox is modeled as a mailbox.

method decrementMailboxCounter([num])

Decrement the counter of this mailbox. It floors to 0.

Parameters
    num=1 (integer) – how many, at most, the counter is decremented
method getMessages([options]) → mail.model.Message[]

Override so that there are options to filter messages based on document model and ID.

Parameters
Return Type
class GetMessagesOptions()
attribute documentModel string
model of the document that the
local messages of inbox must be linked to.
attribute documentID integer
ID of the document that the local
messages of inbox must be linked to.
function getMailboxCounter() → integer

Get the mailbox counter of this mailbox.

Return Type
integer
function getMessagePreviews() → $.Promise<Object[]>

Get the preview of the messages from the inbox mailbox. If there are multiple messages associated to a similar document or channel, only keep the lastest message of this document/channel in the previews.

Return Type
jQuery.Promise<Array<Object>>
function incrementMailboxCounter([num])

Increment the counter of this mailbox

Parameters
    num=1 (integer) – how many, the counter is incremented
function markAllMessagesAsRead(domain) → $.Promise

Marks all messages from the mailbox as read. At the moment, this method makes only sense for ‘Inbox’.

Parameters
    domain (Array)
Returns
resolved when all messages have been marked as read on the server
Return Type
jQuery.Promise
class MailboxParams()
attribute data Object
attribute data.id string

the ID of the mailbox, without the mailbox_ prefix.

attribute data.mailboxCounter integer

the initial mailbox counter of this mailbox.

class Mailbox(params)
Parameters

Mailboxes, called “static channels” in earlier version of Odoo, are threads that are not represented on the server. We can see them as “threads that are not conversations”. For instance, the well-known “Inbox” folder contains a list of messages, but the inbox does not represent a conversation: Inbox is modeled as a mailbox.

method decrementMailboxCounter([num])

Decrement the counter of this mailbox. It floors to 0.

Parameters
    num=1 (integer) – how many, at most, the counter is decremented
method getMessages([options]) → mail.model.Message[]

Override so that there are options to filter messages based on document model and ID.

Parameters
Return Type
class GetMessagesOptions()
attribute documentModel string
model of the document that the
local messages of inbox must be linked to.
attribute documentID integer
ID of the document that the local
messages of inbox must be linked to.
function getMailboxCounter() → integer

Get the mailbox counter of this mailbox.

Return Type
integer
function getMessagePreviews() → $.Promise<Object[]>

Get the preview of the messages from the inbox mailbox. If there are multiple messages associated to a similar document or channel, only keep the lastest message of this document/channel in the previews.

Return Type
jQuery.Promise<Array<Object>>
function incrementMailboxCounter([num])

Increment the counter of this mailbox

Parameters
    num=1 (integer) – how many, the counter is incremented
function markAllMessagesAsRead(domain) → $.Promise

Marks all messages from the mailbox as read. At the moment, this method makes only sense for ‘Inbox’.

Parameters
    domain (Array)
Returns
resolved when all messages have been marked as read on the server
Return Type
jQuery.Promise
class MailboxParams()
attribute data Object
attribute data.id string

the ID of the mailbox, without the mailbox_ prefix.

attribute data.mailboxCounter integer

the initial mailbox counter of this mailbox.

module web.BasicView
class BasicView()
module web_editor.ace
namespace checkSCSS

Checks the syntax validity of some SCSS.

function _getCheckReturn(isValid[, errorLine][, errorMessage]) → Object

Formats a content-check result (@see checkXML, checkSCSS).

Parameters

    isValid (boolean)

    errorLine (integer) – needed if isValid is false

    errorMessage (string) – needed if isValid is false

Return Type
Object
class ViewEditor(parent, viewKey[, options])
Extends
Parameters

    parent (Widget)

    viewKey (string or integer) – xml_id or id of the view whose linked resources have to be loaded.

    options (ViewEditorOptions)

Allows to visualize resources (by default, XML views) and edit them.

method willStart()

Loads everything the ace library needs to work. It also loads the resources to visualize (@see _loadResources).

method start()

Initializes the library and initial view once the DOM is ready. It also initializes the resize feature of the ace editor.

class ViewEditorOptions()
attribute initialResID string|integer
a specific view ID / SCSS URL to load on start (otherwise the main
view ID associated with the specified viewKey will be used)
attribute position string
attribute doNotLoadViews boolean
attribute doNotLoadSCSS boolean
attribute includeBundles boolean
attribute includeAllSCSS boolean
attribute defaultBundlesRestriction string[]
function formatSCSS(scss) → string

Formats some SCSS so that it has proper indentation and structure.

Parameters
    scss (string)
Returns
formatted scss
Return Type
string
class ViewEditor(parent, viewKey[, options])
Extends
Parameters

    parent (Widget)

    viewKey (string or integer) – xml_id or id of the view whose linked resources have to be loaded.

    options (ViewEditorOptions)

Allows to visualize resources (by default, XML views) and edit them.

method willStart()

Loads everything the ace library needs to work. It also loads the resources to visualize (@see _loadResources).

method start()

Initializes the library and initial view once the DOM is ready. It also initializes the resize feature of the ace editor.

class ViewEditorOptions()
attribute initialResID string|integer
a specific view ID / SCSS URL to load on start (otherwise the main
view ID associated with the specified viewKey will be used)
attribute position string
attribute doNotLoadViews boolean
attribute doNotLoadSCSS boolean
attribute includeBundles boolean
attribute includeAllSCSS boolean
attribute defaultBundlesRestriction string[]
function formatXML(xml) → string

Formats some XML so that it has proper indentation and structure.

Parameters
    xml (string)
Returns
formatted xml
Return Type
string
function checkXML(xml) → Object

Checks the syntax validity of some XML.

Parameters
    xml (string)
Returns
@see _getCheckReturn
Return Type
Object
module pos_restaurant.splitbill
namespace
module website.content.snippets.animation
class Animation(parent, editableMode)
Extends
Parameters

    parent (Object)

    editableMode (boolean) – true if the page is in edition mode

Provides a way for executing code once a website DOM element is loaded in the dom and handle the case where the website edit mode is triggered.

Also register AnimationEffect automatically (@see effects, _prepareEffects).

attribute selector Boolean

The selector attribute, if defined, allows to automatically create an instance of this animation on page load for each DOM element which matches this selector. The Animation.$target element will then be that particular DOM element. This should be the main way of instantiating Animation elements.

namespace edit_events

Acts as @see Widget.events except that the events are only binded if the Animation instance is instanciated in edit mode.

namespace read_events

Acts as @see Widget.events except that the events are only binded if the Animation instance is instanciated in readonly mode.

attribute maxFPS Number

The max FPS at which all the automatic animation effects will be running by default.

method start()

Initializes the animation. The method should not be called directly as called automatically on animation instantiation and on restart.

Also, prepares animation’s effects and start them if any.

method destroy()

Destroys the animation and basically restores the target to the state it was before the start method was called (unlike standard widget, the associated $el DOM is not removed).

Also stops animation effects and destroys them if any.

namespace registry

The registry object contains the list of available animations.

class _fixAppleCollapse(parent, editableMode)
Extends
Parameters

    parent (Object)

    editableMode (boolean) – true if the page is in edition mode

This is a fix for apple device (<= IPhone 4, IPad 2) Standard bootstrap requires data-toggle=’collapse’ element to be <a/> tags. Unfortunatly one snippet uses a <div/> tag instead. The fix forces an empty click handler on these div, which allows standard bootstrap to work.

This should be removed in a future odoo snippets refactoring.

class autohideMenu(parent, editableMode)
Extends
Parameters

    parent (Object)

    editableMode (boolean) – true if the page is in edition mode

Auto adapt the header layout so that elements are not wrapped on a new line.

Note: this works well with the affixMenu… by chance (autohideMenu is called after alphabetically).

Extends
Parameters

    parent (Object)

    editableMode (boolean) – true if the page is in edition mode

Note: this works well with the affixMenu… by chance (menuDirection is called after alphabetically).

class AnimationEffect(parent, updateCallback[, startEvents][, $startTarget][, options])
Extends
Parameters

    parent (Object)

    updateCallback (function) – the animation update callback

    startEvents=scroll (string) – space separated list of events which starts the animation loop

    $startTarget=window (jQuery or DOMElement) – the element(s) on which the startEvents are listened

    options (AnimationEffectOptions)

In charge of handling one animation loop using the requestAnimationFrame feature. This is used by the Animation class below and should not be called directly by an end developer.

This uses a simple API: it can be started, stopped, played and paused.

method start()

Initializes when the animation must be played and paused and initializes the animation first frame.

method stop()

Pauses the animation and destroys the attached events which trigger the animation to be played or paused.

method play(e)

Forces the requestAnimationFrame loop to start.

Parameters
    e (Event) – the event which triggered the animation to play
method pause()

Forces the requestAnimationFrame loop to stop.

class AnimationEffectOptions()
attribute getStateCallback function
a function which returns a value which represents the state of the
animation, i.e. for two same value, no refreshing of the animation is needed. Can be used for optimization. If the $startTarget is the window element, this defaults to returning the current scoll offset of the window or the size of the window for the scroll and resize events respectively.
attribute endEvents string
space separated list of events which pause the animation loop. If
not given, the animation is stopped after a while (if no startEvents is received again)
attribute $endTarget jQuery|DOMElement

the element(s) on which the endEvents are listened

namespace
class Animation(parent, editableMode)
Extends
Parameters

    parent (Object)

    editableMode (boolean) – true if the page is in edition mode

Provides a way for executing code once a website DOM element is loaded in the dom and handle the case where the website edit mode is triggered.

Also register AnimationEffect automatically (@see effects, _prepareEffects).

attribute selector Boolean

The selector attribute, if defined, allows to automatically create an instance of this animation on page load for each DOM element which matches this selector. The Animation.$target element will then be that particular DOM element. This should be the main way of instantiating Animation elements.

namespace edit_events

Acts as @see Widget.events except that the events are only binded if the Animation instance is instanciated in edit mode.

namespace read_events

Acts as @see Widget.events except that the events are only binded if the Animation instance is instanciated in readonly mode.

attribute maxFPS Number

The max FPS at which all the automatic animation effects will be running by default.

method start()

Initializes the animation. The method should not be called directly as called automatically on animation instantiation and on restart.

Also, prepares animation’s effects and start them if any.

method destroy()

Destroys the animation and basically restores the target to the state it was before the start method was called (unlike standard widget, the associated $el DOM is not removed).

Also stops animation effects and destroys them if any.

namespace registry

The registry object contains the list of available animations.

class _fixAppleCollapse(parent, editableMode)
Extends
Parameters

    parent (Object)

    editableMode (boolean) – true if the page is in edition mode

This is a fix for apple device (<= IPhone 4, IPad 2) Standard bootstrap requires data-toggle=’collapse’ element to be <a/> tags. Unfortunatly one snippet uses a <div/> tag instead. The fix forces an empty click handler on these div, which allows standard bootstrap to work.

This should be removed in a future odoo snippets refactoring.

class autohideMenu(parent, editableMode)
Extends
Parameters

    parent (Object)

    editableMode (boolean) – true if the page is in edition mode

Auto adapt the header layout so that elements are not wrapped on a new line.

Note: this works well with the affixMenu… by chance (autohideMenu is called after alphabetically).

Extends
Parameters

    parent (Object)

    editableMode (boolean) – true if the page is in edition mode

Note: this works well with the affixMenu… by chance (menuDirection is called after alphabetically).

module website_links.charts
namespace exports
module web.ReportService
class ReportService(parent)
Parameters
    parent
method checkWkhtmltopdf() → Deferred

Checks the state of the installation of wkhtmltopdf on the server. Implements an internal cache to do the request only once.

Returns
resolved with the state of wkhtmltopdf on the server (possible values are ‘ok’, ‘broken’, ‘install’, ‘upgrade’, ‘workers’).
Return Type
module website_blog.editor
namespace
module web.AbstractField
class AbstractField(parent, name, record[, options])
Extends
Parameters

    parent (Widget)

    name (string) – The field name defined in the model

    record (Object) – A record object (result of the get method of a basic model)

    options (AbstractFieldOptions)

namespace fieldDependencies

An object representing fields to be fetched by the model eventhough not present in the view This object contains “field name” as key and an object as value. That value object must contain the key “type” see FieldBinaryImage for an example.

attribute resetOnAnyFieldChange Boolean

If this flag is set to true, the field widget will be reset on every change which is made in the view (if the view supports it). This is currently a form view feature.

attribute specialData Boolean

If this flag is given a string, the related BasicModel will be used to initialize specialData the field might need. This data will be available through this.record.specialData[this.name].

attribute supportedFieldTypes Array<String>

to override to indicate which field types are supported by the widget

method willStart()

Loads the libraries listed in this.jsLibs and this.cssLibs

method start() → Deferred

When a field widget is appended to the DOM, its start method is called, and will automatically call render. Most widgets should not override this.

Return Type
method activate([options]) → boolean

Activates the field widget. By default, activation means focusing and selecting (if possible) the associated focusable element. The selecting part can be disabled. In that case, note that the focused input/textarea will have the cursor at the very end.

Parameters
Returns
true if the widget was activated, false if the focusable element was not found or invisible
Return Type
boolean
class ActivateOptions()
attribute noselect boolean
if false and the input
is of type text or textarea, the content will also be selected
attribute event Event

the event which fired this activation

function commitChanges() → Deferred|undefined

This function should be implemented by widgets that are not able to notify their environment when their value changes (maybe because their are not aware of the changes) or that may have a value in a temporary state (maybe because some action should be performed to validate it before notifying it). This is typically called before trying to save the widget’s value, so it should call _setValue() to notify the environment if the value changed but was not notified.

Return Type
Deferred or undefined
function getFocusableElement() → jQuery

Returns the main field’s DOM element (jQuery form) which can be focused by the browser.

Returns
main focusable element inside the widget
Return Type
jQuery
function isFocusable() → boolean

Returns true iff the widget has a visible element that can take the focus

Return Type
boolean
function isSet() → boolean

this method is used to determine if the field value is set to a meaningful value. This is useful to determine if a field should be displayed as empty

Return Type
boolean
function isValid() → boolean

A field widget is valid if it was checked as valid the last time its value was changed by the user. This is checked before saving a record, by the view.

Note: this is the responsability of the view to check that required fields have a set value.

Returns
true/false if the widget is valid
Return Type
boolean
function reset(record[, event]) → Deferred

this method is supposed to be called from the outside of field widgets. The typical use case is when an onchange has changed the widget value. It will reset the widget to the values that could have changed, then will rerender the widget.

Parameters

    record (any)

    event (OdooEvent) – an event that triggered the reset action. It is optional, and may be used by a widget to share information from the moment a field change event is triggered to the moment a reset operation is applied.

Returns
A Deferred, which resolves when the widget rendering is complete
Return Type
function removeInvalidClass()

Remove the invalid class on a field

function setIDForLabel(id)

Sets the given id on the focusable element of the field and as ‘for’ attribute of potential internal labels.

Parameters
    id (string)
function setInvalidClass()

add the invalid class on a field

function updateModifiersValue(modifiers)

Update the modifiers with the newest value. Now this.attrs.modifiersValue can be used consistantly even with conditional modifiers inside field widgets, and without needing new events or synchronization between the widgets, renderer and controller

Parameters
    modifiers (Object or null) – the updated modifiers
class AbstractFieldOptions()
attribute mode string

should be ‘readonly’ or ‘edit’

module portal.PortalSidebar
class PortalSidebar(parent)
Extends
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.
module web.CalendarView
class CalendarView(viewInfo, params)
Parameters

    viewInfo

    params

module web.concurrency
Depends On
namespace
function asyncWhen() → Deferred

The jquery implementation for $.when has a (most of the time) useful property: it is synchronous, if the deferred is resolved immediately.

This means that when we execute $.when(def), then all registered callbacks will be executed before the next line is executed. This is useful quite often, but in some rare cases, we might want to force an async behavior. This is the purpose of this function, which simply adds a setTimeout before resolving the deferred.

Return Type
function delay([wait]) → Deferred

Returns a deferred resolved after ‘wait’ milliseconds

Parameters
    wait=0 (int) – the delay in ms
Return Type
class DropMisordered([failMisordered])
Extends
Parameters
    failMisordered=false (boolean) – whether mis-ordered responses should be failed or just ignored

The DropMisordered abstraction is useful for situations where you have a sequence of operations that you want to do, but if one of them completes after a subsequent operation, then its result is obsolete and should be ignored.

Note that is is kind of similar to the DropPrevious abstraction, but subtly different. The DropMisordered operations will all resolves if they complete in the correct order.

method add(deferred) → Deferred

Adds a deferred (usually an async request) to the sequencer

Parameters
Return Type
class DropPrevious()
Extends

The DropPrevious abstraction is useful when you have a sequence of operations that you want to execute, but you only care of the result of the last operation.

For example, let us say that we have a _fetch method on a widget which fetches data. We want to rerender the widget after. We could do this:

this._fetch().then(function (result) {
    self.state = result;
    self.render();
});

Now, we have at least two problems:

  • if this code is called twice and the second _fetch completes before the first, the end state will be the result of the first _fetch, which is not what we expect
  • in any cases, the user interface will rerender twice, which is bad.

Now, if we have a DropPrevious:

this.dropPrevious = new DropPrevious();

Then we can wrap the _fetch in a DropPrevious and have the expected result:

this.dropPrevious
    .add(this._fetch())
    .then(function (result) {
        self.state = result;
        self.render();
    });
method add(deferred) → Promise

Registers a new deferred and rejects the previous one

Parameters
    deferred (Deferred) – the new deferred
Return Type
Promise
class Mutex()
Extends

A (Odoo) mutex is a primitive for serializing computations. This is useful to avoid a situation where two computations modify some shared state and cause some corrupted state.

Imagine that we have a function to fetch some data _load(), which returns a deferred which resolves to something useful. Now, we have some code looking like this:

return this._load().then(function (result) {
    this.state = result;
});

If this code is run twice, but the second execution ends before the first, then the final state will be the result of the first call to _load. However, if we have a mutex:

this.mutex = new Mutex();

and if we wrap the calls to _load in a mutex:

return this.mutex.exec(function() {
    return this._load().then(function (result) {
        this.state = result;
    });
});

Then, it is guaranteed that the final state will be the result of the second execution.

A Mutex has to be a class, and not a function, because we have to keep track of some internal state.

method exec(action) → Deferred

Add a computation to the queue, it will be executed as soon as the previous computations are completed.

Parameters
    action (function) – a function which may return a deferred
Return Type
class MutexedDropPrevious()
Extends

A MutexedDropPrevious is a primitive for serializing computations while skipping the ones that where executed between a current one and before the execution of a new one. This is useful to avoid useless RPCs.

You can read the Mutex description to understand its role ; for the DropPrevious part of this abstraction, imagine the following situation: you have a code that call the server with a fixed argument and a list of operations that only grows after each call and you only care about the RPC result (the server code doesn’t do anything). If this code is called three times (A B C) and C is executed before B has started, it’s useless to make an extra RPC (B) if you know that it won’t have an impact and you won’t use its result.

Note that the promise returned by the exec call won’t be resolved if exec is called before the first exec call resolution ; only the promise returned by the last exec call will be resolved (the other are rejected);

A MutexedDropPrevious has to be a class, and not a function, because we have to keep track of some internal state. The exec function takes as argument an action (and not a deferred as DropPrevious for example) because it’s the MutexedDropPrevious role to trigger the RPC call that returns a deferred when it’s time.

function rejectAfter([target_def][, reference_def]) → Deferred

Rejects a deferred as soon as a reference deferred is either resolved or rejected

Parameters

    target_def (Deferred) – the deferred to potentially reject

    reference_def (Deferred) – the reference target

Return Type
module web.CalendarModel
class ()
function calendarEventToRecord(event)

Transform fullcalendar event object to OpenERP Data object

Parameters
    event
function next()

Move the current date range to the next period

function prev()

Move the current date range to the previous period

function today()

Move the current date range to the period containing today

function toggleFullWidth()

Toggle the sidebar (containing the mini calendar)

module website.contentMenu
namespace
module mail.composer.Chatter
class ChatterComposer(parent, model, suggestedPartners, options)
Parameters

    parent

    model

    suggestedPartners

    options

Chat Composer for the Chatter

Extends the basic Composer Widget to add ‘suggested partner’ layer (open popup when suggested partner is selected without email, or other informations), and the button to open the full composer wizard.

method clearComposerOnSend()

Chatter don’t clear message on sent but after successful sent

class ChatterComposer(parent, model, suggestedPartners, options)
Parameters

    parent

    model

    suggestedPartners

    options

Chat Composer for the Chatter

Extends the basic Composer Widget to add ‘suggested partner’ layer (open popup when suggested partner is selected without email, or other informations), and the button to open the full composer wizard.

method clearComposerOnSend()

Chatter don’t clear message on sent but after successful sent

module account.AccountPortalSidebar
class AccountPortalSidebar(parent)
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.
module account.ReconciliationModel
class ManualModel(parent, options)
Parameters

    parent (Widget)

    options (object)

Model use to fetch, format and update ‘account.move.line’ and ‘res.partner’ datas allowing manual reconciliation

method load(context) → Deferred

load data from - ‘account.reconciliation.widget’ fetch the lines to reconciliate - ‘account.account’ fetch all account code

Parameters
Return Type
class LoadContext()
attribute mode string

‘customers’, ‘suppliers’ or ‘accounts’

attribute company_ids integer[]
attribute partner_ids integer[]
used for ‘customers’ and
‘suppliers’ mode
function validate(handle) → Deferred<Array>

Mark the account or the partner as reconciled

Parameters
    handle (string or Array<string>)
Returns
resolved with the handle array
Return Type
Deferred<Array>
class StatementModel(parent, options)
Extends
Parameters

    parent (Widget)

    options (object)

Model use to fetch, format and update ‘account.reconciliation.widget’, datas allowing reconciliation

The statement internal structure:

{
    valuenow: integer
    valuenow: valuemax
    [bank_statement_id]: {
        id: integer
        display_name: string
    }
    reconcileModels: [object]
    accounts: {id: code}
}

The internal structure of each line is:

{
   balance: {
       type: number - show/hide action button
       amount: number - real amount
       amount_str: string - formated amount
       account_code: string
   },
   st_line: {
       partner_id: integer
       partner_name: string
   }
   mode: string ('inactive', 'match', 'create')
   reconciliation_proposition: {
       id: number|string
       partial_reconcile: boolean
       invalid: boolean - through the invalid line (without account, label...)
       is_tax: boolean
       account_code: string
       date: string
       date_maturity: string
       label: string
       amount: number - real amount
       amount_str: string - formated amount
       [already_paid]: boolean
       [partner_id]: integer
       [partner_name]: string
       [account_code]: string
       [journal_id]: {
           id: integer
           display_name: string
       }
       [ref]: string
       [is_partially_reconciled]: boolean
       [amount_currency_str]: string|false (amount in record currency)
   }
   mv_lines: object - idem than reconciliation_proposition
   offset: integer
   limitMoveLines: integer
   filter: string
   [createForm]: {
       account_id: {
           id: integer
           display_name: string
       }
       tax_id: {
           id: integer
           display_name: string
       }
       analytic_account_id: {
           id: integer
           display_name: string
       }
       analytic_tag_ids: {
       }
       label: string
       amount: number,
       [journal_id]: {
           id: integer
           display_name: string
       }
   }
}
method addProposition(handle, mv_line_id) → Deferred

add a reconciliation proposition from the matched lines We also display a warning if the user tries to add 2 line with different account type

Parameters

    handle (string)

    mv_line_id (number)

Return Type
method changeFilter(handle, filter) → Deferred

change the filter for the target line and fetch the new matched lines

Parameters

    handle (string)

    filter (string)

Return Type
method changeMode(handle, mode) → Deferred

change the mode line (‘inactive’, ‘match’, ‘create’), and fetch the new matched lines or prepare to create a new line

match
display the matched lines, the user can select the lines to apply there as proposition
create
display fields and quick create button to create a new proposition for the reconciliation
Parameters

    handle (string)

    mode (inactive or match or create)

Return Type
method changeName(name) → Deferred

call ‘write’ method on the ‘account.bank.statement’

Parameters
    name (string)
Return Type
method changeOffset(handle, offset) → Deferred

change the offset for the matched lines, and fetch the new matched lines

Parameters

    handle (string)

    offset (number)

Return Type
method changePartner(handle, partner, preserveMode) → Deferred

change the partner on the line and fetch the new matched lines

Parameters
Return Type
class ChangePartnerPartner()
attribute display_name string
attribute id number
function closeStatement() → Deferred<number>

close the statement

Returns
resolves to the res_id of the closed statements
Return Type
Deferred<number>
function createProposition(handle) → Deferred

then open the first available line

Parameters
    handle (string)
Return Type
function getContext() → Object

Return context information and journal_id

Returns
context
Return Type
Object
function getStatementLines() → Object

Return the lines that needs to be displayed by the widget

Returns
lines that are loaded and not yet displayed
Return Type
Object
function hasMoreLines() → boolean

Return a boolean telling if load button needs to be displayed or not

Returns
true if load more button needs to be displayed
Return Type
boolean
function getLine(handle) → Object

get the line data for this handle

Parameters
    handle (Object)
Return Type
Object
function load(context) → Deferred

load data from

  • ‘account.bank.statement’ fetch the line id and bank_statement_id info
  • ‘account.reconcile.model’ fetch all reconcile model (for quick add)
  • ‘account.account’ fetch all account code
  • ‘account.reconciliation.widget’ fetch each line data
Parameters
Return Type
class LoadContext()
attribute statement_ids number[]
function loadMore(qty) → Deferred

Load more bank statement line

Parameters
    qty (integer) – quantity to load
Return Type
function loadData(ids, excluded_ids) → Deferred

RPC method to load informations on lines

Parameters

    ids (Array) – ids of bank statement line passed to rpc call

    excluded_ids (Array) – list of move_line ids that needs to be excluded from search

Return Type
function quickCreateProposition(handle, reconcileModelId) → Deferred

Add lines into the propositions from the reconcile model Can add 2 lines, and each with its taxes. The second line become editable in the create mode.

Parameters

    handle (string)

    reconcileModelId (integer)

Return Type
function removeProposition(handle, id) → Deferred

Remove a proposition and switch to an active mode (‘create’ or ‘match’)

Parameters

    handle (string)

    id (number) – (move line id)

Return Type
function togglePartialReconcile(handle) → Deferred

Force the partial reconciliation to display the reconciliate button.

Parameters
    handle (string)
Return Type
function updateProposition(handle, values) → Deferred

Change the value of the editable proposition line or create a new one.

If the editable line comes from a reconcile model with 2 lines and their ‘amount_type’ is “percent” and their total equals 100% (this doesn’t take into account the taxes who can be included or not) Then the total is recomputed to have 100%.

Parameters

    handle (string)

    values (any)

Return Type
function validate(handle) → Deferred<Object>

Format the value and send it to ‘account.reconciliation.widget’ model Update the number of validated lines

Parameters
    handle (string or Array<string>)
Returns
resolved with an object who contains ‘handles’ key
Return Type
Deferred<Object>
namespace
class StatementModel(parent, options)
Extends
Parameters

    parent (Widget)

    options (object)

Model use to fetch, format and update ‘account.reconciliation.widget’, datas allowing reconciliation

The statement internal structure:

{
    valuenow: integer
    valuenow: valuemax
    [bank_statement_id]: {
        id: integer
        display_name: string
    }
    reconcileModels: [object]
    accounts: {id: code}
}

The internal structure of each line is:

{
   balance: {
       type: number - show/hide action button
       amount: number - real amount
       amount_str: string - formated amount
       account_code: string
   },
   st_line: {
       partner_id: integer
       partner_name: string
   }
   mode: string ('inactive', 'match', 'create')
   reconciliation_proposition: {
       id: number|string
       partial_reconcile: boolean
       invalid: boolean - through the invalid line (without account, label...)
       is_tax: boolean
       account_code: string
       date: string
       date_maturity: string
       label: string
       amount: number - real amount
       amount_str: string - formated amount
       [already_paid]: boolean
       [partner_id]: integer
       [partner_name]: string
       [account_code]: string
       [journal_id]: {
           id: integer
           display_name: string
       }
       [ref]: string
       [is_partially_reconciled]: boolean
       [amount_currency_str]: string|false (amount in record currency)
   }
   mv_lines: object - idem than reconciliation_proposition
   offset: integer
   limitMoveLines: integer
   filter: string
   [createForm]: {
       account_id: {
           id: integer
           display_name: string
       }
       tax_id: {
           id: integer
           display_name: string
       }
       analytic_account_id: {
           id: integer
           display_name: string
       }
       analytic_tag_ids: {
       }
       label: string
       amount: number,
       [journal_id]: {
           id: integer
           display_name: string
       }
   }
}
method addProposition(handle, mv_line_id) → Deferred

add a reconciliation proposition from the matched lines We also display a warning if the user tries to add 2 line with different account type

Parameters

    handle (string)

    mv_line_id (number)

Return Type
method changeFilter(handle, filter) → Deferred

change the filter for the target line and fetch the new matched lines

Parameters

    handle (string)

    filter (string)

Return Type
method changeMode(handle, mode) → Deferred

change the mode line (‘inactive’, ‘match’, ‘create’), and fetch the new matched lines or prepare to create a new line

match
display the matched lines, the user can select the lines to apply there as proposition
create
display fields and quick create button to create a new proposition for the reconciliation
Parameters

    handle (string)

    mode (inactive or match or create)

Return Type
method changeName(name) → Deferred

call ‘write’ method on the ‘account.bank.statement’

Parameters
    name (string)
Return Type
method changeOffset(handle, offset) → Deferred

change the offset for the matched lines, and fetch the new matched lines

Parameters

    handle (string)

    offset (number)

Return Type
method changePartner(handle, partner, preserveMode) → Deferred

change the partner on the line and fetch the new matched lines

Parameters
Return Type
class ChangePartnerPartner()
attribute display_name string
attribute id number
function closeStatement() → Deferred<number>

close the statement

Returns
resolves to the res_id of the closed statements
Return Type
Deferred<number>
function createProposition(handle) → Deferred

then open the first available line

Parameters
    handle (string)
Return Type
function getContext() → Object

Return context information and journal_id

Returns
context
Return Type
Object
function getStatementLines() → Object

Return the lines that needs to be displayed by the widget

Returns
lines that are loaded and not yet displayed
Return Type
Object
function hasMoreLines() → boolean

Return a boolean telling if load button needs to be displayed or not

Returns
true if load more button needs to be displayed
Return Type
boolean
function getLine(handle) → Object

get the line data for this handle

Parameters
    handle (Object)
Return Type
Object
function load(context) → Deferred

load data from

  • ‘account.bank.statement’ fetch the line id and bank_statement_id info
  • ‘account.reconcile.model’ fetch all reconcile model (for quick add)
  • ‘account.account’ fetch all account code
  • ‘account.reconciliation.widget’ fetch each line data
Parameters
Return Type
class LoadContext()
attribute statement_ids number[]
function loadMore(qty) → Deferred

Load more bank statement line

Parameters
    qty (integer) – quantity to load
Return Type
function loadData(ids, excluded_ids) → Deferred

RPC method to load informations on lines

Parameters

    ids (Array) – ids of bank statement line passed to rpc call

    excluded_ids (Array) – list of move_line ids that needs to be excluded from search

Return Type
function quickCreateProposition(handle, reconcileModelId) → Deferred

Add lines into the propositions from the reconcile model Can add 2 lines, and each with its taxes. The second line become editable in the create mode.

Parameters

    handle (string)

    reconcileModelId (integer)

Return Type
function removeProposition(handle, id) → Deferred

Remove a proposition and switch to an active mode (‘create’ or ‘match’)

Parameters

    handle (string)

    id (number) – (move line id)

Return Type
function togglePartialReconcile(handle) → Deferred

Force the partial reconciliation to display the reconciliate button.

Parameters
    handle (string)
Return Type
function updateProposition(handle, values) → Deferred

Change the value of the editable proposition line or create a new one.

If the editable line comes from a reconcile model with 2 lines and their ‘amount_type’ is “percent” and their total equals 100% (this doesn’t take into account the taxes who can be included or not) Then the total is recomputed to have 100%.

Parameters

    handle (string)

    values (any)

Return Type
function validate(handle) → Deferred<Object>

Format the value and send it to ‘account.reconciliation.widget’ model Update the number of validated lines

Parameters
    handle (string or Array<string>)
Returns
resolved with an object who contains ‘handles’ key
Return Type
Deferred<Object>
class ManualModel(parent, options)
Parameters

    parent (Widget)

    options (object)

Model use to fetch, format and update ‘account.move.line’ and ‘res.partner’ datas allowing manual reconciliation

method load(context) → Deferred

load data from - ‘account.reconciliation.widget’ fetch the lines to reconciliate - ‘account.account’ fetch all account code

Parameters
Return Type
class LoadContext()
attribute mode string

‘customers’, ‘suppliers’ or ‘accounts’

attribute company_ids integer[]
attribute partner_ids integer[]
used for ‘customers’ and
‘suppliers’ mode
function validate(handle) → Deferred<Array>

Mark the account or the partner as reconciled

Parameters
    handle (string or Array<string>)
Returns
resolved with the handle array
Return Type
Deferred<Array>
module website_links.code_editor
Depends On
namespace
module partner.autocomplete.fieldchar
class FieldAutocomplete()
Extends
FieldChar

FieldChar extension to suggest existing companies when changing the company name on a res.partner view (indeed, it is designed to change the “name”, “website” and “image” fields of records of this model).

class FieldAutocomplete()
Extends
FieldChar

FieldChar extension to suggest existing companies when changing the company name on a res.partner view (indeed, it is designed to change the “name”, “website” and “image” fields of records of this model).

module web.ListView
class ListView()
Extends
module website.WebsiteRoot
namespace
module web.rpc
Depends On
namespace
function query(params, options) → Deferred<any>

Perform a RPC. Please note that this is not the preferred way to do a rpc if you are in the context of a widget. In that case, you should use the this._rpc method.

Parameters

    params (Object) – @see buildQuery for a description

    options (Object)

Return Type
module web.IFrameWidget
Depends On
class IFrameWidget(parent, url)
Extends
Parameters

Generic widget to create an iframe that listens for clicks

It should be extended by overwriting the methods:

init: function(parent) {
    this._super(parent, <url_of_iframe>);
},
_onIFrameClicked: function(e){
    filter the clicks you want to use and apply
    an action on it
}
class IFrameWidget(parent, url)
Extends
Parameters

Generic widget to create an iframe that listens for clicks

It should be extended by overwriting the methods:

init: function(parent) {
    this._super(parent, <url_of_iframe>);
},
_onIFrameClicked: function(e){
    filter the clicks you want to use and apply
    an action on it
}
module web_editor.snippets.options
class SnippetOption(parent, $target, $overlay, data)
Extends
Parameters

    parent

    $target

    $overlay

    data

Handles a set of options for one snippet. The registry returned by this module contains the names of the specialized SnippetOption which can be referenced thanks to the data-js key in the web_editor options template.

attribute preventChildPropagation Boolean

When editing a snippet, its options are shown alongside the ones of its parent snippets. The parent options are only shown if the following flag is set to false (default).

method start()

Called when the option is initialized (i.e. the parent edition overlay is shown for the first time).

method onFocus()

Called when the parent edition overlay is covering the associated snippet (the first time, this follows the call to the @see start method).

method onBuilt()

Called when the parent edition overlay is covering the associated snippet for the first time, when it is a new snippet dropped from the d&d snippet menu. Note: this is called after the start and onFocus methods.

method onBlur()

Called when the parent edition overlay is removed from the associated snippet (another snippet enters edition for example).

method onClone(options)

Called when the associated snippet is the result of the cloning of another snippet (so this.$target is a cloned element).

Parameters
class OnCloneOptions()
attribute isCurrent boolean
true if the associated snippet is a clone of the main element that
was cloned (so not a clone of a child of this main element that was cloned)
function onMove()

Called when the associated snippet is moved to another DOM location.

function onRemove()

Called when the associated snippet is about to be removed from the DOM.

function cleanForSave()

Called when the template which contains the associated snippet is about to be saved.

function selectClass(previewMode, value, $opt)

Default option method which allows to select one and only one class in the option classes set and set it on the associated snippet. The common case is having a subdropdown with each item having a data-select-class value allowing to choose the associated class.

Parameters

    previewMode (boolean or string) – truthy if the option is enabled for preview or if leaving it (in that second case, the value is ‘reset’) - false if the option should be activated for good

    value (any) – the class to activate ($opt.data(‘selectClass’))

    $opt (jQuery) – the related DOMElement option

function toggleClass(previewMode, value, $opt)

Default option method which allows to select one or multiple classes in the option classes set and set it on the associated snippet. The common case is having a subdropdown with each item having a data-toggle-class value allowing to toggle the associated class.

Parameters

    previewMode

    value

    $opt

function $()

Override the helper method to search inside the $target element instead of the dropdown item element.

function notify(name, data)

Sometimes, options may need to notify other options, even in parent editors. This can be done thanks to the ‘option_update’ event, which will then be handled by this function.

Parameters

    name (string) – an identifier for a type of update

    data (any)

function setTarget($target)

Sometimes, an option is binded on an element but should in fact apply on another one. For example, elements which contain slides: we want all the per-slide options to be in the main menu of the whole snippet. This function allows to set the option’s target.

Parameters
    $target (jQuery) – the new target element
namespace
class SnippetOption(parent, $target, $overlay, data)
Extends
Parameters

    parent

    $target

    $overlay

    data

Handles a set of options for one snippet. The registry returned by this module contains the names of the specialized SnippetOption which can be referenced thanks to the data-js key in the web_editor options template.

attribute preventChildPropagation Boolean

When editing a snippet, its options are shown alongside the ones of its parent snippets. The parent options are only shown if the following flag is set to false (default).

method start()

Called when the option is initialized (i.e. the parent edition overlay is shown for the first time).

method onFocus()

Called when the parent edition overlay is covering the associated snippet (the first time, this follows the call to the @see start method).

method onBuilt()

Called when the parent edition overlay is covering the associated snippet for the first time, when it is a new snippet dropped from the d&d snippet menu. Note: this is called after the start and onFocus methods.

method onBlur()

Called when the parent edition overlay is removed from the associated snippet (another snippet enters edition for example).

method onClone(options)

Called when the associated snippet is the result of the cloning of another snippet (so this.$target is a cloned element).

Parameters
class OnCloneOptions()
attribute isCurrent boolean
true if the associated snippet is a clone of the main element that
was cloned (so not a clone of a child of this main element that was cloned)
function onMove()

Called when the associated snippet is moved to another DOM location.

function onRemove()

Called when the associated snippet is about to be removed from the DOM.

function cleanForSave()

Called when the template which contains the associated snippet is about to be saved.

function selectClass(previewMode, value, $opt)

Default option method which allows to select one and only one class in the option classes set and set it on the associated snippet. The common case is having a subdropdown with each item having a data-select-class value allowing to choose the associated class.

Parameters

    previewMode (boolean or string) – truthy if the option is enabled for preview or if leaving it (in that second case, the value is ‘reset’) - false if the option should be activated for good

    value (any) – the class to activate ($opt.data(‘selectClass’))

    $opt (jQuery) – the related DOMElement option

function toggleClass(previewMode, value, $opt)

Default option method which allows to select one or multiple classes in the option classes set and set it on the associated snippet. The common case is having a subdropdown with each item having a data-toggle-class value allowing to toggle the associated class.

Parameters

    previewMode

    value

    $opt

function $()

Override the helper method to search inside the $target element instead of the dropdown item element.

function notify(name, data)

Sometimes, options may need to notify other options, even in parent editors. This can be done thanks to the ‘option_update’ event, which will then be handled by this function.

Parameters

    name (string) – an identifier for a type of update

    data (any)

function setTarget($target)

Sometimes, an option is binded on an element but should in fact apply on another one. For example, elements which contain slides: we want all the per-slide options to be in the main menu of the whole snippet. This function allows to set the option’s target.

Parameters
    $target (jQuery) – the new target element
namespace registry

The registry object contains the list of available options.

class sizing_y(parent, $target, $overlay, data)
Extends
sizing
Parameters

    parent

    $target

    $overlay

    data

Handles the edition of padding-top and padding-bottom.

class colorpicker(parent, $target, $overlay, data)
Parameters

    parent

    $target

    $overlay

    data

Handles the edition of snippet’s background color classes.

class pos_background(parent, $target, $overlay, data)
Parameters

    parent

    $target

    $overlay

    data

Handles the edition of snippet’s background image.

method background(previewMode, value, $opt)

Handles a background change.

Parameters

    previewMode

    value

    $opt

method chooseImage(previewMode, value, $opt)

Opens a media dialog to add a custom background image.

Parameters

    previewMode

    value

    $opt

method bindBackgroundEvents()

Attaches events so that when a background-color is set, the background image is removed.

class background_position(parent, $target, $overlay, data)
Parameters

    parent

    $target

    $overlay

    data

Handles the edition of snippet’s background image position.

method backgroundPosition(previewMode, value, $opt)

Opens a Dialog to edit the snippet’s backgroung image position.

Parameters

    previewMode

    value

    $opt

class many2one(parent, $target, $overlay, data)
Parameters

    parent

    $target

    $overlay

    data

Allows to replace a text value with the name of a database record.

class pos_background(parent, $target, $overlay, data)
Parameters

    parent

    $target

    $overlay

    data

Handles the edition of snippet’s background image.

method background(previewMode, value, $opt)

Handles a background change.

Parameters

    previewMode

    value

    $opt

method chooseImage(previewMode, value, $opt)

Opens a media dialog to add a custom background image.

Parameters

    previewMode

    value

    $opt

method bindBackgroundEvents()

Attaches events so that when a background-color is set, the background image is removed.

namespace registry

The registry object contains the list of available options.

class sizing_y(parent, $target, $overlay, data)
Extends
sizing
Parameters

    parent

    $target

    $overlay

    data

Handles the edition of padding-top and padding-bottom.

class colorpicker(parent, $target, $overlay, data)
Parameters

    parent

    $target

    $overlay

    data

Handles the edition of snippet’s background color classes.

class pos_background(parent, $target, $overlay, data)
Parameters

    parent

    $target

    $overlay

    data

Handles the edition of snippet’s background image.

method background(previewMode, value, $opt)

Handles a background change.

Parameters

    previewMode

    value

    $opt

method chooseImage(previewMode, value, $opt)

Opens a media dialog to add a custom background image.

Parameters

    previewMode

    value

    $opt

method bindBackgroundEvents()

Attaches events so that when a background-color is set, the background image is removed.

class background_position(parent, $target, $overlay, data)
Parameters

    parent

    $target

    $overlay

    data

Handles the edition of snippet’s background image position.

method backgroundPosition(previewMode, value, $opt)

Opens a Dialog to edit the snippet’s backgroung image position.

Parameters

    previewMode

    value

    $opt

class many2one(parent, $target, $overlay, data)
Parameters

    parent

    $target

    $overlay

    data

Allows to replace a text value with the name of a database record.

class pos_background(parent, $target, $overlay, data)
Parameters

    parent

    $target

    $overlay

    data

Handles the edition of snippet’s background image.

method background(previewMode, value, $opt)

Handles a background change.

Parameters

    previewMode

    value

    $opt

method chooseImage(previewMode, value, $opt)

Opens a media dialog to add a custom background image.

Parameters

    previewMode

    value

    $opt

method bindBackgroundEvents()

Attaches events so that when a background-color is set, the background image is removed.

module web.mixins
namespace
mixin ParentedMixin

Mixin to structure objects’ life-cycles folowing a parent-children relationship. Each object can a have a parent and multiple children. When an object is destroyed, all its children are destroyed too releasing any resource they could have reserved before.

function setParent(parent)

Set the parent of the current object. When calling this method, the parent will also be informed and will return the current object when its getChildren() method is called. If the current object did already have a parent, it is unregistered before, which means the previous parent will not return the current object anymore when its getChildren() method is called.

Parameters
    parent
function getParent()

Return the current parent of the object (or null).

function getChildren()

Return a list of the children of the current object.

function isDestroyed()

Returns true if destroy() was called on the current object.

function alive(promise[, reject]) → $.Deferred

Utility method to only execute asynchronous actions if the current object has not been destroyed.

Parameters

    promise (jQuery.Deferred) – The promise representing the asynchronous action.

    reject=false (bool) – If true, the returned promise will be rejected with no arguments if the current object is destroyed. If false, the returned promise will never be resolved or rejected.

Returns
A promise that will mirror the given promise if everything goes fine but will either be rejected with no arguments or never resolved if the current object is destroyed.
Return Type
jQuery.Deferred
function destroy()

Inform the object it should destroy itself, releasing any resource it could have reserved.

function findAncestor(predicate)

Find the closest ancestor matching predicate

Parameters
    predicate
mixin EventDispatcherMixin

Mixin containing an event system. Events are also registered by specifying the target object (the object which will receive the event when it is raised). Both the event-emitting object and the target object store or reference to each other. This is used to correctly remove all reference to the event handler when any of the object is destroyed (when the destroy() method from ParentedMixin is called). Removing those references is necessary to avoid memory leak and phantom events (events which are raised and sent to a previously destroyed object).

class Events()
Extends

Backbone’s events. Do not ever use it directly, use EventDispatcherMixin instead.

This class just handle the dispatching of events, it is not meant to be extended, nor used directly. All integration with parenting and automatic unregistration of events is done in EventDispatcherMixin.

Copyright notice for the following Class:

(c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. Backbone may be freely distributed under the MIT license. For all details and documentation: http://backbonejs.org

mixin EventDispatcherMixin

Mixin containing an event system. Events are also registered by specifying the target object (the object which will receive the event when it is raised). Both the event-emitting object and the target object store or reference to each other. This is used to correctly remove all reference to the event handler when any of the object is destroyed (when the destroy() method from ParentedMixin is called). Removing those references is necessary to avoid memory leak and phantom events (events which are raised and sent to a previously destroyed object).

mixin ParentedMixin

Mixin to structure objects’ life-cycles folowing a parent-children relationship. Each object can a have a parent and multiple children. When an object is destroyed, all its children are destroyed too releasing any resource they could have reserved before.

function setParent(parent)

Set the parent of the current object. When calling this method, the parent will also be informed and will return the current object when its getChildren() method is called. If the current object did already have a parent, it is unregistered before, which means the previous parent will not return the current object anymore when its getChildren() method is called.

Parameters
    parent
function getParent()

Return the current parent of the object (or null).

function getChildren()

Return a list of the children of the current object.

function isDestroyed()

Returns true if destroy() was called on the current object.

function alive(promise[, reject]) → $.Deferred

Utility method to only execute asynchronous actions if the current object has not been destroyed.

Parameters

    promise (jQuery.Deferred) – The promise representing the asynchronous action.

    reject=false (bool) – If true, the returned promise will be rejected with no arguments if the current object is destroyed. If false, the returned promise will never be resolved or rejected.

Returns
A promise that will mirror the given promise if everything goes fine but will either be rejected with no arguments or never resolved if the current object is destroyed.
Return Type
jQuery.Deferred
function destroy()

Inform the object it should destroy itself, releasing any resource it could have reserved.

function findAncestor(predicate)

Find the closest ancestor matching predicate

Parameters
    predicate
module account.AccountPortalSidebar.instance
namespace
module web.PivotController
class PivotController(parent, model, renderer, params)
Parameters
method getContext() → Object

Returns the current measures and groupbys, so we can restore the view when we save the current state in the search view, or when we add it to the dashboard.

Return Type
Object
method renderButtons([$node])

Render the buttons according to the PivotView.buttons template and add listeners on it. Set this.$buttons with the produced jQuery element

Parameters
    $node (jQuery) – a jQuery node where the rendered buttons should be inserted. $node may be undefined, in which case the PivotView does nothing
class PivotControllerParams()
attribute groupableFields Object
a map from field name to field
props
attribute enableLinking boolean
configure the pivot view to allow
opening a list view by clicking on a cell with some data.
module web.basic_fields
class FieldProgressBar()

Node options:

  • title: title of the bar, displayed on top of the bar options
  • editable: boolean if value is editable
  • current_value: get the current_value from the field that must be present in the view
  • max_value: get the max_value from the field that must be present in the view
  • edit_max_value: boolean if the max_value is editable
  • title: title of the bar, displayed on top of the bar –> not translated, use parameter “title” instead
class AceEditor()
Extends
DebouncedField

This widget is intended to be used on Text fields. It will provide Ace Editor for editing XML and Python.

namespace
class FieldDomain()

The “Domain” field allows the user to construct a technical-prefix domain thanks to a tree-like interface and see the selected records in real time. In debug mode, an input is also there to be able to enter the prefix char domain directly (or to build advanced domains the tree-like interface does not allow to).

attribute specialData String

Fetches the number of records which are matched by the domain (if the domain is not server-valid, the value is false) and the model the field must work with.

method isSet()

A domain field is always set since the false value is considered to be equal to “[]” (match all records).

class FieldFloatToggle()

The goal of this widget is to replace the input field by a button containing a range of possible values (given in the options). Each click allows the user to loop in the range. The purpose here is to restrict the field value to a predefined selection. Also, the widget support the factor conversion as the float_factor widget (Range values should be the result of the conversion).

class FieldProgressBar()

Node options:

  • title: title of the bar, displayed on top of the bar options
  • editable: boolean if value is editable
  • current_value: get the current_value from the field that must be present in the view
  • max_value: get the max_value from the field that must be present in the view
  • edit_max_value: boolean if the max_value is editable
  • title: title of the bar, displayed on top of the bar –> not translated, use parameter “title” instead
class FieldToggleBoolean(parent, name, record[, options])
Parameters

    parent (Widget)

    name (string) – The field name defined in the model

    record (Object) – A record object (result of the get method of a basic model)

    options (FieldToggleBooleanOptions)

This widget is intended to be used on boolean fields. It toggles a button switching between a green bullet / gray bullet.

method isSet()

A boolean field is always set since false is a valid value.

class FieldToggleBooleanOptions()
attribute mode string

should be ‘readonly’ or ‘edit’

class HandleWidget(parent, name, record[, options])
Parameters

    parent (Widget)

    name (string) – The field name defined in the model

    record (Object) – A record object (result of the get method of a basic model)

    options (HandleWidgetOptions)

Displays a handle to modify the sequence.

class HandleWidgetOptions()
attribute mode string

should be ‘readonly’ or ‘edit’

class AceEditor()
Extends
DebouncedField

This widget is intended to be used on Text fields. It will provide Ace Editor for editing XML and Python.

class FieldToggleBoolean(parent, name, record[, options])
Parameters

    parent (Widget)

    name (string) – The field name defined in the model

    record (Object) – A record object (result of the get method of a basic model)

    options (FieldToggleBooleanOptions)

This widget is intended to be used on boolean fields. It toggles a button switching between a green bullet / gray bullet.

method isSet()

A boolean field is always set since false is a valid value.

class FieldToggleBooleanOptions()
attribute mode string

should be ‘readonly’ or ‘edit’

class FieldFloatToggle()

The goal of this widget is to replace the input field by a button containing a range of possible values (given in the options). Each click allows the user to loop in the range. The purpose here is to restrict the field value to a predefined selection. Also, the widget support the factor conversion as the float_factor widget (Range values should be the result of the conversion).

class FieldDomain()

The “Domain” field allows the user to construct a technical-prefix domain thanks to a tree-like interface and see the selected records in real time. In debug mode, an input is also there to be able to enter the prefix char domain directly (or to build advanced domains the tree-like interface does not allow to).

attribute specialData String

Fetches the number of records which are matched by the domain (if the domain is not server-valid, the value is false) and the model the field must work with.

method isSet()

A domain field is always set since the false value is considered to be equal to “[]” (match all records).

class HandleWidget(parent, name, record[, options])
Parameters

    parent (Widget)

    name (string) – The field name defined in the model

    record (Object) – A record object (result of the get method of a basic model)

    options (HandleWidgetOptions)

Displays a handle to modify the sequence.

class HandleWidgetOptions()
attribute mode string

should be ‘readonly’ or ‘edit’

module web.framework
function redirect(url, wait)

Redirect to url by replacing window.location If wait is true, sleep 1s and wait for the server i.e. after a restart.

Parameters

    url

    wait

function blockAccessKeys()

Remove the “accesskey” attributes to avoid the use of the access keys while the blockUI is enable.

function Home(parent, action)

Client action to go back home.

Parameters

    parent

    action

function ReloadContext(parent, action)

Client action to refresh the session context (making sure HTTP requests will have the right one) then reload the whole interface.

Parameters

    parent

    action

namespace
function redirect(url, wait)

Redirect to url by replacing window.location If wait is true, sleep 1s and wait for the server i.e. after a restart.

Parameters

    url

    wait

module hr_attendance.kiosk_confirm
class KioskConfirm(parent, action)
Parameters

    parent

    action

module web_editor.root_widget
namespace
class RootWidget()
Extends

Specialized Widget which automatically instantiates child widgets to attach to internal DOM elements once it is started. The widgets to instantiate are known thanks to a linked registry which contains info about the widget classes and jQuery selectors to use to find the elements to attach them to.

class RootWidget()
Extends

Specialized Widget which automatically instantiates child widgets to attach to internal DOM elements once it is started. The widgets to instantiate are known thanks to a linked registry which contains info about the widget classes and jQuery selectors to use to find the elements to attach them to.

module report.client_action
class ReportAction(parent, action, options)
Parameters

    parent

    action

    options

method on_message_received(ev)

Event handler of the message post. We only handle them if they’re from web.base.url host and protocol and if they’re part of AUTHORIZED_MESSAGES.

Parameters
    ev
module sale.ProductConfiguratorFormView
class ProductConfiguratorFormView()
Extends
module hr_attendance.my_attendances
class MyAttendances(parent)
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.
module web_editor.ready
namespace
module mail.Manager.Window
class MailManager(parent)
Parameters
    parent
method addMessage(data)

For new posted message of current user in a document thread: store it in the localStorage to make it appear on the other tabs.

Note: ‘addMessage’ modifies the message in place (by setting the channel_id, so we must store the message in the localStorage before calling ‘addMessage’)

Parameters
class AddMessageData()
attribute author_id Array
[int, string] where int is server ID of
the author, and string is the name of the author.
attribute id integer

server ID of the message

attribute model string
the model name of the document that this
message is related to.
attribute res_id integer
the ID of the document that this message
is related to.
function createChannel(name, type) → $.Promise<integer>

Creates a channel, can be either a true channel or a DM chat based on type

Parameters

    name (integer or string) – id of partner (in case of dm) or name

    type (string) – [‘dm_chat’, ‘public’, ‘private’]

Returns
resolved with ID of the newly created channel
Return Type
jQuery.Promise<integer>
function getCannedResponses() → Array

Returns the list of canned responses A canned response is a pre-formatted text that is triggered with some keystrokes, such as with ‘:’.

Returns
array of Objects (mail.shortcode)
Return Type
Array
function getChannel(threadID) → mail.model.Channel|undefined

Returns a channel corresponding to the given id.

Parameters
    threadID (integer)
Returns
the channel, if it exists
Return Type
mail.model.Channel or undefined
function getChannels() → mail.model.Channel[]

Returns a list of channels

Returns
list of channels
Return Type
function getChannelPreviews() → $.Promise<Object[]>

Overrides to filter out the Support channel from the previews.

Returns
list of valid objects for mail.Preview template
Return Type
jQuery.Promise<Array<Object>>
function getDiscussMenuID() → integer

Returns the record id of ir.ui.menu for Discuss

Returns
record id
Return Type
integer
function getDMChatFromPartnerID(partnerID) → Object|undefined

Gets direct message channel

Parameters
    partnerID (integer)
Returns
channel
Return Type
Object or undefined
function getMailFailures() → mail.model.MailFailure[]

Returns a list of mail failures

Returns
list of mail failures
Return Type
function getMentionPartnerSuggestions() → Array<Object[]>

Get partners as mentions from a chatter Typically all employees as partner suggestions.

Return Type
Array<Array<Object>>
function getMessage(messageID) → mail.model.Message|undefined

Gets message from its ID

Parameters
    messageID (integer)
Returns
the matched message (if any)
Return Type
mail.model.Message or undefined
function getSystrayPreviews([filter]) → $.Promise<Object[]>

Returns the previews to display in the systray’s messaging menu.

Parameters
    filter=undefined (string) – specify ‘chat’ or ‘channels’ to only get previews for that type of threads
Returns
resolved with list of objects that have a valid format for rendering a messaging menu preview items.
Return Type
jQuery.Promise<Array<Object>>
function getModeratedChannelIDs() → integer[]

Get the list of channel IDs where the current user is a moderator

Return Type
Array<integer>
function getOdoobotID() → string

Get the OdooBot ID, which is the default authorID for transient messages

Return Type
string
function getThread(threadID) → mail.model.Thread|undefined

Returns thread matching provided ID, if any

Parameters
    threadID (string or integer)
Returns
the thread, if it exists
Return Type
mail.model.Thread or undefined
function getThreads() → mail.model.Thread[]

Returns a list of threads

Returns
list of threads
Return Type
function isMyselfModerator() → boolean

States whether the current user is a moderator or not

Return Type
boolean
function isReady() → $.Promise

States whether the mail manager is ready or not This is the case when it has fetched the initial state from the server, by means of the route ‘mail/init_messaging’

Return Type
jQuery.Promise
function joinChannel(channelID[, options]) → $.Promise<integer>

Join an existing channel See @createChannel to join a new channel

Parameters

    channelID (integer)

    options (Object) – options to be passed on channel add

Returns
resolved with channelID joined
Return Type
jQuery.Promise<integer>
function markMessagesAsRead(messageIDs) → $.Promise

Mark messages as read

Parameters
    messageIDs (Array) – list of messages IDs
Returns
resolved when messages have been marked as read on the server.
Return Type
jQuery.Promise
function openThread(threadID)

Open the thread window if discuss is not opened

Parameters
    threadID (integer or string)
function redirect(resModel, resID[, dmRedirectionCallback])

Special redirection handling for given model and id

If the model is res.partner, and there is a user associated with this partner which isn’t the current user, open the DM chat with this user. Otherwhise, open the record’s form view (if not current user’s).

Parameters

    resModel (string) – model to open

    resID (integer) – record to open

    dmRedirectionCallback (function) – only used if ‘res.partner’, a function that has a threadID as input

function removeMessageFromThreads(message)

Remove the message from all of its threads

Parameters
function searchPartner(searchVal, limit) → $.Promise<Object[]>

Search among prefetched partners, using the string ‘searchVal’

Parameters

    searchVal (string)

    limit (integer) – max number of found partners in the response

Returns
list of found partners (matching ‘searchVal’)
Return Type
jQuery.Promise<Array<Object>>
function unstarAll() → $.Promise

Unstars all messages from all channels

Return Type
jQuery.Promise
function getDocumentThread(model, resID) → integer

Returns a document thread corresponding to the given model and resID.

Parameters

    model (string) – of the document thread, if it exists

    resID

Returns
resID of the document thread, if it exists
Return Type
integer
function getOrAddDocumentThread(params) → mail.model.DocumentThread

Add a new document thread, or get if it exists already.

Also, if a name is provided for the document thread, it overwrites the previous one.

class GetOrAddDocumentThreadParams()
attribute message_ids interger[]
the list of message ids linked
to the document (if not given, they will be fetched before fetching the messages)
attribute name string
if provided, overwrites the name of the
existing document thread
attribute resID integer
attribute resModel string
function updateDocumentThreadState(threadID, state)

Updates the state of a given document thread (stored in localStorage). Garbage collects windows previously marked as ‘closed’ (assuming that the info has already been processed by the other tabs).

Parameters
class UpdateDocumentThreadStateState()
attribute name string

name of the document thread

attribute windowState string

(‘closed’, ‘folded’ or ‘open’)

function initSupport()

Initialises the Support: checks if there is a pending chat session between the user and Support, and if so, re-opens it. Note: we can’t directly override init(), because it is already called when the include is applied, so we use this hook instead (called at webclient startup)

function startPollingSupport([pollingDelay])

Initiates a longpoll with the server hosting the Support channel.

Parameters
    pollingDelay=POLL_TIMEOUT_DELAY (integer) – the longpolling timeout delay to set
function startSupportLivechat([channelState]) → Deferred

Opens the Support channel between a livechat operator from the Support database and the current user (if there is an available operator). Ensures to perform only once the request to create/retrieve the Support channel.

Parameters
    channelState=’open’ (string) – state of the Support channel (see CHANNEL_STATES for accepted values)
Return Type
function updateSupportChannelState(state)

Updates the state of the Support channel (stored in the localStorage).

Parameters
    state (string) – (‘closed’, ‘folded’ or ‘open’)
function openBlankThreadWindow()

Open the blank thread window (i.e. the thread window without any thread linked to it). Make it if there is no blank thread window yet.

function openDMChatWindowFromBlankThreadWindow(partnerID)

Open a DM chat in a thread window. This is useful when selecting a DM chatin the blank thread window, so that it replaces it with the DM chat window.

Parameters
    partnerID (integer)
function openThreadWindow(threadID[, options])

Open a thread in a thread window

Parameters
class OpenThreadWindowOptions()
attribute passively boolean
if set to true, open the thread
window without focusing the input and marking messages as read if it is not open yet, and do nothing otherwise.
attribute keepFoldState boolean
if set to true, keep the
fold state of the thread
function updateThreadWindow(threadID, options)

Called when a thread has its window state that has been changed, so its thread window view should be changed to match the model.

Parameters

    threadID (integer or string)

    options (UpdateThreadWindowOptions) – option to be applied on opening thread window, if the thread is detached

class UpdateThreadWindowOptions()
option to be applied on opening thread window, if
the thread is detached
attribute passively boolean
if set, the window will behave
passively.
module mail.model.CCThrottleFunction
function CCThrottleFunction(params) → function

A function that creates a cancellable and clearable (CC) throttle version of a provided function.

This throttle mechanism allows calling a function at most once during a certain period:

  • When a function call is made, it enters a ‘cooldown’ phase, in which any
    attempt to call the function is buffered until the cooldown phase ends.
  • At most 1 function call can be buffered during the cooldown phase, and the
    latest one in this phase will be considered at its end.
  • When a cooldown phase ends, any buffered function call will be performed
    and another cooldown phase will follow up.

This throttle version has the following interesting properties:

  • cancellable: it allows removing a buffered function call during the
    cooldown phase, but it keeps the cooldown phase running.
  • clearable: it allows to clear the internal clock of the throttled function,
    so that any cooldown phase is immediately ending.
Parameters
Returns
the cancellable and clearable throttle version of the provided function in argument.
Return Type
function
class CCThrottleFunctionParams()
attribute duration integer
a duration for the throttled behaviour,
in milli-seconds.
attribute func function

the function to throttle

function CCThrottleFunction(params) → function

A function that creates a cancellable and clearable (CC) throttle version of a provided function.

This throttle mechanism allows calling a function at most once during a certain period:

  • When a function call is made, it enters a ‘cooldown’ phase, in which any
    attempt to call the function is buffered until the cooldown phase ends.
  • At most 1 function call can be buffered during the cooldown phase, and the
    latest one in this phase will be considered at its end.
  • When a cooldown phase ends, any buffered function call will be performed
    and another cooldown phase will follow up.

This throttle version has the following interesting properties:

  • cancellable: it allows removing a buffered function call during the
    cooldown phase, but it keeps the cooldown phase running.
  • clearable: it allows to clear the internal clock of the throttled function,
    so that any cooldown phase is immediately ending.
Parameters
Returns
the cancellable and clearable throttle version of the provided function in argument.
Return Type
function
class CCThrottleFunctionParams()
attribute duration integer
a duration for the throttled behaviour,
in milli-seconds.
attribute func function

the function to throttle

module web.view_dialogs
class SelectCreateDialog()
Extends

Search dialog (displays a list of records and permits to create a new one by switching to a form view)

class ViewDialog(parent[, options])
Extends
Parameters

Class with everything which is common between FormViewDialog and SelectCreateDialog.

class ViewDialogOptions()
attribute dialogClass string
attribute res_model string

the model of the record(s) to open

attribute domain any[]
attribute context Object
namespace
class FormViewDialog(parent[, options])
Extends
Parameters

Create and edit dialog (displays a form view record and leave once saved)

method open() → FormViewDialog

Open the form view dialog. It is necessarily asynchronous, but this method returns immediately.

Returns
this instance
Return Type
class FormViewDialogOptions()
attribute parentID string
the id of the parent record. It is
useful for situations such as a one2many opened in a form view dialog. In that case, we want to be able to properly evaluate domains with the ‘parent’ key.
attribute res_id integer

the id of the record to open

attribute form_view_options Object
dict of options to pass to
the Form View @todo: make it work
attribute fields_view Object

optional form fields_view

attribute readonly boolean
only applicable when not in
creation mode
attribute deletable boolean
whether or not the record can
be deleted
attribute disable_multiple_selection boolean
set to true
to remove the possibility to create several records in a row
attribute on_saved function
callback executed after saving a
record. It will be called with the record data, and a boolean which indicates if something was changed
attribute on_remove function
callback executed when the user
clicks on the ‘Remove’ button
attribute model BasicModel
if given, it will be used instead of
a new form view model
attribute recordID string
if given, the model has to be given as
well, and in that case, it will be used without loading anything.
attribute shouldSaveLocally boolean
if true, the view dialog
will save locally instead of actually saving (useful for one2manys)
class SelectCreateDialog()
Extends

Search dialog (displays a list of records and permits to create a new one by switching to a form view)

class FormViewDialog(parent[, options])
Extends
Parameters

Create and edit dialog (displays a form view record and leave once saved)

method open() → FormViewDialog

Open the form view dialog. It is necessarily asynchronous, but this method returns immediately.

Returns
this instance
Return Type
class FormViewDialogOptions()
attribute parentID string
the id of the parent record. It is
useful for situations such as a one2many opened in a form view dialog. In that case, we want to be able to properly evaluate domains with the ‘parent’ key.
attribute res_id integer

the id of the record to open

attribute form_view_options Object
dict of options to pass to
the Form View @todo: make it work
attribute fields_view Object

optional form fields_view

attribute readonly boolean
only applicable when not in
creation mode
attribute deletable boolean
whether or not the record can
be deleted
attribute disable_multiple_selection boolean
set to true
to remove the possibility to create several records in a row
attribute on_saved function
callback executed after saving a
record. It will be called with the record data, and a boolean which indicates if something was changed
attribute on_remove function
callback executed when the user
clicks on the ‘Remove’ button
attribute model BasicModel
if given, it will be used instead of
a new form view model
attribute recordID string
if given, the model has to be given as
well, and in that case, it will be used without loading anything.
attribute shouldSaveLocally boolean
if true, the view dialog
will save locally instead of actually saving (useful for one2manys)
module payment.processing
class (parent, payment_tx_ids)
Extends
Parameters

    parent

    payment_tx_ids

module web.py_utils
Depends On
function tz_offset() → datetime.timedelta

Returns a timedelta object which represents the timezone offset between the local timezone and the UTC time.

This is very useful to generate datetime strings which are ‘timezone’ dependant. For example, we can now write this to generate the correct datetime string representing “this morning in the user timezone”:

“datetime.datetime.now().replace(hour=0,minute=0,second=0) + tz_offset()).strftime(‘%Y-%m-%d %H:%M:%S’)”

Return Type
datetime.timedelta
function get_normalized_domain(domain_array) → Array

Returns a normalized copy of the given domain array. Normalization is is making the implicit “&” at the start of the domain explicit, e.g. [A, B, C] would become [“&”, “&”, A, B, C].

Parameters
    domain_array (Array)
Returns
normalized copy of the given array
Return Type
Array
function context_today() → datetime.date

Returns the current local date, which means the date on the client (which can be different compared to the date of the server).

Return Type
datetime.date
function ensure_evaluated(args, kwargs)

If args or kwargs are unevaluated contexts or domains (compound or not), evaluated them in-place.

Potentially mutates both parameters.

Parameters

    args

    kwargs

function assembleDomains(domains, operator) → string

Assemble domains into a single domains using an ‘OR’ or an ‘AND’ operator.

Parameters

    domains (Array<string>) – list of string representing domains

    operator (AND or OR) – used to combine domains (default “AND”)

Returns
normalized domain
Return Type
string
namespace
function ensure_evaluated(args, kwargs)

If args or kwargs are unevaluated contexts or domains (compound or not), evaluated them in-place.

Potentially mutates both parameters.

Parameters

    args

    kwargs

function normalizeDomain(domain) → string

Normalize a domain via its string representation.

Note: this function does not evaluate anything inside the domain. This is actually quite critical because this allows the manipulation of unevaluated (dynamic) domains.

Parameters
    domain (string) – string representing a domain
Returns
normalized domain
Return Type
string
function assembleDomains(domains, operator) → string

Assemble domains into a single domains using an ‘OR’ or an ‘AND’ operator.

Parameters

    domains (Array<string>) – list of string representing domains

    operator (AND or OR) – used to combine domains (default “AND”)

Returns
normalized domain
Return Type
string
function normalizeDomain(domain) → string

Normalize a domain via its string representation.

Note: this function does not evaluate anything inside the domain. This is actually quite critical because this allows the manipulation of unevaluated (dynamic) domains.

Parameters
    domain (string) – string representing a domain
Returns
normalized domain
Return Type
string
module web.AbstractService
class AbstractService(parent)
Extends
Parameters
    parent
module iap.credit.checker
class IAPCreditChecker(parent, data, options)
Extends
Parameters

    parent

    data

    options

module web_diagram.DiagramController
class DiagramController(parent, model, renderer, params)
Parameters

Diagram Controller

method renderButtons([$node])

Render the buttons according to the DiagramView.buttons template and add listeners on it. Set this.$buttons with the produced jQuery element

Parameters
    $node (jQuery) – a jQuery node where the rendered buttons should be inserted $node may be undefined, in which case they are inserted into this.options.$buttons
class DiagramController(parent, model, renderer, params)
Parameters

Diagram Controller

method renderButtons([$node])

Render the buttons according to the DiagramView.buttons template and add listeners on it. Set this.$buttons with the produced jQuery element

Parameters
    $node (jQuery) – a jQuery node where the rendered buttons should be inserted $node may be undefined, in which case they are inserted into this.options.$buttons
module unsplash.api
class UnsplashCore(parent)
Extends
Parameters
    parent
method getImages(query, pageSize, pageNumber)

Gets unsplash images from query string.

Parameters

    query (String) – search terms

    pageSize (Integer) – number of image to display per page

    pageNumber (Integer) – page number to retrieve

method notifyDownload(url)

Notifies Unsplash from an image download. (API requirement)

Parameters
    url (String) – url of the image to notify
module mail.ThreadField
class ThreadField()

‘mail_thread’ widget: displays the thread of messages

class ThreadField()

‘mail_thread’ widget: displays the thread of messages

module web.Registry
Exports
Depends On
class Registry([mapping])
Extends
Parameters
    mapping (Object) – the initial data in the registry

The registry is really pretty much only a mapping from some keys to some values. The Registry class only add a few simple methods around that to make it nicer and slightly safer.

Note that registries have a fundamental problem: the value that you try to get in a registry might not have been added yet, so of course, you need to make sure that your dependencies are solid. For this reason, it is a good practice to avoid using the registry if you can simply import what you need with the ‘require’ statement.

However, on the flip side, sometimes you cannot just simply import something because we would have a dependency cycle. In that case, registries might help.

method add(key, value) → Registry

Add a key (and a value) to the registry.

Notify the listeners on newly added item in the registry.

Parameters

    key (string)

    value (any)

Returns
can be used to chain add calls.
Return Type
method contains(key) → boolean

Check if the registry contains the value

Parameters
    key (string)
Return Type
boolean
method extend([mapping])

Creates and returns a copy of the current mapping, with the provided mapping argument added in (replacing existing keys if needed)

Parent and child remain linked, a new key in the parent (which is not overwritten by the child) will appear in the child.

Parameters
    mapping={} (Object) – a mapping of keys to object-paths
method get(key) → any

Returns the value associated to the given key.

Parameters
    key (string)
Return Type
any
method getAny(keys) → any

Tries a number of keys, and returns the first object matching one of the keys.

Parameters
    keys (Array<string>) – a sequence of keys to fetch the object for
Returns
the first result found matching an object
Return Type
any
method onAdd(callback)

Register a callback to execute when items are added to the registry.

Parameters
    callback (function) – function with parameters (key, value).
class Registry([mapping])
Extends
Parameters
    mapping (Object) – the initial data in the registry

The registry is really pretty much only a mapping from some keys to some values. The Registry class only add a few simple methods around that to make it nicer and slightly safer.

Note that registries have a fundamental problem: the value that you try to get in a registry might not have been added yet, so of course, you need to make sure that your dependencies are solid. For this reason, it is a good practice to avoid using the registry if you can simply import what you need with the ‘require’ statement.

However, on the flip side, sometimes you cannot just simply import something because we would have a dependency cycle. In that case, registries might help.

method add(key, value) → Registry

Add a key (and a value) to the registry.

Notify the listeners on newly added item in the registry.

Parameters

    key (string)

    value (any)

Returns
can be used to chain add calls.
Return Type
method contains(key) → boolean

Check if the registry contains the value

Parameters
    key (string)
Return Type
boolean
method extend([mapping])

Creates and returns a copy of the current mapping, with the provided mapping argument added in (replacing existing keys if needed)

Parent and child remain linked, a new key in the parent (which is not overwritten by the child) will appear in the child.

Parameters
    mapping={} (Object) – a mapping of keys to object-paths
method get(key) → any

Returns the value associated to the given key.

Parameters
    key (string)
Return Type
any
method getAny(keys) → any

Tries a number of keys, and returns the first object matching one of the keys.

Parameters
    keys (Array<string>) – a sequence of keys to fetch the object for
Returns
the first result found matching an object
Return Type
any
method onAdd(callback)

Register a callback to execute when items are added to the registry.

Parameters
    callback (function) – function with parameters (key, value).
module portal.portal
namespace
module web.crash_manager
object instance of CrashManager
module web.GroupByMenu
class GroupByMenu(parent, groupbys, fields, options)
Parameters

    parent (Widget)

    groupbys (Array<Object>) – list of groupbys (type IGroupBy below) interface IGroupBy { itemId: string; unique id associated with the groupby fieldName: string; field name without interval! description: string; label printed on screen groupId: string; isDate: boolean; isActive: boolean; (optional) determines if the groupby is considered active isOpen: boolean; (optional) in case there are options the submenu presenting the options is opened or closed according to isOpen isRemovable: boolean; (optional) can be removed from menu options: array of objects with ‘optionId’ and ‘description’ keys; (optional) currentOptionId: string refers to an optionId that is activated if item is active (optional) }

    fields (Object) – ‘field_get’ of a model: mapping from field name to an object with its properties

    options (GroupByMenuOptions)

class GroupByMenuOptions()
attribute headerStyle string

conditions the style of the main button

module web.data
function deserialize_sort(criterion)

Reverse of the serialize_sort function: convert an array of SQL-like sort descriptors into a list of fields prefixed with ‘-‘ if necessary.

Parameters
    criterion
function serialize_sort(criterion) → String

Serializes the sort criterion array of a dataset into a form which can be consumed by OpenERP’s RPC APIs.

Parameters
    criterion (Array) – array of fields, from first to last criteria, prefixed with ‘-‘ for reverse sorting
Returns
SQL-like sorting string (``ORDER BY``) clause
Return Type
String
namespace data
module web.QuickCreateFormView
class QuickCreateFormView()
Extends
module website_forum.share
namespace
module im_livechat.im_livechat
namespace
module web_kanban_gauge.widget
class GaugeWidget(parent, name, record[, options])
Parameters

    parent (Widget)

    name (string) – The field name defined in the model

    record (Object) – A record object (result of the get method of a basic model)

    options (GaugeWidgetOptions)

options

  • max_value: maximum value of the gauge [default: 100]
  • max_field: get the max_value from the field that must be present in the view; takes over max_value
  • gauge_value_field: if set, the value displayed below the gauge is taken from this field instead of the base field used for the gauge. This allows to display a number different from the gauge.
  • label: lable of the gauge, displayed below the gauge value
  • label_field: get the label from the field that must be present in the view; takes over label
  • title: title of the gauge, displayed on top of the gauge
  • style: custom style
class GaugeWidgetOptions()
attribute mode string

should be ‘readonly’ or ‘edit’

class GaugeWidget(parent, name, record[, options])
Parameters

    parent (Widget)

    name (string) – The field name defined in the model

    record (Object) – A record object (result of the get method of a basic model)

    options (GaugeWidgetOptions)

options

  • max_value: maximum value of the gauge [default: 100]
  • max_field: get the max_value from the field that must be present in the view; takes over max_value
  • gauge_value_field: if set, the value displayed below the gauge is taken from this field instead of the base field used for the gauge. This allows to display a number different from the gauge.
  • label: lable of the gauge, displayed below the gauge value
  • label_field: get the label from the field that must be present in the view; takes over label
  • title: title of the gauge, displayed on top of the gauge
  • style: custom style
class GaugeWidgetOptions()
attribute mode string

should be ‘readonly’ or ‘edit’

module web.AbstractStorageService
class AbstractStorageService(parent)
Parameters
    parent
method clear()

Removes all data from the storage

method getItem(key, defaultValue) → string

Returns the value associated with a given key in the storage

Parameters

    key (string)

    defaultValue

Return Type
string
method removeItem(key)

Removes the given key from the storage

Parameters
    key (string)
method setItem(key, value)

Sets the value of a given key in the storage

Parameters

    key (string)

    value (string)

method onStorage()

Add an handler on storage event

module mail_bot.systray.MessagingMenu
namespace
module point_of_sale.keyboard
Depends On
namespace
module web.BasicModel
class BasicModel()
method addDefaultRecord(listID[, options]) → Deferred<string>

Add a default record to a list object. This method actually makes a new record with the _makeDefaultRecord method, then adds it to the list object. The default record is added in the data directly. This is meant to be used by list or kanban controllers (i.e. not for x2manys in form views, as in this case, we store changes as commands).

Parameters
Returns
resolves to the id of the new created record
Return Type
Deferred<string>
class AddDefaultRecordOptions()
attribute position string
if the new record should be added
on top or on bottom of the list
function applyDefaultValues(recordID, values[, options]) → Deferred

Add and process default values for a given record. Those values are parsed and stored in the ‘_changes’ key of the record. For relational fields, sub-dataPoints are created, and missing relational data is fetched. Also generate default values for fields with no given value. Typically, this function is called with the result of a ‘default_get’ RPC, to populate a newly created dataPoint. It may also be called when a one2many subrecord is open in a form view (dialog), to generate the default values for the fields displayed in the o2m form view, but not in the list or kanban (mainly to correctly create sub-dataPoints for relational fields).

Parameters

    recordID (string) – local id for a record

    values (Object) – dict of default values for the given record

    options (ApplyDefaultValuesOptions)

Return Type
class ApplyDefaultValuesOptions()
attribute viewType string
current viewType. If not set, we will
assume main viewType from the record
attribute fieldNames Array
list of field names for which a
default value must be generated (used to complete the values dict)
function applyRawChanges(recordID, viewType) → Deferred<string>

Onchange RPCs may return values for fields that are not in the current view. Those fields might even be unknown when the onchange returns (e.g. in x2manys, we only know the fields that are used in the inner view, but not those used in the potential form view opened in a dialog when a sub- record is clicked). When this happens, we can’t infer their type, so the given value can’t be processed. It is instead stored in the ‘_rawChanges’ key of the record, without any processing. Later on, if this record is displayed in another view (e.g. the user clicked on it in the x2many list, and the record opens in a dialog), those changes that were left behind must be applied. This function applies changes stored in ‘_rawChanges’ for a given viewType.

Parameters

    recordID (string) – local resource id of a record

    viewType (string) – the current viewType

Returns
resolves to the id of the record
Return Type
Deferred<string>
function deleteRecords(recordIds, modelName) → Deferred

Delete a list of records, then, if the records have a parent, reload it.

Parameters

    recordIds (Array<string>) – list of local resources ids. They should all be of type ‘record’, be of the same model and have the same parent.

    modelName (string) – mode name used to unlink the records

Return Type
function discardChanges(id[, options])

Discard all changes in a local resource. Basically, it removes everything that was stored in a _changes key.

Parameters
class DiscardChangesOptions()
attribute rollback boolean
if true, the changes will
be reset to the last _savePoint, otherwise, they are reset to null
function duplicateRecord(recordID) → Deferred<string>

Duplicate a record (by calling the ‘copy’ route)

Parameters
    recordID (string) – id for a local resource
Returns
resolves to the id of duplicate record
Return Type
Deferred<string>
function get(id, options) → Object

The get method first argument is the handle returned by the load method. It is optional (the handle can be undefined). In some case, it makes sense to use the handle as a key, for example the BasicModel holds the data for various records, each with its local ID.

synchronous method, it assumes that the resource has already been loaded.

Parameters

    id (string) – local id for the resource

    options (GetOptions)

Return Type
Object
class GetOptions()
attribute env boolean
if true, will only return res_id
(if record) or res_ids (if list)
attribute raw boolean

if true, will not follow relations

function getName(id) → string

Returns the current display_name for the record.

Parameters
    id (string) – the localID for a valid record element
Return Type
string
function canBeAbandoned(id) → boolean

Returns true if a record can be abandoned.

Case for not abandoning the record:

  1. flagged as ‘no abandon’ (i.e. during a default_get, including any onchange from a default_get)
  2. registered in a list on addition

    2.1. registered as non-new addition 2.2. registered as new additon on update

  3. record is not new

Otherwise, the record can be abandoned.

This is useful when discarding changes on this record, as it means that we must keep the record even if some fields are invalids (e.g. required field is empty).

Parameters
    id (string) – id for a local resource
Return Type
boolean
function isDirty(id) → boolean

Returns true if a record is dirty. A record is considered dirty if it has some unsaved changes, marked by the _isDirty property on the record or one of its subrecords.

Parameters
    id (string) – the local resource id
Return Type
boolean
function isNew(id) → boolean

Check if a localData is new, meaning if it is in the process of being created and no actual record exists in db. Note: if the localData is not of the “record” type, then it is always considered as not new.

Note: A virtual id is a character string composed of an integer and has a dash and other information. E.g: in calendar, the recursive event have virtual id linked to a real id virtual event id “23-20170418020000” is linked to the event id 23

Parameters
    id (string) – id for a local resource
Return Type
boolean
function load(params) → Deferred<string>

Main entry point, the goal of this method is to fetch and process all data (following relations if necessary) for a given record/list.

Parameters
Returns
resolves to a local id, or handle
Return Type
Deferred<string>
class LoadParams()
attribute fieldsInfo Object

contains the fieldInfo of each field

attribute fields Object

contains the description of each field

attribute type string

‘record’ or ‘list’

attribute recordID string

an ID for an existing resource.

function makeRecord(model, fields[, fieldInfo]) → string

This helper method is designed to help developpers that want to use a field widget outside of a view. In that case, we want a way to create data without actually performing a fetch.

Parameters

    model (string) – name of the model

    fields (Array<Object>) – a description of field properties

    fieldInfo (Object) – various field info that we want to set

Returns
the local id for the created resource
Return Type
string
function notifyChanges(record_id, changes[, options]) → string[]

This is an extremely important method. All changes in any field go through this method. It will then apply them in the local state, check if onchanges needs to be applied, actually do them if necessary, then resolves with the list of changed fields.

Parameters

    record_id (string)

    changes (Object) – a map field => new value

    options (Object) – will be transferred to the applyChange method

Returns
list of changed fields
Return Type
Array<string>
function reload(id[, options]) → Deferred<string>

Reload all data for a given resource. At any time there is at most one reload operation active.

Parameters
Returns
resolves to the id of the resource
Return Type
Deferred<string>
class ReloadOptions()
attribute keepChanges boolean
if true, doesn’t discard the
changes on the record before reloading it
function removeLine(elementID)

In some case, we may need to remove an element from a list, without going through the notifyChanges machinery. The motivation for this is when the user click on ‘Add a line’ in a field one2many with a required field, then clicks somewhere else. The new line need to be discarded, but we don’t want to trigger a real notifyChanges (no need for that, and also, we don’t want to rerender the UI).

Parameters
    elementID (string) – some valid element id. It is necessary that the corresponding element has a parent.
function resequence(modelName, resIDs, parentID[, options]) → Deferred<string>

Resequences records.

Parameters

    modelName (string) – the resIDs model

    resIDs (Array<integer>) – the new sequence of ids

    parentID (string) – the localID of the parent

    options (ResequenceOptions)

Returns
resolves to the local id of the parent
Return Type
Deferred<string>
class ResequenceOptions()
attribute offset integer
attribute field string

the field name used as sequence

function save(recordID[, options]) → Deferred

Save a local resource, if needed. This is a complicated operation, - it needs to check all changes, - generate commands for x2many fields, - call the /create or /write method according to the record status - After that, it has to reload all data, in case something changed, server side.

Parameters

    recordID (string) – local resource

    options (SaveOptions)

Returns
Resolved with the list of field names (whose value has been modified)
Return Type
class SaveOptions()
attribute reload boolean

if true, data will be reloaded

attribute savePoint boolean
if true, the record will only
be ‘locally’ saved: its changes written in a _savePoint key that can be restored later by call discardChanges with option rollback to true
attribute viewType string
current viewType. If not set, we will
assume main viewType from the record
function addFieldsInfo(recordID, viewInfo)

Completes the fields and fieldsInfo of a dataPoint with the given ones. It is useful for the cases where a record element is shared between various views, such as a one2many with a tree and a form view.

Parameters
class AddFieldsInfoViewInfo()
attribute fields Object
attribute fieldsInfo Object
function freezeOrder(listID)

For list resources, this freezes the current records order.

Parameters
    listID (string) – a valid element ID of type list
function setDirty(id)

Manually sets a resource as dirty. This is used to notify that a field has been modified, but with an invalid value. In that case, the value is not sent to the basic model, but the record should still be flagged as dirty so that it isn’t discarded without any warning.

Parameters
    id (string) – a resource id
function setSort(list_id, fieldName) → Deferred

For list resources, this changes the orderedBy key.

Parameters

    list_id (string) – id for the list resource

    fieldName (string) – valid field name

Return Type
function toggleActive(recordIDs, value, parentID) → Deferred<string>

Toggle the active value of given records (to archive/unarchive them)

Parameters

    recordIDs (Array) – local ids of the records to (un)archive

    value (boolean) – false to archive, true to unarchive (value of the active field)

    parentID (string) – id of the parent resource to reload

Returns
resolves to the parent id
Return Type
Deferred<string>
function toggleGroup(groupId) → Deferred<string>

Toggle (open/close) a group in a grouped list, then fetches relevant data

Parameters
    groupId (string)
Returns
resolves to the group id
Return Type
Deferred<string>
function unfreezeOrder(elementID)

For a list datapoint, unfreezes the current records order and sorts it. For a record datapoint, unfreezes the x2many list datapoints.

Parameters
    elementID (string) – a valid element ID
function updateMessageIDs(id, msgIDs)

Update the message ids on a datapoint.

Note that we directly update the res_ids on the datapoint as the message has already been posted ; this change can’t be handled ‘normally’ with x2m commands because the change won’t be saved as a normal field.

Parameters

    id (string)

    msgIDs (Array<integer>)

module web.AbstractRenderer
Exports
<anonymous>
Depends On
class AbstractRenderer(parent, state, params)
Extends
Parameters
method start() → Deferred

The rendering can be asynchronous (but it is not encouraged). The start method simply makes sure that we render the view.

Return Type
method on_attach_callback()

Called each time the renderer is attached into the DOM.

method on_detach_callback()

Called each time the renderer is detached from the DOM.

method getLocalState() → any

Returns any relevant state that the renderer might want to keep.

The idea is that a renderer can be destroyed, then be replaced by another one instantiated with the state from the model and the localState from the renderer, and the end result should be the same.

The kind of state that we expect the renderer to have is mostly DOM state such as the scroll position, the currently active tab page, …

This method is called before each updateState, by the controller.

Return Type
any
method giveFocus()

Order to focus to be given to the content of the current view

method setLocalState(localState)

This is the reverse operation from getLocalState. With this method, we expect the renderer to restore all DOM state, if it is relevant.

This method is called after each updateState, by the controller.

Parameters
    localState (any) – the result of a call to getLocalState
method updateState(state, params) → Deferred

Updates the state of the view. It retriggers a full rerender, unless told otherwise (for optimization for example).

Parameters
Return Type
class UpdateStateParams()
attribute noRender boolean

if true, the method only updates the state without rerendering

class AbstractRendererParams()
attribute noContentHelp string
module sale.SalePortalSidebar
class SalePortalSidebar($watched_selector)
Parameters
    $watched_selector (Object)
module web.data_manager
object data_manager instance of
module web.KeyboardNavigationMixin
unknown ArrayExpression
namespace KeyboardNavigationMixin
module web.KanbanController
class KanbanController()
Mixes
  • includeDict
method renderButtons()

Extends the renderButtons function of ListView by adding an event listener on the import button.

module payment_stripe.stripe
namespace
module point_of_sale.BaseWidget
class PosBaseWidget(parent, options)
Extends
Parameters

    parent

    options

module web.SessionStorageService
class SessionStorageService(parent)
Parameters
    parent
module web.ControlPanel
class ControlPanel(parent[, template])
Extends
Parameters

    parent

    template (String) – the QWeb template to render the ControlPanel. By default, the template ‘ControlPanel’ will be used

method start() → jQuery.Deferred

Renders the control panel and creates a dictionnary of its exposed elements

Return Type
jQuery.Deferred
method update(status, options)

Updates the content and displays the ControlPanel

Parameters
class UpdateOptions()
attribute clear Boolean

set to true to clear from control panel elements that are not in status.cp_content

class UpdateStatus()
attribute active_view Object

the current active view

the breadcrumbs to display (see _render_breadcrumbs() for precise description)

attribute cp_content Object

dictionnary containing the new ControlPanel jQuery elements

attribute hidden Boolean

true if the ControlPanel should be hidden

attribute searchview openerp.web.SearchView

the searchview widget

attribute search_view_hidden Boolean

true if the searchview is hidden, false otherwise

module mail.ActivityController
class ActivityController(parent, model, renderer, params)
Parameters
class ActivityControllerParams()
attribute modelName string
attribute controllerID string
an id to ease the communication
with upstream components
attribute handle any

a handle that will be given to the model (some id)

attribute initialState any

the initialState

attribute isMultiRecord boolean
attribute actionViews Object[]
attribute viewType string
attribute withControlPanel boolean
set to false to hide the
ControlPanel
module mail.ActivityRenderer
class ActivityRenderer(parent, state, params)
Parameters
class ActivityRendererParams()
attribute noContentHelp string
module pos_restaurant.floors
namespace
module web_diagram.DiagramModel
class DiagramModel(parent)
Parameters

DiagramModel

class DiagramModel(parent)
Parameters

DiagramModel

module web_editor.rte.summernote
class SummernoteManager(parent)
Extends
Parameters
    parent
module mail.ThreadWindow
class ThreadWindow()

This is the main widget for rendering small windows for mail.model.Thread. Almost all instances of this class are linked to a thread. The sole exception is the “blank” thread window. This window let us open another thread window, using this “blank” thread window.

method start()

Overrides to remove the attachment button in the Support channel as this feature does not work in that channel.

method focusInput()

Set the focus on the input of this thread window

method getTitle() → string

Overrides so that if this thread window is not linked to any thread (= “blank” thread window), displays “New message” as its title.

Return Type
string
method isPassive() → boolean

Tell whether the thread window is passive or not. A passive thread window does not auto-mark the thread as read when scrolling at the bottom.

Return Type
boolean
method needsComposer() → boolean

States whether the input of the thread window should be displayed or not. This is based on the type of the thread:

Do not display the input in the following cases:

  • no thread related to this window
  • window of a mailbox (temp: let us have mailboxes in window mode)
  • window of a thread with mass mailing

Any other threads show the input in the window.

Return Type
boolean
method removePassive()

Turn the thread window in active mode, so that when the bottom of the thread is visible, it is automatically marked as read.

method update(options)

Update this thread window

Parameters
class UpdateOptions()
attribute keepBottom boolean
if set, this thread window
should scroll to the bottom if it was at the bottom before update
attribute passively boolean
if set, this thread window
becomes passive, so that it is marked as read only when the focus is on it. Ignore this option if the focus is already on the thread window.
class ThreadWindow()

This is the main widget for rendering small windows for mail.model.Thread. Almost all instances of this class are linked to a thread. The sole exception is the “blank” thread window. This window let us open another thread window, using this “blank” thread window.

method start()

Overrides to remove the attachment button in the Support channel as this feature does not work in that channel.

method focusInput()

Set the focus on the input of this thread window

method getTitle() → string

Overrides so that if this thread window is not linked to any thread (= “blank” thread window), displays “New message” as its title.

Return Type
string
method isPassive() → boolean

Tell whether the thread window is passive or not. A passive thread window does not auto-mark the thread as read when scrolling at the bottom.

Return Type
boolean
method needsComposer() → boolean

States whether the input of the thread window should be displayed or not. This is based on the type of the thread:

Do not display the input in the following cases:

  • no thread related to this window
  • window of a mailbox (temp: let us have mailboxes in window mode)
  • window of a thread with mass mailing

Any other threads show the input in the window.

Return Type
boolean
method removePassive()

Turn the thread window in active mode, so that when the bottom of the thread is visible, it is automatically marked as read.

method update(options)

Update this thread window

Parameters
class UpdateOptions()
attribute keepBottom boolean
if set, this thread window
should scroll to the bottom if it was at the bottom before update
attribute passively boolean
if set, this thread window
becomes passive, so that it is marked as read only when the focus is on it. Ignore this option if the focus is already on the thread window.
module mail.composer.Basic
class BasicComposer(parent, options)
Extends
Parameters

    parent

    options

method clearComposer()

Empty input, selected partners and attachments

method focus()

Set the focus on the input

method getState() → Object

Get the state of the composer.

This is useful in order to (re)store its state when switchng to another thread with a composer, and coming back to the thread with this composer.

Return Type
Object
method setState(state)

Set the state of the composer.

This is useful in order to (re)store its state when switching to another thread with a composer, and coming back to the thread with this composer.

Parameters
class SetStateState()
attribute attachments Array
attribute text string
function setThread(thread)

Set the thread that this composer refers to.

Parameters
function mentionSetCommands(commands)

Set the list of command suggestions on the thread.

When the user partially types a command, matching commands are displayed to the user (@see _mentionGetCommands).

Parameters
    commands (Array<Object>)
function mentionSetPrefetchedPartners(prefetchedPartners)

Set the list of partner mentions suggestions that has been prefetched.

When the user partially types a mention, matching prefetched partners are displayed to the user. If none of them match, then it will fetch for more partner suggestions (@see _mentionFetchPartners).

Parameters
    prefetchedPartners (jQuery.Deferred<Array<Object>>)
module partner.autocomplete.many2one
class PartnerField()
Extends
FieldMany2One
module web.ChangePassword
class ChangePassword(parent)
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.
module im_support.SupportMessage
class SupportMessage()
Extends

This is a model for messages that are in the the support channel

method shouldRedirectToAuthor() → boolean

Overrides to prevent clicks on the Support operator from redirecting.

Return Type
boolean
method toggleStarStatus() → $.Promise

Overrides to prevent from calling the server for messages of the Support channel (which are records on the Support database).

Return Type
jQuery.Promise
class SupportMessage()
Extends

This is a model for messages that are in the the support channel

method shouldRedirectToAuthor() → boolean

Overrides to prevent clicks on the Support operator from redirecting.

Return Type
boolean
method toggleStarStatus() → $.Promise

Overrides to prevent from calling the server for messages of the Support channel (which are records on the Support database).

Return Type
jQuery.Promise
module web.StandaloneFieldManagerMixin
mixin StandaloneFieldManagerMixin

The StandaloneFieldManagerMixin is a mixin, designed to be used by a widget that instanciates its own field widgets.

mixin StandaloneFieldManagerMixin

The StandaloneFieldManagerMixin is a mixin, designed to be used by a widget that instanciates its own field widgets.

module mail.Followers
class Followers(parent, name, record, options)
Parameters

    parent

    name

    record

    options

module website_forum.website_forum
namespace
module hr_timesheet.timesheet_uom
class FieldTimesheetToggle(parent, name, record, options)
Parameters

    parent

    name

    record

    options

Extend the float toggle widget to set default value for timesheet use case. The ‘range’ is different from the default one of the native widget, and the ‘factor’ is forced to be the UoM timesheet conversion.

unknown ConditionalExpression
class FieldTimesheetFactor(parent, name, record, options)
Extends
FieldFloatFactor
Parameters

    parent

    name

    record

    options

Extend the float factor widget to set default value for timesheet use case. The ‘factor’ is forced to be the UoM timesheet conversion from the session info.

module web_editor.translate
namespace
module website.navbar
namespace
module web.KanbanView
class KanbanView()
Extends
module mail.model.AbstractMessage
class AbstractMessage(parent, data)
Extends
Parameters

This is an abstract class for modeling messages in JS. The purpose of this interface is to make im_livechat compatible with mail.widget.Thread, as this widget was designed to work with messages that are instances of mail.model.Messages.

Ideally, im_livechat should also handle mail.model.Message, but this is not feasible for the moment, as mail.model.Message requires mail.Manager to work, and this module should not leak outside of the backend, hence the use of mail.model.AbstractMessage as a work-around.

method getAttachments() → Object[]

Get the list of files attached to this message. Note that attachments are stored with server-format

Return Type
Array<Object>
method getAuthorID() → integer

Get the server ID (number) of the author of this message If there are no author, return -1;

Return Type
integer
method getAvatarSource() → string

Get the relative url of the avatar to display next to the message

Return Type
string
method getBody() → string

Get the body content of this message

Return Type
string
method getDateDay() → string

Get the date day of this message

Return Type
string
method getDisplayedAuthor() → string

Get the name of the author, if there is an author of this message If there are no author of this message, returns ‘null’

Return Type
string
method getID() → integer

Get the server ID (number) of this message

Return Type
integer
method getImageAttachments() → Object[]

Get the list of images attached to this message. Note that attachments are stored with server-format

Return Type
Array<Object>
method getNonImageAttachments() → Object[]

Get the list of non-images attached to this message. Note that attachments are stored with server-format

Return Type
Array<Object>
method getTimeElapsed() → string

Get the time elapsed between sent message and now

Return Type
string
method getType() → string|undefined

Get the type of message (e.g. ‘comment’, ‘email’, ‘notification’, …) By default, messages are of type ‘undefined’

Return Type
string or undefined
method hasAttachments() → boolean

State whether this message contains some attachments.

Return Type
boolean
method hasAuthor() → boolean

State whether this message has an author

Return Type
boolean
method hasCustomerEmailData() → boolean

State whether this message contains some customer email data By default, messages do not have any customer email data

Return Type
boolean
method hasEmailFrom() → string

State whether this message has an email of its sender. By default, messages do not have any email of its sender.

Return Type
string
method hasImageAttachments() → boolean

State whether this image contains images attachments

Return Type
boolean
method hasNonImageAttachments() → boolean

State whether this image contains non-images attachments

Return Type
boolean
method originatesFromChannel() → boolean

State whether this message originates from a channel. By default, messages do not originate from a channel.

Return Type
boolean
method hasSubject() → boolean

State whether this message has a subject By default, messages do not have any subject.

Return Type
boolean
method hasSubtypeDescription() → boolean

By default, messages do not have any subtype description

Return Type
boolean
method hasTrackingValues() → boolean

State whether this message contains some tracking values By default, messages do not have any tracking values.

Return Type
boolean
method isDiscussion() → boolean

State whether this message is a discussion

Return Type
boolean
method isLinkedToDocumentThread() → boolean

State whether this message is linked to a document thread By default, messages are not linked to a document thread.

Return Type
boolean
method isNeedaction() → boolean

State whether this message is needaction By default, messages are not needaction.

Return Type
boolean
method isNote() → boolean

State whether this message is a note (i.e. a message from “Log note”)

Return Type
boolean
method isNotification() → boolean

State whether this message is a notification

User notifications are defined as either
  • notes
  • pushed to user Inbox or email through classic notification process
  • not linked to any document, meaning model and res_id are void

This is useful in order to display white background for user notifications in chatter

Return Type
boolean
method isStarred() → boolean

State whether this message is starred By default, messages are not starred.

Return Type
boolean
method isSystemNotification() → boolean

State whether this message is a system notification By default, messages are not system notifications

Return Type
boolean
method needsModeration() → boolean

States whether the current message needs moderation in general. By default, messages do not require any moderation.

Return Type
boolean
method shouldRedirectToAuthor() → boolean

State whether this message should redirect to the author when clicking on the author of this message.

Do not redirect on author clicked of self-posted messages.

Return Type
boolean
class AbstractMessageData()
attribute attachment_ids Array
attribute author_id Array
attribute body string

= “”]

attribute date string
the server-format date time of the message.
If not provided, use current date time for this message.
attribute id integer
attribute is_discussion boolean

= false]

attribute is_notification boolean

= false]

attribute message_type string

= undefined]

class AbstractMessage(parent, data)
Extends
Parameters

This is an abstract class for modeling messages in JS. The purpose of this interface is to make im_livechat compatible with mail.widget.Thread, as this widget was designed to work with messages that are instances of mail.model.Messages.

Ideally, im_livechat should also handle mail.model.Message, but this is not feasible for the moment, as mail.model.Message requires mail.Manager to work, and this module should not leak outside of the backend, hence the use of mail.model.AbstractMessage as a work-around.

method getAttachments() → Object[]

Get the list of files attached to this message. Note that attachments are stored with server-format

Return Type
Array<Object>
method getAuthorID() → integer

Get the server ID (number) of the author of this message If there are no author, return -1;

Return Type
integer
method getAvatarSource() → string

Get the relative url of the avatar to display next to the message

Return Type
string
method getBody() → string

Get the body content of this message

Return Type
string
method getDateDay() → string

Get the date day of this message

Return Type
string
method getDisplayedAuthor() → string

Get the name of the author, if there is an author of this message If there are no author of this message, returns ‘null’

Return Type
string
method getID() → integer

Get the server ID (number) of this message

Return Type
integer
method getImageAttachments() → Object[]

Get the list of images attached to this message. Note that attachments are stored with server-format

Return Type
Array<Object>
method getNonImageAttachments() → Object[]

Get the list of non-images attached to this message. Note that attachments are stored with server-format

Return Type
Array<Object>
method getTimeElapsed() → string

Get the time elapsed between sent message and now

Return Type
string
method getType() → string|undefined

Get the type of message (e.g. ‘comment’, ‘email’, ‘notification’, …) By default, messages are of type ‘undefined’

Return Type
string or undefined
method hasAttachments() → boolean

State whether this message contains some attachments.

Return Type
boolean
method hasAuthor() → boolean

State whether this message has an author

Return Type
boolean
method hasCustomerEmailData() → boolean

State whether this message contains some customer email data By default, messages do not have any customer email data

Return Type
boolean
method hasEmailFrom() → string

State whether this message has an email of its sender. By default, messages do not have any email of its sender.

Return Type
string
method hasImageAttachments() → boolean

State whether this image contains images attachments

Return Type
boolean
method hasNonImageAttachments() → boolean

State whether this image contains non-images attachments

Return Type
boolean
method originatesFromChannel() → boolean

State whether this message originates from a channel. By default, messages do not originate from a channel.

Return Type
boolean
method hasSubject() → boolean

State whether this message has a subject By default, messages do not have any subject.

Return Type
boolean
method hasSubtypeDescription() → boolean

By default, messages do not have any subtype description

Return Type
boolean
method hasTrackingValues() → boolean

State whether this message contains some tracking values By default, messages do not have any tracking values.

Return Type
boolean
method isDiscussion() → boolean

State whether this message is a discussion

Return Type
boolean
method isLinkedToDocumentThread() → boolean

State whether this message is linked to a document thread By default, messages are not linked to a document thread.

Return Type
boolean
method isNeedaction() → boolean

State whether this message is needaction By default, messages are not needaction.

Return Type
boolean
method isNote() → boolean

State whether this message is a note (i.e. a message from “Log note”)

Return Type
boolean
method isNotification() → boolean

State whether this message is a notification

User notifications are defined as either
  • notes
  • pushed to user Inbox or email through classic notification process
  • not linked to any document, meaning model and res_id are void

This is useful in order to display white background for user notifications in chatter

Return Type
boolean
method isStarred() → boolean

State whether this message is starred By default, messages are not starred.

Return Type
boolean
method isSystemNotification() → boolean

State whether this message is a system notification By default, messages are not system notifications

Return Type
boolean
method needsModeration() → boolean

States whether the current message needs moderation in general. By default, messages do not require any moderation.

Return Type
boolean
method shouldRedirectToAuthor() → boolean

State whether this message should redirect to the author when clicking on the author of this message.

Do not redirect on author clicked of self-posted messages.

Return Type
boolean
class AbstractMessageData()
attribute attachment_ids Array
attribute author_id Array
attribute body string

= “”]

attribute date string
the server-format date time of the message.
If not provided, use current date time for this message.
attribute id integer
attribute is_discussion boolean

= false]

attribute is_notification boolean

= false]

attribute message_type string

= undefined]

module stock.stock_report_generic
class stock_report_generic(parent, action)
Parameters

    parent

    action

module web.FormController
class FormController()
method autofocus()

Calls autofocus on the renderer

method createRecord([parentID]) → Deferred

This method switches the form view in edit mode, with a new record.

Parameters
    parentID (string) – if given, the parentID will be used as parent for the new record.
Return Type
method getSelectedIds() → number[]

Returns the current res_id, wrapped in a list. This is only used by the sidebar (and the debugmanager)

Returns
either [current res_id] or []
Return Type
Array<number>
method on_attach_callback()

Called each time the form view is attached into the DOM

method renderButtons($node)

Render buttons for the control panel. The form view can be rendered in a dialog, and in that case, if we have buttons defined in the footer, we have to use them instead of the standard buttons.

Parameters
    $node (jQueryElement)
method renderPager($node, options)

The form view has to prevent a click on the pager if the form is dirty

Parameters

    $node (jQueryElement)

    options (Object)

method renderSidebar([$node])

Instantiate and render the sidebar if a sidebar is requested Sets this.sidebar

Parameters
    $node (jQuery) – a jQuery node where the sidebar should be inserted
method saveRecord()

Show a warning message if the user modified a translated field. For each field, the notification provides a link to edit the field’s translations.

method update(params, options)

Overrides to force the viewType to ‘form’, so that we ensure that the correct fields are reloaded (this is only useful for one2many form views).

Parameters

    params

    options

module web.NotificationService
class NotificationService(parent)
Parameters
    parent

Notification Service

The Notification Service is simply a service used to display notifications in the top/right part of the screen.

If you want to display such a notification, you probably do not want to do it by using this file. The proper way is to use the do_warn or do_notify methods on the Widget class.

method close(notificationId[, silent])

It may sometimes be useful to close programmatically a notification. For example, when there is a sticky notification that warns the user about some condition (connection lost), but the condition do not apply anymore.

Parameters

    notificationId (number)

    silent=false (boolean) – if true, the notification does not call onClose callback

method notify(params) → Number

Display a notification at the appropriate location, and returns the reference id to the same widget.

Note that this method does not wait for the appendTo method to complete.

Parameters
Returns
notification id
Return Type
Number
class NotifyParams()
attribute Notification function
javascript class of a notification
to instantiate by default use ‘web.Notification’
attribute title string

notification title

attribute message string

notification main message

attribute type string

‘notification’ or ‘warning’

attribute sticky boolean
if true, the notification will stay
visible until the user clicks on it.
attribute className string

className to add on the dom

attribute onClose function
callback when the user click on the x
or when the notification is auto close (no sticky)
attribute buttons Object[]
attribute buttons[0].click function

callback on click

attribute buttons[0].primary Boolean

display the button as primary

attribute buttons[0].text string

button label

attribute buttons[0].icon string

font-awsome className or image src

class NotificationService(parent)
Parameters
    parent

Notification Service

The Notification Service is simply a service used to display notifications in the top/right part of the screen.

If you want to display such a notification, you probably do not want to do it by using this file. The proper way is to use the do_warn or do_notify methods on the Widget class.

method close(notificationId[, silent])

It may sometimes be useful to close programmatically a notification. For example, when there is a sticky notification that warns the user about some condition (connection lost), but the condition do not apply anymore.

Parameters

    notificationId (number)

    silent=false (boolean) – if true, the notification does not call onClose callback

method notify(params) → Number

Display a notification at the appropriate location, and returns the reference id to the same widget.

Note that this method does not wait for the appendTo method to complete.

Parameters
Returns
notification id
Return Type
Number
class NotifyParams()
attribute Notification function
javascript class of a notification
to instantiate by default use ‘web.Notification’
attribute title string

notification title

attribute message string

notification main message

attribute type string

‘notification’ or ‘warning’

attribute sticky boolean
if true, the notification will stay
visible until the user clicks on it.
attribute className string

className to add on the dom

attribute onClose function
callback when the user click on the x
or when the notification is auto close (no sticky)
attribute buttons Object[]
attribute buttons[0].click function

callback on click

attribute buttons[0].primary Boolean

display the button as primary

attribute buttons[0].text string

button label

attribute buttons[0].icon string

font-awsome className or image src

module mail.ActivityModel
class ActivityModel(parent)
Parameters
module web.Notification
Depends On
class Notification(parent, params)
Extends
Parameters
class NotificationParams()
attribute title string

notification title

attribute message string

notification main message

attribute type string

‘notification’ or ‘warning’

attribute sticky boolean
if true, the notification will stay
visible until the user clicks on it.
attribute className string

className to add on the dom

attribute onClose function
callback when the user click on the x
or when the notification is auto close (no sticky)
attribute buttons Object[]
attribute buttons[0].click function

callback on click

attribute buttons[0].primary boolean

display the button as primary

attribute buttons[0].text string

button label

attribute buttons[0].icon string

font-awsome className or image src

module web.FavoriteMenu
class (parent, query, target_model, action, filters)
Extends
Parameters

    parent

    query

    target_model

    action

    filters

function start()

We manually add the ‘add to dashboard’ feature in the searchview.

function key_for(filter) → String

Generates a mapping key (in the filters and $filter mappings) for the filter descriptor object provided (as returned by get_filters).

The mapping key is guaranteed to be unique for a given (user_id, name) pair.

Parameters
Returns
mapping key corresponding to the filter
Return Type
String
class KeyForFilter()
attribute name String
attribute user_id Number|Pair<Number, String>
function facet_for(filter) → Object

Generates a Facet() descriptor from a filter descriptor

Parameters
Return Type
Object
class FacetForFilter()
attribute name String
attribute context Object
attribute domain Array
function add_filter([filter])

Adds a filter description to the filters dict

Parameters
    filter (Object) – the filter description
function append_filter([filter])

Creates a $filter JQuery node, adds it to the $filters dict and appends it to the filter menu

Parameters
    filter (Object) – the filter description
module pos_reprint.pos_reprint
namespace
module web.search_inputs
class DateTimeField(view_section, field, parent)
Extends
DateField
Parameters

    view_section

    field

    parent

Implementation of the datetime openerp field type:

  • Uses the same widget as the date field type (a simple date)
  • Builds a slighly more complex, it’s a datetime range (includes time) spanning the whole day selected by the date widget
namespace
function facet_from(field, pair)

Utility function for m2o & selection fields taking a selection/name_get pair (value, name) and converting it to a Facet descriptor

Parameters

    field (instance.web.search.Field) – holder field

    pair (Array) – pair value to convert

class CharField(view_section, field, parent)
Extends
Field
Parameters

    view_section

    field

    parent

Implementation of the char OpenERP field type:

  • Default operator is ilike rather than =
  • The Javascript and the HTML values are identical (strings)
module web.Context
class Context()
Extends
method set_eval_context(evalContext) → Context

Set the evaluation context to be used when we actually eval.

Parameters
    evalContext (Object)
Return Type
module web.Session
class Session(parent, origin, options)
Extends
Parameters

    parentThe parent of the newly created object. or `null` if the server to contact is the origin server.

    origin

    options (Dict) – A dictionary that can contain the following options: “override_session”: Default to false. If true, the current session object will not try to re-use a previously created session id stored in a cookie. “session_id”: Default to null. If specified, the specified session_id will be used by this session object. Specifying this option automatically implies that the option “override_session” is set to true.

method session_bind(origin)

Setup a session

Parameters
    origin
method session_init()

Init a session, reloads from cookie, if it exists

method session_authenticate()

The session is validated by restoration of a previous session

method load_modules()

Load additional web addons of that instance and init them

method session_reload() → $.Deferred

(re)loads the content of a session: db name, username, user id, session context and status of the support contract

Returns
deferred indicating the session is done reloading
Return Type
jQuery.Deferred
method rpc(url, params, options) → jQuery.Deferred

Executes an RPC call, registering the provided callbacks.

Registers a default error callback if none is provided, and handles setting the correct session id and session context in the parameter objects

Parameters

    url (String) – RPC endpoint

    params (Object) – call parameters

    options (Object) – additional options for rpc call

Returns
jquery-provided ajax deferred
Return Type
jQuery.Deferred
method getTZOffset(date) → integer

Returns the time zone difference (in minutes) from the current locale (host system settings) to UTC, for a given date. The offset is positive if the local timezone is behind UTC, and negative if it is ahead.

Parameters
    date (string or moment) – a valid string date or moment instance
Return Type
integer
module mail.model.Thread
class Thread(params)
Parameters

This is the super class modeling threads in JS. Such threads are stored in the mail manager, and any piece of JS code whose logic relies on threads must ideally interact with such objects.

In particular, channels and mailboxes are two different kinds of threads.

method close()

Updates the _detached state of the thread. Must be overriden to reflect the new state in the interface.

method detach([options])

Updates the _detached state of the thread. Must be overriden to reflect the new state in the interface.

Parameters
class DetachOptions()
attribute keepFoldState boolean
if set, keep the fold state
of this thread. Otherwise unfold it while detaching it.
attribute passively boolean
if set, if the thread window
will be created passively.
function fetchMessages() → $.Promise<mail.model.Message[]>

Fetch the list of messages in this thread. By default, a thread has no messages.

Note that this method only returns some messages, as we do not want to fetch all messages of a thread at once, just to read the last message.

As a result, this method fetches only some messages of the thread, starting from the last message in the thread. At most, it fetches this.LIMIT number of messages at a time.

Return Type
jQuery.Promise<Array<mail.model.Message>>
function fold(folded)

Updates the folded state of the thread. Must be overriden to reflect the new state in the interface.

Parameters
    folded (boolean)
function getCommands() → Array

Get the list of available commands for the thread. By default, threads do not have any available command.

Return Type
Array
function getMentionPartnerSuggestions() → $.Promise<Object[]>

Get the listeners of the thread. By default, a thread has not listener.

Return Type
jQuery.Promise<Array<Object>>
function getPreview() → Object

Returns the information required to render the preview of this channel.

Returns
a valid object for the rendering of previews (@see mail.Preview template)
Return Type
Object
function hasBeenPreviewed() → boolean

State whether this channel has been previewed

A channel that has been previewed means that it had the necessary data to display its preview format. A channel needs its meta data and the last message in order to build its preview format.

This is useful in order to not fetch preview info on this channel more than once on channels that have no message at all.

Any received message updates the last_message, so a channel should always have all the necessary information to display its preview after the 1st time.

Return Type
boolean
function hasUnreadMessages() → boolean

State whether there are unread messages in this thread

Return Type
boolean
function incrementNeedactionCounter()

Increments the needaction counter of this thread FIXME: this method makes only sense for channels. Not sure, but I think this method is necessary at this level because of the model im_support.SupportChannel

function isAutoswitch() → boolean

States whether the thread should be auto-selected on creation

Note that this is not of the responsibility of the thread: it only provides guidance for the object that uses threads (e.g. mail.Discuss must listen on threads and auto-select the thread if autoswitch is set).

By default, threads are not in autoswitch mode.

Return Type
boolean
function isChannel() → boolean

States whether this thread is a channel or not. A thread is a channel if it is an instance of mail.model.Channel (direct or indirect). By default, any thread is not a channel

Return Type
boolean
function isDetached() → boolean

States whether this thread is detached or not. A thread that is detached must have a thread window linked to itself.

Return Type
boolean
function isLinkedToDocument() → boolean

States whether the thread is linked to a document By default, threads are not linked to a document.

Return Type
boolean
function isMassMailing() → boolean

States whether this thread has the mass mailing setting active or not. This is a server-side setting, that determine the type of composer that is used (basic or extended composer).

By default, thread have not mass-mailings feature set.

Return Type
boolean
function isModerated() → boolean

States whether the thread is moderated or not. By default, threads are not moderated.

Return Type
boolean
function isMyselfModerator() → boolean

States whether the current user is moderator of this thread. By default, the current user is not moderator of this thread.

Return Type
boolean
function isTwoUserThread() → boolean

States whether this is a two-user thread or not. In particular, public and private channels are not two-user threads, but DMs and Livechats are two-user threads. Two-user threads are used for communication between two users. By default, any thread is not two-user thread.

Return Type
boolean
function markAsPreviewed()

Mark this channel as previewed

This is useful in order to not fetch preview info on this channel is the server has no preview in the first place.

Note: preview fetch is useful only when the channel contains messages that have not been fetched at all. After that, this channel instance is updated regularly so that the most up-to-date info are available to make the preview of this channel.

class ThreadParams()
attribute parent mail.Manager
attribute data Object
attribute data.channel_type string
attribute data.name string
attribute data.type string
class Thread(params)
Parameters

This is the super class modeling threads in JS. Such threads are stored in the mail manager, and any piece of JS code whose logic relies on threads must ideally interact with such objects.

In particular, channels and mailboxes are two different kinds of threads.

method close()

Updates the _detached state of the thread. Must be overriden to reflect the new state in the interface.

method detach([options])

Updates the _detached state of the thread. Must be overriden to reflect the new state in the interface.

Parameters
class DetachOptions()
attribute keepFoldState boolean
if set, keep the fold state
of this thread. Otherwise unfold it while detaching it.
attribute passively boolean
if set, if the thread window
will be created passively.
function fetchMessages() → $.Promise<mail.model.Message[]>

Fetch the list of messages in this thread. By default, a thread has no messages.

Note that this method only returns some messages, as we do not want to fetch all messages of a thread at once, just to read the last message.

As a result, this method fetches only some messages of the thread, starting from the last message in the thread. At most, it fetches this.LIMIT number of messages at a time.

Return Type
jQuery.Promise<Array<mail.model.Message>>
function fold(folded)

Updates the folded state of the thread. Must be overriden to reflect the new state in the interface.

Parameters
    folded (boolean)
function getCommands() → Array

Get the list of available commands for the thread. By default, threads do not have any available command.

Return Type
Array
function getMentionPartnerSuggestions() → $.Promise<Object[]>

Get the listeners of the thread. By default, a thread has not listener.

Return Type
jQuery.Promise<Array<Object>>
function getPreview() → Object

Returns the information required to render the preview of this channel.

Returns
a valid object for the rendering of previews (@see mail.Preview template)
Return Type
Object
function hasBeenPreviewed() → boolean

State whether this channel has been previewed

A channel that has been previewed means that it had the necessary data to display its preview format. A channel needs its meta data and the last message in order to build its preview format.

This is useful in order to not fetch preview info on this channel more than once on channels that have no message at all.

Any received message updates the last_message, so a channel should always have all the necessary information to display its preview after the 1st time.

Return Type
boolean
function hasUnreadMessages() → boolean

State whether there are unread messages in this thread

Return Type
boolean
function incrementNeedactionCounter()

Increments the needaction counter of this thread FIXME: this method makes only sense for channels. Not sure, but I think this method is necessary at this level because of the model im_support.SupportChannel

function isAutoswitch() → boolean

States whether the thread should be auto-selected on creation

Note that this is not of the responsibility of the thread: it only provides guidance for the object that uses threads (e.g. mail.Discuss must listen on threads and auto-select the thread if autoswitch is set).

By default, threads are not in autoswitch mode.

Return Type
boolean
function isChannel() → boolean

States whether this thread is a channel or not. A thread is a channel if it is an instance of mail.model.Channel (direct or indirect). By default, any thread is not a channel

Return Type
boolean
function isDetached() → boolean

States whether this thread is detached or not. A thread that is detached must have a thread window linked to itself.

Return Type
boolean
function isLinkedToDocument() → boolean

States whether the thread is linked to a document By default, threads are not linked to a document.

Return Type
boolean
function isMassMailing() → boolean

States whether this thread has the mass mailing setting active or not. This is a server-side setting, that determine the type of composer that is used (basic or extended composer).

By default, thread have not mass-mailings feature set.

Return Type
boolean
function isModerated() → boolean

States whether the thread is moderated or not. By default, threads are not moderated.

Return Type
boolean
function isMyselfModerator() → boolean

States whether the current user is moderator of this thread. By default, the current user is not moderator of this thread.

Return Type
boolean
function isTwoUserThread() → boolean

States whether this is a two-user thread or not. In particular, public and private channels are not two-user threads, but DMs and Livechats are two-user threads. Two-user threads are used for communication between two users. By default, any thread is not two-user thread.

Return Type
boolean
function markAsPreviewed()

Mark this channel as previewed

This is useful in order to not fetch preview info on this channel is the server has no preview in the first place.

Note: preview fetch is useful only when the channel contains messages that have not been fetched at all. After that, this channel instance is updated regularly so that the most up-to-date info are available to make the preview of this channel.

class ThreadParams()
attribute parent mail.Manager
attribute data Object
attribute data.channel_type string
attribute data.name string
attribute data.type string
module hr_attendance.greeting_message
class GreetingMessage(parent, action)
Parameters

    parent

    action

module web_tour.utils
namespace
module web.Bus
Exports
<anonymous>
class Bus(parent)
Extends
Parameters
    parent

Event Bus used to bind events scoped in the current instance

module crm.partner_assign
namespace
module mail.model.CCThrottleFunctionObject
class CCThrottleFunctionObject(params)
Extends

This object models the behaviour of the clearable and cancellable (CC) throttle version of a provided function.

method cancel()

Cancel any buffered function call, but keep the cooldown phase running.

method clear()

Clear the internal throttle timer, so that the following function call is immediate. For instance, if there is a cooldown stage, it is aborted.

method do()

Called when there is a call to the function. This function is throttled, so the time it is called depends on whether the “cooldown stage” occurs or not:

  • no cooldown stage: function is called immediately, and it starts
    the cooldown stage when successful.
  • in cooldown stage: function is called when the cooldown stage has
    ended from timeout.

Note that after the cooldown stage, only the last attempted function call will be considered.

class CCThrottleFunctionObjectParams()
attribute duration integer
duration of the ‘cooldown’ phase, i.e.
the minimum duration between the most recent function call that has been made and the following function call.
attribute func function
provided function for making the CC
throttled version.
class CCThrottleFunctionObject(params)
Extends

This object models the behaviour of the clearable and cancellable (CC) throttle version of a provided function.

method cancel()

Cancel any buffered function call, but keep the cooldown phase running.

method clear()

Clear the internal throttle timer, so that the following function call is immediate. For instance, if there is a cooldown stage, it is aborted.

method do()

Called when there is a call to the function. This function is throttled, so the time it is called depends on whether the “cooldown stage” occurs or not:

  • no cooldown stage: function is called immediately, and it starts
    the cooldown stage when successful.
  • in cooldown stage: function is called when the cooldown stage has
    ended from timeout.

Note that after the cooldown stage, only the last attempted function call will be considered.

class CCThrottleFunctionObjectParams()
attribute duration integer
duration of the ‘cooldown’ phase, i.e.
the minimum duration between the most recent function call that has been made and the following function call.
attribute func function
provided function for making the CC
throttled version.
module mail.AttachmentBox
class AttachmentBox(parent, record)
Extends
Parameters
class AttachmentBoxRecord()
attribute model string
attribute res_id Number
module web.BrowserDetection
Depends On
class BrowserDetection()
Extends
module im_livechat.model.WebsiteLivechat
class WebsiteLivechat(params)

Thread model that represents a livechat on the website-side. This livechat is not linked to the mail service.

method incrementUnreadCounter()

Increments the unread counter of this livechat by 1 unit.

Note: this public method makes sense because the management of messages for website livechat is external. This method should be dropped when this class handles messages by itself.

method setMessages(messages)

AKU: hack for the moment

Parameters
class WebsiteLivechatParams()
attribute data Object
attribute data.folded boolean
states whether the livechat is
folded or not. It is considered only if this is defined and it is a boolean.
attribute data.id integer

the ID of this livechat.

attribute data.message_unread_counter integer
the unread counter
of this livechat.
attribute data.operator_pid Array
attribute data.name string

the name of this livechat.

attribute data.state string
if ‘folded’, the livechat is folded.
This is ignored if folded is provided and is a boolean value.
attribute data.uuid string

the UUID of this livechat.

attribute parent im_livechat.im_livechat.LivechatButton
class WebsiteLivechat(params)

Thread model that represents a livechat on the website-side. This livechat is not linked to the mail service.

method incrementUnreadCounter()

Increments the unread counter of this livechat by 1 unit.

Note: this public method makes sense because the management of messages for website livechat is external. This method should be dropped when this class handles messages by itself.

method setMessages(messages)

AKU: hack for the moment

Parameters
class WebsiteLivechatParams()
attribute data Object
attribute data.folded boolean
states whether the livechat is
folded or not. It is considered only if this is defined and it is a boolean.
attribute data.id integer

the ID of this livechat.

attribute data.message_unread_counter integer
the unread counter
of this livechat.
attribute data.operator_pid Array
attribute data.name string

the name of this livechat.

attribute data.state string
if ‘folded’, the livechat is folded.
This is ignored if folded is provided and is a boolean value.
attribute data.uuid string

the UUID of this livechat.

attribute parent im_livechat.im_livechat.LivechatButton
module sale_management.sale_management
namespace
module portal.signature_form
namespace
module web.OrgChart
class FieldOrgChart()
module mrp.mrp_bom_report
class MrpBomReport(parent, action)
Parameters

    parent

    action

module partner.autocomplete.core
namespace
function getCreateData(company) → Deferred

Get enriched data + logo before populating partner form

Parameters
    company (Object)
Return Type
function isOnline() → boolean

Check connectivity

Return Type
boolean
module mail.model.Channel
class Channel(params)
Parameters

This class represent channels in JS. In this context, the word channel has the same meaning of channel on the server, meaning that direct messages (DM) and livechats are also channels.

Any piece of code in JS that make use of channels must ideally interact with such objects, instead of direct data from the server.

method close()

Close the channel

This operation is executed server-side and the chat window will be folded in all potential tabs from all browsers.

method decrementNeedactionCounter([num])

Decrement the needaction counter of the channel Floor value at 0.

Parameters
    num=1 (integer) – the amount to decrement at most
method detach()

Open the chat window for this channel (in all potential tabs from all browsers)

method forceFetchMembers() → $.Promise<Object[]>

Force fetch members of the channel

Returns
resolved with list of channel listeners
Return Type
jQuery.Promise<Array<Object>>
method fold(folded)

Folds/Minimize the channel (in all potential tabs from all browsers)

Parameters
    folded (boolean)
method getCommands() → Array

Show the list of available commands on this channel (e.g. ‘/help’)

Returns
list of commands
Return Type
Array
method getMentionPartnerSuggestions() → $.Promise<Object[]>

Get listeners of a channel

Returns
resolved with list of channel listeners
Return Type
jQuery.Promise<Array<Object>>
method getTitle() → string|Object

Returns the title to display in thread window’s headers. For channels, the title is prefixed with “#”.

Returns
the name of the thread by default (see getName)
Return Type
string or Object
method getUUID() → string

Get the UUID of the channel. This is a string that uniquely links this channel to a server channel.

Returns
uuid of this channel
Return Type
string
method incrementNeedactionCounter()

Increment the needaction counter of this channel by 1 unit

method isAutoswitch() → boolean

States whether the channel should be auto-selected on creation

Note that this is not of the responsibility of the channel (see mail.model.Thread for more information)

Return Type
boolean
method isChannel() → boolean

All instances of this class are chanels

Return Type
boolean
method isGroupBasedSubscription() → boolean

States whether the channel auto-subscribes some users in a group

Return Type
boolean
method isModerated() → boolean

States whether the channel is moderated or not.

Return Type
boolean
method isMyselfAdministrator() → boolean

Tells whether the current user is administrator of the channel. Note that there is no administrator for two-user channels

Return Type
boolean
method isMyselfModerator() → boolean

States whether the current user is moderator of this channel.

Return Type
boolean
method unsubscribe() → $.Promise

Unsubscribes from channel

Returns
resolve when unsubscribed
Return Type
jQuery.Promise
method updateWindowState(params)

Updates the internal state of the channel, and reflects the changes in the UI.

Called by {mail.Manager.Notification} on receiving a channel window notification. A notification is received after a client-side action that changes the state of the channel window visually, so that cross tab channels are updated similarly.

TODO: This method should be dropped if the state of windows are completely handled client-side, which should be the case in the near future.

Parameters
class UpdateWindowStateParams()
attribute detached boolean
attribute folded boolean
function resetNeedactionCounter()

Reset the needaction counter to 0.

class ChannelParams()
attribute data Object
attribute data.channel_type string
attribute data.create_uid integer
the ID of the user that has
created the channel.
attribute data.group_based_subscription boolean
attribute data.is_minimized boolean
attribute data.is_moderator boolean
whether the current user is
moderator of this channel.
attribute data.last_message_date string

date in server-format

attribute data.message_unread_counter integer
attribute data.moderation boolean
whether the channel is
moderated or not
attribute data.state string
attribute data.uuid string
attribute options Object
attribute options.autoswitch boolean
attribute commands Object[]
class Channel(params)
Parameters

This class represent channels in JS. In this context, the word channel has the same meaning of channel on the server, meaning that direct messages (DM) and livechats are also channels.

Any piece of code in JS that make use of channels must ideally interact with such objects, instead of direct data from the server.

method close()

Close the channel

This operation is executed server-side and the chat window will be folded in all potential tabs from all browsers.

method decrementNeedactionCounter([num])

Decrement the needaction counter of the channel Floor value at 0.

Parameters
    num=1 (integer) – the amount to decrement at most
method detach()

Open the chat window for this channel (in all potential tabs from all browsers)

method forceFetchMembers() → $.Promise<Object[]>

Force fetch members of the channel

Returns
resolved with list of channel listeners
Return Type
jQuery.Promise<Array<Object>>
method fold(folded)

Folds/Minimize the channel (in all potential tabs from all browsers)

Parameters
    folded (boolean)
method getCommands() → Array

Show the list of available commands on this channel (e.g. ‘/help’)

Returns
list of commands
Return Type
Array
method getMentionPartnerSuggestions() → $.Promise<Object[]>

Get listeners of a channel

Returns
resolved with list of channel listeners
Return Type
jQuery.Promise<Array<Object>>
method getTitle() → string|Object

Returns the title to display in thread window’s headers. For channels, the title is prefixed with “#”.

Returns
the name of the thread by default (see getName)
Return Type
string or Object
method getUUID() → string

Get the UUID of the channel. This is a string that uniquely links this channel to a server channel.

Returns
uuid of this channel
Return Type
string
method incrementNeedactionCounter()

Increment the needaction counter of this channel by 1 unit

method isAutoswitch() → boolean

States whether the channel should be auto-selected on creation

Note that this is not of the responsibility of the channel (see mail.model.Thread for more information)

Return Type
boolean
method isChannel() → boolean

All instances of this class are chanels

Return Type
boolean
method isGroupBasedSubscription() → boolean

States whether the channel auto-subscribes some users in a group

Return Type
boolean
method isModerated() → boolean

States whether the channel is moderated or not.

Return Type
boolean
method isMyselfAdministrator() → boolean

Tells whether the current user is administrator of the channel. Note that there is no administrator for two-user channels

Return Type
boolean
method isMyselfModerator() → boolean

States whether the current user is moderator of this channel.

Return Type
boolean
method unsubscribe() → $.Promise

Unsubscribes from channel

Returns
resolve when unsubscribed
Return Type
jQuery.Promise
method updateWindowState(params)

Updates the internal state of the channel, and reflects the changes in the UI.

Called by {mail.Manager.Notification} on receiving a channel window notification. A notification is received after a client-side action that changes the state of the channel window visually, so that cross tab channels are updated similarly.

TODO: This method should be dropped if the state of windows are completely handled client-side, which should be the case in the near future.

Parameters
class UpdateWindowStateParams()
attribute detached boolean
attribute folded boolean
function resetNeedactionCounter()

Reset the needaction counter to 0.

class ChannelParams()
attribute data Object
attribute data.channel_type string
attribute data.create_uid integer
the ID of the user that has
created the channel.
attribute data.group_based_subscription boolean
attribute data.is_minimized boolean
attribute data.is_moderator boolean
whether the current user is
moderator of this channel.
attribute data.last_message_date string

date in server-format

attribute data.message_unread_counter integer
attribute data.moderation boolean
whether the channel is
moderated or not
attribute data.state string
attribute data.uuid string
attribute options Object
attribute options.autoswitch boolean
attribute commands Object[]
module mail.Chatter
class Chatter(parent, record, mailFields, options)
Extends
Parameters
class ChatterMailFields()
attribute mail_activity string
attribute mail_followers string
attribute mail_thread string
class ChatterOptions()
attribute viewType string
current viewType in
which the chatter is instantiated
module web.AutoComplete
Depends On
class (parent, options)
Extends
Parameters

    parent

    options

module mail.model.Message
class Message(parent, data, emojis)
Parameters

    parent (web.Manager)

    data (MessageData)

    emojis (Array<Object>)

This is the main class for the modeling messages in JS. Such messages are stored in the mail manager, and any piece of JS code whose logic relies on threads must ideally interact with such objects.

method getAuthorName() → string

Get the name of the author of this message If there are no author, return “”.

Return Type
string
method getAvatarSource() → string

Get the relative url of the avatar to display next to the message

Return Type
string
method getCustomerEmailData() → Object[]|undefined

Get the customer email data of this email, if any. If this message has no such data, returns ‘undefined’

Return Type
Array<Object> or undefined
method getCustomerEmailStatus() → string|undefined

Get the customer email status of this email, if any. If this message has no such data, returns ‘undefined’

Return Type
string or undefined
method getDisplayedAuthor() → string

Get the text to display for the author of the message

Rule of precedence for the displayed author:

author name > sender email > "anonymous"
Return Type
string
method getDocumentID() → integer

Get the ID of the document that this message is linked.

Return Type
integer
method getDocumentModel() → string

Get the model of the document that this message is linked. If this message is not linked to a document, returns “”.

Return Type
string
method getDocumentName() → string

Get the name of the document that this message is linked. If this message is not linked to a document, returns “”.

It uses the name of an existing document thread, in order to have the updated document name. If there is no document thread yet, use the currently aware document name.

As a result, this method should ideally be called internally, in order to avoid having different names for messages linked to a same modified document.

Return Type
string
method getEmailFrom() → string

Get the email of the sender of this message. If this email has no sender email, returns “”.

Return Type
string
method getOriginChannelID() → integer

Get the ID of the channel that this message originates from. If this message does not originate from a channel, returns -1.

Return Type
integer
method getOriginChannelName() → string

Get the name of the channel that this message originates from. If this message does not originate from a channel, returns “”.

Return Type
string
method getPreview() → Object

Returns the information required to render the preview of this channel.

Return Type
Object
method getSubject() → string

Get the subject of this message If this message has no subject, returns “”.

Return Type
string
method getThreadIDs() → string[]|undefined

Get the list of thread IDs that this message is linked to If this message is not linked to a thread, returns ‘undefined’

Returns
list of thread IDs, if any
Return Type
Array<string> or undefined
method getTrackingValues() → Object[]|undefined

Get the tracking values of this message If this message has no tracking values, returns ‘undefined’

Return Type
Array<Object> or undefined
method hasCustomerEmailData() → boolean

State whether this message contains some customer email data

Return Type
boolean
method hasEmailFrom() → string

State whether this message has an email of its sender.

Return Type
string
method hasSubject() → boolean

State whether this message has a subject

Return Type
boolean
method hasTrackingValues() → boolean

State whether this message contains some tracking values

Return Type
boolean
method isLinkedToDocumentThread() → boolean

State whether this message is linked to a document thread (not channel)

Usually, if this is true, then this message comes from a document thread, but the document model could be a channel. In that case, the document resID tells the channel that this message originally comes from.

To detect whether the message comes from a channel, see the method ‘originatesFromChannel’.

Return Type
boolean
method isMyselfAuthor() → boolean

State whether the current user is the author of this message

Return Type
boolean
method needsModeration() → boolean

States whether the current message needs moderation in general.

Return Type
boolean
method needsModerationByUser() → boolean

States whether the current message needs moderation by the current user. Such a message should be in the moderation mailbox.

Return Type
boolean
method isNeedaction() → boolean

State whether this message is needaction

Return Type
boolean
method isStarred() → boolean

State whether this message is starred

Return Type
boolean
method isSystemNotification() → boolean

State whether this message is a system notification

Return Type
boolean
method originatesFromChannel() → boolean

States whether the message originates from a channel or not

Return Type
boolean
method removeThread(threadID)

Unregister thread with ID threadID from this message

Parameters
    threadID (string or integer) – ID of thread
method setModerationStatus(newModerationStatus[, options])

Update the moderation status of the message, so that it is now accepted or rejected. When the message is accepted, it may be linked to more threads, which is the case for relay channels on moderated channels.

Parameters
class SetModerationStatusOptions()
attribute additionalThreadIDs Object
contains additional thread
IDs to be registered on the message.
function setStarred(starred)

Set whether the message is starred or not. If it is starred, the message is moved to the “Starred” mailbox. Note that this function only applies it locally, the server is not aware

Parameters
    starred (boolean) – if set, the message is starred
function shouldDisplaySubject() → boolean

State whether this message should display the subject

Return Type
boolean
function shouldRedirectToAuthor() → boolean

State whether this message should redirect to the author when clicking on the author of this message.

Do not redirect on author clicked of self-posted or Odoobot messages (note: Odoobot is the default author of transient messages)

Return Type
boolean
function toggleStarStatus() → $.Promise

Toggle the star status of the message

It relies on the star status of the message from the date of the server. The star status is updated from a ‘toggle_star’ notification on the longpoll bus

Return Type
jQuery.Promise
function updateCustomerEmailStatus(newCustomerEmailStatus)

Update the customer email status

Parameters
    newCustomerEmailStatus (string)
class MessageData()
attribute body string

= “”]

attribute channel_ids (string|integer)[]
attribute customer_email_data Object[]
attribute customer_email_status string
attribute email_from string
attribute info string
attribute model string
attribute moderation_status string
attribute module_icon string
attribute needaction_partner_ids Array

= []]

attribute record_name string
attribute res_id integer
attribute starred_partner_ids Array

= []]

attribute subject string
attribute subtype_description string
attribute tracking_value_ids Object[]
class Message(parent, data, emojis)
Parameters

    parent (web.Manager)

    data (MessageData)

    emojis (Array<Object>)

This is the main class for the modeling messages in JS. Such messages are stored in the mail manager, and any piece of JS code whose logic relies on threads must ideally interact with such objects.

method getAuthorName() → string

Get the name of the author of this message If there are no author, return “”.

Return Type
string
method getAvatarSource() → string

Get the relative url of the avatar to display next to the message

Return Type
string
method getCustomerEmailData() → Object[]|undefined

Get the customer email data of this email, if any. If this message has no such data, returns ‘undefined’

Return Type
Array<Object> or undefined
method getCustomerEmailStatus() → string|undefined

Get the customer email status of this email, if any. If this message has no such data, returns ‘undefined’

Return Type
string or undefined
method getDisplayedAuthor() → string

Get the text to display for the author of the message

Rule of precedence for the displayed author:

author name > sender email > "anonymous"
Return Type
string
method getDocumentID() → integer

Get the ID of the document that this message is linked.

Return Type
integer
method getDocumentModel() → string

Get the model of the document that this message is linked. If this message is not linked to a document, returns “”.

Return Type
string
method getDocumentName() → string

Get the name of the document that this message is linked. If this message is not linked to a document, returns “”.

It uses the name of an existing document thread, in order to have the updated document name. If there is no document thread yet, use the currently aware document name.

As a result, this method should ideally be called internally, in order to avoid having different names for messages linked to a same modified document.

Return Type
string
method getEmailFrom() → string

Get the email of the sender of this message. If this email has no sender email, returns “”.

Return Type
string
method getOriginChannelID() → integer

Get the ID of the channel that this message originates from. If this message does not originate from a channel, returns -1.

Return Type
integer
method getOriginChannelName() → string

Get the name of the channel that this message originates from. If this message does not originate from a channel, returns “”.

Return Type
string
method getPreview() → Object

Returns the information required to render the preview of this channel.

Return Type
Object
method getSubject() → string

Get the subject of this message If this message has no subject, returns “”.

Return Type
string
method getThreadIDs() → string[]|undefined

Get the list of thread IDs that this message is linked to If this message is not linked to a thread, returns ‘undefined’

Returns
list of thread IDs, if any
Return Type
Array<string> or undefined
method getTrackingValues() → Object[]|undefined

Get the tracking values of this message If this message has no tracking values, returns ‘undefined’

Return Type
Array<Object> or undefined
method hasCustomerEmailData() → boolean

State whether this message contains some customer email data

Return Type
boolean
method hasEmailFrom() → string

State whether this message has an email of its sender.

Return Type
string
method hasSubject() → boolean

State whether this message has a subject

Return Type
boolean
method hasTrackingValues() → boolean

State whether this message contains some tracking values

Return Type
boolean
method isLinkedToDocumentThread() → boolean

State whether this message is linked to a document thread (not channel)

Usually, if this is true, then this message comes from a document thread, but the document model could be a channel. In that case, the document resID tells the channel that this message originally comes from.

To detect whether the message comes from a channel, see the method ‘originatesFromChannel’.

Return Type
boolean
method isMyselfAuthor() → boolean

State whether the current user is the author of this message

Return Type
boolean
method needsModeration() → boolean

States whether the current message needs moderation in general.

Return Type
boolean
method needsModerationByUser() → boolean

States whether the current message needs moderation by the current user. Such a message should be in the moderation mailbox.

Return Type
boolean
method isNeedaction() → boolean

State whether this message is needaction

Return Type
boolean
method isStarred() → boolean

State whether this message is starred

Return Type
boolean
method isSystemNotification() → boolean

State whether this message is a system notification

Return Type
boolean
method originatesFromChannel() → boolean

States whether the message originates from a channel or not

Return Type
boolean
method removeThread(threadID)

Unregister thread with ID threadID from this message

Parameters
    threadID (string or integer) – ID of thread
method setModerationStatus(newModerationStatus[, options])

Update the moderation status of the message, so that it is now accepted or rejected. When the message is accepted, it may be linked to more threads, which is the case for relay channels on moderated channels.

Parameters
class SetModerationStatusOptions()
attribute additionalThreadIDs Object
contains additional thread
IDs to be registered on the message.
function setStarred(starred)

Set whether the message is starred or not. If it is starred, the message is moved to the “Starred” mailbox. Note that this function only applies it locally, the server is not aware

Parameters
    starred (boolean) – if set, the message is starred
function shouldDisplaySubject() → boolean

State whether this message should display the subject

Return Type
boolean
function shouldRedirectToAuthor() → boolean

State whether this message should redirect to the author when clicking on the author of this message.

Do not redirect on author clicked of self-posted or Odoobot messages (note: Odoobot is the default author of transient messages)

Return Type
boolean
function toggleStarStatus() → $.Promise

Toggle the star status of the message

It relies on the star status of the message from the date of the server. The star status is updated from a ‘toggle_star’ notification on the longpoll bus

Return Type
jQuery.Promise
function updateCustomerEmailStatus(newCustomerEmailStatus)

Update the customer email status

Parameters
    newCustomerEmailStatus (string)
class MessageData()
attribute body string

= “”]

attribute channel_ids (string|integer)[]
attribute customer_email_data Object[]
attribute customer_email_status string
attribute email_from string
attribute info string
attribute model string
attribute moderation_status string
attribute module_icon string
attribute needaction_partner_ids Array

= []]

attribute record_name string
attribute res_id integer
attribute starred_partner_ids Array

= []]

attribute subject string
attribute subtype_description string
attribute tracking_value_ids Object[]
module mail.utils
Depends On
namespace
module web.KanbanColumn
class KanbanColumn()
Extends
method on_attach_callback()

Called when a record has been quick created, as a new column is rendered and appended into a fragment, before replacing the old column in the DOM. When this happens, the quick create widget is inserted into the new column directly, and it should be focused. However, as it is rendered into a fragment, the focus has to be set manually once in the DOM.

method addQuickCreate() → Deferred

Adds the quick create record to the top of the column.

Return Type
method cancelQuickCreate()

Closes the quick create widget if it isn’t dirty.

module web_settings_dashboard
namespace
module web.Pager
Exports
class Pager([parent, ][size, ][current_min, ][limit, ]options)
Extends
Parameters

    parent (Widget) – the parent widget

    size (int) – the total number of elements

    current_min (int) – the first element of the current_page

    limit (int) – the number of elements per page

    options (PagerOptions)

method start() → jQuery.Deferred

Renders the pager

Return Type
jQuery.Deferred
method disable()

Disables the pager’s arrows and the edition

method enable()

Enables the pager’s arrows and the edition

method next()

Executes the next action on the pager

method previous()

Executes the previous action on the pager

method updateState([state][, options])

Sets the state of the pager and renders it

Parameters

    state (Object) – the values to update (size, current_min and limit)

    options (UpdateStateOptions)

class UpdateStateOptions()
attribute notifyChange boolean
set to true to make the pager
notify the environment that its state changed
class PagerOptions()
attribute can_edit boolean

editable feature of the pager

attribute single_page_hidden boolean
(not) to display the pager
if only one page
attribute validate function
callback returning a Deferred to
validate changes
module mail.model.Timers
class Timers(params)
Extends
Parameters

This class lists several timers that use a same callback and duration.

method registerTimer(params)

Register a timer with ID timerID to start.

  • an already registered timer with this ID is reset.
  • (optional) can provide a list of arguments that is passed to the function callback when timer times out.
Parameters
class RegisterTimerParams()
attribute timeoutCallbackArguments Array
attribute timerID integer
function unregisterTimer(params)

Unregister a timer with ID timerID. The unregistered timer is aborted and will not time out.

Parameters
class UnregisterTimerParams()
attribute timerID integer
class TimersParams()
attribute duration integer
duration of the underlying timers from
start to timeout, in milli-seconds.
attribute onTimeout function
a function to call back for underlying
timers on timeout.
class Timers(params)
Extends
Parameters

This class lists several timers that use a same callback and duration.

method registerTimer(params)

Register a timer with ID timerID to start.

  • an already registered timer with this ID is reset.
  • (optional) can provide a list of arguments that is passed to the function callback when timer times out.
Parameters
class RegisterTimerParams()
attribute timeoutCallbackArguments Array
attribute timerID integer
function unregisterTimer(params)

Unregister a timer with ID timerID. The unregistered timer is aborted and will not time out.

Parameters
class UnregisterTimerParams()
attribute timerID integer
class TimersParams()
attribute duration integer
duration of the underlying timers from
start to timeout, in milli-seconds.
attribute onTimeout function
a function to call back for underlying
timers on timeout.
module pos_restaurant.printbill
namespace
module web.view_registry
Depends On
object instance of Registry
module mail.AbstractThreadWindow
class AbstractThreadWindow(parent[, thread][, options])
Extends
Parameters

This is an abstract widget for rendering thread windows.

It contains logic that are shared between mail.ThreadWindow and im_livechat.WebsiteLivechatWindow.

The reason for having two different implementation of thread windows is that mail.ThreadWindow makes use of mail.Manager, which is used in the backend, while im_livechat.WebsiteLivechatWindow must work without this mail service.

method close()

Close this window

method getID() → integer|string

Get the ID of the thread window, which is equivalent to the ID of the thread related to this window

Return Type
integer or string
method getThreadStatus() → string|undefined

Get the status of the thread, such as the im status of a DM chat (‘online’, ‘offline’, etc.). If this window has no thread, returns undefined.

Return Type
string or undefined
method getTitle() → string

Get the title of the thread window, which usually contains the name of the thread.

Return Type
string
method getUnreadCounter() → integer

Get the unread counter of the related thread. If there are no thread linked to this window, returns 0.

Return Type
integer
method hasThread() → boolean

States whether this thread window is related to a thread or not.

This is useful in order to provide specific behaviour for thread windows without any thread, e.g. let them open a thread from this “blank” thread window.

Return Type
boolean
method isAtBottom() → boolean

Tells whether the bottom of the thread in the thread window is visible or not.

Return Type
boolean
method isFolded() → boolean

State whether the related thread is folded or not. If there are no thread related to this window, it means this is the “blank” thread window, therefore we use the internal folded state.

Return Type
boolean
method isMobile() → boolean

States whether the current environment is in mobile or not. This is useful in order to customize the template rendering for mobile view.

Return Type
boolean
method isHidden() → boolean

States whether the thread window is hidden or not.

Return Type
boolean
method needsComposer() → boolean

States whether the input of the thread window should be displayed or not. By default, any thread window with a thread needs a composer.

Return Type
boolean
method render()

Render the thread window

method renderTypingNotificationBar()

Render the ‘is typing…’ notification bar text on the thread in this thread window. This is called when there is a change in the list of users currently typing something on this thread.

method scrollToBottom()

Scroll to the bottom of the thread in the thread window

method toggleFold([folded])

Toggle the fold state of this thread window. Also update the fold state of the thread model. If the boolean parameter folded is provided, it folds/unfolds the window when it is set/unset.

Parameters
    folded (boolean) – if not a boolean, toggle the fold state. Otherwise, fold/unfold the window if set/unset.
method updateVisualFoldState()

Update the visual state of the window so that it matched the internal fold state. This is useful in case the related thread has its fold state that has been changed.

class AbstractThreadWindowOptions()
attribute thread mail.model.AbstractThread
class AbstractThreadWindow(parent[, thread][, options])
Extends
Parameters

This is an abstract widget for rendering thread windows.

It contains logic that are shared between mail.ThreadWindow and im_livechat.WebsiteLivechatWindow.

The reason for having two different implementation of thread windows is that mail.ThreadWindow makes use of mail.Manager, which is used in the backend, while im_livechat.WebsiteLivechatWindow must work without this mail service.

method close()

Close this window

method getID() → integer|string

Get the ID of the thread window, which is equivalent to the ID of the thread related to this window

Return Type
integer or string
method getThreadStatus() → string|undefined

Get the status of the thread, such as the im status of a DM chat (‘online’, ‘offline’, etc.). If this window has no thread, returns undefined.

Return Type
string or undefined
method getTitle() → string

Get the title of the thread window, which usually contains the name of the thread.

Return Type
string
method getUnreadCounter() → integer

Get the unread counter of the related thread. If there are no thread linked to this window, returns 0.

Return Type
integer
method hasThread() → boolean

States whether this thread window is related to a thread or not.

This is useful in order to provide specific behaviour for thread windows without any thread, e.g. let them open a thread from this “blank” thread window.

Return Type
boolean
method isAtBottom() → boolean

Tells whether the bottom of the thread in the thread window is visible or not.

Return Type
boolean
method isFolded() → boolean

State whether the related thread is folded or not. If there are no thread related to this window, it means this is the “blank” thread window, therefore we use the internal folded state.

Return Type
boolean
method isMobile() → boolean

States whether the current environment is in mobile or not. This is useful in order to customize the template rendering for mobile view.

Return Type
boolean
method isHidden() → boolean

States whether the thread window is hidden or not.

Return Type
boolean
method needsComposer() → boolean

States whether the input of the thread window should be displayed or not. By default, any thread window with a thread needs a composer.

Return Type
boolean
method render()

Render the thread window

method renderTypingNotificationBar()

Render the ‘is typing…’ notification bar text on the thread in this thread window. This is called when there is a change in the list of users currently typing something on this thread.

method scrollToBottom()

Scroll to the bottom of the thread in the thread window

method toggleFold([folded])

Toggle the fold state of this thread window. Also update the fold state of the thread model. If the boolean parameter folded is provided, it folds/unfolds the window when it is set/unset.

Parameters
    folded (boolean) – if not a boolean, toggle the fold state. Otherwise, fold/unfold the window if set/unset.
method updateVisualFoldState()

Update the visual state of the window so that it matched the internal fold state. This is useful in case the related thread has its fold state that has been changed.

class AbstractThreadWindowOptions()
attribute thread mail.model.AbstractThread
module web.viewUtils
Exports
namespace utils

FIXME: move this module to its own file in master

function getGroupValue(group, groupByField) → string | integer | false

Returns the value of a group dataPoint, i.e. the value of the groupBy field for the records in that group.

Parameters

    group (Object) – dataPoint of type list, corresponding to a group

    groupByField (string) – the name of the groupBy field

Return Type
string or integer or false
function isQuickCreateEnabled(list) → Boolean

States whether or not the quick create feature is available for the given datapoint, depending on its groupBy field.

Parameters
    list (Object) – dataPoint of type list
Returns
true iff the kanban quick create feature is available
Return Type
Boolean
namespace utils

FIXME: move this module to its own file in master

function getGroupValue(group, groupByField) → string | integer | false

Returns the value of a group dataPoint, i.e. the value of the groupBy field for the records in that group.

Parameters

    group (Object) – dataPoint of type list, corresponding to a group

    groupByField (string) – the name of the groupBy field

Return Type
string or integer or false
function isQuickCreateEnabled(list) → Boolean

States whether or not the quick create feature is available for the given datapoint, depending on its groupBy field.

Parameters
    list (Object) – dataPoint of type list
Returns
true iff the kanban quick create feature is available
Return Type
Boolean
module account.ReconciliationRenderer
class StatementRenderer(parent, model, state)
Extends
Parameters

    parent

    model

    state

rendering of the bank statement action contains progress bar, title and auto reconciliation button

method start()

display iniial state and create the name statement field

method update(state)

update the statement rendering

Parameters
class UpdateState()

statement data

attribute valuenow integer

for the progress bar

attribute valuemax integer

for the progress bar

attribute title string

for the progress bar

attribute notifications [object]
class LineRenderer(parent, model, state)
Extends
Parameters

    parent

    model

    state

rendering of the bank statement line, contains line data, proposition and view for ‘match’ and ‘create’ mode

method update(state)

update the statement line rendering

Parameters
    state (object) – statement line
namespace
class StatementRenderer(parent, model, state)
Extends
Parameters

    parent

    model

    state

rendering of the bank statement action contains progress bar, title and auto reconciliation button

method start()

display iniial state and create the name statement field

method update(state)

update the statement rendering

Parameters
class UpdateState()

statement data

attribute valuenow integer

for the progress bar

attribute valuemax integer

for the progress bar

attribute title string

for the progress bar

attribute notifications [object]
class ManualRenderer(parent, model, state)
Parameters

    parent

    model

    state

rendering of the manual reconciliation action contains progress bar, title and auto reconciliation button

class LineRenderer(parent, model, state)
Extends
Parameters

    parent

    model

    state

rendering of the bank statement line, contains line data, proposition and view for ‘match’ and ‘create’ mode

method update(state)

update the statement line rendering

Parameters
    state (object) – statement line
class ManualLineRenderer(parent, model, state)
Parameters

    parent

    model

    state

rendering of the manual reconciliation, contains line data, proposition and view for ‘match’ mode

method start()

move the partner field

class ManualLineRenderer(parent, model, state)
Parameters

    parent

    model

    state

rendering of the manual reconciliation, contains line data, proposition and view for ‘match’ mode

method start()

move the partner field

class ManualRenderer(parent, model, state)
Parameters

    parent

    model

    state

rendering of the manual reconciliation action contains progress bar, title and auto reconciliation button

module mail.Discuss
class Discuss()
class PartnerInviteDialog(parent, title, channelID)
Extends
Parameters

    parent

    title

    channelID (integer or string) – id of the channel, a string for static channels (e.g. ‘mailbox_inbox’).

Widget : Invite People to Channel Dialog

Popup containing a ‘many2many_tags’ custom input to select multiple partners. Searches user according to the input, and triggers event when selection is validated.

class ModeratorRejectMessageDialog(parent, params)
Extends

Widget : Moderator reject message dialog

Popup containing message title and reject message body. This let the moderator provide a reason for rejecting the messages.

class ModeratorRejectMessageDialogParams()
attribute messageIDs integer[]
list of message IDs to send
‘reject’ decision reason
attribute proceedReject function
a function to call when the

moderator confirms the reason for rejecting the messages. This function passes an object as the reason for reject, which is structured as follow:

{
    title: <string>,
    comment: <string>,
}
module web.AbstractController
class AbstractController(parent, model, renderer, params)
method start() → Deferred

Simply renders and updates the url.

Return Type
method on_attach_callback()

Called each time the controller is attached into the DOM.

method on_detach_callback()

Called each time the controller is detached from the DOM.

method giveFocus()

Gives the focus to the renderer

method discardChanges([recordID]) → Deferred

Discards the changes made on the record associated to the given ID, or all changes made by the current controller if no recordID is given. For example, when the user opens the ‘home’ screen, the action manager calls this method on the active view to make sure it is ok to open the home screen (and lose all current state).

Note that it returns a deferred, because the view could choose to ask the user if he agrees to discard.

Parameters
    recordID (string) – if not given, we consider all the changes made by the controller
Returns
resolved if properly discarded, rejected otherwise
Return Type
method getContext() → Object

Returns any special keys that may be useful when reloading the view to get the same effect. This is necessary for saving the current view in the favorites. For example, a graph view might want to add a key to save the current graph type.

Return Type
Object
method getTitle() → string

Returns a title that may be displayed in the breadcrumb area. For example, the name of the record.

note: this will be moved to AbstractAction

Return Type
string
method is_action_enabled(action) → boolean

The use of this method is discouraged. It is still snakecased, because it currently is used in many templates, but we will move to a simpler mechanism as soon as we can.

Parameters
    action (string) – type of action, such as ‘create’, ‘read’, …
Return Type
boolean
method reload([params]) → Deferred

Short helper method to reload the view

Parameters
    params (Object) – This object will simply be given to the update
Return Type
method renderPager($node)

For views that require a pager, this method will be called to allow the controller to instantiate and render a pager. Note that in theory, the controller can actually render whatever he wants in the pager zone. If your view does not want a pager, just let this method empty.

Parameters
    $node (jQuery)
method renderSidebar($node)

Same as renderPager, but for the ‘sidebar’ zone (the zone with the menu dropdown in the control panel next to the buttons)

Parameters
    $node (jQuery)
method update(params[, options]) → Deferred

This is the main entry point for the controller. Changes from the search view arrive in this method, and internal changes can sometimes also call this method. It is basically the way everything notifies the controller that something has changed.

The update method is responsible for fetching necessary data, then updating the renderer and wait for the rendering to complete.

Parameters

    params (Object) – will be given to the model and to the renderer

    options (UpdateOptions)

Return Type
class UpdateOptions()
attribute reload boolean

if true, the model will reload data

class AbstractControllerParams()
attribute modelName string
attribute controllerID string
an id to ease the communication
with upstream components
attribute handle any

a handle that will be given to the model (some id)

attribute initialState any

the initialState

attribute isMultiRecord boolean
attribute actionViews Object[]
attribute viewType string
attribute withControlPanel boolean
set to false to hide the
ControlPanel
module point_of_sale.gui
namespace
module web.GraphModel
class (parent)
Parameters
function get() → Object

We defend against outside modifications by extending the chart data. It may be overkill.

Return Type
Object
function load(params) → Deferred

Initial loading.

Parameters
Returns
The deferred does not return a handle, we don’t need to keep track of various entities.
Return Type
class LoadParams()
attribute mode string

one of ‘pie’, ‘bar’, ‘line

attribute measure string

a valid field name

attribute groupBys string[]

a list of valid field names

attribute context Object
attribute domain string[]
attribute intervalMapping Object
object linking fieldNames with intervals.
this could be useful to simplify the code. For now this parameter is not used.
function reload(handle, params) → Deferred

Reload data. It is similar to the load function. Note that we ignore the handle parameter, we always expect our data to be in this.chart object.

Parameters
Return Type
class ReloadParams()
attribute domain string[]
attribute groupBy string[]
attribute mode string

one of ‘bar’, ‘pie’, ‘line’

attribute measure string

a valid field name

module web.DropdownMenu
Extends
Parameters

    parent (Widget)

    dropdownHeader (DropdownMenuDropdownHeader) – object used to customize the dropdown menu.

    items (Array<Object>) – list of menu items Menu items: * itemId: string; (optional) unique id associated with the item * description: string; label printed on screen * groupId: string; * isActive: boolean; (optional) determines if the item is considered active * isOpen: boolean; (optional) in case there are options the submenu presenting the options is opened or closed according to isOpen * isRemovable: boolean; (optional) can be removed from menu options: array of objects with ‘optionId’ and ‘description’ keys; (optional) * currentOptionId: string refers to an optionId that is activated if item is active (optional)

method start()

override

object used to customize the dropdown menu.

attribute title String
attribute icon String
attribute symbol String
attribute category String

descripbes the type of items

attribute style String

the button style

module web.local_storage
object storage instance of RamStorage
module mail.model.Timer
Exports
Depends On
class Timer(params)
Extends
Parameters

This class creates a timer which, when times out, calls a function.

method clear()

Clears the countdown of the timer.

method reset()

Resets the timer, i.e. resets its duration.

method start()

Starts the timer, i.e. after a certain duration, it times out and calls a function back.

class TimerParams()
attribute duration integer
duration of timer before timeout in
milli-seconds.
attribute onTimeout function
function that is called when the
timer times out.
class Timer(params)
Extends
Parameters

This class creates a timer which, when times out, calls a function.

method clear()

Clears the countdown of the timer.

method reset()

Resets the timer, i.e. resets its duration.

method start()

Starts the timer, i.e. after a certain duration, it times out and calls a function back.

class TimerParams()
attribute duration integer
duration of timer before timeout in
milli-seconds.
attribute onTimeout function
function that is called when the
timer times out.
module website_event.registration_form.instance
namespace
module mail_bot.MailBotService
class MailBotService(parent)
Parameters
    parent
method getPreviews([filter]) → Object[]

Get the previews related to the OdooBot (conversation not included). For instance, when there is no conversation with OdooBot and OdooBot has a request, it should display a preview in the systray messaging menu.

Parameters
    filter (string or undefined)
Returns
list of objects that are compatible with the ‘mail.Preview’ template.
Return Type
Array<Object>
method hasRequest() → boolean

Tell whether OdooBot has a request or not.

Return Type
boolean
module pos_discount.pos_discount
namespace
module web.FormView
class FormView()
Extends
module website_sale_stock.ProductConfiguratorMixin
namespace ProductConfiguratorMixin
function computePriceTotal()

When a product is added or when the quantity is changed, we need to refresh the total price row TODO awa: add a container context to avoid global selectors ?

function onChangeVariant(ev)

When a variant is changed, this will check: - If the selected combination is available or not - The extra price if applicable - The display name of the product (“Customizable desk (White, Steel)”) - The new total price - The need of adding a “custom value” input

Parameters
    ev (MouseEvent)
function onClickAddCartJSON(ev)

Hack to add and remove from cart with json

Parameters
    ev (MouseEvent)
function onChangeAddQuantity(ev)

When the quantity is changed, we need to query the new price of the product. Based on the price list, the price might change when quantity exceeds X

Parameters
    ev (MouseEvent)
function triggerVariantChange($container)

Triggers the price computation and other variant specific changes

Parameters
    $container (jQuery.Element)
function getCustomVariantValues($container) → Array

Will look for user custom attribute values in the provided container

Parameters
    $container (jQuery.Element)
Returns
array of custom values with the following format {integer} attribute_value_id {string} attribute_value_name {string} custom_value
Return Type
Array
function getNoVariantAttributeValues($container) → Array

Will look for attribute values that do not create product variant (see product_attribute.create_variant “dynamic”)

Parameters
    $container (jQuery.Element)
Returns
array of attribute values with the following format {integer} attribute_value_id {string} attribute_value_name {integer} value {string} attribute_name {boolean} is_custom
Return Type
Array
function getSelectedVariantValues($container)

Will return the list of selected product.template.attribute.value ids For the modal, the “main product“‘s attribute values are stored in the “unchanged_value_ids” data

Parameters
    $container (jQuery.Element) – the container to look into
function selectOrCreateProduct($container, productId, productTemplateId, useAjax) → $.Deferred

Will return a deferred: - If the product already exists, immediately resolves it with the product_id - If the product does not exist yet (“dynamic” variant creation), this method will

create the product first and then resolve the deferred with the created product’s id
Parameters

    $container (jQuery.Element) – the container to look into

    productId (integer) – the product id

    productTemplateId (integer) – the corresponding product template id

    useAjax (boolean) – wether the rpc call should be done using ajax.jsonRpc or using _rpc

Returns
the deferred that will be resolved with a {integer} productId
Return Type
jQuery.Deferred
function _onChangeCombinationStock(ev, $parent, combination)

Addition to the product_configurator_mixin._onChangeCombination

This will prevent the user from selecting a quantity that is not available in the stock for that product.

It will also display various info/warning messages regarding the select product’s stock.

This behavior is only applied for the web shop (and not on the SO form) and only for the main product.

Parameters

    ev (MouseEvent)

    $parent (jQuery.Element)

    combination (Array)

module web.UserMenu
class UserMenu(parent)
Extends
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.
module web.DebugManager
class DebugManager()
Extends

DebugManager base + general features (applicable to any context)

method perform_callback(evt)

Calls the appropriate callback when clicking on a Debug option

Parameters
    evt
method perform_js_tests()

Runs the JS (desktop) tests

method perform_js_mobile_tests()

Runs the JS mobile tests

method regenerateAssets() → void

Delete assets bundles to force their regeneration

Return Type
void
class DebugManager()
Extends

DebugManager base + general features (applicable to any context)

method perform_callback(evt)

Calls the appropriate callback when clicking on a Debug option

Parameters
    evt
method perform_js_tests()

Runs the JS (desktop) tests

method perform_js_mobile_tests()

Runs the JS mobile tests

method regenerateAssets() → void

Delete assets bundles to force their regeneration

Return Type
void
module web.ModelFieldSelector
class ModelFieldSelector(parent, model, chain[, options])
Extends
Parameters

    parent

    model (string) – the model name (e.g. “res.partner”)

    chain (Array<string>) – list of the initial field chain parts

    options (ModelFieldSelectorOptions) – some key-value options

The ModelFieldSelector widget can be used to display/select a particular field chain from a given model.

method getSelectedField() → Object

Returns the field information selected by the field chain.

Return Type
Object
method isValid() → boolean

Indicates if the field chain is valid. If the field chain has not been processed yet (the widget is not ready), this method will return undefined.

Return Type
boolean
method setChain(chain) → Deferred

Saves a new field chain (array) and re-render.

Parameters
    chain (Array<string>) – the new field chain
Returns
resolved once the re-rendering is finished
Return Type
class ModelFieldSelectorOptions()

some key-value options

attribute order string

an ordering key for displayed fields

attribute readonly boolean

true if should be readonly

attribute filter function

a function to filter the fetched fields

attribute filters Object

some key-value options to filter the fetched fields

attribute filters.searchable boolean

true if only the searchable fields have to be used

attribute fields Object[]
the list of fields info to use when no relation has
been followed (null indicates the widget has to request the fields itself)
attribute followRelations boolean|function

true if can follow relation when building the chain

attribute debugMode boolean

true if the widget is in debug mode, false otherwise

namespace modelFieldsCache

Field Selector Cache - TODO Should be improved to use external cache ? - Stores fields per model used in field selector

class ModelFieldSelector(parent, model, chain[, options])
Extends
Parameters

    parent

    model (string) – the model name (e.g. “res.partner”)

    chain (Array<string>) – list of the initial field chain parts

    options (ModelFieldSelectorOptions) – some key-value options

The ModelFieldSelector widget can be used to display/select a particular field chain from a given model.

method getSelectedField() → Object

Returns the field information selected by the field chain.

Return Type
Object
method isValid() → boolean

Indicates if the field chain is valid. If the field chain has not been processed yet (the widget is not ready), this method will return undefined.

Return Type
boolean
method setChain(chain) → Deferred

Saves a new field chain (array) and re-render.

Parameters
    chain (Array<string>) – the new field chain
Returns
resolved once the re-rendering is finished
Return Type
class ModelFieldSelectorOptions()

some key-value options

attribute order string

an ordering key for displayed fields

attribute readonly boolean

true if should be readonly

attribute filter function

a function to filter the fetched fields

attribute filters Object

some key-value options to filter the fetched fields

attribute filters.searchable boolean

true if only the searchable fields have to be used

attribute fields Object[]
the list of fields info to use when no relation has
been followed (null indicates the widget has to request the fields itself)
attribute followRelations boolean|function

true if can follow relation when building the chain

attribute debugMode boolean

true if the widget is in debug mode, false otherwise

function sortFields(fields, model, order) → Object[]

Allows to transform a mapping field name -> field info in an array of the field infos, sorted by field user name (“string” value). The field infos in the final array contain an additional key “name” with the field name.

Parameters

    fields (Object) – the mapping field name -> field info

    model (string)

    order

Returns
the field infos sorted by field “string” (field infos contain additional keys “model” and “name” with the field name)
Return Type
Array<Object>
module web.kanban_record_quick_create
class RecordQuickCreate(parent, options)
Extends
Parameters
method willStart()

Loads the form fieldsView (if not provided), instantiates the form view and starts the form controller.

method on_attach_callback()

Called when the quick create is appended into the DOM.

class RecordQuickCreateOptions()
attribute context Object
attribute formViewRef string|null
attribute model string
module web.Loading
class Loading(parent)
Extends
Parameters
    parent
module web.clickEverywhere
function startClickEverywhere()
module web.AjaxService
class AjaxService(parent)
Parameters
    parent
module website.mobile
namespace
module web.KanbanColumnProgressBar
class KanbanColumnProgressBar(parent, options, columnState)
Extends
Parameters

    parent

    options

    columnState

attribute ANIMATE boolean

Allows to disable animations for tests.

module google_drive.sidebar
Exports
Depends On
Extends
Parameters

    parent

    options

method start()

Get the attachment linked to the record when the toolbar started

module mail.DocumentViewer
class DocumentViewer(parent, attachments, activeAttachmentID)
Extends
Parameters

    parent

    attachments (Array<Object>) – list of attachments

    activeAttachmentID (integer)

method start()

Open a modal displaying the active attachment

module web.WebClient
class (parent)
Parameters
    parent
function show_application()

Overrides to ask the Mail service to check whether there is a pending chat session with Support, and if so, to re-open it.

function getScrollPosition() → Object

Returns the left and top scroll positions of the main scrolling area (i.e. the action manager in desktop).

Returns
with keys left and top
Return Type
Object
module website_sale.editor
namespace
module survey.survey
namespace
module web.DomainSelector
class DomainTree(parent, model, domain)
Extends
Parameters

    parent

    model

    domain

DomainNode which can handle subdomains (a domain which is composed of multiple parts). It thus will be composed of other DomainTree instances and/or leaf parts of a domain (@see DomainLeaf).

class DomainLeaf(parent, model, domain, options)
Extends
Parameters

    parent

    model

    domain

    options

DomainNode which handles a domain which cannot be split in another subdomains, i.e. composed of a field chain, an operator and a value.

method willStart() → Deferred

Prepares the information the rendering of the widget will need by pre-instantiating its internal field selector widget.

Return Type
class DomainNode(parent, model, domain[, options])
Extends
Parameters

    parent (Object)

    model (string) – the model name

    domain (Array or string) – the prefix representation of the domain

    options (DomainNodeOptions) – an object with possible values:

Abstraction for widgets which can represent and allow edition of a domain.

method isValid() → boolean

Should return if the node is representing a well-formed domain, whose field chains properly belong to the associated model.

Return Type
boolean
method getDomain() → Array

Should return the prefix domain the widget is currently representing (an array).

Return Type
Array
class DomainNodeOptions()

an object with possible values:

attribute readonly boolean

true if is readonly

attribute default Array
default domain used when creating a
new node
attribute operators string[]

a list of available operators (null = all of supported ones)

attribute debugMode boolean

true if should be in debug

class DomainSelector(parent, model, domain)
Extends
Parameters

    parent

    model

    domain

The DomainSelector widget can be used to build prefix char domain. It is the DomainTree specialization to use to have a fully working widget.

Known limitations:

  • Some operators like “child_of”, “parent_of”, “like”, “not like”, “=like”, “=ilike” will come only if you use them from demo data or debug input.
  • Some kind of domain can not be build right now e.g (“country_id”, “in”, [1,2,3]) but you can insert from debug input.
method setDomain(domain) → Deferred

Changes the internal domain value and forces a reparsing and rerendering. If the internal domain value was already equal to the given one, this does nothing.

Parameters
    domain (string)
Returns
resolved when the rerendering is finished
Return Type
class DomainSelector(parent, model, domain)
Extends
Parameters

    parent

    model

    domain

The DomainSelector widget can be used to build prefix char domain. It is the DomainTree specialization to use to have a fully working widget.

Known limitations:

  • Some operators like “child_of”, “parent_of”, “like”, “not like”, “=like”, “=ilike” will come only if you use them from demo data or debug input.
  • Some kind of domain can not be build right now e.g (“country_id”, “in”, [1,2,3]) but you can insert from debug input.
method setDomain(domain) → Deferred

Changes the internal domain value and forces a reparsing and rerendering. If the internal domain value was already equal to the given one, this does nothing.

Parameters
    domain (string)
Returns
resolved when the rerendering is finished
Return Type
function instantiateNode(parent, model, domain, options) → DomainTree|DomainLeaf|null

Instantiates a DomainTree if the given domain contains several parts and a DomainLeaf if it only contains one part. Returns null otherwise.

Parameters

    parent (Object)

    model (string) – the model name

    domain (Array or string) – the prefix representation of the domain

    options (Object) – @see DomainNode.init.options

Return Type
module web_tour.Tip
class Tip(parent[, info])
Extends
Parameters

    parent (Widget)

    info (Object) – description of the tip, containing the following keys: - content [String] the html content of the tip - event_handlers [Object] description of optional event handlers to bind to the tip: - event [String] the event name - selector [String] the jQuery selector on which the event should be bound - handler [function] the handler - position [String] tip’s position (‘top’, ‘right’, ‘left’ or ‘bottom’), default ‘right’ - width [int] the width in px of the tip when opened, default 270 - space [int] space in px between anchor and tip, default 10 - overlay [Object] x and y values for the number of pixels the mouseout detection area overlaps the opened tip, default {x: 50, y: 50}

module mail.composer.Extended
class ExtendedComposer(parent, options)
Parameters

    parent

    options

module mail.emojis
Exports
namespace emojis
namespace data

This data represent all the available emojis that are supported on the web client:

  • key: this is the source representation of an emoji, i.e. its “character”
    representation. This is a string that can be easily typed by the user and then translated to its unicode representation (see value)
  • value: this is the unicode representation of an emoji, i.e. its “true”
    representation in the system.
module web_editor.context
namespace
module sale.ProductConfiguratorMixin
namespace ProductConfiguratorMixin
function computePriceTotal()

When a product is added or when the quantity is changed, we need to refresh the total price row TODO awa: add a container context to avoid global selectors ?

function onChangeVariant(ev)

When a variant is changed, this will check: - If the selected combination is available or not - The extra price if applicable - The display name of the product (“Customizable desk (White, Steel)”) - The new total price - The need of adding a “custom value” input

Parameters
    ev (MouseEvent)
function onClickAddCartJSON(ev)

Hack to add and remove from cart with json

Parameters
    ev (MouseEvent)
function onChangeAddQuantity(ev)

When the quantity is changed, we need to query the new price of the product. Based on the price list, the price might change when quantity exceeds X

Parameters
    ev (MouseEvent)
function triggerVariantChange($container)

Triggers the price computation and other variant specific changes

Parameters
    $container (jQuery.Element)
function getCustomVariantValues($container) → Array

Will look for user custom attribute values in the provided container

Parameters
    $container (jQuery.Element)
Returns
array of custom values with the following format {integer} attribute_value_id {string} attribute_value_name {string} custom_value
Return Type
Array
function getNoVariantAttributeValues($container) → Array

Will look for attribute values that do not create product variant (see product_attribute.create_variant “dynamic”)

Parameters
    $container (jQuery.Element)
Returns
array of attribute values with the following format {integer} attribute_value_id {string} attribute_value_name {integer} value {string} attribute_name {boolean} is_custom
Return Type
Array
function getSelectedVariantValues($container)

Will return the list of selected product.template.attribute.value ids For the modal, the “main product“‘s attribute values are stored in the “unchanged_value_ids” data

Parameters
    $container (jQuery.Element) – the container to look into
function selectOrCreateProduct($container, productId, productTemplateId, useAjax) → $.Deferred

Will return a deferred: - If the product already exists, immediately resolves it with the product_id - If the product does not exist yet (“dynamic” variant creation), this method will

create the product first and then resolve the deferred with the created product’s id
Parameters

    $container (jQuery.Element) – the container to look into

    productId (integer) – the product id

    productTemplateId (integer) – the corresponding product template id

    useAjax (boolean) – wether the rpc call should be done using ajax.jsonRpc or using _rpc

Returns
the deferred that will be resolved with a {integer} productId
Return Type
jQuery.Deferred
function _onChangeCombinationStock(ev, $parent, combination)

Addition to the product_configurator_mixin._onChangeCombination

This will prevent the user from selecting a quantity that is not available in the stock for that product.

It will also display various info/warning messages regarding the select product’s stock.

This behavior is only applied for the web shop (and not on the SO form) and only for the main product.

Parameters

    ev (MouseEvent)

    $parent (jQuery.Element)

    combination (Array)

module barcodes.field
namespace
module web.datepicker
namespace
module website.ace
class WebsiteAceEditor(parent, viewKey[, options])
Extends
Parameters

    parent (Widget)

    viewKey (string or integer) – xml_id or id of the view whose linked resources have to be loaded.

    options (WebsiteAceEditorOptions)

Extends the default view editor so that the URL hash is updated with view ID

class WebsiteAceEditorOptions()
attribute initialResID string|integer
a specific view ID / SCSS URL to load on start (otherwise the main
view ID associated with the specified viewKey will be used)
attribute position string
attribute doNotLoadViews boolean
attribute doNotLoadSCSS boolean
attribute includeBundles boolean
attribute includeAllSCSS boolean
attribute defaultBundlesRestriction string[]
class WebsiteAceEditor(parent, viewKey[, options])
Extends
Parameters

    parent (Widget)

    viewKey (string or integer) – xml_id or id of the view whose linked resources have to be loaded.

    options (WebsiteAceEditorOptions)

Extends the default view editor so that the URL hash is updated with view ID

class WebsiteAceEditorOptions()
attribute initialResID string|integer
a specific view ID / SCSS URL to load on start (otherwise the main
view ID associated with the specified viewKey will be used)
attribute position string
attribute doNotLoadViews boolean
attribute doNotLoadSCSS boolean
attribute includeBundles boolean
attribute includeAllSCSS boolean
attribute defaultBundlesRestriction string[]
module website.content.lazy_template_call
class LazyTemplateRenderer(parent)
Extends
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.
method start()

Lazy replaces the [data-oe-call] elements by their corresponding template content.

module mail.model.Livechat
class Livechat(params)
Parameters

backend-side of the livechat.

Any piece of code in JS that make use of Livechats must ideally interact with such objects, instead of direct data from the server.

method getMentionPartnerSuggestions() → $.Promise<Object[]>

Override so that the list of members has the website use. This is necessary in order for the ‘is_typing’ feature to compute the name to display of a user that is typing.

Returns
resolved with list of livechat members
Return Type
jQuery.Promise<Array<Object>>
method registerTyping(params)

Called when someone starts typing something on the livechat.

Overrides it so that it determine the partner based on the received userID. The reason is that anonymous users have the partner ID of the admin, which is likely also an operator, so userID must be used in order to distinct them.

Parameters
class RegisterTypingParams()
attribute partnerID integer
ID of the partner that is currently
typing something on the thread.
attribute isWebsiteUser boolean
whether the typing partner
is an anonymous user (reminder: they share partnerID with admin).
function unregisterTyping(params)

Called when someone stops typing something on the livechat.

Overrides it so that it determine the partner based on the received userID. The reason is that anonymous users have the partner ID of the admin, which is likely also an operator, so userID must be used in order to distinct them.

Parameters
class UnregisterTypingParams()
attribute partnerID integer
ID of the partner that stops typing
something on the thread.
attribute isWebsiteUser boolean
whether the typing partner
is an anonymous user (reminder: they share partnerID with admin).
class LivechatParams()
attribute data Object
attribute data.anonymous_name string

name of the website user

class Livechat(params)
Parameters

backend-side of the livechat.

Any piece of code in JS that make use of Livechats must ideally interact with such objects, instead of direct data from the server.

method getMentionPartnerSuggestions() → $.Promise<Object[]>

Override so that the list of members has the website use. This is necessary in order for the ‘is_typing’ feature to compute the name to display of a user that is typing.

Returns
resolved with list of livechat members
Return Type
jQuery.Promise<Array<Object>>
method registerTyping(params)

Called when someone starts typing something on the livechat.

Overrides it so that it determine the partner based on the received userID. The reason is that anonymous users have the partner ID of the admin, which is likely also an operator, so userID must be used in order to distinct them.

Parameters
class RegisterTypingParams()
attribute partnerID integer
ID of the partner that is currently
typing something on the thread.
attribute isWebsiteUser boolean
whether the typing partner
is an anonymous user (reminder: they share partnerID with admin).
function unregisterTyping(params)

Called when someone stops typing something on the livechat.

Overrides it so that it determine the partner based on the received userID. The reason is that anonymous users have the partner ID of the admin, which is likely also an operator, so userID must be used in order to distinct them.

Parameters
class UnregisterTypingParams()
attribute partnerID integer
ID of the partner that stops typing
something on the thread.
attribute isWebsiteUser boolean
whether the typing partner
is an anonymous user (reminder: they share partnerID with admin).
class LivechatParams()
attribute data Object
attribute data.anonymous_name string

name of the website user

module web.colorpicker
class Colorpicker(parent[, options])
Extends
Parameters
method convertHexToRgb(hex) → Object|false

Converts Hexadecimal code to RGB.

Parameters
    hex (string) – hexadecimal code
Returns
contains red, green and blue
Return Type
Object or false
method convertRgbToHsl(r, g, b) → Object|false

Converts RGB color to HSL.

Parameters

    r (integer)

    g (integer)

    b (integer)

Returns
contains hue, saturation and lightness
Return Type
Object or false
method convertHslToRgb(h, s, l) → Object|false

Converts HSL color to RGB.

Parameters

    h (integer)

    s (integer)

    l (integer)

Returns
contains red, green and blue
Return Type
Object or false
method convertRgbToHex(r, g, b) → Object|false

Converts RGB color to Hexadecimal code.

Parameters

    r (integer)

    g (integer)

    b (integer)

Returns
contains hexadecimal code
Return Type
Object or false
class ColorpickerOptions()
attribute defaultColor string
module web.ListRenderer
class ListRenderer(parent, state, params)
Parameters
method giveFocus()

Order to focus to be given to the content of the current view

method canBeSaved([recordID]) → string[]

If the given recordID is the list main one (or that no recordID is given), then the whole view can be saved if one of the two following conditions is true: - There is no line in edition (all lines are saved so they are all valid) - The line in edition can be saved

Parameters
    recordID (string)
Return Type
Array<string>
method confirmChange(state, id)

We need to override the confirmChange method from BasicRenderer to reevaluate the row decorations. Since they depends on the current value of the row, they might have changed between each edit.

Parameters

    state

    id

method confirmUpdate(state, id, fields, ev) → Deferred<AbstractField[]>

This is a specialized version of confirmChange, meant to be called when the change may have affected more than one line (so, for example, an onchange which add/remove a few lines in a x2many. This does not occur in a normal list view)

The update is more difficult when other rows could have been changed. We need to potentially remove some lines, add some other lines, update some other lines and maybe reorder a few of them. This problem would neatly be solved by using a virtual dom, but we do not have this luxury yet. So, in the meantime, what we do is basically remove every current row except the ‘main’ one (the row which caused the update), then rerender every new row and add them before/after the main one.

Parameters

    state (Object)

    id (string)

    fields (Array<string>)

    ev (OdooEvent)

Returns
resolved with the list of widgets that have been reset
Return Type
method editRecord(recordID)

Edit a given record in the list

Parameters
    recordID (string)
method getEditableRecordID() → string|null

Returns the recordID associated to the line which is currently in edition or null if there is no line in edition.

Return Type
string or null
method removeLine(state, recordID)

Removes the line associated to the given recordID (the index of the row is found thanks to the old state), then updates the state.

Parameters

    state (Object)

    recordID (string)

method setRowMode(recordID, mode) → Deferred

Updates the already rendered row associated to the given recordID so that it fits the given mode.

Parameters

    recordID (string)

    mode (string)

Return Type
method unselectRow() → Deferred

This method is called whenever we click/move outside of a row that was in edit mode. This is the moment we save all accumulated changes on that row, if needed (@see BasicController.saveRecord).

Note that we have to disable the focusable elements (inputs, …) to prevent subsequent editions. These edits would be lost, because the list view only saves records when unselecting a row.

Returns
The deferred resolves if the row was unselected (and possibly removed). If may be rejected, when the row is dirty and the user refuses to discard its changes.
Return Type
class ListRendererParams()
attribute addCreateLine boolean
attribute addTrashIcon boolean
module bus.CrossTab
class CrossTabBus()

CrossTab

This is an extension of the longpolling bus with browser cross-tab synchronization. It uses a Master/Slaves with Leader Election architecture: - a single tab handles longpolling. - tabs are synchronized by means of the local storage.

localStorage used keys are: - {LOCAL_STORAGE_PREFIX}.{sanitizedOrigin}.channels : shared public channel list to listen during the poll - {LOCAL_STORAGE_PREFIX}.{sanitizedOrigin}.options : shared options - {LOCAL_STORAGE_PREFIX}.{sanitizedOrigin}.notification : the received notifications from the last poll - {LOCAL_STORAGE_PREFIX}.{sanitizedOrigin}.tab_list : list of opened tab ids - {LOCAL_STORAGE_PREFIX}.{sanitizedOrigin}.tab_master : generated id of the master tab

trigger: - window_focus : when the window is focused - notification : when a notification is receive from the long polling - become_master : when this tab became the master - no_longer_master : when this tab is not longer the master (the user swith tab)

method addChannel()

Share the bus channels with the others tab by the local storage

method deleteChannel()

Share the bus channels with the others tab by the local storage

method isMasterTab() → boolean

Tells whether this bus is related to the master tab.

Return Type
boolean
method startPolling()

Use the local storage to share the long polling from the master tab.

method updateOption()

Share the option with the local storage

class CrossTabBus()

CrossTab

This is an extension of the longpolling bus with browser cross-tab synchronization. It uses a Master/Slaves with Leader Election architecture: - a single tab handles longpolling. - tabs are synchronized by means of the local storage.

localStorage used keys are: - {LOCAL_STORAGE_PREFIX}.{sanitizedOrigin}.channels : shared public channel list to listen during the poll - {LOCAL_STORAGE_PREFIX}.{sanitizedOrigin}.options : shared options - {LOCAL_STORAGE_PREFIX}.{sanitizedOrigin}.notification : the received notifications from the last poll - {LOCAL_STORAGE_PREFIX}.{sanitizedOrigin}.tab_list : list of opened tab ids - {LOCAL_STORAGE_PREFIX}.{sanitizedOrigin}.tab_master : generated id of the master tab

trigger: - window_focus : when the window is focused - notification : when a notification is receive from the long polling - become_master : when this tab became the master - no_longer_master : when this tab is not longer the master (the user swith tab)

method addChannel()

Share the bus channels with the others tab by the local storage

method deleteChannel()

Share the bus channels with the others tab by the local storage

method isMasterTab() → boolean

Tells whether this bus is related to the master tab.

Return Type
boolean
method startPolling()

Use the local storage to share the long polling from the master tab.

method updateOption()

Share the option with the local storage

module point_of_sale.devices
namespace
module sale.SalePortalSidebar.instance
namespace
module im_support.SupportSession
object instance of Session

This module returns an instance of Session which is linked to the Support server, allowing the current instance to communicate with the Support server (CORS).

module auth_password_policy.PasswordField

Defines a proper password field (rather than just an InputField option) to provide a “password strength” meter based on the database’s current policy & the 2word16 password policy recommended by Shay (2016) “Designing Password Policies for Strength and Usability”.

class PasswordField()
Extends
InputField
module website_sale_options.website_sale
module report.utils
namespace
module web.utils
Exports
Depends On
namespace utils
function assert(bool)

Throws an error if the given condition is not true

Parameters
    bool (any)
function binaryToBinsize(value) → string

Check if the value is a bin_size or not. If not, compute an approximate size out of the base64 encoded string.

Parameters
    value (string) – original format
Returns
bin_size (human-readable)
Return Type
string
function confine([val][, min][, max]) → number

Confines a value inside an interval

Parameters

    val (number) – the value to confine

    min (number) – the minimum of the interval

    max (number) – the maximum of the interval

Returns
val if val is in [min, max], min if val < min and max otherwise
Return Type
number
function generateID() → integer

Generate a unique numerical ID

Return Type
integer

Read the cookie described by c_name

Parameters
    c_name (string)
Return Type
string
function human_number(number[, decimals][, minDigits][, formatterCallback]) → string

Returns a human readable number (e.g. 34000 -> 34k).

Parameters

    number (number)

    decimals=0 (integer) – maximum number of decimals to use in human readable representation

    minDigits=1 (integer) – the minimum number of digits to preserve when switching to another level of thousands (e.g. with a value of ‘2’, 4321 will still be represented as 4321 otherwise it will be down to one digit (4k))

    formatterCallback (function) – a callback to transform the final number before adding the thousands symbol (default to adding thousands separators (useful if minDigits > 1))

Return Type
string
function human_size(size)

Returns a human readable size

Parameters
    size (Number) – number of bytes
function insert_thousand_seps(num) → String

Insert “thousands” separators in the provided number (which is actually a string)

Parameters
    num (String)
Return Type
String
function intersperse(str, indices, separator) → String

Intersperses separator in str at the positions indicated by indices.

indices is an array of relative offsets (from the previous insertion position, starting from the end of the string) at which to insert separator.

There are two special values:

-1
indicates the insertion should end now
0
indicates that the previous section pattern should be repeated (until all of str is consumed)
Parameters

    str (String)

    indices (Array<Number>)

    separator (String)

Return Type
String
function lpad(str, size) → string

Left-pad provided arg 1 with zeroes until reaching size provided by second argument.

Parameters

    str (number or string) – value to pad

    size (number) – size to reach on the final padded value

Returns
padded string
Return Type
string
function round_decimals(value, decimals)

performs a half up rounding with a fixed amount of decimals, correcting for float loss of precision See the corresponding float_round() in server/tools/float_utils.py for more info

Parameters

    value (Number) – the value to be rounded

    decimals (Number) – the number of decimals. eg: round_decimals(3.141592,2) -> 3.14

function round_precision(value, precision)

performs a half up rounding with arbitrary precision, correcting for float loss of precision See the corresponding float_round() in server/tools/float_utils.py for more info

Parameters

    value (number) – the value to be rounded

    precision (number) – a precision parameter. eg: 0.01 rounds to two digits.

Create a cookie

Parameters

    name (String) – the name of the cookie

    value (String) – the value stored in the cookie

    ttl (Integer) – time to live of the cookie in millis. -1 to erase the cookie.

function stableSort(array, iteratee)

Sort an array in place, keeping the initial order for identical values.

Parameters

    array (Array)

    iteratee (function)

function traverse(tree, f)

Visit a tree of objects, where each children are in an attribute ‘children’. For each children, we call the callback function given in arguments.

Parameters

    tree (Object) – an object describing a tree structure

    f (function) – a callback

function traversePath(tree, f, path)

Enhanced traverse function with ‘path’ building on traverse.

Parameters

    tree (Object) – an object describing a tree structure

    f (function) – a callback

    path (Object) – the path to the current ‘tree’ object

function deepFreeze(obj)

Visit a tree of objects and freeze all

Parameters
    obj (Object)
function closestNumber(num, arr) → Number|undefined

Find the closest value of the given one in the provided array

Parameters

    num (Number)

    arr (Array)

Return Type
Number or undefined
module portal.chatter
class PortalChatter(parent, options)
Extends
Parameters

    parent

    options

Widget PortalChatter

  • Fetch message fron controller
  • Display chatter: pager, total message, composer (according to access right)
  • Provider API to filter displayed messages
method messageFetch(domain) → Deferred

Fetch the messages and the message count from the server for the current page and current domain.

Parameters
    domain (Array)
Return Type
method preprocessMessages(messages) → Array

Update the messages format

Parameters
    messages (Array<Object>)
Return Type
Array
method round_to_half(value)

Round the given value with a precision of 0.5.

Examples: - 1.2 –> 1.0 - 1.7 –> 1.5 - 1.9 –> 2.0

Parameters
    value (Number)
namespace
class PortalChatter(parent, options)
Extends
Parameters

    parent

    options

Widget PortalChatter

  • Fetch message fron controller
  • Display chatter: pager, total message, composer (according to access right)
  • Provider API to filter displayed messages
method messageFetch(domain) → Deferred

Fetch the messages and the message count from the server for the current page and current domain.

Parameters
    domain (Array)
Return Type
method preprocessMessages(messages) → Array

Update the messages format

Parameters
    messages (Array<Object>)
Return Type
Array
method round_to_half(value)

Round the given value with a precision of 0.5.

Examples: - 1.2 –> 1.0 - 1.7 –> 1.5 - 1.9 –> 2.0

Parameters
    value (Number)
module mail.Service
class MailManager(parent)
Parameters
    parent
method addMessage(data)

For new posted message of current user in a document thread: store it in the localStorage to make it appear on the other tabs.

Note: ‘addMessage’ modifies the message in place (by setting the channel_id, so we must store the message in the localStorage before calling ‘addMessage’)

Parameters
class AddMessageData()
attribute author_id Array
[int, string] where int is server ID of
the author, and string is the name of the author.
attribute id integer

server ID of the message

attribute model string
the model name of the document that this
message is related to.
attribute res_id integer
the ID of the document that this message
is related to.
function createChannel(name, type) → $.Promise<integer>

Creates a channel, can be either a true channel or a DM chat based on type

Parameters

    name (integer or string) – id of partner (in case of dm) or name

    type (string) – [‘dm_chat’, ‘public’, ‘private’]

Returns
resolved with ID of the newly created channel
Return Type
jQuery.Promise<integer>
function getCannedResponses() → Array

Returns the list of canned responses A canned response is a pre-formatted text that is triggered with some keystrokes, such as with ‘:’.

Returns
array of Objects (mail.shortcode)
Return Type
Array
function getChannel(threadID) → mail.model.Channel|undefined

Returns a channel corresponding to the given id.

Parameters
    threadID (integer)
Returns
the channel, if it exists
Return Type
mail.model.Channel or undefined
function getChannels() → mail.model.Channel[]

Returns a list of channels

Returns
list of channels
Return Type
function getChannelPreviews() → $.Promise<Object[]>

Overrides to filter out the Support channel from the previews.

Returns
list of valid objects for mail.Preview template
Return Type
jQuery.Promise<Array<Object>>
function getDiscussMenuID() → integer

Returns the record id of ir.ui.menu for Discuss

Returns
record id
Return Type
integer
function getDMChatFromPartnerID(partnerID) → Object|undefined

Gets direct message channel

Parameters
    partnerID (integer)
Returns
channel
Return Type
Object or undefined
function getMailFailures() → mail.model.MailFailure[]

Returns a list of mail failures

Returns
list of mail failures
Return Type
function getMentionPartnerSuggestions() → Array<Object[]>

Get partners as mentions from a chatter Typically all employees as partner suggestions.

Return Type
Array<Array<Object>>
function getMessage(messageID) → mail.model.Message|undefined

Gets message from its ID

Parameters
    messageID (integer)
Returns
the matched message (if any)
Return Type
mail.model.Message or undefined
function getSystrayPreviews([filter]) → $.Promise<Object[]>

Returns the previews to display in the systray’s messaging menu.

Parameters
    filter=undefined (string) – specify ‘chat’ or ‘channels’ to only get previews for that type of threads
Returns
resolved with list of objects that have a valid format for rendering a messaging menu preview items.
Return Type
jQuery.Promise<Array<Object>>
function getModeratedChannelIDs() → integer[]

Get the list of channel IDs where the current user is a moderator

Return Type
Array<integer>
function getOdoobotID() → string

Get the OdooBot ID, which is the default authorID for transient messages

Return Type
string
function getThread(threadID) → mail.model.Thread|undefined

Returns thread matching provided ID, if any

Parameters
    threadID (string or integer)
Returns
the thread, if it exists
Return Type
mail.model.Thread or undefined
function getThreads() → mail.model.Thread[]

Returns a list of threads

Returns
list of threads
Return Type
function isMyselfModerator() → boolean

States whether the current user is a moderator or not

Return Type
boolean
function isReady() → $.Promise

States whether the mail manager is ready or not This is the case when it has fetched the initial state from the server, by means of the route ‘mail/init_messaging’

Return Type
jQuery.Promise
function joinChannel(channelID[, options]) → $.Promise<integer>

Join an existing channel See @createChannel to join a new channel

Parameters

    channelID (integer)

    options (Object) – options to be passed on channel add

Returns
resolved with channelID joined
Return Type
jQuery.Promise<integer>
function markMessagesAsRead(messageIDs) → $.Promise

Mark messages as read

Parameters
    messageIDs (Array) – list of messages IDs
Returns
resolved when messages have been marked as read on the server.
Return Type
jQuery.Promise
function openThread(threadID)

Open the thread window if discuss is not opened

Parameters
    threadID (integer or string)
function redirect(resModel, resID[, dmRedirectionCallback])

Special redirection handling for given model and id

If the model is res.partner, and there is a user associated with this partner which isn’t the current user, open the DM chat with this user. Otherwhise, open the record’s form view (if not current user’s).

Parameters

    resModel (string) – model to open

    resID (integer) – record to open

    dmRedirectionCallback (function) – only used if ‘res.partner’, a function that has a threadID as input

function removeMessageFromThreads(message)

Remove the message from all of its threads

Parameters
function searchPartner(searchVal, limit) → $.Promise<Object[]>

Search among prefetched partners, using the string ‘searchVal’

Parameters

    searchVal (string)

    limit (integer) – max number of found partners in the response

Returns
list of found partners (matching ‘searchVal’)
Return Type
jQuery.Promise<Array<Object>>
function unstarAll() → $.Promise

Unstars all messages from all channels

Return Type
jQuery.Promise
function getDocumentThread(model, resID) → integer

Returns a document thread corresponding to the given model and resID.

Parameters

    model (string) – of the document thread, if it exists

    resID

Returns
resID of the document thread, if it exists
Return Type
integer
function getOrAddDocumentThread(params) → mail.model.DocumentThread

Add a new document thread, or get if it exists already.

Also, if a name is provided for the document thread, it overwrites the previous one.

class GetOrAddDocumentThreadParams()
attribute message_ids interger[]
the list of message ids linked
to the document (if not given, they will be fetched before fetching the messages)
attribute name string
if provided, overwrites the name of the
existing document thread
attribute resID integer
attribute resModel string
function updateDocumentThreadState(threadID, state)

Updates the state of a given document thread (stored in localStorage). Garbage collects windows previously marked as ‘closed’ (assuming that the info has already been processed by the other tabs).

Parameters
class UpdateDocumentThreadStateState()
attribute name string

name of the document thread

attribute windowState string

(‘closed’, ‘folded’ or ‘open’)

function initSupport()

Initialises the Support: checks if there is a pending chat session between the user and Support, and if so, re-opens it. Note: we can’t directly override init(), because it is already called when the include is applied, so we use this hook instead (called at webclient startup)

function startPollingSupport([pollingDelay])

Initiates a longpoll with the server hosting the Support channel.

Parameters
    pollingDelay=POLL_TIMEOUT_DELAY (integer) – the longpolling timeout delay to set
function startSupportLivechat([channelState]) → Deferred

Opens the Support channel between a livechat operator from the Support database and the current user (if there is an available operator). Ensures to perform only once the request to create/retrieve the Support channel.

Parameters
    channelState=’open’ (string) – state of the Support channel (see CHANNEL_STATES for accepted values)
Return Type
function updateSupportChannelState(state)

Updates the state of the Support channel (stored in the localStorage).

Parameters
    state (string) – (‘closed’, ‘folded’ or ‘open’)
function openBlankThreadWindow()

Open the blank thread window (i.e. the thread window without any thread linked to it). Make it if there is no blank thread window yet.

function openDMChatWindowFromBlankThreadWindow(partnerID)

Open a DM chat in a thread window. This is useful when selecting a DM chatin the blank thread window, so that it replaces it with the DM chat window.

Parameters
    partnerID (integer)
function openThreadWindow(threadID[, options])

Open a thread in a thread window

Parameters
class OpenThreadWindowOptions()
attribute passively boolean
if set to true, open the thread
window without focusing the input and marking messages as read if it is not open yet, and do nothing otherwise.
attribute keepFoldState boolean
if set to true, keep the
fold state of the thread
function updateThreadWindow(threadID, options)

Called when a thread has its window state that has been changed, so its thread window view should be changed to match the model.

Parameters

    threadID (integer or string)

    options (UpdateThreadWindowOptions) – option to be applied on opening thread window, if the thread is detached

class UpdateThreadWindowOptions()
option to be applied on opening thread window, if
the thread is detached
attribute passively boolean
if set, the window will behave
passively.
module web.CalendarQuickCreate
class QuickCreate(parent, buttons, options, dataTemplate, dataCalendar)
Extends
Parameters

    parent (Widget)

    buttons (Object)

    options (Object)

    dataTemplate (Object)

    dataCalendar (Object)

Quick creation view.

Triggers a single event “added” with a single parameter “name”, which is the name entered by the user

class QuickCreate(parent, buttons, options, dataTemplate, dataCalendar)
Extends
Parameters

    parent (Widget)

    buttons (Object)

    options (Object)

    dataTemplate (Object)

    dataCalendar (Object)

Quick creation view.

Triggers a single event “added” with a single parameter “name”, which is the name entered by the user

module web.Dialog
class Dialog(parent[, options])
Extends
Parameters

A useful class to handle dialogs. Attributes:

$footer
A jQuery element targeting a dom part where buttons can be added. It always exists during the lifecycle of the dialog.
method willStart()

Wait for XML dependencies and instantiate the modal structure (except modal-body).

method destroy([options])

Close and destroy the dialog.

Parameters
class DestroyOptions()
attribute infos Object
if provided and silent is unset, the
on_close handler will pass this information related to closing this information.
attribute silent boolean
if set, do not call the
on_close handler.
function rebindButtonBehavior()

adds the keydown behavior to the dialogs after external files modifies its DOM.

function safeConfirm(owner, message[, options]) → Dialog

Static method to open double confirmation dialog.

Parameters
Returns
(open() is automatically called)
Return Type
class SafeConfirmOptions()

@see Dialog.init @see Dialog.confirm

attribute securityLevel string

bootstrap color

attribute securityMessage string

am sure about this”]

class DialogOptions()
attribute title string
attribute subtitle string
attribute size string

‘large’, ‘medium’ or ‘small’

attribute fullscreen boolean
whether or not the dialog
should be open in fullscreen mode (the main usecase is mobile)
attribute dialogClass string

class to add to the modal-body

attribute $content jQuery
Element which will be the $el, replace the .modal-body and get the
modal-body class
attribute buttons Object[]
List of button descriptions. Note: if no buttons, a “ok” primary
button is added to allow closing the dialog
attribute buttons[].text string
attribute buttons[].classes string
Default to ‘btn-primary’ if only one button, ‘btn-secondary’
otherwise
attribute buttons[].close boolean
attribute buttons[].click function
attribute buttons[].disabled boolean
attribute technical boolean
If set to false, the modal will have the standard frontend style
(use this for non-editor frontend features)
class Dialog(parent[, options])
Extends
Parameters

A useful class to handle dialogs. Attributes:

$footer
A jQuery element targeting a dom part where buttons can be added. It always exists during the lifecycle of the dialog.
method willStart()

Wait for XML dependencies and instantiate the modal structure (except modal-body).

method destroy([options])

Close and destroy the dialog.

Parameters
class DestroyOptions()
attribute infos Object
if provided and silent is unset, the
on_close handler will pass this information related to closing this information.
attribute silent boolean
if set, do not call the
on_close handler.
function rebindButtonBehavior()

adds the keydown behavior to the dialogs after external files modifies its DOM.

function safeConfirm(owner, message[, options]) → Dialog

Static method to open double confirmation dialog.

Parameters
Returns
(open() is automatically called)
Return Type
class SafeConfirmOptions()

@see Dialog.init @see Dialog.confirm

attribute securityLevel string

bootstrap color

attribute securityMessage string

am sure about this”]

class DialogOptions()
attribute title string
attribute subtitle string
attribute size string

‘large’, ‘medium’ or ‘small’

attribute fullscreen boolean
whether or not the dialog
should be open in fullscreen mode (the main usecase is mobile)
attribute dialogClass string

class to add to the modal-body

attribute $content jQuery
Element which will be the $el, replace the .modal-body and get the
modal-body class
attribute buttons Object[]
List of button descriptions. Note: if no buttons, a “ok” primary
button is added to allow closing the dialog
attribute buttons[].text string
attribute buttons[].classes string
Default to ‘btn-primary’ if only one button, ‘btn-secondary’
otherwise
attribute buttons[].close boolean
attribute buttons[].click function
attribute buttons[].disabled boolean
attribute technical boolean
If set to false, the modal will have the standard frontend style
(use this for non-editor frontend features)
module web.session
Exports
Depends On
object session instance of Session
module website_slides.slides
namespace
module base.settings
namespace
module auth_password_policy
Depends On
namespace
function computeScore(password, requirements, recommendations)

Computes the password’s score, should be roughly continuous, under 0.5 if the requirements don’t pass and at 1 if the recommendations are exceeded

Parameters

    password

    requirements

    recommendations

module web_tour.RunningTourActionHelper
class RunningTourActionHelper(tip_widget)
Extends
Parameters
    tip_widget
module web.GraphRenderer
class (parent, state, params)
Parameters
function on_attach_callback()

The graph view uses the nv(d3) lib to render the graph. This lib requires that the rendering is done directly into the DOM (so that it can correctly compute positions). However, the views are always rendered in fragments, and appended to the DOM once ready (to prevent them from flickering). We here use the on_attach_callback hook, called when the widget is attached to the DOM, to perform the rendering. This ensures that the rendering is always done in the DOM.

class Params()
attribute stacked boolean
module web.TimeRangeMenu
class TimeRangeMenu(parent, fields, configuration)
Extends
Parameters

    parent (Widget)

    fields (Object)

    configuration (Object)

method facetFor() → Object

Generates a Facet() descriptor from a filter descriptor

Return Type
Object
module mail.ActivityView
class ActivityView(viewInfo, params)
Parameters
class ActivityViewViewInfo()
attribute arch Object
attribute fields Object
attribute fieldsInfo Object
class ActivityViewParams()
attribute modelName string

The actual model name

attribute context Object
attribute count number
attribute controllerID string
attribute domain string[]
attribute timeRange string[][]
attribute comparisonTimeRange string[][]
attribute timeRangeDescription string
attribute comparisonTimeRangeDescription string
attribute compare boolean
attribute groupBy string[]
attribute currentId number
attribute isEmbedded boolean
attribute ids number[]
attribute withControlPanel boolean
attribute action.flags.headless boolean
attribute action.display_name string
attribute action.name string
attribute action.help string
attribute action.jsID string
attribute action.views boolean
module point_of_sale.screens
namespace
module web.translation
Depends On
function _t(source) → String

Eager translation function, performs translation immediately at call site. Beware using this outside of method bodies (before the translation database is loaded), you probably want _lt() instead.

Parameters
    source (String) – string to translate
Returns
source translated into the current locale
Return Type
String
function _lt(s) → Object

Lazy translation function, only performs the translation when actually printed (e.g. inserted into a template)

Useful when defining translatable strings in code evaluated before the translation database is loaded, as class attributes or at the top-level of an OpenERP Web module

Parameters
    s (String) – string to translate
Returns
lazy translation object
Return Type
Object
namespace
function _t(source) → String

Eager translation function, performs translation immediately at call site. Beware using this outside of method bodies (before the translation database is loaded), you probably want _lt() instead.

Parameters
    source (String) – string to translate
Returns
source translated into the current locale
Return Type
String
function _lt(s) → Object

Lazy translation function, only performs the translation when actually printed (e.g. inserted into a template)

Useful when defining translatable strings in code evaluated before the translation database is loaded, as class attributes or at the top-level of an OpenERP Web module

Parameters
    s (String) – string to translate
Returns
lazy translation object
Return Type
Object
module website.theme
class ThemeCustomizeDialog(parent, options)
Extends
Parameters

    parent

    options

module web.KanbanModel
class KanbanModel()
Extends
method addRecordToGroup(groupID, resId) → Deferred<string>

Adds a record to a group in the localData, and fetch the record.

Parameters

    groupID (string) – localID of the group

    resId (integer) – id of the record

Returns
resolves to the local id of the new record
Return Type
Deferred<string>
method createGroup(name, parentID) → Deferred<string>

Creates a new group from a name (performs a name_create).

Parameters

    name (string)

    parentID (string) – localID of the parent of the group

Returns
resolves to the local id of the new group
Return Type
Deferred<string>
method createRecordInGroup(groupID, values) → Deferred

Creates a new record from the given value, and add it to the given group.

Parameters

    groupID (string)

    values (Object)

Returns
resolved with the local id of the created record
Return Type
method get() → Object

Add the following (kanban specific) keys when performing a get:

  • tooltipData
  • progressBarValues
  • isGroupedByM2ONoColumn
Return Type
Object
method getColumn(id) → Object

Same as @see get but getting the parent element whose ID is given.

Parameters
    id (string)
Return Type
Object
method loadColumnRecords(groupID) → Deferred

Opens a given group and loads its <limit> first records

Parameters
    groupID (string)
Return Type
method loadMore(groupID) → Deferred<string>

Load more records in a group.

Parameters
    groupID (string) – localID of the group
Returns
resolves to the localID of the group
Return Type
Deferred<string>
method moveRecord(recordID, groupID, parentID) → Deferred<string[]>

Moves a record from a group to another.

Parameters

    recordID (string) – localID of the record

    groupID (string) – localID of the new group of the record

    parentID (string) – localID of the parent

Returns
resolves to a pair [oldGroupID, newGroupID]
Return Type
Deferred<Array<string>>
module web_editor.backend
namespace
class FieldTextHtmlSimple()
Extends
DebouncedField
Mixes
  • TranslatableFieldMixin

FieldTextHtmlSimple Widget Intended to display HTML content. This widget uses the summernote editor improved by odoo.

method commitChanges()

Summernote doesn’t notify for changes done in code mode. We override commitChanges to manually switch back to normal mode before committing changes, so that the widget is aware of the changes done in code mode.

method reset(record, event)

Do not re-render this field if it was the origin of the onchange call.

Parameters

    record

    event

class FieldTextHtmlSimple()
Extends
DebouncedField
Mixes
  • TranslatableFieldMixin

FieldTextHtmlSimple Widget Intended to display HTML content. This widget uses the summernote editor improved by odoo.

method commitChanges()

Summernote doesn’t notify for changes done in code mode. We override commitChanges to manually switch back to normal mode before committing changes, so that the widget is aware of the changes done in code mode.

method reset(record, event)

Do not re-render this field if it was the origin of the onchange call.

Parameters

    record

    event

module mail.Manager
class MailManager(parent)
Parameters
    parent
method addMessage(data)

For new posted message of current user in a document thread: store it in the localStorage to make it appear on the other tabs.

Note: ‘addMessage’ modifies the message in place (by setting the channel_id, so we must store the message in the localStorage before calling ‘addMessage’)

Parameters
class AddMessageData()
attribute author_id Array
[int, string] where int is server ID of
the author, and string is the name of the author.
attribute id integer

server ID of the message

attribute model string
the model name of the document that this
message is related to.
attribute res_id integer
the ID of the document that this message
is related to.
function createChannel(name, type) → $.Promise<integer>

Creates a channel, can be either a true channel or a DM chat based on type

Parameters

    name (integer or string) – id of partner (in case of dm) or name

    type (string) – [‘dm_chat’, ‘public’, ‘private’]

Returns
resolved with ID of the newly created channel
Return Type
jQuery.Promise<integer>
function getCannedResponses() → Array

Returns the list of canned responses A canned response is a pre-formatted text that is triggered with some keystrokes, such as with ‘:’.

Returns
array of Objects (mail.shortcode)
Return Type
Array
function getChannel(threadID) → mail.model.Channel|undefined

Returns a channel corresponding to the given id.

Parameters
    threadID (integer)
Returns
the channel, if it exists
Return Type
mail.model.Channel or undefined
function getChannels() → mail.model.Channel[]

Returns a list of channels

Returns
list of channels
Return Type
function getChannelPreviews() → $.Promise<Object[]>

Overrides to filter out the Support channel from the previews.

Returns
list of valid objects for mail.Preview template
Return Type
jQuery.Promise<Array<Object>>
function getDiscussMenuID() → integer

Returns the record id of ir.ui.menu for Discuss

Returns
record id
Return Type
integer
function getDMChatFromPartnerID(partnerID) → Object|undefined

Gets direct message channel

Parameters
    partnerID (integer)
Returns
channel
Return Type
Object or undefined
function getMailFailures() → mail.model.MailFailure[]

Returns a list of mail failures

Returns
list of mail failures
Return Type
function getMentionPartnerSuggestions() → Array<Object[]>

Get partners as mentions from a chatter Typically all employees as partner suggestions.

Return Type
Array<Array<Object>>
function getMessage(messageID) → mail.model.Message|undefined

Gets message from its ID

Parameters
    messageID (integer)
Returns
the matched message (if any)
Return Type
mail.model.Message or undefined
function getSystrayPreviews([filter]) → $.Promise<Object[]>

Returns the previews to display in the systray’s messaging menu.

Parameters
    filter=undefined (string) – specify ‘chat’ or ‘channels’ to only get previews for that type of threads
Returns
resolved with list of objects that have a valid format for rendering a messaging menu preview items.
Return Type
jQuery.Promise<Array<Object>>
function getModeratedChannelIDs() → integer[]

Get the list of channel IDs where the current user is a moderator

Return Type
Array<integer>
function getOdoobotID() → string

Get the OdooBot ID, which is the default authorID for transient messages

Return Type
string
function getThread(threadID) → mail.model.Thread|undefined

Returns thread matching provided ID, if any

Parameters
    threadID (string or integer)
Returns
the thread, if it exists
Return Type
mail.model.Thread or undefined
function getThreads() → mail.model.Thread[]

Returns a list of threads

Returns
list of threads
Return Type
function isMyselfModerator() → boolean

States whether the current user is a moderator or not

Return Type
boolean
function isReady() → $.Promise

States whether the mail manager is ready or not This is the case when it has fetched the initial state from the server, by means of the route ‘mail/init_messaging’

Return Type
jQuery.Promise
function joinChannel(channelID[, options]) → $.Promise<integer>

Join an existing channel See @createChannel to join a new channel

Parameters

    channelID (integer)

    options (Object) – options to be passed on channel add

Returns
resolved with channelID joined
Return Type
jQuery.Promise<integer>
function markMessagesAsRead(messageIDs) → $.Promise

Mark messages as read

Parameters
    messageIDs (Array) – list of messages IDs
Returns
resolved when messages have been marked as read on the server.
Return Type
jQuery.Promise
function openThread(threadID)

Open the thread window if discuss is not opened

Parameters
    threadID (integer or string)
function redirect(resModel, resID[, dmRedirectionCallback])

Special redirection handling for given model and id

If the model is res.partner, and there is a user associated with this partner which isn’t the current user, open the DM chat with this user. Otherwhise, open the record’s form view (if not current user’s).

Parameters

    resModel (string) – model to open

    resID (integer) – record to open

    dmRedirectionCallback (function) – only used if ‘res.partner’, a function that has a threadID as input

function removeMessageFromThreads(message)

Remove the message from all of its threads

Parameters
function searchPartner(searchVal, limit) → $.Promise<Object[]>

Search among prefetched partners, using the string ‘searchVal’

Parameters

    searchVal (string)

    limit (integer) – max number of found partners in the response

Returns
list of found partners (matching ‘searchVal’)
Return Type
jQuery.Promise<Array<Object>>
function unstarAll() → $.Promise

Unstars all messages from all channels

Return Type
jQuery.Promise
function getDocumentThread(model, resID) → integer

Returns a document thread corresponding to the given model and resID.

Parameters

    model (string) – of the document thread, if it exists

    resID

Returns
resID of the document thread, if it exists
Return Type
integer
function getOrAddDocumentThread(params) → mail.model.DocumentThread

Add a new document thread, or get if it exists already.

Also, if a name is provided for the document thread, it overwrites the previous one.

class GetOrAddDocumentThreadParams()
attribute message_ids interger[]
the list of message ids linked
to the document (if not given, they will be fetched before fetching the messages)
attribute name string
if provided, overwrites the name of the
existing document thread
attribute resID integer
attribute resModel string
function updateDocumentThreadState(threadID, state)

Updates the state of a given document thread (stored in localStorage). Garbage collects windows previously marked as ‘closed’ (assuming that the info has already been processed by the other tabs).

Parameters
class UpdateDocumentThreadStateState()
attribute name string

name of the document thread

attribute windowState string

(‘closed’, ‘folded’ or ‘open’)

function initSupport()

Initialises the Support: checks if there is a pending chat session between the user and Support, and if so, re-opens it. Note: we can’t directly override init(), because it is already called when the include is applied, so we use this hook instead (called at webclient startup)

function startPollingSupport([pollingDelay])

Initiates a longpoll with the server hosting the Support channel.

Parameters
    pollingDelay=POLL_TIMEOUT_DELAY (integer) – the longpolling timeout delay to set
function startSupportLivechat([channelState]) → Deferred

Opens the Support channel between a livechat operator from the Support database and the current user (if there is an available operator). Ensures to perform only once the request to create/retrieve the Support channel.

Parameters
    channelState=’open’ (string) – state of the Support channel (see CHANNEL_STATES for accepted values)
Return Type
function updateSupportChannelState(state)

Updates the state of the Support channel (stored in the localStorage).

Parameters
    state (string) – (‘closed’, ‘folded’ or ‘open’)
function openBlankThreadWindow()

Open the blank thread window (i.e. the thread window without any thread linked to it). Make it if there is no blank thread window yet.

function openDMChatWindowFromBlankThreadWindow(partnerID)

Open a DM chat in a thread window. This is useful when selecting a DM chatin the blank thread window, so that it replaces it with the DM chat window.

Parameters
    partnerID (integer)
function openThreadWindow(threadID[, options])

Open a thread in a thread window

Parameters
class OpenThreadWindowOptions()
attribute passively boolean
if set to true, open the thread
window without focusing the input and marking messages as read if it is not open yet, and do nothing otherwise.
attribute keepFoldState boolean
if set to true, keep the
fold state of the thread
function updateThreadWindow(threadID, options)

Called when a thread has its window state that has been changed, so its thread window view should be changed to match the model.

Parameters

    threadID (integer or string)

    options (UpdateThreadWindowOptions) – option to be applied on opening thread window, if the thread is detached

class UpdateThreadWindowOptions()
option to be applied on opening thread window, if
the thread is detached
attribute passively boolean
if set, the window will behave
passively.
module web.ListController
class ListController()
Mixes
  • includeDict
method getActiveDomain() → Deferred<array[]>

Calculate the active domain of the list view. This should be done only if the header checkbox has been checked. This is done by evaluating the search results, and then adding the dataset domain (i.e. action domain).

Returns
a deferred that resolve to the active domain
Return Type
Deferred<Array<array>>
method getSelectedIds() → number[]

Returns the list of currently selected res_ids (with the check boxes on the left)

Returns
list of res_ids
Return Type
Array<number>
method getSelectedRecords() → Object[]

Returns the list of currently selected records (with the check boxes on the left)

Returns
list of records
Return Type
Array<Object>
attribute buttons_template String

This key contains the name of the buttons template to render on top of the form view. It can be overridden to add buttons in specific child views.

method renderButtons()

Extends the renderButtons function of ListView by adding an event listener on the import button.

method renderSidebar($node)

Render the sidebar (the ‘action’ menu in the control panel, right of the main buttons)

Parameters
    $node (jQuery)
method update(params, options)

Overrides to update the list of selected records

Parameters

    params

    options

module web.Domain
class Domain(domain[, evalContext])
Extends
Parameters

    domain (string or Array or boolean or undefined) – The given domain can be: * a string representation of the Python prefix-array representation of the domain. * a JS prefix-array representation of the domain. * a boolean where the “true” domain match all records and the “false” domain does not match any records. * undefined, considered as the false boolean. * a number, considered as true except 0 considered as false.

    evalContext (Object) – in case the given domain is a string, an evaluation context might be needed

The Domain Class allows to work with a domain as a tree and provides tools to manipulate array and string representations of domains.

method compute(values) → boolean

Evaluates the domain with a set of values.

Parameters
    values (Object) – a mapping {fieldName -> fieldValue} (note: all the fields used in the domain should be given a value otherwise the computation will break)
Return Type
boolean
method toArray() → Array

Return the JS prefix-array representation of this domain. Note that all domains that use the “false” domain cannot be represented as such.

Returns
JS prefix-array representation of this domain
Return Type
Array
method arrayToString(domain) → string

Converts JS prefix-array representation of a domain to a string representation of the Python prefix-array representation of this domain.

Parameters
    domain (Array or string)
Return Type
string
method stringToArray(domain[, evalContext]) → Array

Converts a string representation of the Python prefix-array representation of a domain to a JS prefix-array representation of this domain.

Parameters

    domain (string or Array)

    evalContext (Object)

Return Type
Array
method normalizeArray(domain) → Array

Makes implicit “&” operators explicit in the given JS prefix-array representation of domain (e.g [A, B] -> [“&”, A, B])

Parameters
    domain (Array) – the JS prefix-array representation of the domain to normalize (! will be normalized in-place)
Returns
the normalized JS prefix-array representation of the given domain
Return Type
Array
method domainToCondition(domain) → string

Converts JS prefix-array representation of a domain to a python condition

Parameters
    domain (Array)
Return Type
string
method conditionToDomain(condition) → Array

Converts python condition to a JS prefix-array representation of a domain

Parameters
    condition (string)
Return Type
Array
class Domain(domain[, evalContext])
Extends
Parameters

    domain (string or Array or boolean or undefined) – The given domain can be: * a string representation of the Python prefix-array representation of the domain. * a JS prefix-array representation of the domain. * a boolean where the “true” domain match all records and the “false” domain does not match any records. * undefined, considered as the false boolean. * a number, considered as true except 0 considered as false.

    evalContext (Object) – in case the given domain is a string, an evaluation context might be needed

The Domain Class allows to work with a domain as a tree and provides tools to manipulate array and string representations of domains.

method compute(values) → boolean

Evaluates the domain with a set of values.

Parameters
    values (Object) – a mapping {fieldName -> fieldValue} (note: all the fields used in the domain should be given a value otherwise the computation will break)
Return Type
boolean
method toArray() → Array

Return the JS prefix-array representation of this domain. Note that all domains that use the “false” domain cannot be represented as such.

Returns
JS prefix-array representation of this domain
Return Type
Array
method arrayToString(domain) → string

Converts JS prefix-array representation of a domain to a string representation of the Python prefix-array representation of this domain.

Parameters
    domain (Array or string)
Return Type
string
method stringToArray(domain[, evalContext]) → Array

Converts a string representation of the Python prefix-array representation of a domain to a JS prefix-array representation of this domain.

Parameters

    domain (string or Array)

    evalContext (Object)

Return Type
Array
method normalizeArray(domain) → Array

Makes implicit “&” operators explicit in the given JS prefix-array representation of domain (e.g [A, B] -> [“&”, A, B])

Parameters
    domain (Array) – the JS prefix-array representation of the domain to normalize (! will be normalized in-place)
Returns
the normalized JS prefix-array representation of the given domain
Return Type
Array
method domainToCondition(domain) → string

Converts JS prefix-array representation of a domain to a python condition

Parameters
    domain (Array)
Return Type
string
method conditionToDomain(condition) → Array

Converts python condition to a JS prefix-array representation of a domain

Parameters
    condition (string)
Return Type
Array
module web.KanbanRecord
class KanbanRecord(parent, state, options)
Extends
Parameters

    parent

    state

    options

method on_attach_callback()

Called each time the record is attached to the DOM.

method on_detach_callback()

Called each time the record is detached from the DOM.

method update(state) → Deferred

Re-renders the record with a new state

Parameters
    state (Object)
Return Type
module web.sessionStorage
object storage instance of RamStorage
module web_editor.BodyManager
class BodyManager()

Element which is designed to be unique and that will be the top-most element in the widget hierarchy. So, all other widgets will be indirectly linked to this Class instance. Its main role will be to retrieve RPC demands from its children and handle them.

class BodyManager()

Element which is designed to be unique and that will be the top-most element in the widget hierarchy. So, all other widgets will be indirectly linked to this Class instance. Its main role will be to retrieve RPC demands from its children and handle them.

module website_sale.utils
namespace
module web_editor.rte
namespace
module web.dom
namespace
function append([$target, ][content, ]options)

Appends content in a jQuery object and optionnally triggers an event

Parameters

    $target (jQuery) – the node where content will be appended

    content (htmlString or Element or Array or jQuery) – DOM element, array of elements, HTML string or jQuery object to append to $target

    options (AppendOptions)

class AppendOptions()
attribute in_DOM Boolean

true if $target is in the DOM

attribute callbacks Array
array of objects describing the
callbacks to perform (see _notify for a complete description)
function autoresize($textarea, options)

Autoresize a $textarea node, by recomputing its height when necessary

Parameters
class AutoresizeOptions()
attribute min_height number

by default, 50.

attribute parent Widget
if set, autoresize will listen to some
extra events to decide when to resize itself. This is useful for widgets that are not in the dom when the autoresize is declared.
function cssFind($from, selector) → jQuery

jQuery find function behavior is:

$('A').find('A B') <=> $('A A B')

The searches behavior to find options’ DOM needs to be:

$('A').find('A B') <=> $('A B')

This is what this function does.

Parameters

    $from (jQuery) – the jQuery element(s) from which to search

    selector (string) – the CSS selector to match

Return Type
jQuery
function detach([to_detach, ]options) → jQuery

Detaches widgets from the DOM and performs their on_detach_callback()

Parameters

    to_detach (Array) – array of {widget: w, callback_args: args} such that w.$el will be detached and w.on_detach_callback(args) will be called

    options (DetachOptions)

Returns
the detached elements
Return Type
jQuery
class DetachOptions()
attribute $to_detach jQuery
if given, detached instead of
widgets’ $el
function getSelectionRange(node) → Object

Returns the selection range of an input or textarea

Parameters
    node (Object) – DOM item input or texteara
Returns
range
Return Type
Object
function getPosition(e) → Object

Returns the distance between a DOM element and the top-left corner of the window

Parameters
    e (Object) – DOM element (input or texteara)
Returns
the left and top distances in pixels
Return Type
Object
function prepend([$target, ][content, ]options)

Prepends content in a jQuery object and optionnally triggers an event

Parameters

    $target (jQuery) – the node where content will be prepended

    content (htmlString or Element or Array or jQuery) – DOM element, array of elements, HTML string or jQuery object to prepend to $target

    options (PrependOptions)

class PrependOptions()
attribute in_DOM Boolean

true if $target is in the DOM

attribute callbacks Array
array of objects describing the
callbacks to perform (see _notify for a complete description)
function renderButton(options) → jQuery

Renders a button with standard odoo template. This does not use any xml template to avoid forcing the frontend part to lazy load a xml file for each widget which might want to create a simple button.

Parameters
Return Type
jQuery
class RenderButtonOptions()
attribute attrs Object

Attributes to put on the button element

attribute attrs.type string
attribute attrs.class string
Note: automatically completed with “btn btn-X”
(@see options.size for the value of X)
attribute size string

@see options.attrs.class

attribute icon string
The specific fa icon class (for example “fa-home”) or an URL for
an image to use as icon.
attribute text string

the button’s text

function renderCheckbox([options]) → jQuery

Renders a checkbox with standard odoo/BS template. This does not use any xml template to avoid forcing the frontend part to lazy load a xml file for each widget which might want to create a simple checkbox.

Parameters
Return Type
jQuery
class RenderCheckboxOptions()
attribute prop Object

Allows to set the input properties (disabled and checked states).

attribute text string
The checkbox’s associated text. If none is given then a simple
checkbox is rendered.
function setSelectionRange(node, range)

Sets the selection range of a given input or textarea

Parameters
class SetSelectionRangeRange()
attribute start integer
attribute end integer
function initAutoMoreMenu($el[, options])

Creates an automatic ‘more’ dropdown-menu for a set of navbar items.

Parameters
class InitAutoMoreMenuOptions()
attribute unfoldable string
attribute maxWidth function
attribute sizeClass string
function destroyAutoMoreMenu($el)

Cleans what has been done by initAutoMoreMenu.

Parameters
    $el (jQuery)
function _notify([content, ]callbacks)

Private function to notify that something has been attached in the DOM

Parameters

    content (htmlString or Element or Array or jQuery) – the content that has been attached in the DOM

    callbacks

module website.utils
namespace
function autocompleteWithPages(self, $input)

Allows the given input to propose existing website URLs.

Parameters
function autocompleteWithPages(self, $input)

Allows the given input to propose existing website URLs.

Parameters
module web.AppsMenu
Exports
Depends On
class AppsMenu(parent, menuData)
Extends
Parameters
method openFirstApp()

Open the first app in the list of apps

class AppsMenuMenuData()
attribute children Object[]
module web.DomainSelectorDialog
Exports
<anonymous>
class DomainSelectorDialog(parent, model, domain, options)
Extends
Parameters

    parent

    model

    domain

    options

module web.FormRenderer
class FormRenderer(parent, state, params)
Parameters

    parent

    state

    params

method autofocus() → int | undefined

Focuses the field having attribute ‘default_focus’ set, if any, or the first focusable field otherwise. In read mode, delegate which button to give the focus to, to the form_renderer

Returns
the index of the widget activated else undefined
Return Type
int or undefined
method canBeSaved(recordID) → string[]

Extend the method so that labels also receive the ‘o_field_invalid’ class if necessary.

Parameters
    recordID (string)
Return Type
Array<string>
method displayTranslationAlert(alertFields)

Show a warning message if the user modified a translated field. For each field, the notification provides a link to edit the field’s translations.

Parameters
    alertFields (Array<Object>) – field list
method confirmChange(state, id, fields)

Updates the chatter area with the new state if its fields has changed

Parameters

    state

    id

    fields

method disableButtons()

Disable statusbar buttons and stat buttons so that they can’t be clicked anymore

method enableButtons()

Enable statusbar buttons and stat buttons so they can be clicked again

method focusLastActivatedWidget()

Put the focus on the last activated widget. This function is used when closing a dialog to give the focus back to the form that has opened it and ensures that the focus is in the correct field.

method getLocalState() → Object

returns the active tab pages for each notebook

Returns
a map from notebook name to the active tab index
Return Type
Object
method resetLastActivatedField()

Reset the tracking of the last activated field. The fast entry with keyboard navigation needs to track the last activated field in order to set the focus.

In particular, when there are changes of mode (e.g. edit -> readonly -> edit), we do not want to auto-set the focus on the previously last activated field. To avoid this issue, this method should be called whenever there is a change of mode.

method setLocalState(state)

restore active tab pages for each notebook

Parameters
    state (Object) – the result from a getLocalState call
module web.FieldManagerMixin
namespace FieldManagerMixin
module website.backend.dashboard
class Dashboard(parent, context)
Parameters

    parent

    context

method fetch_data()

Fetches dashboard data

module web.ServicesMixin
Depends On
mixin ServicesMixin
function do_action(action, options) → Deferred

Informs the action manager to do an action. This supposes that the action manager can be found amongst the ancestors of the current widget. If that’s not the case this method will simply return an unresolved deferred.

Parameters

    action (any)

    options (any)

Return Type
module web.ActionManager
class ActionManager(parent[, userContext])
Extends
Parameters

    parent

    userContext={} (Object)

method on_attach_callback()

Called each time the action manager is attached into the DOM.

method on_detach_callback()

Called each time the action manager is detached from the DOM.

method clearUncommittedChanges() → Deferred

This function is called when the current controller is about to be removed from the DOM, because a new one will be pushed, or an old one will be restored. It ensures that the current controller can be left (for instance, that it has no unsaved changes).

Returns
resolved if the current controller can be left, rejected otherwise.
Return Type
method doAction(action[, options]) → $.Deferred<Object>

This is the entry point to execute Odoo actions, given as an ID in database, an xml ID, a client action tag or an action descriptor.

Parameters

    action (number or string or Object) – the action to execute

    options (DoActionOptions)

Returns
resolved with the action when the action is loaded and appended to the DOM ; rejected if the action can’t be executed (e.g. if doAction has been called to execute another action before this one was complete).
Return Type
jQuery.Deferred<Object>
class DoActionOptions()
attribute additional_context Object
additional context to be
merged with the action’s context.
attribute clear_breadcrumbs boolean
set to true to clear
the breadcrumbs history list
attribute on_close Function
callback to be executed when the
current action is active again (typically, if the new action is executed in target=”new”, on_close will be executed when the dialog is closed, if the current controller is still active)
attribute on_reverse_breadcrumb Function
callback to be executed
whenever an anterior breadcrumb item is clicked on
attribute pushState boolean
set to false to prevent the
ActionManager from pushing the state when the action is executed (this is useful when we come from a loadState())
attribute replace_last_action boolean
set to true to
replace last part of the breadcrumbs with the action
function do_push_state(state)

Compatibility with client actions that are still using do_push_state.

Parameters
    state (Object)
function getCurrentAction() → Object|null

Returns the action of the last controller in the controllerStack, i.e. the action of the currently displayed controller in the main window (not in a dialog), and null if there is no controller in the stack.

Return Type
Object or null
function getCurrentController() → Object|null

Returns the last controller in the controllerStack, i.e. the currently displayed controller in the main window (not in a dialog), and null if there is no controller in the stack.

Return Type
Object or null
function loadState(state)

Overrides to handle the case where an ‘ir.actions.act_window’ has to be loaded.

Parameters
class LoadStateState()
attribute action integer|string
the ID or xml ID of the action to
execute
attribute active_id integer
attribute active_ids string
attribute id integer
attribute view_id integer
attribute view_type string
function getCurrentActionInDialog() → Object|null

Returns the action of the controller currently opened in a dialog, i.e. a target=’new’ action, if any.

Return Type
Object or null
function getCurrentControllerInDialog() → Object|null

Returns the controller currently opened in a dialog, if any.

Return Type
Object or null
module mail.systray.ActivityMenu
class ActivityMenu(parent)
Extends
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.

Menu item appended in the systray part of the navbar, redirects to the next activities of all app

class ActivityMenu(parent)
Extends
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.

Menu item appended in the systray part of the navbar, redirects to the next activities of all app

module web.Apps
class Apps(parent, action)
Parameters

    parent

    action

module web_editor.rte.summernote_custom_colors
Exports
<anonymous>
unknown ArrayExpression
module payment.payment_form
class PaymentForm(parent, options)
Extends
Parameters

    parent

    options

module web.AbstractModel
class AbstractModel(parent)
Extends
Parameters
method get() → *

This method should return the complete state necessary for the renderer to display the currently viewed data.

Return Type
any
method load(params) → Deferred

The load method is called once in a model, when we load the data for the first time. The method returns (a deferred that resolves to) some kind of token/handle. The handle can then be used with the get method to access a representation of the data.

Parameters
Returns
The deferred resolves to some kind of handle
Return Type
class LoadParams()
attribute modelName string

the name of the model

function reload(params) → Deferred

When something changes, the data may need to be refetched. This is the job for this method: reloading (only if necessary) all the data and making sure that they are ready to be redisplayed.

Parameters
    params (Object)
Return Type
module mail.widget.Thread
class ThreadWidget(parent, options)
Extends
Parameters

    parent (widget)

    options (Object)

This is a generic widget to render a thread. Any thread that extends mail.model.AbstractThread can be used with this widget.

method destroy()

The message mail popover may still be shown at this moment. If we do not remove it, it stays visible on the page until a page reload.

method isAtBottom() → boolean

State whether the bottom of the thread is visible or not, with a tolerance of 5 pixels

Return Type
boolean
method removeMessageAndRender([messageID, ]thread[, options])

Removes a message and re-renders the thread

Parameters

    messageID (integer) – the id of the removed message

    thread (mail.model.AbstractThread) – the thread which contains updated list of messages (so it does not contain any message with ID `messageID`).

    options (Object) – options for the thread rendering

method renderTypingNotificationBar(thread)

Render the ‘is typing…’ text on the typing notification bar of the thread. This is called when there is a change in the list of users typing something on this thread.

Parameters
method scrollToBottom()

Scroll to the bottom of the thread

method scrollToMessage(options)

Scrolls the thread to a given message

Parameters
class ScrollToMessageOptions()
attribute messageID integer

the ID of the message to scroll to

attribute duration integer
attribute onlyIfNecessary boolean
function scrollToPosition([position])

Scroll to the specific position in pixel

If no position is provided, scroll to the bottom of the thread

Parameters
    position (integer) – distance from top to position in pixels. If not provided, scroll to the bottom.
function toggleModerationCheckboxes(checked)

Toggle all the moderation checkboxes in the thread

Parameters
    checked (boolean) – if true, check the boxes, otherwise uncheck them.
function unselectMessage()

Unselect the selected message

class ThreadWidget(parent, options)
Extends
Parameters

    parent (widget)

    options (Object)

This is a generic widget to render a thread. Any thread that extends mail.model.AbstractThread can be used with this widget.

method destroy()

The message mail popover may still be shown at this moment. If we do not remove it, it stays visible on the page until a page reload.

method isAtBottom() → boolean

State whether the bottom of the thread is visible or not, with a tolerance of 5 pixels

Return Type
boolean
method removeMessageAndRender([messageID, ]thread[, options])

Removes a message and re-renders the thread

Parameters

    messageID (integer) – the id of the removed message

    thread (mail.model.AbstractThread) – the thread which contains updated list of messages (so it does not contain any message with ID `messageID`).

    options (Object) – options for the thread rendering

method renderTypingNotificationBar(thread)

Render the ‘is typing…’ text on the typing notification bar of the thread. This is called when there is a change in the list of users typing something on this thread.

Parameters
method scrollToBottom()

Scroll to the bottom of the thread

method scrollToMessage(options)

Scrolls the thread to a given message

Parameters
class ScrollToMessageOptions()
attribute messageID integer

the ID of the message to scroll to

attribute duration integer
attribute onlyIfNecessary boolean
function scrollToPosition([position])

Scroll to the specific position in pixel

If no position is provided, scroll to the bottom of the thread

Parameters
    position (integer) – distance from top to position in pixels. If not provided, scroll to the bottom.
function toggleModerationCheckboxes(checked)

Toggle all the moderation checkboxes in the thread

Parameters
    checked (boolean) – if true, check the boxes, otherwise uncheck them.
function unselectMessage()

Unselect the selected message

module web_editor.widget
class Dialog(parent, options)
Extends
Parameters

    parent

    options

Extend Dialog class to handle save/cancel of edition components.

method save()

Called when the dialog is saved. Set the destroy action type to “save” and should set the final_data variable correctly before closing.

class CropImageDialog(parent, options, $editable, media)
Extends
Parameters

    parent

    options

    $editable

    media

CropImageDialog widget. Let users crop an image.

method save()

Updates the DOM image with cropped data and associates required information for a potential future save (where required cropped data attachments will be created).

class LinkDialog(parent, options, editable, linkInfo)
Extends
Parameters

    parent

    options

    editable

    linkInfo

Allows to customize link content and style.

method start()

Allows the URL input to propose existing website pages.

class IconWidget(parent, media)
Extends
MediaWidget
Parameters

    parent

    media

Let users choose a font awesome icon, support all font awesome loaded in the css files.

namespace
class Dialog(parent, options)
Extends
Parameters

    parent

    options

Extend Dialog class to handle save/cancel of edition components.

method save()

Called when the dialog is saved. Set the destroy action type to “save” and should set the final_data variable correctly before closing.

class AltDialog(parent, options, $editable, media)
Extends
Parameters

    parent

    options

    $editable

    media

Let users change the alt & title of a media.

class MediaDialog(parent, options, $editable, media)
Extends
Parameters

    parent

    options

    $editable

    media

MediaDialog widget. Lets users change a media, including uploading a new image, font awsome or video and can change a media into an other media.

class LinkDialog(parent, options, editable, linkInfo)
Extends
Parameters

    parent

    options

    editable

    linkInfo

Allows to customize link content and style.

method start()

Allows the URL input to propose existing website pages.

class CropImageDialog(parent, options, $editable, media)
Extends
Parameters

    parent

    options

    $editable

    media

CropImageDialog widget. Let users crop an image.

method save()

Updates the DOM image with cropped data and associates required information for a potential future save (where required cropped data attachments will be created).

class ImageWidget()
Extends
MediaWidget

Let users choose an image, including uploading a new image in odoo.

class MediaDialog(parent, options, $editable, media)
Extends
Parameters

    parent

    options

    $editable

    media

MediaDialog widget. Lets users change a media, including uploading a new image, font awsome or video and can change a media into an other media.

class VideoWidget(parent, media)
Extends
MediaWidget
Parameters

    parent

    media

Let users choose a video, support all summernote video, and embed iframe.

class AltDialog(parent, options, $editable, media)
Extends
Parameters

    parent

    options

    $editable

    media

Let users change the alt & title of a media.

class ImageWidget()
Extends
MediaWidget

Let users choose an image, including uploading a new image in odoo.

module web.AbstractView
class AbstractView(viewInfo, params)
Extends
Parameters
method getController(parent) → Deferred

Main method of the view class. Create a controller, and make sure that data and libraries are loaded.

There is a unusual thing going in this method with parents: we create renderer/model with parent as parent, then we have to reassign them at the end to make sure that we have the proper relationships. This is necessary to solve the problem that the controller need the model and the renderer to be instantiated, but the model need a parent to be able to load itself, and the renderer needs the data in its constructor.

Parameters
    parent (Widget) – The parent of the resulting Controller (most likely an action manager)
Returns
The deferred resolves to a controller
Return Type
method getModel(parent) → Object

Returns the view model or create an instance of it if none

Parameters
    parent (Widget) – the parent of the model, if it has to be created
Returns
instance of the view model
Return Type
Object
method getRenderer(parent, state) → Object

Returns the a new view renderer instance

Parameters

    parent (Widget) – the parent of the model, if it has to be created

    state (Object) – the information related to the rendered view

Returns
instance of the view renderer
Return Type
Object
method setController(Controller)

this is useful to customize the actual class to use before calling createView.

Parameters
    Controller (Controller)
class AbstractViewViewInfo()
attribute arch Object
attribute fields Object
attribute fieldsInfo Object
class AbstractViewParams()
attribute modelName string

The actual model name

attribute context Object
attribute count number
attribute controllerID string
attribute domain string[]
attribute timeRange string[][]
attribute comparisonTimeRange string[][]
attribute timeRangeDescription string
attribute comparisonTimeRangeDescription string
attribute compare boolean
attribute groupBy string[]
attribute currentId number
attribute isEmbedded boolean
attribute ids number[]
attribute withControlPanel boolean
attribute action.flags.headless boolean
attribute action.display_name string
attribute action.name string
attribute action.help string
attribute action.jsID string
attribute action.views boolean
module web.PieChart
class PieChart(parent, record, node)
Extends
Parameters

    parent (Widget)

    record (Object)

    node (Object) – node from arch

method willStart()

Instantiates the pie chart view and starts the graph controller.

method on_attach_callback()

Call on_attach_callback for each subview

module web.core
namespace
class Class()

Improved John Resig’s inheritance, based on:

Simple JavaScript Inheritance By John Resig http://ejohn.org/ MIT Licensed.

Adds “include()”

Defines The Class object. That object can be used to define and inherit classes using the extend() method.

Example:

var Person = Class.extend({
 init: function(isDancing){
    this.dancing = isDancing;
  },
  dance: function(){
    return this.dancing;
  }
});

The init() method act as a constructor. This class can be instanced this way:

var person = new Person(true);
person.dance();

The Person class can also be extended again:

var Ninja = Person.extend({
  init: function(){
    this._super( false );
  },
  dance: function(){
    // Call the inherited version of dance()
    return this._super();
  },
  swingSword: function(){
    return true;
  }
});

When extending a class, each re-defined method can use this._super() to call the previous implementation of that method.

method extend(prop)

Subclass an existing class

Parameters
    prop (Object) – class-level properties (class attributes and instance methods) to set on the new class
attribute bus Boolean

Whether the client is currently in “debug” mode

function _t(source) → String

Eager translation function, performs translation immediately at call site. Beware using this outside of method bodies (before the translation database is loaded), you probably want _lt() instead.

Parameters
    source (String) – string to translate
Returns
source translated into the current locale
Return Type
String
function _lt(s) → Object

Lazy translation function, only performs the translation when actually printed (e.g. inserted into a template)

Useful when defining translatable strings in code evaluated before the translation database is loaded, as class attributes or at the top-level of an OpenERP Web module

Parameters
    s (String) – string to translate
Returns
lazy translation object
Return Type
Object
attribute bus Boolean

Whether the client is currently in “debug” mode

module survey.result
namespace
module sale.ProductConfiguratorFormController
class ProductConfiguratorFormController()
module web_editor.base
namespace
namespace cacheCssSelectors

Retrieves all the CSS rules which match the given parser (Regex).

attribute fontIcons Array

List of font icons to load by editor. The icons are displayed in the media editor and identified like font and image (can be colored, spinned, resized with fa classes). To add font, push a new object {base, parser}

  • base: class who appear on all fonts
  • parser: regular expression used to select all font in css stylesheets
namespace computeFonts

Searches the fonts described by the @see fontIcons variable.

function ready() → Deferred

If a widget needs to be instantiated on page loading, it needs to wait for appropriate resources to be loaded. This function returns a Deferred which is resolved when the dom is ready, the session is bound (translations loaded) and the XML is loaded. This should however not be necessary anymore as widgets should not be parentless and should then be instantiated (directly or not) by the page main component (webclient, website root, editor bar, …). The DOM will be ready then, the main component is in charge of waiting for the session and the XML can be lazy loaded thanks to the @see Widget.xmlDependencies key.

Return Type
module web.PivotModel
class PivotModel(params)
Parameters
    params (Object)
method closeHeader(headerID) → Deferred

Close a header. This method is actually synchronous, but returns a deferred.

Parameters
    headerID (any)
Return Type
method expandHeader(header, field)

Expand (open up) a given header, be it a row or a column.

Parameters

    header (any)

    field (any)

method exportData() → Object

Export the current pivot view in a simple JS object.

Return Type
Object
method flip()

Swap the columns and the rows. It is a synchronous operation.

method sortRows(col_id, measure, descending)

Sort the rows, depending on the values of a given column. This is an in-memory sort.

Parameters

    col_id (any)

    measure (any)

    descending (any)

method toggleMeasure(field) → Deferred

Toggle the active state for a given measure, then reload the data.

Parameters
    field (string)
Return Type
module web.PivotView
class PivotView(viewInfo, params)
Parameters

    viewInfo

    params (Object)

module mail.model.DocumentThread
class DocumentThread(params)
Extends
Parameters

These threads represent threads that are directly attached to documents. It is sometimes called the “chatter”, but technically this is just the part of the chatter containing the thread, as the chatter also contains the activity and listener fields.

Note that there are still some hacks in the handling of document threads, due to document threads are instantiated from fetched messages, either from mail.ThreadField or by fetching messages in Inbox.

Also, because messages are not sent on the longpoll bus for this kind of threads, it stores the list of message IDs that it contains, which should be up-to-date whenever someone wants to get the messages in the document thread.

method close()

Overrides to store the thread’s state in the LocalStorage, so that it is shared between tabs, and restored on F5.

method detach()

Overrides to store the thread’s state in the LocalStorage, so that it is shared between tabs, and restored on F5.

method fetchMessages(options) → $.Promise<mail.model.Message[]>

Fetch messages of the document thread

Parameters
Return Type
jQuery.Promise<Array<mail.model.Message>>
class FetchMessagesOptions()
attribute forceFetch boolean
if true, fetch anyway, as user
clicked on ‘load more’.
function fold()

Overrides to store the thread’s state in the LocalStorage, so that it is shared between tabs, and restored on F5.

function getDocumentModel() → string

Get the model name of the document that is linked to this document thread

Return Type
string
function getDocumentID() → integer

Get the ID of the document that is linked to this document thread

Return Type
integer
function getMessageIDs() → integer[]

Get he list of message IDs that this document threads contain.

Return Type
Array<integer>
function isLinkedToDocument() → boolean

States whether the thread is linked to a document Document thread’s are always linked to a document.

Return Type
boolean
function setMessageIDs(messageIDs)

Set list of message IDs of this document thread

Useful in order to handle message history of the document thread, in particular to fetch messages when necessary and/or display ‘load more’.

Parameters
    messageIDs (Array<integer>)
function setName(newName)

Set the name of this document thread

This is useful if the name of the document related to the document thread has changed

Parameters
    newName (string)
class DocumentThreadParams()
attribute data Object
attribute data.messagesIDs string
the list of message ids linked
to the document (if not given, they will be fetched before fetching the messages)
attribute data.model string
attribute data.resID integer
class DocumentThread(params)
Extends
Parameters

These threads represent threads that are directly attached to documents. It is sometimes called the “chatter”, but technically this is just the part of the chatter containing the thread, as the chatter also contains the activity and listener fields.

Note that there are still some hacks in the handling of document threads, due to document threads are instantiated from fetched messages, either from mail.ThreadField or by fetching messages in Inbox.

Also, because messages are not sent on the longpoll bus for this kind of threads, it stores the list of message IDs that it contains, which should be up-to-date whenever someone wants to get the messages in the document thread.

method close()

Overrides to store the thread’s state in the LocalStorage, so that it is shared between tabs, and restored on F5.

method detach()

Overrides to store the thread’s state in the LocalStorage, so that it is shared between tabs, and restored on F5.

method fetchMessages(options) → $.Promise<mail.model.Message[]>

Fetch messages of the document thread

Parameters
Return Type
jQuery.Promise<Array<mail.model.Message>>
class FetchMessagesOptions()
attribute forceFetch boolean
if true, fetch anyway, as user
clicked on ‘load more’.
function fold()

Overrides to store the thread’s state in the LocalStorage, so that it is shared between tabs, and restored on F5.

function getDocumentModel() → string

Get the model name of the document that is linked to this document thread

Return Type
string
function getDocumentID() → integer

Get the ID of the document that is linked to this document thread

Return Type
integer
function getMessageIDs() → integer[]

Get he list of message IDs that this document threads contain.

Return Type
Array<integer>
function isLinkedToDocument() → boolean

States whether the thread is linked to a document Document thread’s are always linked to a document.

Return Type
boolean
function setMessageIDs(messageIDs)

Set list of message IDs of this document thread

Useful in order to handle message history of the document thread, in particular to fetch messages when necessary and/or display ‘load more’.

Parameters
    messageIDs (Array<integer>)
function setName(newName)

Set the name of this document thread

This is useful if the name of the document related to the document thread has changed

Parameters
    newName (string)
class DocumentThreadParams()
attribute data Object
attribute data.messagesIDs string
the list of message ids linked
to the document (if not given, they will be fetched before fetching the messages)
attribute data.model string
attribute data.resID integer
module mail.Activity
function setDelayLabel(activities) → Array

Set the ‘label_delay’ entry in activity data according to the deadline date

Parameters
    activities (Array) – list of activity Object
Returns
list of modified activity Object
Return Type
Array
function _readActivities(self, ids) → Deferred<Array>

Fetches activities and postprocesses them.

This standalone function performs an RPC, but to do so, it needs an instance of a widget that implements the _rpc() function.

Parameters

    self (Widget) – a widget instance that can perform RPCs

    ids (Array) – the ids of activities to read

Returns
resolved with the activities
Return Type
Deferred<Array>
class Activity()
Extends
BasicActivity
module point_of_sale.models
namespace exports
module web.special_fields
namespace
class FieldTimezoneMismatch()

This widget is intended to display a warning near a label of a ‘timezone’ field indicating if the browser timezone is identical (or not) to the selected timezone. This widget depends on a field given with the param ‘tz_offset_field’, which contains the time difference between UTC time and local time, in minutes.

class FieldTimezoneMismatch()

This widget is intended to display a warning near a label of a ‘timezone’ field indicating if the browser timezone is identical (or not) to the selected timezone. This widget depends on a field given with the param ‘tz_offset_field’, which contains the time difference between UTC time and local time, in minutes.

module hr_attendance.kiosk_mode
class KioskMode(parent)
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.
module web.ControlPanelMixin
namespace ControlPanelMixin

Mixin allowing widgets to communicate with the ControlPanel. Widgets needing a ControlPanel should use this mixin and call update_control_panel(cp_status) where cp_status contains information for the ControlPanel to update itself.

Note that the API is slightly awkward. Hopefully we will improve this when we get the time to refactor the control panel.

For example, here is what a typical client action would need to do to add support for a control panel with some buttons:

var ControlPanelMixin = require('web.ControlPanelMixin');

var SomeClientAction = Widget.extend(ControlPanelMixin, {
    ...
    start: function () {
        this._renderButtons();
        this._updateControlPanel();
        ...
    },
    do_show: function () {
         ...
         this._updateControlPanel();
    },
    _renderButtons: function () {
        this.$buttons = $(QWeb.render('SomeTemplate.Buttons'));
        this.$buttons.on('click', ...);
    },
    _updateControlPanel: function () {
        this.update_control_panel({
            cp_content: {
               $buttons: this.$buttons,
            },
     });
function update_control_panel([cp_status][, options])

Triggers ‘update’ on the cp_bus to update the ControlPanel according to cp_status

Parameters

    cp_status (Object) – see web.ControlPanel.update() for a description

    options (Object) – see web.ControlPanel.update() for a description

namespace ControlPanelMixin

Mixin allowing widgets to communicate with the ControlPanel. Widgets needing a ControlPanel should use this mixin and call update_control_panel(cp_status) where cp_status contains information for the ControlPanel to update itself.

Note that the API is slightly awkward. Hopefully we will improve this when we get the time to refactor the control panel.

For example, here is what a typical client action would need to do to add support for a control panel with some buttons:

var ControlPanelMixin = require('web.ControlPanelMixin');

var SomeClientAction = Widget.extend(ControlPanelMixin, {
    ...
    start: function () {
        this._renderButtons();
        this._updateControlPanel();
        ...
    },
    do_show: function () {
         ...
         this._updateControlPanel();
    },
    _renderButtons: function () {
        this.$buttons = $(QWeb.render('SomeTemplate.Buttons'));
        this.$buttons.on('click', ...);
    },
    _updateControlPanel: function () {
        this.update_control_panel({
            cp_content: {
               $buttons: this.$buttons,
            },
     });
function update_control_panel([cp_status][, options])

Triggers ‘update’ on the cp_bus to update the ControlPanel according to cp_status

Parameters

    cp_status (Object) – see web.ControlPanel.update() for a description

    options (Object) – see web.ControlPanel.update() for a description

module barcodes.BarcodeParser
class BarcodeParser(attributes)
Extends
Parameters
    attributes
module web.time
function str_to_time(str) → Date

Converts a string to a Date javascript object using OpenERP’s time string format (exemple: ‘15:12:35’).

The OpenERP times are supposed to always be naive times. We assume it is represented using a javascript Date with a date 1 of January 1970 and a time corresponding to the meant time in the browser’s time zone.

Parameters
    str (String) – A string representing a time.
Return Type
Date
function moment_to_strftime_format(value)

Convert moment.js format to python strftime

Parameters
    value (String) – original format
function getLangTimeFormat()

Get time format of the user’s language

function time_to_str(obj) → String

Converts a Date javascript object to a string using OpenERP’s time string format (exemple: ‘15:12:35’).

The OpenERP times are supposed to always be naive times. We assume it is represented using a javascript Date with a date 1 of January 1970 and a time corresponding to the meant time in the browser’s time zone.

Parameters
    obj (Date)
Returns
A string representing a time.
Return Type
String
function strftime_to_moment_format(value)

Convert Python strftime to escaped moment.js format.

Parameters
    value (String) – original format
function str_to_date(str) → Date

Converts a string to a Date javascript object using OpenERP’s date string format (exemple: ‘2011-12-01’).

As a date is not subject to time zones, we assume it should be represented as a Date javascript object at 00:00:00 in the time zone of the browser.

Parameters
    str (String) – A string representing a date.
Return Type
Date
namespace
function date_to_utc(k, v) → Object

Replacer function for JSON.stringify, serializes Date objects to UTC datetime in the OpenERP Server format.

However, if a serialized value has a toJSON method that method is called before the replacer is invoked. Date#toJSON exists, and thus the value passed to the replacer is a string, the original Date has to be fetched on the parent object (which is provided as the replacer’s context).

Parameters

    k (String)

    v (Object)

Return Type
Object
function str_to_datetime(str) → Date

Converts a string to a Date javascript object using OpenERP’s datetime string format (exemple: ‘2011-12-01 15:12:35.832’).

The time zone is assumed to be UTC (standard for OpenERP 6.1) and will be converted to the browser’s time zone.

Parameters
    str (String) – A string representing a datetime.
Return Type
Date
function str_to_date(str) → Date

Converts a string to a Date javascript object using OpenERP’s date string format (exemple: ‘2011-12-01’).

As a date is not subject to time zones, we assume it should be represented as a Date javascript object at 00:00:00 in the time zone of the browser.

Parameters
    str (String) – A string representing a date.
Return Type
Date
function str_to_time(str) → Date

Converts a string to a Date javascript object using OpenERP’s time string format (exemple: ‘15:12:35’).

The OpenERP times are supposed to always be naive times. We assume it is represented using a javascript Date with a date 1 of January 1970 and a time corresponding to the meant time in the browser’s time zone.

Parameters
    str (String) – A string representing a time.
Return Type
Date
function datetime_to_str(obj) → String

Converts a Date javascript object to a string using OpenERP’s datetime string format (exemple: ‘2011-12-01 15:12:35’).

The time zone of the Date object is assumed to be the one of the browser and it will be converted to UTC (standard for OpenERP 6.1).

Parameters
    obj (Date)
Returns
A string representing a datetime.
Return Type
String
function date_to_str(obj) → String

Converts a Date javascript object to a string using OpenERP’s date string format (exemple: ‘2011-12-01’).

As a date is not subject to time zones, we assume it should be represented as a Date javascript object at 00:00:00 in the time zone of the browser.

Parameters
    obj (Date)
Returns
A string representing a date.
Return Type
String
function time_to_str(obj) → String

Converts a Date javascript object to a string using OpenERP’s time string format (exemple: ‘15:12:35’).

The OpenERP times are supposed to always be naive times. We assume it is represented using a javascript Date with a date 1 of January 1970 and a time corresponding to the meant time in the browser’s time zone.

Parameters
    obj (Date)
Returns
A string representing a time.
Return Type
String
function strftime_to_moment_format(value)

Convert Python strftime to escaped moment.js format.

Parameters
    value (String) – original format
function moment_to_strftime_format(value)

Convert moment.js format to python strftime

Parameters
    value (String) – original format
function getLangDateFormat()

Get date format of the user’s language

function getLangTimeFormat()

Get time format of the user’s language

function getLangDatetimeFormat()

Get date time format of the user’s language

function getLangDateFormat()

Get date format of the user’s language

function datetime_to_str(obj) → String

Converts a Date javascript object to a string using OpenERP’s datetime string format (exemple: ‘2011-12-01 15:12:35’).

The time zone of the Date object is assumed to be the one of the browser and it will be converted to UTC (standard for OpenERP 6.1).

Parameters
    obj (Date)
Returns
A string representing a datetime.
Return Type
String
function date_to_utc(k, v) → Object

Replacer function for JSON.stringify, serializes Date objects to UTC datetime in the OpenERP Server format.

However, if a serialized value has a toJSON method that method is called before the replacer is invoked. Date#toJSON exists, and thus the value passed to the replacer is a string, the original Date has to be fetched on the parent object (which is provided as the replacer’s context).

Parameters

    k (String)

    v (Object)

Return Type
Object
function date_to_str(obj) → String

Converts a Date javascript object to a string using OpenERP’s date string format (exemple: ‘2011-12-01’).

As a date is not subject to time zones, we assume it should be represented as a Date javascript object at 00:00:00 in the time zone of the browser.

Parameters
    obj (Date)
Returns
A string representing a date.
Return Type
String
function getLangDatetimeFormat()

Get date time format of the user’s language

function str_to_datetime(str) → Date

Converts a string to a Date javascript object using OpenERP’s datetime string format (exemple: ‘2011-12-01 15:12:35.832’).

The time zone is assumed to be UTC (standard for OpenERP 6.1) and will be converted to the browser’s time zone.

Parameters
    str (String) – A string representing a datetime.
Return Type
Date
module im_livechat.WebsiteLivechatWindow
class LivechatWindow(parent, thread)
Parameters

This is the widget that represent windows of livechat in the frontend.

method replaceContentWith($element)

Replace the thread content with provided new content

Parameters
    $element (jQuery.Element)
method toggleFold(folded)

Warn the parent widget (LivechatButton)

Parameters
    folded (boolean)
class LivechatWindow(parent, thread)
Parameters

This is the widget that represent windows of livechat in the frontend.

method replaceContentWith($element)

Replace the thread content with provided new content

Parameters
    $element (jQuery.Element)
method toggleFold(folded)

Warn the parent widget (LivechatButton)

Parameters
    folded (boolean)
module web_editor.snippet.editor
namespace
class SnippetsMenu(parent, $editable)
Extends
Parameters

    parent

    $editable

Management of drag&drop menu and snippet related behaviors in the page.

class SnippetEditor(parent, target, templateOptions)
Extends
Parameters

    parent (Widget)

    target (Element)

    templateOptions

Management of the overlay and option list for a snippet.

method buildSnippet()

Notifies all the associated snippet options that the snippet has just been dropped in the page.

method cleanForSave()

Notifies all the associated snippet options that the template which contains the snippet is about to be saved.

method cover()

Makes the editor overlay cover the associated snippet.

method removeSnippet()

Removes the associated snippet from the DOM and destroys the associated editor (itself).

method toggleFocus(focus)

Displays/Hides the editor overlay and notifies the associated snippet options. Note: when it is displayed, this is here that the parent snippet options are moved to the editor overlay.

Parameters
    focus (boolean) – true to display, false to hide
class SnippetEditor(parent, target, templateOptions)
Extends
Parameters

    parent (Widget)

    target (Element)

    templateOptions

Management of the overlay and option list for a snippet.

method buildSnippet()

Notifies all the associated snippet options that the snippet has just been dropped in the page.

method cleanForSave()

Notifies all the associated snippet options that the template which contains the snippet is about to be saved.

method cover()

Makes the editor overlay cover the associated snippet.

method removeSnippet()

Removes the associated snippet from the DOM and destroys the associated editor (itself).

method toggleFocus(focus)

Displays/Hides the editor overlay and notifies the associated snippet options. Note: when it is displayed, this is here that the parent snippet options are moved to the editor overlay.

Parameters
    focus (boolean) – true to display, false to hide
class SnippetsMenu(parent, $editable)
Extends
Parameters

    parent

    $editable

Management of drag&drop menu and snippet related behaviors in the page.

module website_sale.backend
Exports
WebsiteBackend
class Dashboard(parent, context)
Parameters

    parent

    context

method fetch_data()

Fetches dashboard data

module web.search_filters
namespace
module web.CalendarController
class CalendarController(parent, model, renderer, params)
Parameters
method destroy()

Overrides to unbind handler on the control panel mobile ‘Today’ button.

method renderButtons([$node])

Render the buttons according to the CalendarView.buttons template and add listeners on it. Set this.$buttons with the produced jQuery element

Parameters
    $node (jQueryElement) – a jQuery node where the rendered buttons should be inserted. $node may be undefined, in which case the Calendar inserts them into this.options.$buttons or into a div of its template
method renderPager($node)

In mobile, we want to display a special ‘Today’ button on the bottom right corner of the control panel. This is the pager area, and as there is no pager in Calendar views, we fool the system by defining a fake pager (which is actually our button) such that it will be inserted in the desired place.

Parameters
    $node (jQueryElement) – the button should be appended to this element to be displayed in the bottom right corner of the control panel
module web.widget_registry
Depends On
object instance of Registry
module sms.sms_widget
class SmsWidget()
Extends
InputField

SmsWidget is a widget to display a textarea (the body) and a text representing the number of SMS and the number of characters. This text is computed every time the user changes the body.

class SmsWidget()
Extends
InputField

SmsWidget is a widget to display a textarea (the body) and a text representing the number of SMS and the number of characters. This text is computed every time the user changes the body.

module web_editor.editor
namespace
module web_diagram.DiagramView
class DiagramView(viewInfo, params)
Extends
Parameters

    viewInfo (Object)

    params (Object)

Diagram View

method getController()

This override is quite tricky: the graph renderer uses Raphael.js to render itself, so it needs it to be loaded in the window before rendering However, the raphael.js library is built in such a way that if it detects that a module system is present, it will try to use it. So, in that case, it is not available on window.Raphael. This means that the diagram view is then broken.

As a workaround, we simply remove and restore the define function, if present, while we are loading Raphael.

class DiagramView(viewInfo, params)
Extends
Parameters

    viewInfo (Object)

    params (Object)

Diagram View

method getController()

This override is quite tricky: the graph renderer uses Raphael.js to render itself, so it needs it to be loaded in the window before rendering However, the raphael.js library is built in such a way that if it detects that a module system is present, it will try to use it. So, in that case, it is not available on window.Raphael. This means that the diagram view is then broken.

As a workaround, we simply remove and restore the define function, if present, while we are loading Raphael.

module web.Sidebar
Extends
Parameters

    parent

    options

method start()

Get the attachment linked to the record when the toolbar started

module mass_mailing.unsubscribe
namespace
module im_support.SupportBus
class SupportBusService()
Extends
module sale.OptionalProductsModal
class OptionalProductsModal(parent, params)
Extends
Parameters
method open(options)

This is overridden to append the modal to the provided container (see init(“parent”)). We need this to have the modal contained in the web shop product form. The additional products data will then be contained in the form and sent on submit.

Parameters
    options
method start()

Will update quantity input to synchronize with previous window

method getSelectedProducts() → Array

Returns the list of selected products. The root product is added on top of the list.

Returns
products {integer} product_id {integer} quantity {Array} product_custom_variant_values {Array} no_variant_attribute_values
Return Type
Array
class OptionalProductsModalParams()
attribute pricelistId integer
attribute isWebsite boolean
If we’re on a web shop page, we need some
custom behavior
attribute okButtonText string

The text to apply on the “ok” button, typically “Add” for the sale order and “Proceed to checkout” on the web shop

attribute cancelButtonText string
same as “params.okButtonText” but
for the cancel button
attribute rootProduct Object

The root product of the optional products window

attribute rootProduct.product_id integer
attribute rootProduct.quantity integer
attribute rootProduct.variant_values Array
attribute rootProduct.product_custom_attribute_values Array
attribute rootProduct.no_variant_attribute_values Array
module website_slides.upload
namespace
module web.relational_fields
class FieldMany2ManyBinaryMultiFiles()

Widget to upload or delete one or more files at the same time.

class FieldSelection()

The FieldSelection widget is a simple select tag with a dropdown menu to allow the selection of a range of values. It is designed to work with fields of type ‘selection’ and ‘many2one’.

method updateModifiersValue()

Listen to modifiers updates to hide/show the falsy value in the dropdown according to the required modifier.

namespace
class FieldMany2ManyBinaryMultiFiles()

Widget to upload or delete one or more files at the same time.

class FieldSelection()

The FieldSelection widget is a simple select tag with a dropdown menu to allow the selection of a range of values. It is designed to work with fields of type ‘selection’ and ‘many2one’.

method updateModifiersValue()

Listen to modifiers updates to hide/show the falsy value in the dropdown according to the required modifier.

class FieldReference()
Extends
FieldMany2One

The FieldReference is a combination of a select (for the model) and a FieldMany2one for its value. Its intern representation is similar to the many2one (a datapoint with a name_get as data). Note that there is some logic to support char field because of one use in our codebase, but this use should be removed along with this note.

class FieldReference()
Extends
FieldMany2One

The FieldReference is a combination of a select (for the model) and a FieldMany2one for its value. Its intern representation is similar to the many2one (a datapoint with a name_get as data). Note that there is some logic to support char field because of one use in our codebase, but this use should be removed along with this note.

module im_livechat.model.WebsiteLivechatMessage
class WebsiteLivechatMessage(parent, data, options)
Parameters

This is a message that is handled by im_livechat, without making use of the mail.Manager. The purpose of this is to make im_livechat compatible with mail.widget.Thread.

method getAvatarSource() → string

Get the relative url of the avatar to display next to the message

Return Type
string
method getDisplayedAuthor() → string

Get the text to display for the author of the message

Rule of precedence for the displayed author:

author name > default usernane
Return Type
string
class WebsiteLivechatMessageOptions()
attribute default_username string
attribute serverURL string
class WebsiteLivechatMessage(parent, data, options)
Parameters

This is a message that is handled by im_livechat, without making use of the mail.Manager. The purpose of this is to make im_livechat compatible with mail.widget.Thread.

method getAvatarSource() → string

Get the relative url of the avatar to display next to the message

Return Type
string
method getDisplayedAuthor() → string

Get the text to display for the author of the message

Rule of precedence for the displayed author:

author name > default usernane
Return Type
string
class WebsiteLivechatMessageOptions()
attribute default_username string
attribute serverURL string
module web.BasicController
class BasicController(parent, model, renderer, params)
Parameters
method canBeDiscarded([recordID]) → Deferred<boolean>

Determines if we can discard the current changes. If the model is not dirty, that is not a problem. However, if it is dirty, we have to ask the user for confirmation.

Parameters
    recordID (string) – default to main recordID
Returns
resolved if can be discarded, a boolean value is given to tells if there is something to discard or not rejected otherwise
Return Type
Deferred<boolean>
method canBeSaved([recordID]) → boolean

Ask the renderer if all associated field widget are in a valid state for saving (valid value and non-empty value for required fields). If this is not the case, this notifies the user with a warning containing the names of the invalid fields.

Note: changing the style of invalid fields is the renderer’s job.

Parameters
    recordID (string) – default to main recordID
Return Type
boolean
method discardChanges(recordID, options)

Waits for the mutex to be unlocked and then calls _.discardChanges. This ensures that the confirm dialog isn’t displayed directly if there is a pending ‘write’ rpc.

Parameters

    recordID

    options

method getSelectedIds() → Array

Method that will be overriden by the views with the ability to have selected ids

Return Type
Array
method giveFocus()

Gives the focus to the renderer

method isDirty([recordID]) → boolean

Returns true iff the given recordID (or the main recordID) is dirty.

Parameters
    recordID (string) – default to main recordID
Return Type
boolean
method saveRecord([recordID][, options]) → Deferred

Saves the record whose ID is given if necessary (@see _saveRecord).

Parameters

    recordID (string) – default to main recordID

    options (Object)

Returns
Resolved with the list of field names (whose value has been modified) Rejected if the record can’t be saved
Return Type
class BasicControllerParams()
attribute archiveEnabled boolean
attribute confirmOnDelete boolean
attribute hasButtons boolean
module web.dom_ready
Exports
namespace def
module web.download
Exports
<anonymous>

download.js v4.2, by dandavis; 2008-2018. [MIT] see http://danml.com/download.html for tests/usage

function download(data, filename, mimetype)
Parameters

    data

    filename

    mimetype

module web.PivotRenderer
class PivotRenderer(parent, state, params)
Parameters

    parent (Widget)

    state (Object)

    params (Object)

module web.SwitchCompanyMenu
class SwitchCompanyMenu()
Extends
module web.Widget
class Widget(parent)
Extends
Mixes
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.

Base class for all visual components. Provides a lot of functions helpful for the management of a part of the DOM.

Widget handles:

  • Rendering with QWeb.
  • Life-cycle management and parenting (when a parent is destroyed, all its children are destroyed too).
  • Insertion in DOM.

Guide to create implementations of the Widget class

Here is a sample child class:

var MyWidget = Widget.extend({
    // the name of the QWeb template to use for rendering
    template: "MyQWebTemplate",

    init: function (parent) {
        this._super(parent);
        // stuff that you want to init before the rendering
    },
    willStart: function () {
        // async work that need to be done before the widget is ready
        // this method should return a deferred
    },
    start: function() {
        // stuff you want to make after the rendering, `this.$el` holds a correct value
        this.$(".my_button").click(/* an example of event binding * /);

        // if you have some asynchronous operations, it's a good idea to return
        // a promise in start(). Note that this is quite rare, and if you
        // need to fetch some data, this should probably be done in the
        // willStart method
        var promise = this._rpc(...);
        return promise;
    }
});

Now this class can simply be used with the following syntax:

var myWidget = new MyWidget(this);
myWidget.appendTo($(".some-div"));

With these two lines, the MyWidget instance was initialized, rendered, inserted into the DOM inside the .some-div div and its events were bound.

And of course, when you don’t need that widget anymore, just do:

myWidget.destroy();

That will kill the widget in a clean way and erase its content from the dom.

attribute template null|string

The name of the QWeb template that will be used for rendering. Must be redefined in subclasses or the default render() method can not be used.

attribute xmlDependencies null|string[]

List of paths to xml files that need to be loaded before the widget can be rendered. This will not induce loading anything that has already been loaded.

method willStart() → Deferred

Method called between @see init and @see start. Performs asynchronous calls required by the rendering and the start method.

This method should return a Deferred which is resolved when start can be executed.

Return Type
method start() → Deferred

Method called after rendering. Mostly used to bind actions, perform asynchronous calls, etc…

By convention, this method should return an object that can be passed to $.when() to inform the caller when this widget has been initialized.

Note that, for historic reasons, many widgets still do work in the start method that would be more suited to the willStart method.

Return Type
method destroy()

Destroys the current widget, also destroys all its children before destroying itself.

method appendTo(target)

Renders the current widget and appends it to the given jQuery object.

Parameters
    target (jQuery)
method attachTo(target)

Attach the current widget to a dom element

Parameters
    target (jQuery)
method do_hide()

Hides the widget

method do_show()

Displays the widget

method do_toggle([display])

Displays or hides the widget

Parameters
    display (boolean) – use true to show the widget or false to hide it
method insertAfter(target)

Renders the current widget and inserts it after to the given jQuery object.

Parameters
    target (jQuery)
method insertBefore(target)

Renders the current widget and inserts it before to the given jQuery object.

Parameters
    target (jQuery)
method prependTo(target)

Renders the current widget and prepends it to the given jQuery object.

Parameters
    target (jQuery)
method renderElement()

Renders the element. The default implementation renders the widget using QWeb, this.template must be defined. The context given to QWeb contains the “widget” key that references this.

method replace(target)

Renders the current widget and replaces the given jQuery object.

Parameters
    targetA jQuery object or a Widget instance.
method setElement(element) → Widget

Re-sets the widget’s root element (el/$el/$el).

Includes:

  • re-delegating events
  • re-binding sub-elements
  • if the widget already had a root element, replacing the pre-existing element in the DOM
Parameters
    element (HTMLElement or jQuery) – new root element for the widget
Returns
this
Return Type
class Widget(parent)
Extends
Mixes
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.

Base class for all visual components. Provides a lot of functions helpful for the management of a part of the DOM.

Widget handles:

  • Rendering with QWeb.
  • Life-cycle management and parenting (when a parent is destroyed, all its children are destroyed too).
  • Insertion in DOM.

Guide to create implementations of the Widget class

Here is a sample child class:

var MyWidget = Widget.extend({
    // the name of the QWeb template to use for rendering
    template: "MyQWebTemplate",

    init: function (parent) {
        this._super(parent);
        // stuff that you want to init before the rendering
    },
    willStart: function () {
        // async work that need to be done before the widget is ready
        // this method should return a deferred
    },
    start: function() {
        // stuff you want to make after the rendering, `this.$el` holds a correct value
        this.$(".my_button").click(/* an example of event binding * /);

        // if you have some asynchronous operations, it's a good idea to return
        // a promise in start(). Note that this is quite rare, and if you
        // need to fetch some data, this should probably be done in the
        // willStart method
        var promise = this._rpc(...);
        return promise;
    }
});

Now this class can simply be used with the following syntax:

var myWidget = new MyWidget(this);
myWidget.appendTo($(".some-div"));

With these two lines, the MyWidget instance was initialized, rendered, inserted into the DOM inside the .some-div div and its events were bound.

And of course, when you don’t need that widget anymore, just do:

myWidget.destroy();

That will kill the widget in a clean way and erase its content from the dom.

attribute template null|string

The name of the QWeb template that will be used for rendering. Must be redefined in subclasses or the default render() method can not be used.

attribute xmlDependencies null|string[]

List of paths to xml files that need to be loaded before the widget can be rendered. This will not induce loading anything that has already been loaded.

method willStart() → Deferred

Method called between @see init and @see start. Performs asynchronous calls required by the rendering and the start method.

This method should return a Deferred which is resolved when start can be executed.

Return Type
method start() → Deferred

Method called after rendering. Mostly used to bind actions, perform asynchronous calls, etc…

By convention, this method should return an object that can be passed to $.when() to inform the caller when this widget has been initialized.

Note that, for historic reasons, many widgets still do work in the start method that would be more suited to the willStart method.

Return Type
method destroy()

Destroys the current widget, also destroys all its children before destroying itself.

method appendTo(target)

Renders the current widget and appends it to the given jQuery object.

Parameters
    target (jQuery)
method attachTo(target)

Attach the current widget to a dom element

Parameters
    target (jQuery)
method do_hide()

Hides the widget

method do_show()

Displays the widget

method do_toggle([display])

Displays or hides the widget

Parameters
    display (boolean) – use true to show the widget or false to hide it
method insertAfter(target)

Renders the current widget and inserts it after to the given jQuery object.

Parameters
    target (jQuery)
method insertBefore(target)

Renders the current widget and inserts it before to the given jQuery object.

Parameters
    target (jQuery)
method prependTo(target)

Renders the current widget and prepends it to the given jQuery object.

Parameters
    target (jQuery)
method renderElement()

Renders the element. The default implementation renders the widget using QWeb, this.template must be defined. The context given to QWeb contains the “widget” key that references this.

method replace(target)

Renders the current widget and replaces the given jQuery object.

Parameters
    targetA jQuery object or a Widget instance.
method setElement(element) → Widget

Re-sets the widget’s root element (el/$el/$el).

Includes:

  • re-delegating events
  • re-binding sub-elements
  • if the widget already had a root element, replacing the pre-existing element in the DOM
Parameters
    element (HTMLElement or jQuery) – new root element for the widget
Returns
this
Return Type
module web.kanban_examples_registry
Depends On
object instance of Registry
module im_support.SupportChannel
class SupportChannel(params)
Parameters

This mail model represents support channel, which are communication channels between two different databases for support-related reasons. It is like livechat, but both users are in different databases, and both users communicate from their respective ‘backend’ access.

FIXME: it should inherit from mail.model.Channel, not from mail.model.SearchableThread

method addDefaultMessage()

Adds the default message in the Support channel (depending on its availability).

method close()

Overrides to store the state of the Support channel in the localStorage.

method detach()

Overrides to store the state of the Support channel in the localStorage.

method fold(folded)

Overrides to store the state of the Support channel in the localStorage.

Parameters
    folded
method getNeedactionCounter() → integer

FIXME: this override is necessary just because the support channel is considered as a channel, even though it does not inherit from mail.model.Channel.

Return Type
integer
method hasBeenPreviewed() → boolean

FIXME: this method is necessary just because the support channel is considered as a channel, even though it does not inherit from mail.model.Channel.

Return Type
boolean
method isChannel() → boolean

FIXME: this override is necessary just because the support channel is considered as a channel, even though it does not inherit from mail.model.Channel.

Return Type
boolean
method updateWindowState(params)

Called when fold or detach (or both) status have changed on the support channel.

Note: this is partially a hack due to support channel not being a channel. Also, the support channel uses another way to handle its window state, by means of the local storage.

Parameters
class UpdateWindowStateParams()
attribute folded boolean
attribute detached boolean
class SupportChannelParams()
attribute data Object
attribute data.available boolean
attribute data.id string|integer
attribute data.is_minimized boolean
attribute data.operator Object
attribute data.state string

[‘open’, ‘closed’, ‘folded’]

attribute data.uuid string
attribute data.welcome_message string
attribute options Object
class SupportChannel(params)
Parameters

This mail model represents support channel, which are communication channels between two different databases for support-related reasons. It is like livechat, but both users are in different databases, and both users communicate from their respective ‘backend’ access.

FIXME: it should inherit from mail.model.Channel, not from mail.model.SearchableThread

method addDefaultMessage()

Adds the default message in the Support channel (depending on its availability).

method close()

Overrides to store the state of the Support channel in the localStorage.

method detach()

Overrides to store the state of the Support channel in the localStorage.

method fold(folded)

Overrides to store the state of the Support channel in the localStorage.

Parameters
    folded
method getNeedactionCounter() → integer

FIXME: this override is necessary just because the support channel is considered as a channel, even though it does not inherit from mail.model.Channel.

Return Type
integer
method hasBeenPreviewed() → boolean

FIXME: this method is necessary just because the support channel is considered as a channel, even though it does not inherit from mail.model.Channel.

Return Type
boolean
method isChannel() → boolean

FIXME: this override is necessary just because the support channel is considered as a channel, even though it does not inherit from mail.model.Channel.

Return Type
boolean
method updateWindowState(params)

Called when fold or detach (or both) status have changed on the support channel.

Note: this is partially a hack due to support channel not being a channel. Also, the support channel uses another way to handle its window state, by means of the local storage.

Parameters
class UpdateWindowStateParams()
attribute folded boolean
attribute detached boolean
class SupportChannelParams()
attribute data Object
attribute data.available boolean
attribute data.id string|integer
attribute data.is_minimized boolean
attribute data.operator Object
attribute data.state string

[‘open’, ‘closed’, ‘folded’]

attribute data.uuid string
attribute data.welcome_message string
attribute options Object
module mail.composer.MentionManager
class MentionManager(parent)
Extends
Parameters
    parent
method isOpen() → boolean

Returns true if the mention suggestions dropdown is open, false otherwise

Return Type
boolean
method getListenerSelection(delimiter) → Array

Returns the mentions of the given listener that haven’t been erased from the composer’s input

Parameters
    delimiter
Return Type
Array
method detectDelimiter()

Detects if the user is currently typing a mention word

Replaces mentions appearing in the string ‘s’ by html links with proper redirection

Parameters
    s (string)
Return Type
string
method register(listener)

Registers a new listener, described by an object containing the following keys

Parameters
class RegisterListener()
attribute beginningOnly boolean
true to enable autocomplete
only at first position of input
attribute delimiter char

the mention delimiter

attribute fetchCallback function
the callback to fetch mention
suggestions
true to wrap mentions in <a>
links
attribute model string
(optional) the model used for
redirection
attribute redirectClassname string
(optional) the classname
of the <a> wrapping the mention
attribute selection Array
(optional) initial mentions for
each listener
attribute suggestionTemplate string
the template of
suggestions’ dropdown
module web.DataManager
class ()
Extends
function invalidate()

Invalidates the whole cache Suggestion: could be refined to invalidate some part of the cache

function load_action([action_id][, additional_context]) → Deferred

Loads an action from its id or xmlid.

Parameters

    action_id (int or string) – the action id or xmlid

    additional_context (Object) – used to load the action

Returns
resolved with the action whose id or xmlid is action_id
Return Type
function load_views(params[, options]) → Deferred

Loads various information concerning views: fields_view for each view, the fields of the corresponding model, and optionally the filters.

Parameters

    params (LoadViewsParams)

    options (Object) – dictionary of various options: - options.load_filters: whether or not to load the filters, - options.action_id: the action_id (required to load filters), - options.toolbar: whether or not a toolbar will be displayed,

Returns
resolved with the requested views information
Return Type
class LoadViewsParams()
attribute model String
attribute context Object
attribute views_descr Array

array of [view_id, view_type]

function load_filters([dataset][, action_id]) → Deferred

Loads the filters of a given model and optional action id.

Parameters

    dataset (Object) – the dataset for which the filters are loaded

    action_id (int) – the id of the action (optional)

Returns
resolved with the requested filters
Return Type
function create_filter([filter]) → Deferred

Calls ‘create_or_replace’ on ‘ir_filters’.

Parameters
    filter (Object) – the filter description
Returns
resolved with the id of the created or replaced filter
Return Type
function delete_filter([filter]) → Deferred

Calls ‘unlink’ on ‘ir_filters’.

Parameters
    filter (Object) – the description of the filter to remove
Return Type
module bus.Longpolling
Exports
LongpollingBus
class Longpolling(parent, params)
Extends
Parameters

    parent

    params

Event Longpolling bus used to bind events on the server long polling return

trigger: - window_focus : when the window focus change (true for focused, false for blur) - notification : when a notification is receive from the long polling

method addChannel(channel)

Register a new channel to listen on the longpoll (ignore if already listening on this channel). Aborts a pending longpoll, in order to re-start another longpoll, so that we can immediately get notifications on newly registered channel.

Parameters
    channel (string)
method deleteChannel(channel)

Unregister a channel from listening on the longpoll.

Aborts a pending longpoll, in order to re-start another longpoll, so that we immediately remove ourselves from listening on notifications on this channel.

Parameters
    channel (string)
method isOdooFocused() → boolean

Tell whether odoo is focused or not

Return Type
boolean
method startPolling()

Start a long polling, i.e. it continually opens a long poll connection as long as it is not stopped (@see stopPolling)

method stopPolling()

Stops any started long polling

Aborts a pending longpoll so that we immediately remove ourselves from listening on notifications on this channel.

method updateOption(key, value)

Add or update an option on the longpoll bus. Stored options are sent to the server whenever a poll is started.

Parameters

    key (string)

    value (any)

class Longpolling(parent, params)
Extends
Parameters

    parent

    params

Event Longpolling bus used to bind events on the server long polling return

trigger: - window_focus : when the window focus change (true for focused, false for blur) - notification : when a notification is receive from the long polling

method addChannel(channel)

Register a new channel to listen on the longpoll (ignore if already listening on this channel). Aborts a pending longpoll, in order to re-start another longpoll, so that we can immediately get notifications on newly registered channel.

Parameters
    channel (string)
method deleteChannel(channel)

Unregister a channel from listening on the longpoll.

Aborts a pending longpoll, in order to re-start another longpoll, so that we immediately remove ourselves from listening on notifications on this channel.

Parameters
    channel (string)
method isOdooFocused() → boolean

Tell whether odoo is focused or not

Return Type
boolean
method startPolling()

Start a long polling, i.e. it continually opens a long poll connection as long as it is not stopped (@see stopPolling)

method stopPolling()

Stops any started long polling

Aborts a pending longpoll so that we immediately remove ourselves from listening on notifications on this channel.

method updateOption(key, value)

Add or update an option on the longpoll bus. Stored options are sent to the server whenever a poll is started.

Parameters

    key (string)

    value (any)

module web_editor.IframeRoot
namespace
module web.DataExport
class DataExport(parent, record, defaultExportFields)
Extends
Parameters

    parent

    record

    defaultExportFields

module stock.ReportWidget
class ReportWidget(parent)
Extends
Parameters
    parent
module web_diagram.DiagramRenderer
class DiagramRenderer(parent, state, params)
Parameters

Diagram Renderer

The diagram renderer responsability is to render a diagram view, that is, a set of (labelled) nodes and edges. To do that, it uses the Raphael.js library.

class DiagramRendererParams()
attribute noContentHelp string
class DiagramRenderer(parent, state, params)
Parameters

Diagram Renderer

The diagram renderer responsability is to render a diagram view, that is, a set of (labelled) nodes and edges. To do that, it uses the Raphael.js library.

class DiagramRendererParams()
attribute noContentHelp string
module web.BasicRenderer
class BasicRenderer(parent, state, params)
Parameters

    parent

    state

    params

method canBeSaved(recordID) → string[]

This method has two responsabilities: find every invalid fields in the current view, and making sure that they are displayed as invalid, by toggling the o_form_invalid css class. It has to be done both on the widget, and on the label, if any.

Parameters
    recordID (string)
Returns
the list of invalid field names
Return Type
Array<string>
method commitChanges(recordID) → Deferred

Calls ‘commitChanges’ on all field widgets, so that they can notify the environment with their current value (useful for widgets that can’t detect when their value changes or that have to validate their changes before notifying them).

Parameters
    recordID (string)
Return Type
method confirmChange(state, id, fields, ev) → Deferred<AbstractField[]>

Updates the internal state of the renderer to the new state. By default, this also implements the recomputation of the modifiers and their application to the DOM and the reset of the field widgets if needed.

In case the given record is not found anymore, a whole re-rendering is completed (possible if a change in a record caused an onchange which erased the current record).

We could always rerender the view from scratch, but then it would not be as efficient, and we might lose some local state, such as the input focus cursor, or the scrolling position.

Parameters

    state (Object)

    id (string)

    fields (Array<string>)

    ev (OdooEvent)

Returns
resolved with the list of widgets that have been reset
Return Type
method focusField(id, fieldName, offset)

Activates the widget and move the cursor to the given offset

Parameters

    id (string)

    fieldName (string)

    offset (integer)

module web.KanbanRenderer
class KanbanRenderer()
method on_attach_callback()

As this renderer defines its own scrolling area (the column in grouped mode), we override this hook to restore the scroll position like it was when the renderer has been last detached.

method on_detach_callback()

As this renderer defines its own scrolling area (the column in grouped mode), we override this hook to store the scroll position, so that we can restore it if the renderer is re-attached to the DOM later.

method addQuickCreate() → Deferred

Displays the quick create record in the active column

Return Type
method quickCreateToggleFold()

Toggle fold/unfold the Column quick create widget

method removeWidget(widget)

Removes a widget (record if ungrouped, column if grouped) from the view.

Parameters
    widget (Widget) – the instance of the widget to remove
method updateColumn(localID)

Overrides to restore the left property and the scrollTop on the updated column, and to enable the swipe handlers

Parameters
    localID
method updateRecord(recordState) → Deferred

Updates a given record with its new state.

Parameters
    recordState (Object)
Return Type
module web.Class
Exports
OdooClass
class Class()

Improved John Resig’s inheritance, based on:

Simple JavaScript Inheritance By John Resig http://ejohn.org/ MIT Licensed.

Adds “include()”

Defines The Class object. That object can be used to define and inherit classes using the extend() method.

Example:

var Person = Class.extend({
 init: function(isDancing){
    this.dancing = isDancing;
  },
  dance: function(){
    return this.dancing;
  }
});

The init() method act as a constructor. This class can be instanced this way:

var person = new Person(true);
person.dance();

The Person class can also be extended again:

var Ninja = Person.extend({
  init: function(){
    this._super( false );
  },
  dance: function(){
    // Call the inherited version of dance()
    return this._super();
  },
  swingSword: function(){
    return true;
  }
});

When extending a class, each re-defined method can use this._super() to call the previous implementation of that method.

method extend(prop)

Subclass an existing class

Parameters
    prop (Object) – class-level properties (class attributes and instance methods) to set on the new class
class Class()

Improved John Resig’s inheritance, based on:

Simple JavaScript Inheritance By John Resig http://ejohn.org/ MIT Licensed.

Adds “include()”

Defines The Class object. That object can be used to define and inherit classes using the extend() method.

Example:

var Person = Class.extend({
 init: function(isDancing){
    this.dancing = isDancing;
  },
  dance: function(){
    return this.dancing;
  }
});

The init() method act as a constructor. This class can be instanced this way:

var person = new Person(true);
person.dance();

The Person class can also be extended again:

var Ninja = Person.extend({
  init: function(){
    this._super( false );
  },
  dance: function(){
    // Call the inherited version of dance()
    return this._super();
  },
  swingSword: function(){
    return true;
  }
});

When extending a class, each re-defined method can use this._super() to call the previous implementation of that method.

method extend(prop)

Subclass an existing class

Parameters
    prop (Object) – class-level properties (class attributes and instance methods) to set on the new class
module web.TimeRangeMenuOptions
Depends On
namespace
module web.QWeb
Exports
Depends On
function QWeb(debug, default_dict[, enableTranslation])
Parameters

    debug (boolean)

    default_dict (Object)

    enableTranslation=true (boolean) – if true (this is the default), the rendering will translate all strings that are not marked with t-translation=off. This is useful for the kanban view, which uses a template which is already translated by the server

module mail.Manager.DocumentThread
class MailManager(parent)
Parameters
    parent
method addMessage(data)

For new posted message of current user in a document thread: store it in the localStorage to make it appear on the other tabs.

Note: ‘addMessage’ modifies the message in place (by setting the channel_id, so we must store the message in the localStorage before calling ‘addMessage’)

Parameters
class AddMessageData()
attribute author_id Array
[int, string] where int is server ID of
the author, and string is the name of the author.
attribute id integer

server ID of the message

attribute model string
the model name of the document that this
message is related to.
attribute res_id integer
the ID of the document that this message
is related to.
function createChannel(name, type) → $.Promise<integer>

Creates a channel, can be either a true channel or a DM chat based on type

Parameters

    name (integer or string) – id of partner (in case of dm) or name

    type (string) – [‘dm_chat’, ‘public’, ‘private’]

Returns
resolved with ID of the newly created channel
Return Type
jQuery.Promise<integer>
function getCannedResponses() → Array

Returns the list of canned responses A canned response is a pre-formatted text that is triggered with some keystrokes, such as with ‘:’.

Returns
array of Objects (mail.shortcode)
Return Type
Array
function getChannel(threadID) → mail.model.Channel|undefined

Returns a channel corresponding to the given id.

Parameters
    threadID (integer)
Returns
the channel, if it exists
Return Type
mail.model.Channel or undefined
function getChannels() → mail.model.Channel[]

Returns a list of channels

Returns
list of channels
Return Type
function getChannelPreviews() → $.Promise<Object[]>

Overrides to filter out the Support channel from the previews.

Returns
list of valid objects for mail.Preview template
Return Type
jQuery.Promise<Array<Object>>
function getDiscussMenuID() → integer

Returns the record id of ir.ui.menu for Discuss

Returns
record id
Return Type
integer
function getDMChatFromPartnerID(partnerID) → Object|undefined

Gets direct message channel

Parameters
    partnerID (integer)
Returns
channel
Return Type
Object or undefined
function getMailFailures() → mail.model.MailFailure[]

Returns a list of mail failures

Returns
list of mail failures
Return Type
function getMentionPartnerSuggestions() → Array<Object[]>

Get partners as mentions from a chatter Typically all employees as partner suggestions.

Return Type
Array<Array<Object>>
function getMessage(messageID) → mail.model.Message|undefined

Gets message from its ID

Parameters
    messageID (integer)
Returns
the matched message (if any)
Return Type
mail.model.Message or undefined
function getSystrayPreviews([filter]) → $.Promise<Object[]>

Returns the previews to display in the systray’s messaging menu.

Parameters
    filter=undefined (string) – specify ‘chat’ or ‘channels’ to only get previews for that type of threads
Returns
resolved with list of objects that have a valid format for rendering a messaging menu preview items.
Return Type
jQuery.Promise<Array<Object>>
function getModeratedChannelIDs() → integer[]

Get the list of channel IDs where the current user is a moderator

Return Type
Array<integer>
function getOdoobotID() → string

Get the OdooBot ID, which is the default authorID for transient messages

Return Type
string
function getThread(threadID) → mail.model.Thread|undefined

Returns thread matching provided ID, if any

Parameters
    threadID (string or integer)
Returns
the thread, if it exists
Return Type
mail.model.Thread or undefined
function getThreads() → mail.model.Thread[]

Returns a list of threads

Returns
list of threads
Return Type
function isMyselfModerator() → boolean

States whether the current user is a moderator or not

Return Type
boolean
function isReady() → $.Promise

States whether the mail manager is ready or not This is the case when it has fetched the initial state from the server, by means of the route ‘mail/init_messaging’

Return Type
jQuery.Promise
function joinChannel(channelID[, options]) → $.Promise<integer>

Join an existing channel See @createChannel to join a new channel

Parameters

    channelID (integer)

    options (Object) – options to be passed on channel add

Returns
resolved with channelID joined
Return Type
jQuery.Promise<integer>
function markMessagesAsRead(messageIDs) → $.Promise

Mark messages as read

Parameters
    messageIDs (Array) – list of messages IDs
Returns
resolved when messages have been marked as read on the server.
Return Type
jQuery.Promise
function openThread(threadID)

Open the thread window if discuss is not opened

Parameters
    threadID (integer or string)
function redirect(resModel, resID[, dmRedirectionCallback])

Special redirection handling for given model and id

If the model is res.partner, and there is a user associated with this partner which isn’t the current user, open the DM chat with this user. Otherwhise, open the record’s form view (if not current user’s).

Parameters

    resModel (string) – model to open

    resID (integer) – record to open

    dmRedirectionCallback (function) – only used if ‘res.partner’, a function that has a threadID as input

function removeMessageFromThreads(message)

Remove the message from all of its threads

Parameters
function searchPartner(searchVal, limit) → $.Promise<Object[]>

Search among prefetched partners, using the string ‘searchVal’

Parameters

    searchVal (string)

    limit (integer) – max number of found partners in the response

Returns
list of found partners (matching ‘searchVal’)
Return Type
jQuery.Promise<Array<Object>>
function unstarAll() → $.Promise

Unstars all messages from all channels

Return Type
jQuery.Promise
function getDocumentThread(model, resID) → integer

Returns a document thread corresponding to the given model and resID.

Parameters

    model (string) – of the document thread, if it exists

    resID

Returns
resID of the document thread, if it exists
Return Type
integer
function getOrAddDocumentThread(params) → mail.model.DocumentThread

Add a new document thread, or get if it exists already.

Also, if a name is provided for the document thread, it overwrites the previous one.

class GetOrAddDocumentThreadParams()
attribute message_ids interger[]
the list of message ids linked
to the document (if not given, they will be fetched before fetching the messages)
attribute name string
if provided, overwrites the name of the
existing document thread
attribute resID integer
attribute resModel string
function updateDocumentThreadState(threadID, state)

Updates the state of a given document thread (stored in localStorage). Garbage collects windows previously marked as ‘closed’ (assuming that the info has already been processed by the other tabs).

Parameters
class UpdateDocumentThreadStateState()
attribute name string

name of the document thread

attribute windowState string

(‘closed’, ‘folded’ or ‘open’)

function initSupport()

Initialises the Support: checks if there is a pending chat session between the user and Support, and if so, re-opens it. Note: we can’t directly override init(), because it is already called when the include is applied, so we use this hook instead (called at webclient startup)

function startPollingSupport([pollingDelay])

Initiates a longpoll with the server hosting the Support channel.

Parameters
    pollingDelay=POLL_TIMEOUT_DELAY (integer) – the longpolling timeout delay to set
function startSupportLivechat([channelState]) → Deferred

Opens the Support channel between a livechat operator from the Support database and the current user (if there is an available operator). Ensures to perform only once the request to create/retrieve the Support channel.

Parameters
    channelState=’open’ (string) – state of the Support channel (see CHANNEL_STATES for accepted values)
Return Type
function updateSupportChannelState(state)

Updates the state of the Support channel (stored in the localStorage).

Parameters
    state (string) – (‘closed’, ‘folded’ or ‘open’)
function openBlankThreadWindow()

Open the blank thread window (i.e. the thread window without any thread linked to it). Make it if there is no blank thread window yet.

function openDMChatWindowFromBlankThreadWindow(partnerID)

Open a DM chat in a thread window. This is useful when selecting a DM chatin the blank thread window, so that it replaces it with the DM chat window.

Parameters
    partnerID (integer)
function openThreadWindow(threadID[, options])

Open a thread in a thread window

Parameters
class OpenThreadWindowOptions()
attribute passively boolean
if set to true, open the thread
window without focusing the input and marking messages as read if it is not open yet, and do nothing otherwise.
attribute keepFoldState boolean
if set to true, keep the
fold state of the thread
function updateThreadWindow(threadID, options)

Called when a thread has its window state that has been changed, so its thread window view should be changed to match the model.

Parameters

    threadID (integer or string)

    options (UpdateThreadWindowOptions) – option to be applied on opening thread window, if the thread is detached

class UpdateThreadWindowOptions()
option to be applied on opening thread window, if
the thread is detached
attribute passively boolean
if set, the window will behave
passively.
module web.RainbowMan
class RainbowMan([options])
Extends
Parameters
class RainbowManOptions()
attribute message string

Message to be displayed on rainbowman card

attribute fadeout string

Delay for rainbowman to disappear. ‘fast’ will make rainbowman dissapear quickly, ‘medium’ and ‘slow’ will wait little longer before disappearing (can be used when options.message is longer), ‘no’ will keep rainbowman on screen until user clicks anywhere outside rainbowman

attribute img_url string

URL of the image to be displayed

module mail.systray.MessagingMenu
class MessagingMenu()
Extends

Menu item appended in the systray part of the navbar

The menu item indicates the counter of needactions + unread messages in chat channels. When clicking on it, it toggles a dropdown containing a preview of each pinned channels (except mailbox and mass mailing channels) with a quick link to open them in chat windows. It also contains a direct link to the Inbox in Discuss.

method start()

Overrides to add a className to the bottom part of the dropdown (containing the Support channel), so that the css rules apply. This className can’t be added directly in the template, otherwise this.$channels_preview would be a nodeset containing the bottom part as well, and it will cause rendering issues when the dropdown is rerendered.

method isMobile() → boolean

States whether the widget is in mobile mode or not. This is used by the template.

Return Type
boolean
class MessagingMenu()
Extends

Menu item appended in the systray part of the navbar

The menu item indicates the counter of needactions + unread messages in chat channels. When clicking on it, it toggles a dropdown containing a preview of each pinned channels (except mailbox and mass mailing channels) with a quick link to open them in chat windows. It also contains a direct link to the Inbox in Discuss.

method start()

Overrides to add a className to the bottom part of the dropdown (containing the Support channel), so that the css rules apply. This className can’t be added directly in the template, otherwise this.$channels_preview would be a nodeset containing the bottom part as well, and it will cause rendering issues when the dropdown is rerendered.

method isMobile() → boolean

States whether the widget is in mobile mode or not. This is used by the template.

Return Type
boolean
module web.config
Exports
function _updateSizeProps()

Update the size dependant properties in the config object. This method should be called every time the size class changes.

function _getSizeClass() → integer

Return the current size class

Returns
a number between 0 and 5, included
Return Type
integer
namespace config
module account.ReconciliationClientAction
class ManualAction(parent, params)
Parameters

Widget used as action for ‘account.move.line’ and ‘res.partner’ for the manual reconciliation and mark data as reconciliate

class ManualActionParams()
attribute context Object
namespace
class StatementAction(parent, params)
Parameters

Widget used as action for ‘account.bank.statement’ reconciliation

method willStart()

instantiate the action renderer

method start()

append the renderer and instantiate the line renderers

method do_show()

update the control panel and breadcrumbs

class StatementActionParams()
attribute context Object
class ManualAction(parent, params)
Parameters

Widget used as action for ‘account.move.line’ and ‘res.partner’ for the manual reconciliation and mark data as reconciliate

class ManualActionParams()
attribute context Object
class StatementAction(parent, params)
Parameters

Widget used as action for ‘account.bank.statement’ reconciliation

method willStart()

instantiate the action renderer

method start()

append the renderer and instantiate the line renderers

method do_show()

update the control panel and breadcrumbs

class StatementActionParams()
attribute context Object
module mail.model.TwoUserChannel
class TwoUserChannel(params)
Extends
Parameters
method unsubscribe() → $.Promise

Unpin from two-user thread

Returns
resolve when unsubscribed
Return Type
jQuery.Promise
class TwoUserChannelParams()
attribute data Object
attribute data.channel_type string
attribute data.create_uid integer
the ID of the user that has
created the channel.
attribute data.group_based_subscription boolean
attribute data.is_minimized boolean
attribute data.is_moderator boolean
whether the current user is
moderator of this channel.
attribute data.last_message_date string

date in server-format

attribute data.message_unread_counter integer
attribute data.moderation boolean
whether the channel is
moderated or not
attribute data.state string
attribute data.uuid string
attribute options Object
attribute options.autoswitch boolean
attribute commands Object[]
module mail.model.CreateModeDocumentThread
class CreateModeDocumentThread()

Special document thread that is linked to a new document that is in create mode. This thread only display a single (fake) message which displays the user avatar and the message ‘Creating a new record…’.

Note: it uses AbstractThread and AbstractMessage, because this is a fake thread which contains a fake message. We do not want to register both of them in the mail service.

class CreateModeDocumentThread()

Special document thread that is linked to a new document that is in create mode. This thread only display a single (fake) message which displays the user avatar and the message ‘Creating a new record…’.

Note: it uses AbstractThread and AbstractMessage, because this is a fake thread which contains a fake message. We do not want to register both of them in the mail service.

module web.kanban_column_quick_create
class ColumnQuickCreate(parent[, options])
Extends
Parameters
method on_attach_callback()

Called each time the quick create is attached into the DOM

method toggleFold()

Folds/unfolds the Column quick create widget

class ColumnQuickCreateOptions()
attribute examples Object
module web_editor.summernote
Exports
summernote
Depends On
module website.customizeMenu
class CustomizeMenu(parent)
Extends
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.
module website_crm.tour
namespace
module web_editor.transcoder
function linkImgToAttachmentThumbnail($editable)

Revert attachmentThumbnailToLinkImg changes

Parameters
    $editable (jQuery)
namespace
function fontToImg($editable)

Converts font icons to images.

Parameters
    $editable (jQuery) – the element in which the font icons have to be converted to images
function imgToFont($editable)

Converts images which were the result of a font icon convertion to a font icon again.

Parameters
    $editable (jQuery) – the element in which the images will be converted back to font icons
function classToStyle($editable)

Converts css style to inline style (leave the classes on elements but forces the style they give as inline style).

Parameters
    $editable (jQuery)
function styleToClass($editable)

Removes the inline style which is not necessary (because, for example, a class on an element will induce the same style).

Parameters
    $editable (jQuery)
function attachmentThumbnailToLinkImg($editable)

Converts css display for attachment link to real image. Without this post process, the display depends on the css and the picture does not appear when we use the html without css (to send by email for e.g.)

Parameters
    $editable (jQuery)
function linkImgToAttachmentThumbnail($editable)

Revert attachmentThumbnailToLinkImg changes

Parameters
    $editable (jQuery)
function fontToImg($editable)

Converts font icons to images.

Parameters
    $editable (jQuery) – the element in which the font icons have to be converted to images
function classToStyle($editable)

Converts css style to inline style (leave the classes on elements but forces the style they give as inline style).

Parameters
    $editable (jQuery)
function getMatchedCSSRules(a) → Object

Returns the css rules which applies on an element, tweaked so that they are browser/mail client ok.

Parameters
    a (DOMElement)
Returns
css property name -> css property value
Return Type
Object
function attachmentThumbnailToLinkImg($editable)

Converts css display for attachment link to real image. Without this post process, the display depends on the css and the picture does not appear when we use the html without css (to send by email for e.g.)

Parameters
    $editable (jQuery)
function styleToClass($editable)

Removes the inline style which is not necessary (because, for example, a class on an element will induce the same style).

Parameters
    $editable (jQuery)
function imgToFont($editable)

Converts images which were the result of a font icon convertion to a font icon again.

Parameters
    $editable (jQuery) – the element in which the images will be converted back to font icons
module point_of_sale.popups
class SelectionPopupWidget(parent, args)
Parameters

    parent

    args

A popup that allows the user to select one item from a list.

Example:

show_popup('selection',{
    title: "Popup Title",
    list: [
        { label: 'foobar',  item: 45 },
        { label: 'bar foo', item: 'stuff' },
    ],
    confirm: function(item) {
        // get the item selected by the user.
    },
    cancel: function(){
        // user chose nothing
    }
});
class PopupWidget(parent, args)
Parameters

    parent

    args

module website.newMenu
class NewContentMenu(parent)
Extends
WebsiteNavbarActionWidget
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.
method start()

Prepare the navigation and find the modules to install. Move not installed module buttons after installed modules buttons, but keep the original index to be able to move back the pending install button at its final position, so the user can click at the same place.

module web.SystrayMenu
Depends On
class SystrayMenu(parent)
Extends
Parameters
    parent

The SystrayMenu is the class that manage the list of icons in the top right of the menu bar.

class SystrayMenu(parent)
Extends
Parameters
    parent

The SystrayMenu is the class that manage the list of icons in the top right of the menu bar.

module website_event.website_event
class EventRegistrationForm(parent)
Extends
Parameters
    parent (Widget or null) – Binds the current instance to the given Widget instance. When that widget is destroyed by calling destroy(), the current instance will be destroyed too. Can be null.
module web.Menu
Extends
Parameters

    parent

    menu_data

method action_id_to_primary_menu_id(action_id)

Helpers used by web_client in order to restore the state from an url (by restore, read re-synchronize menu and action manager)

Parameters
    action_id
method getCurrentPrimaryMenu() → integer

Returns the id of the current primary (first level) menu.

Return Type
integer
method openFirstApp()

Open the first app

module website.content.compatibility
namespace
module sale.ProductConfiguratorFormRenderer
class ProductConfiguratorFormRenderer()
method renderConfigurator(configuratorHtml)

Renders the product configurator within the form

Will also: - add events handling for variant changes - trigger variant change to compute the price and other

variant specific changes
Parameters
    configuratorHtml (string) – the evaluated template of the product configurator
module website.seo
namespace
module point_of_sale.DB
Exports
Depends On
class PosDB(options)
Extends
Parameters
    options
module web.LocalStorageService
class LocalStorageService(parent)
Parameters
    parent
module pos_restaurant.notes
namespace
module web_tour.TourManager
class (parent, consumed_tours)
Extends
Parameters

    parent

    consumed_tours

function register(name, [options, ]steps)

Registers a tour described by the following arguments in order

Parameters

    name (string) – tour’s name

    options (RegisterOptions) – options (optional), available options are:

    steps (Array<Object>) – steps’ descriptions, each step being an object containing a tip description

class RegisterOptions()

options (optional), available options are:

attribute test boolean

true if this is only for tests

attribute skip_enabled boolean

true to add a link in its tips to consume the whole tour

attribute url string

the url to load when manually running the tour

attribute rainbowMan boolean

whether or not the rainbowman must be shown at the end of the tour

attribute wait_for Deferred

indicates when the tour can be started

function update(tour_name)

Checks for tooltips to activate (only from the running tour or specified tour if there is one, from all active tours otherwise). Should be called each time the DOM changes.

Parameters
    tour_name
namespace STEPS

Tour predefined steps

module web_tour.tour
namespace
module mail.model.DMChat
class DMChat(params)
Parameters

Any piece of code in JS that make use of DMs must ideally interact with such objects, instead of direct data from the server.

method getDirectPartnerID() → integer

Get the direct partner ID linked to the DM, i.e. the partner ID of the user at the other end of the DM conversation. All DM chats do have a direct partner iD.

Return Type
integer
class DMChatParams()
attribute data Object
attribute data.direct_partner Object[]
attribute data.direct_partner[0].id integer
attribute data.direct_partner[0].im_status string
attribute data.direct_partner[0].name string
class DMChat(params)
Parameters

Any piece of code in JS that make use of DMs must ideally interact with such objects, instead of direct data from the server.

method getDirectPartnerID() → integer

Get the direct partner ID linked to the DM, i.e. the partner ID of the user at the other end of the DM conversation. All DM chats do have a direct partner iD.

Return Type
integer
class DMChatParams()
attribute data Object
attribute data.direct_partner Object[]
attribute data.direct_partner[0].id integer
attribute data.direct_partner[0].im_status string
attribute data.direct_partner[0].name string
module web.GroupByMenuInterfaceMixin
mixin GroupByMenuInterfaceMixin

The aim of this mixin is to facilitate the interaction between a view controller and a dropdown menu with its control panel TO DO: the pivot subview has two types of groupbys so that it will not understand the current implementation of this mixin

mixin GroupByMenuInterfaceMixin

The aim of this mixin is to facilitate the interaction between a view controller and a dropdown menu with its control panel TO DO: the pivot subview has two types of groupbys so that it will not understand the current implementation of this mixin

module web.SearchView
class SearchView(parent, dataset, fvg[, options])
Extends
Parameters

Performs the search view collection of widget data.

If the collection went well (all fields are valid), then triggers instance.web.SearchView.on_search().

If at least one field failed its validation, triggers instance.web.SearchView.on_invalid() instead.

Parameters

    _query

    options (Object)

method setup_global_completion()

Sets up search view’s view-wide auto-completion widget

Provide auto-completion result for req.term (an array to resp)

Parameters
class CompleteGlobalSearchReq()

request to complete

attribute term String

searched term to complete

function select_completion(e, ui)

Action to perform in case of selection: create a facet (model) and add it to the search collection

Parameters

    e (Object) – selection event, preventDefault to avoid setting value on object

    ui (SelectCompletionUi) – selection information

class SelectCompletionUi()

selection information

attribute item Object

selected completion item

function renderChangedFacets(model, options)

Call the renderFacets method with the correct arguments. This is due to the fact that change events are called with two arguments (model, options) while add, reset and remove events are called with (collection, model, options) as arguments

Parameters

    model

    options

function updateFilters(newFilters, filtersToRemove) → Array<Object>

Updates the domain of the search view by adding and/or removing filters.

Parameters

    newFilters (Array<Object>) – list of filters to add, described by objects with keys domain (the domain as an Array), and help (the text to display in the facet)

    filtersToRemove (Array<Object>) – list of filters to remove (previously added ones)

Returns
list of added filters (to pass as filtersToRemove for a further call to this function)
Return Type
Array<Object>
class SearchViewOptions()
attribute hidden Boolean

hide the search view

attribute disable_custom_filters Boolean

do not load custom filters from ir.filters

module web.field_registry
Depends On
object instance of Registry
module web.CalendarRenderer
class (parent, state, params)
Parameters

    parent (Widget)

    state (Object)

    params (Object)

function getAvatars(record, fieldName, imageField) → string[]

Note: this is not dead code, it is called by the calendar-box template

Parameters

    record (any)

    fieldName (any)

    imageField (any)

Return Type
Array<string>
function getColor(key) → integer

Note: this is not dead code, it is called by two template

Parameters
    key (any)
Return Type
integer
module base_import.import
function dataFilteredQuery(q)

query returns a list of suggestion select2 objects, this function:

  • returns data exactly matching query by either id or text if those exist
  • otherwise it returns a select2 option matching the term and any data option whose id or text matches (by substring)
Parameters
    q
namespace
function jsonp(form, attributes, callback)

Safari does not deal well at all with raw JSON data being returned. As a result, we’re going to cheat by using a pseudo-jsonp: instead of getting JSON data in the iframe, we’re getting a script tag which consists of a function call and the returned data (the json dump).

The function is an auto-generated name bound to window, which calls back into the callback provided here.

Parameters

    form (Object) – the form element (DOM or jQuery) to use in the call

    attributes (Object) – jquery.form attributes object

    callback (Function) – function to call with the returned data

module web.field_utils
function formatFloatFactor(value, field, options) → string

Returns a string representing a float value, from a float converted with a factor.

Parameters
Return Type
string
class FormatFloatFactorOptions()
attribute factor number

Conversion factor, default value is 1.0

function formatX2Many(value) → string

Returns a string indicating the number of records in the relation.

Parameters
    value (Object) – a valid element from a BasicModel, that represents a list of values
Return Type
string
function formatPercentage(value[, field][, options]) → string

Returns a string representing the given value (multiplied by 100) concatenated with ‘%’.

Parameters
Return Type
string
class FormatPercentageOptions()
attribute humanReadable function

if returns true, parsing is avoided

function formatMany2one(value[, field][, options]) → string

Returns a string representing an many2one. If the value is false, then we return an empty string. Note that it accepts two types of input parameters: an array, in that case we assume that the many2one value is of the form [id, nameget], and we return the nameget, or it can be an object, and in that case, we assume that it is a record from a BasicModel.

Parameters

    value (Array or Object or false)

    field (Object) – a description of the field (note: this parameter is ignored)

    options (FormatMany2oneOptions) – additional options

Return Type
string
class FormatMany2oneOptions()

additional options

attribute escape boolean

if true, escapes the formatted value

function formatInteger(value[, field][, options]) → string

Returns a string representing an integer. If the value is false, then we return an empty string.

Parameters

    value (integer or false)

    field (Object) – a description of the field (note: this parameter is ignored)

    options (FormatIntegerOptions) – additional options

Return Type
string
class FormatIntegerOptions()

additional options

attribute isPassword boolean

if true, returns ‘****

attribute humanReadable function
if returns true,
formatFloat acts like utils.human_number
function formatDateTime(value[, field][, options]) → string

Returns a string representing a datetime. If the value is false, then we return an empty string. Note that this is dependant on the localization settings

Parameters

    value

    field (Object) – a description of the field (note: this parameter is ignored)

    options (FormatDateTimeOptions) – additional options

Return Type
string
class FormatDateTimeOptions()

additional options

attribute timezone boolean
use the user timezone when formating the
date
function parseMonetary(value[, field][, options]) → float

Parse a String containing currency symbol and returns amount

Parameters

    value (string) – The string to be parsed We assume that a monetary is always a pair (symbol, amount) separated by a non breaking space. A simple float can also be accepted as value

    field (Object) – a description of the field (returned by fields_get for example).

    options (ParseMonetaryOptions) – additional options.

Returns
the float value contained in the string representation
Return Type
float
class ParseMonetaryOptions()

additional options.

attribute currency Object

the description of the currency to use

attribute currency_id integer

the id of the ‘res.currency’ to use (ignored if options.currency)

attribute currency_field string
the name of the field whose value is the currency id
(ignore if options.currency or options.currency_id) Note: if not given it will default to the field currency_field value or to ‘currency_id’.
attribute data Object
a mapping of field name to field value, required with
options.currency_field
function parseMany2one(value) → Object

Creates an object with id and display_name.

Parameters
    value (Array or number or string or Object) – The given value can be : - an array with id as first element and display_name as second element - a number or a string representing the id (the display_name will be returned as undefined) - an object, simply returned untouched
Returns
(contains the id and display_name) Note: if the given value is not an array, a string or a number, the value is returned untouched.
Return Type
Object
function parseInteger(value) → integer

Parse a String containing integer with language formating

Parameters
    value (string) – The string to be parsed with the setting of thousands and decimal separator
Return Type
integer
function formatSelection(value[, field][, options])

Returns a string representing the value of the selection.

Parameters

    value (string or false)

    field (Object) – a description of the field (note: this parameter is ignored)

    options (FormatSelectionOptions) – additional options

class FormatSelectionOptions()

additional options

attribute escape boolean

if true, escapes the formatted value

function parseDate(value[, field][, options]) → Moment|false

Create an Date object The method toJSON return the formated value to send value server side

Parameters

    value (string)

    field (Object) – a description of the field (note: this parameter is ignored)

    options (ParseDateOptions) – additional options

Returns
Moment date object
Return Type
Moment or false
class ParseDateOptions()

additional options

attribute isUTC boolean

the formatted date is utc

attribute timezone boolean
format the date after apply the timezone
offset
function formatMonetary(value[, field][, options]) → string

Returns a string representing a monetary value. The result takes into account the user settings (to display the correct decimal separator, currency, …).

Parameters

    value (float or false) – the value that should be formatted

    field (Object) – a description of the field (returned by fields_get for example). It may contain a description of the number of digits that should be used.

    options (FormatMonetaryOptions) – additional options to override the values in the python description of the field.

Return Type
string
class FormatMonetaryOptions()
additional options to override the values in the python description of
the field.
attribute currency Object

the description of the currency to use

attribute currency_id integer

the id of the ‘res.currency’ to use (ignored if options.currency)

attribute currency_field string
the name of the field whose value is the currency id
(ignore if options.currency or options.currency_id) Note: if not given it will default to the field currency_field value or to ‘currency_id’.
attribute data Object
a mapping of field name to field value, required with
options.currency_field
attribute digits integer[]
the number of digits that should be used, instead of the default
digits precision in the field. Note: if the currency defines a precision, the currency’s one is used.
function formatBinary([value][, field][, options]) → string

Convert binary to bin_size

Parameters

    value (string) – base64 representation of the binary (might be already a bin_size!)

    field (Object) – a description of the field (note: this parameter is ignored)

    options (Object) – additional options (note: this parameter is ignored)

Returns
bin_size (which is human-readable)
Return Type
string
namespace
function parseFloat(value) → float

Parse a String containing float in language formating

Parameters
    value (string) – The string to be parsed with the setting of thousands and decimal separator
Return Type
float
function formatChar(value[, field][, options]) → string

Returns a string representing a char. If the value is false, then we return an empty string.

Parameters

    value (string or false)

    field (Object) – a description of the field (note: this parameter is ignored)

    options (FormatCharOptions) – additional options

Return Type
string
class FormatCharOptions()

additional options

attribute escape boolean

if true, escapes the formatted value

attribute isPassword boolean
if true, returns ‘****
instead of the formatted value
function formatDate(value[, field][, options]) → string

Returns a string representing a date. If the value is false, then we return an empty string. Note that this is dependant on the localization settings

Parameters

    value (Moment or false)

    field (Object) – a description of the field (note: this parameter is ignored)

    options (FormatDateOptions) – additional options

Return Type
string
class FormatDateOptions()

additional options

attribute timezone boolean
use the user timezone when formating the
date
function formatFloatTime(value) → string

Returns a string representing a time value, from a float. The idea is that we sometimes want to display something like 1:45 instead of 1.75, or 0:15 instead of 0.25.

Parameters
    value (float)
Return Type
string
function parseDateTime(value[, field][, options]) → Moment|false

Create an Date object The method toJSON return the formated value to send value server side

Parameters

    value (string)

    field (Object) – a description of the field (note: this parameter is ignored)

    options (ParseDateTimeOptions) – additional options

Returns
Moment date object
Return Type
Moment or false
class ParseDateTimeOptions()

additional options

attribute isUTC boolean

the formatted date is utc

attribute timezone boolean
format the date after apply the timezone
offset
function parseFloatFactor(value, field, options)

Parse a String containing float and unconvert it with a conversion factor

Parameters
class ParseFloatFactorOptions()
attribute factor number

Conversion factor, default value is 1.0

function formatFloat(value[, field][, options]) → string

Returns a string representing a float. The result takes into account the user settings (to display the correct decimal separator).

Parameters

    value (float or false) – the value that should be formatted

    field (Object) – a description of the field (returned by fields_get for example). It may contain a description of the number of digits that should be used.

    options (FormatFloatOptions) – additional options to override the values in the python description of the field.

Return Type
string
class FormatFloatOptions()
additional options to override the values in the
python description of the field.
attribute digits integer[]
the number of digits that should be used,
instead of the default digits precision in the field.
attribute humanReadable function
if returns true,
formatFloat acts like utils.human_number
function parseNumber(value) → float|NaN

Parse a String containing number in language formating

Parameters
    value (string) – The string to be parsed with the setting of thousands and decimal separator
Returns
the number value contained in the string representation
Return Type
float or NaN