When an automated action triggers for an action of a public/portal
user session, the server action is executed with the session
credentials. As of 4a18d5744e
only employees can access model fields, including the model name,
so a temporary sudo() elevation is necessary to find the model name.
The `model` and `record` action context parameters are however still
provided with the credentials of the session, not the super-user.
Purpose
=======
When using Studio and adding a many2one field for example, it will be easier for a non technical user to find the model res.partner under the name "Contacts" than under the name "Partners".
The boolean field `is_mail_thread` on `ir.model` allows to create custom models
that inherit from model `mail.thread`. The selection field `track_visibility`
on `ir.model.fields` allows to add tracking on custom fields.
Also change the order on model `ir.model` to make mail thread models appear first.
The fields objects are responsible for creating their column/table and indexes.
The methods that update the schema are overridden to handle cases specific to
each type of field.
Simplify the API as much as possible, and delegate all the implementation
details to the models `ir.model`, `ir.model.fields`, `ir.model.constraint` and
`ir.model.relation`.
In a lead:
- Fill in contact information (phone, address, email...)
- Create a new contact
All information is copied to the new contact, except the email.
opw-706711
If a bundle contains a file whose URL does not match any file in the
filesystem, its content is searched in the ir.attachment records.
The problem was that the content was base64-decoded but also had to
be utf-8 decoded to make its use work (like it would have been done
if the file was found in the filesystem).
Before this commit, when a LESS bundle compilation failed, web pages
were displayed without any style and the error appeared in the DOM
thanks to a custom ::before style which was ugly and not selectable.
Now the error is displayed like any other error in Odoo: in a dialog
with selectable content. The pages are also displayed with the last
style which was successfuly compiled.
If odoo dialog are not defined (a page without any javascript), a
fallback has been implemented to show the LESS error with a JS alert.
When using read_group() and grouping by many2one fields, the many2one groupby
fields get updated from an integer id to a tuple from name_get() at the end
of the method.
e.g.: {'user_id': 1, ...} -> {'user_id': (1, u'Administrator'), ...}
To do this, it reads the many2one field by browsing on self.
When self is a model with _auto = False (typically an SQL view), searching by
id can be costly as the id column may not have usual properties for performance
(in some cases a full computation of the table is required to look up 1 id).