Commit Graph
1852 Commits
Author SHA1 Message Date
Pratima Gupta caf400fa7c [IMP] tools: allow more items in styling white list when sanitizing
Some of the templates Odoo proposed do not display well on all email readers
as too much styling attributes are sanitized. This commit adds some styling
in the white list to allow having stylized templates while still having a
coherent white list.

This commit is related to task 51122 (and PR #24052).
2018-06-08 15:20:03 +02:00
Christophe Simonis 2ab7ad8361 [MERGE] forward port branch saas-11.3 up to c00df14654 2018-06-07 11:43:07 +02:00
Christophe Simonis 969eb3fa2f [MERGE] forward port branch saas-11.2 up to c834c0f587 2018-06-06 15:46:36 +02:00
qdp-odoo a6b75d401d [REF] mail_thread: refactoring of _find_partner_from_emails()
More flexibility equals more powa
2018-06-06 14:17:03 +02:00
Olivier Dony 86ae4b90a3 [IMP] mail: make connection test attempt to send an email
The "connection test" was only attempting to establish a socket to the
SMTP server and then trying to login, if credentials were setup.

This would catch basic config errors but would fail to detect setups
were the SMTP server would forbid relaying, because of missing
credentials, missing STARTSSL mode, and other more complex cases.

By actually beginning a real SMTP session and sending the MAIL FROM,
RCPT TO and DATA command, we make sure that the server appeas willing to
relay emails from the current user address to an arbitrary recipient
address. Then we close the session before actually sending the message.

In order to have a valid destination domain with a valid MX server, we
use an odoo.com recipient address for the test, which should prove that
the destination server will relay to arbitrary addresses (unless the
destination server is an Odoo.com MX server ;-))
2018-06-06 10:26:30 +02:00
Olivier Dony c72eec46f9 [FIX] mail: do not shadow SMTP errors with QUIT
When an exception is raised during the course of a normal SMTP session,
smtplib's `sendmail()` method will close the channel automatically,
so any further attempt at sending SMTP commands will fail with an
SMTPServerDisconnected error, even just calling `smtp.quit()`.
This will shadow the original error, and make debugging harder.

Fixes #1493
2018-06-06 10:26:22 +02:00
Olivier Dony 6ef27bb913 [REM] core: remove deprecated v7 onchange support
Old API support has been dropped as of 11.0, and the old onchange system
should have been discontinued along with it.

New-API onchange mechanism is automatically triggered without requiring
any extra markup in view declarations, as explained in the
documentation:
- https://www.odoo.com/documentation/11.0/reference/orm.html#porting-from-the-old-api-to-the-new-api
- https://www.odoo.com/documentation/11.0/reference/orm.html#onchange-updating-ui-on-the-fly
2018-06-06 10:25:58 +02:00
Olivier Dony 025e65a925 [REV] Revert "[IMP] base: select countries & state based on exact code, (useful for import and fast many2one)"
This reverts commit 09a22e3bef, which was
attempting to fix a use case that was actually working.
It also created a duplicate `name_search()` method for res.country, in
addition to the one aliased to `location_name_search()`

It is indeed supported to import countries and states, using the
country code or state code as the imported value. These will be matched
uniquely thanks to the special `name_search()` performed for import,
forcing the `operator`.
And this is done while still allowing proper auto-completing for normal
UI case, where the "exact code match" will only promote an extra result
at the top of the suggested matches, rather than limit the results to a
single match.

The confusion apparently stemmed from the test case using "UK" as the
country code. UK is not a valid ISO country code, so it would never
match as expected.
2018-06-06 10:22:19 +02:00
Ivan Yelizariev f81963addd [IMP] base: correct link in comment
To describe the date format on babel website
Closes #25085
2018-06-06 10:11:47 +02:00
Christophe Simonis aba8c2b8fb [MERGE] forward port branch 11.0 up to 1b272a2050 2018-06-05 16:27:49 +02:00
Christophe Simonis 279d928693 [FIX] core: always load base and web as server wide modules
Since 285ead28e3, `base` should be loaded
as a server wide module to enable rpc routes.
2018-06-05 14:46:24 +02:00
Pierre Masereel 675ed5d9dd [FIX] expression: interpret (X, 'child_of', False) as false
Interpret such domains that do not really make sense as falsy, and log a
warning when it occurs.
2018-06-04 17:07:50 +02:00
Odoo Translation Bot 75c44c4778 [I18N] Update translation terms from Transifex 2018-06-04 11:08:02 +02:00
Lucas Perais (lpe) a1d5f32296 [FIX] base: res.config.settings discard should actually discard changes
Before this commit, some values of res.config.settings were saved
(e.g case of website settings were some fields are related)

