Rationale
=========
Since v8, the `display_name` field is present on all models. By default,
`display_name` uses `name_get` which has pretty much the same purpose
(return record name used by the web client). Gradually, many (backend)
developers (and the ORM: https://github.com/odoo/odoo/commit/6da1c3ac4c036eac289597602976538e243cb939)
started using `display_name` (more convenient than
`record.name_get()[0][1]`) but it still had the `name_get` override.
It becomes more complex than necessary and poeple start to misunderstand
the two (and sometimes override both, leading to inconstiencies between
`display_name`/`name_get`).
To simplify the ORM and the API, we decided to keep only one of them,
the `display_name` field:
- It is much more convenient from a backend point of view
(`record.name_get()[0][1]` vs `record.display_name`)
- It is cached during the same transaction (and invalidated if
its dependencies change)
- It can be overridden like any other compute field (override
`_compute_display_name` with any extra dependencies)
- `name_get` is replaced by `read(['display_name'])`
(API perceptive), which can actually be more efficient
(if `display_name`'s depends are correct, the ORM will only fetch the
fields it needs instead of every prefetchable field)
Changes
=======
- Deprecates `name_get` for the v17 and based the method on
`display_name` (the opposite of before)
- Converts all usage of `name_get`
- Overrides of `name_get` are now overrides of `_compute_display_name`
- For `res.partner`, rename the field store `display_name` into
`complete_name` because `display_name` context-dependent and it makes
no sense to have a compute store that is context-dependent.
- Previously, it was possible to return multiple names for the same
record with `name_get`, but it was tricky and most of the usage of
this `name_get` didn't take this into account. The only example of
this is the `name_get` of `product.product`
(now use `", ".join(<names>)`).
Part-of: odoo/odoo#122085
Currently, when the geolocation coordinates (latitude & longitude) of
the partner are not set, location for such partners is shown in the
middle of the sea (on /partners page).
With this commit, the coordinates are handled properly so that if they
are not set, instead of sending "0.0" to the map API, we now pass them
as a Falsy value, so that Geocoder API could use the available address
and locate such partners properly in the google map.
taskID-2819772
closesodoo/odoo#88622
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
t-raw is used to inject safe-ified JSON into a script tag.
The scriptsafe json pseudo-module takes care of that, so remove
explicit escaping and use a script-safe JSON dump.
When .with_context() is called with a dictionary as 1st positional
argument, it will replace context (and not modify the referenced keys)
It may create bugs when losing the content of the context (e.g. remove
partner's language)
This is a partial merge of #36164 without the inventory part as
discussed.
closesodoo/odoo#36729
X-forward: 4717ccfa
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Following commit 983c7e8152.
`_compute_display_name` is overridden in partner to force `show_adress` and some
other context variables to None. When those values are in the context, calling
`display_name` can give a different result than calling `name_get()[0][1]`.
This commit reverts the changes of the mentioned commit where the behavior is
actually different, that is, when `show_address` is in the context.
It also adds a comment on the `_compute_display_name` method to avoid further
mistakes.
closesodoo/odoo#29510
Purpose
=======
display_name is equal to doing name_get()[0][1]
Replacing name_get()[0][1] by display_name could be good for 2 things:
- Uniformization of the code
- Probable optimization if name_get is used inside a for loop on a recordset (as the values will be prefetched and put in the cache).
TaskID: 1849250
closesodoo/odoo#26341
google analytics, google map api key, ... can be set by website
Remove useless duplicated label
Co-authored-by: Derie Romain <rde@odoo.com>
Co-authored-by: Kersten Jérémy <jke@odoo.com>
As of June 22 2016, the use of API key is required to access the
following:
- Google Maps JavaScript API
- Google Static Maps API
- Google Street View Image API
https://developers.google.com/maps/pricing-and-plans/standard-plan-2016-update
For domains accessing the API before June 22, it will still work without
an API key. Since Google advises to use the API key, we hide the Maps if
no API key is defined.
Since saas-3, website controllers use `request.website.render`
to render the template of a web page. This was kept for retro
compatibility. It's time to stop using deprecated stuff.
Same for `_render` method on website.
'json' route don't use `request.render` since
`JsonRequest` has no `render` method.
The only supported prefixes are the following:
- /partners/ when website_partner and/or website_crm_partner_assign are installed
- /customers/ when website_customer is installed
[FIX] website*: unfuck buggy controllers
[IMP] website*: display GoogleMap in a human-usable interface
[IMP] website_google_map: large module cleaning
- There is now only one controller, data is sent once for all!
- Map is now fully resizable in its hosting template
- HTML/CSS cleaning
- JavaScript is now human-readable ;-)