After this commit, they are not saved

OPW 1853230
closes #24972
closes #25028
2018-06-04 09:13:58 +02:00
Odoo Translation Bot fc5e61b63d [I18N] Update translation terms from Transifex 2018-06-03 07:04:06 +02:00
Odoo Translation Bot 395459d077 [I18N] Update translation terms from Transifex 2018-06-03 04:41:19 +02:00
Raphael Collet 627292f7f3 [IMP] convert: simplify context when creating records
The context was containing a dictionary under the key `install_mode_data`,
which was informing about the model, xml_id, module, filename.  Actually only
the module and filename were necessary, and the others were slowing down the
import because of generating artificially different environments.

The context now has two entries `install_module` and `install_filename`.
2018-06-01 13:30:28 +02:00
Raphael Collet 655ec91807 [IMP] models: simplify API of _parent_store_create and _parent_store_update
The parameter `vals` is no longer given, and the first method has been adapted
to work on several records.
2018-06-01 13:30:28 +02:00
Raphael Collet 23a3ee1254 [IMP] models: no need to mark non-stored fields as modified
Those will be handled by the transitive closure made over non-stored
dependencies.
2018-06-01 13:30:28 +02:00
Adrian Torres a5ccc1b6b5 [FIX] orm: re-create constraints of extended fields
Before this commit:

* Module A defines a field X of model M
* Module B inherits from model M without touching field X
* Module C inherits from model M and extends field X by giving an INDEX
/ NOT NULL constraint.
* Module B and C depend from Module A, but not each other

If all three modules are installed and Module B is updated, the INDEX /
NOT NULL constraint could be dropped.

This happens because Module B can be loaded before Module C is loaded,
if that's the case, then after the upgrade of Module B, during the
schema checking, we verify that the field object we have and the field
on the DB are the same, since Module B doesn't introduce the index then
this check is false and we drop the index. When we get to loading Module
C, we do not do any schema checking because the module is not marked as
`to upgrade`, therefore the index is lost forever.

To solve this, we re-init the models that belong to the set of the intersection
between upgraded and modified models and loaded and modified models.

Fixes #24958
2018-06-01 10:55:35 +02:00
Martin Geubelle eee245cee8 [IMP] base: allow to move an element in inherited view
The `position='move'` has been introduced to move an element in an inherited
view.

It's used as
<xpath expr="//@target" position="after">
    <xpath expr="//@node" position="move"/>
</xpath>

or also

<field name="target_field" position="after">
    <field name="my_field" position="move"/>
</field>

The xpath with a position `after`, `before`, `inside` or `replace` can thus now
have another xpath as *direct* child with position `move`.
2018-06-01 10:19:09 +02:00
Christophe Matthieu 241e67b788 [FIX] qweb: Field type monetary use the record context
Before this fix, the _convert method use the context of the qweb rendering
instead of use the record context.

'date' and 'company' are automatically set as option for the field. The
template who use t-esc with the widget monetary must define the options.

The bug is introduce by https://github.com/odoo/odoo/commit/7a282c99655d4f154ac1808fcb8a70339dc70930
2018-05-31 10:26:52 +02:00
Laurent Smet dfde326e75 [IMP] account: add account.fiscalyear model
In order to improve the fiscal year management, we allow the user to define custom fiscal years
    using the account.fiscalyear model.

Was task: https://www.odoo.com/web#id=39878&view_type=form&model=project.task&menu_id=
Was PR #20936
2018-05-30 18:28:13 +02:00
Olivier Colson cda8bdc8b3 [FIX] base: res.currency: use company_id context value as an integer id (not as a model reference) as it used to be before refactoring.
The use of id and model reference was inconsistent for this variable, depending on the content of the context. Doing this caused a failure when trying to load some financial reports (> Balance Sheet, Spanish reports, ...) of accounting in multi company, if both companies had not the same currency.
2018-05-30 15:01:01 +02:00
Christophe Simonis e008ef302a [MERGE] forward port branch saas-11.3 up to 53300648ed 2018-05-30 12:18:52 +02:00
Olivier Colson 4a1bc45934 [FIX] base: set vat number field as readonly on children partners; as it is a commercial field, it should always have the value defined on the parent partner.
(this is a manual forward port from https://github.com/odoo/odoo/commit/98b1fffd4e99cc8ad2862c56fbd727979c38c48b , as a new view is defined in 11.0, needing this correction too)
2018-05-30 10:50:50 +02:00
Christophe Simonis c2c9a60466 [MERGE] forward port branch saas-11.2 up to a2f275dfc4 2018-05-29 21:05:26 +02:00
Christophe Simonis a2f275dfc4 [MERGE] forward port branch 11.0 up to 4ea3838d89 2018-05-29 20:00:31 +02:00
Christophe Simonis f36e6917bd [MERGE] forward port branch saas-11.3 up to 37eed7c509 2018-05-29 17:34:43 +02:00
pimodoo fedec79a8b [FIX] base: missing rng attribute 'force_save' on fields
Th view validation when attribute force_save is set on a field raise an
'Invalidation error' because there is no rng attribute for 'force_save'.

This attribute disappeared during the refactoring in rev: https://github.com/odoo/odoo/commit/70942e4cfb7a8993904b4d142e3b1749a40db806
2018-05-29 17:18:49 +02:00
Odoo Translation Bot ca653c8c44 [I18N] Update translation terms from Transifex 2018-05-29 14:14:28 +02:00
Benjamin Stiens 6383120f3b [IMP] all: Improve error messages
Many error messages are misleading or too "vague"
This task aims to improve all error message.

Task #47042
PR #23321
2018-05-28 16:45:48 +02:00
William Henrotin c9735c75d6 [IMP] base: prevent to archive users linked to active partners.
An active user could not see messages in its inbox if his partner is
archived. With this commit, we cannot archiving a partner linked to an
active user anymore.

In the opposite way:

 -if we deactivate a user, warning message is given saying the related
  partner will stay active. A link to the related partner is also given
  if we really need to archive it;
 -if we activate a user, the related partner will be set as active;

This commit is linked to task ID 46158. Closes #24628.
2018-05-28 14:43:06 +02:00
Christophe Simonis f65528a74e [IMP] http: avoid saving sessions for some endpoints
Endpoints can be explicitly marked as `save_session=False` (default is
true across the board). In that case they will have an in-memory session
(either the existing one or a brand new one) but the session won't be
persisted to disk.

Currently used for non-browser RPC endpoints: the APIs don't use
cookies/sessions and we can't assume the RPC libraries keep cookies
across calls. This means a new session is created and saved to disk for
each RPC calls, for no useful reason.
2018-05-28 09:48:29 +02:00
Odoo Translation Bot 01d024d2d5 [I18N] Update translation terms from Transifex 2018-05-27 07:03:37 +02:00
Odoo Translation Bot a89e46fdc0 [I18N] Update translation terms from Transifex 2018-05-27 04:10:26 +02:00
Fabien Meghazi 32c5392f5f [ADD] http: addons preload opt-out for socket activation
Before this patch, early connections made to a 11.0 Odoo server running
on Python 3 and deployed in threaded mode with socket activation would
generate invalid registries.
With this patch it is now possible, when this deployment mode is used,
to opt-out addons preload by setting the following environment variable:

    ODOO_PRELOAD_ADDONS=no

Note: this environment variable is only available for v11.0 as later
versions does not preload anymore (cf: 1a39c9b)
2018-05-25 15:33:31 +02:00
Christophe Simonis 37eed7c509 [MERGE] forward port branch saas-11.2 up to 58e3552246 2018-05-25 14:34:18 +02:00
Christophe Simonis 58e3552246 [MERGE] forward port branch 11.0 up to 2ca7296000 2018-05-25 11:50:02 +02:00
Christophe Simonis 2ca7296000 [MERGE] forward port branch saas-15 up to dbb2b9bf73 2018-05-25 11:08:39 +02:00
Christophe Simonis dbb2b9bf73 [MERGE] forward port branch saas-14 up to cafe56da80 2018-05-24 19:40:05 +02:00
Christophe Simonis cafe56da80 [MERGE] forward port branch 10.0 up to 3051d1dd2f 2018-05-24 18:24:12 +02:00
Christophe Simonis 299b613da3 [MERGE] forward port branch 9.0 up to 919a1af936 2018-05-24 16:31:23 +02:00
xmo-odoo 4ac7820afb [IMP] export: move XIDs management to end of export & batch further
* export benches for m2o
* tag benches instead of requiring editing the source to enable them
* dump the profiling stats intead of saving to disk (less convenient
  for complex analysis but way more so for simple overview)
* add M2O benching in addition to the existing integer-based one in
  order to expose problematic behaviour when exporting significant
  numbers of non-shared relational records (& quantify impact of
  creation v read)

Following odoo/odoo#22493 the performances of exporting XIDs was
greatly improved by batching XIDs and avoiding the ~3 SQL queries per
xid/record when no xid exists yet.

*However* the batching was done per call of _export_rows and to handle
relational fields _export_rows calls itself recursively leading to
sub-standard xid batching:

* for M2M and O2M fields, some batching would happen on a
  parent-record basis, each M2M or O2M field (in a parent) would be
  xid-batched, but two parent records wouldn't see their children
  xid-batched together
* for M2O, there would be essentially no batching with a call to
  __ensure_xml_id per record and while less queries than before in the
  worst case more complex ones in fact

Change: rather than ensure XIDs exist when performing the export, add
XIDs export as a post-processing of the exported records table. This
way, each involved model can be entirely batched and exporting 10000
records's (id, value_id/id) 2 calls instead of 10001.

Also rename _export_rows's recursion parameter for clarity, it has
clearly outgrown its use as a batch invalidation flag and the name
is now less than clear.

Furthermore _-prefix & mandate kwarg usage to make it clearer it's not
really a "public" parameter, and is intended as an internal recursion
flag.
2018-05-24 14:50:13 +02:00
xmo-odoo a06066b920 [IMP] merge auth_crypt into base
* store hashed passwords in the `password` column but gate it behind a
  computed field
* make the password field essentially write-only (SQL aside)
* add a "plaintext" hash type so it's possible to set the password in
  SQL directly & be able to login & have it automatically updated

Task 34211
2018-05-24 14:43:31 +02:00
Christophe Simonis 2bc6ea1b37 [MERGE] forward port branch 11.0 up to 02ee3fd88e 2018-05-23 19:33:40 +02:00
Yannick Tivisse 473c74f636 [IMP] various: Override _(name_)search instead of (name_)search
Purpose
=======
The method _name_search and _search add support to search as another user.

All the overrides of name_search and search redefine the behavior of the search.

This bring inconsistencies as the result of a call to _name_search and name_search
could differ on certain modules, which is not acceptable.

Specification
=============

Example:
~~~~~~~~

If the name_search method is overridden to search also on the driver name,
then calling name_search with a label 'JF' will return all the cars with a name containing
'JF' or all the cars with a driver name containing 'JF'. Let's say that we have a ir.rule
preventing a user to read the cars of another company. Then the call to name search only returns
the cars satisfying the previous condition AND belonging to his company.

Now, we want to overpass this constraint. We call _name_search with the attribute name_get_uid=1.
Then the call to _name_search returns all the cars from all the companies with a name like 'JF',
but nothing is done about the driver_name.

Example of wrong search redefinition on a model
-----------------------------------------------

    @api.model
    def name_search(self, name, args=None, operator='ilike', limit=100):
        domain = args or []
        domain = expression.AND([domain, [('name', 'ilike', name)]])
        partners = self.env['res.partner'].search([('name', operator, name)])
        if partners and name:
            domain = expression.OR([domain, ['|', ('driver_id', 'in', partners.ids), ('driver_id', '=', False)]])
        rec = self.search(domain, limit=limit)
        return rec.name_get()

Example of correct search redefinition on a model
-------------------------------------------------

    @api.model
    def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
        domain = args or []
        domain = expression.AND([domain, [('name', operator, name)]])
        partner_ids = self.env['res.partner']._search([('name', operator, name)], access_rights_uid=name_get_uid)
        if partner_ids:
            domain = expression.OR([domain, ['|', ('driver_id', 'in', partner_ids), ('driver_id', '=', False)]])
        rec = self._search(domain, limit=limit, access_rights_uid=name_get_uid)
        return self.browse(rec).name_get()

The same logic should be applied on the overrides of the search method.
2018-05-23 11:15:46 +02:00
Simon Lejeune 565277acbb [REF] base: assets: fallback on sassc if libsass not present 2018-05-23 11:05:03 +02:00
jem-odoo e38ed7c780 [MOV] purchase_stock: move code from purchase
We want to break the dependency between stock and purchase
for our furtur developpement. For more modularity, a new
bridge module 'purchase_stock' is created.
This commti move part of business code, views, data, ...
related to stock management from purchase into purchase_stock
without changing any feature.

Task #47927
2018-05-23 10:13:49 +02:00
Christophe Simonis 3d7b238b8e [FIX] core: correctly decode 8bit mail headers
When an header contains surrogates, an Header object is returned when
read headers from Message objects.

Also, correctly join header parts in python3.
2018-05-22 16:45:59 +02:00