Commit Graph
289 Commits
Author SHA1 Message Date
Christophe Simonis 49c3264ce0 [MERGE] forward port branch saas-11.3 up to 4850fb0838 2018-09-07 14:43:48 +02:00
Toufik Benjaa 7700bd172f [FIX] mail: Avoid using default value for track fields logging
- When a tracked field is modified, a mail.message is created.
  When create is called its tries to fill missing values with "default
values".
  It first tries to find the default values in the context, which may
occurs.
  For example, modifying a tracked field on a subtask will add a key
"default_parent_id" in the context, which is the parent_id of the project.task.
  Create will try to use "default_parent_id" for the mail.message
parent_id field, which make the SQL Request invalid.
2018-09-05 18:36:54 +02:00
Christophe Simonis ef6b574eda [MERGE] forward port branch saas-11.3 up to 6cc7d3f945 2018-08-21 18:48:13 +02:00
Christophe Simonis 70d0148d0d [MERGE] forward port branch 11.0 up to fbfb91799e 2018-08-21 16:58:17 +02:00
Christophe Simonis fbfb91799e [MERGE] forward port branch saas-15 up to 9cf0dbe226 2018-08-21 16:00:40 +02:00
Christophe Simonis e80f853ab3 [MERGE] forward port branch saas-14 up to aafa6e38c4 2018-08-21 12:06:23 +02:00
Christophe Simonis aafa6e38c4 [MERGE] forward port branch 10.0 up to 342d037373 2018-08-21 11:33:53 +02:00
Nicolas Martinelli 07b5f205ab [FIX] models: unlink ir.property
On a new DB with demo data, as Demo User:
- Create a partner
- Unlink the partner

An `AccessError` is raised.

The error is raised on `ir.property`, for the field
`property_product_pricelist`. An entry was indeed automatically created
at partner creation. However, a regular user is not allowed to delete an
`ir.property`.

The property can be safely deleted as SUPERUSER as long as the proper
unlink access rights have been tested beforehand.

opw-1870737
2018-08-21 09:32:01 +02:00
Christophe Simonis 7717f082c0 [MERGE] forward port branch saas-11.3 up to af35aea6b0 2018-08-09 19:33:32 +02:00
Christophe Simonis 9cb97a8c2d [MERGE] forward port branch saas-11.2 up to 499af66727 2018-08-09 15:06:31 +02:00
Christophe Simonis efe2dcd7ae [MERGE] forward port branch 11.0 up to ced9156a97 2018-08-07 19:08:07 +02:00
Christophe Simonis 65a80cf3fd [MERGE] forward port branch saas-14 up to 0c5cbbe0bb 2018-08-07 17:01:16 +02:00
Christophe Simonis 0c5cbbe0bb [MERGE] forward port branch 10.0 up to 692a32e780 2018-08-07 16:54:18 +02:00
Christophe Simonis 8d9366197e [MERGE] forward port branch saas-11.3 up to 691dd65e0e 2018-08-01 17:23:03 +02:00
Christophe Simonis a9bb3249c6 [MERGE] forward port branch saas-11.2 up to 22b31152ca 2018-08-01 15:17:21 +02:00
Christophe Simonis 22b31152ca [MERGE] forward port branch 11.0 up to f9e0f6663f 2018-08-01 14:20:39 +02:00
Christophe Simonis 8c81eaabe6 Revert "[FIX] models: make onchange return a smaller diff"
This reverts commit 2054b59285 which
already has been fixed multiple times [0].

However this change does not correctly handle successive onchange calls on
ony2many fields which alter existing rows.

i.e., in saas~11.4, an onchange has been added on move lines [1] in
order to create and/or update lines containing taxes amounts.
However, with diff-only onchange, a second call to onchange will discard
changes made by a first one as nothing change between the 2 calls.

Scenario: On an existing account.move, add a new credit line with a tax set.
The first onchange will update the tax line with new amount. Add a
second line (with debit amount balanced). The onchange will not change
the tax line, resulting as it value being reset to initial value. As a
result, the move is not balanced and cannot be saved.

[0] cd2ccc4110, 5e58ac16c3, 07023137cd
[1] d49ab568a2
2018-07-31 19:36:30 +02:00
Christophe Simonis a719cf2563 [MERGE] forward port branch saas-11.3 up to b4555df336 2018-07-30 17:02:28 +02:00
Christophe Simonis b4555df336 [MERGE] forward port branch saas-11.2 up to 3376bad191 2018-07-30 15:51:38 +02:00
Christophe Simonis e1585c1a75 [MERGE] forward port branch 11.0 up to adc97120c9 2018-07-26 19:16:14 +02:00
Nicolas Lempereur 07023137cd [FIX] models.py: onchange creating m2m => no NewId
Since 2054b59 if we created a record in a many2many relationship of an
onchange, we would also possibly erreneously return the NewId.

The logic of convert_to_onchange of _RelationalMulti doesn't send back
the ID field (if the ID is needed, it is part of the command, not the
update/create dictionary values of a command) and this commit does the
same for the code changed in 2054b59.

This commit also adds a test for this fix, and a test for the regression
corrected with cd2ccc4110 reported in #25969

fix for https://github.com/odoo/odoo/commit/2054b5928#commitcomment-29837226
closes #25984
2018-07-26 15:26:27 +02:00
Christophe Simonis 93e689d1c2 [MERGE] forward port branch 11.0 up to 1353abecbe 2018-07-26 12:58:46 +02:00
Can Tecim 5e58ac16c3 [FIX] models.py: onchange in python2 with 2054b59
Without the call to `super`, with at least two level off expected
onchange return data (eg. `invoice_lines.name`) we have an error in
python2, python3 python implementation of OrderedDict and possibly other
python implementation.

So this worked most often (with python3 CPython C implementation of
OrderedDict) by chance.

closes #25960
2018-07-26 09:58:29 +02:00
Christophe Simonis cd2ccc4110 [FIX] models: correct onchange on one2many fields
The method `convert_to_onchange` on one2many fields [1] makes a `copy()`
of `subnames` before altering it. However during onchange management, we
pass it a `PrefixTree` object that can't be copied. As we knows the
object is empty, directly use a empty dict.

[1] https://github.com/odoo/odoo/blob/e6928a6c976cf0f0f7b7b3280205516ad677b413/odoo/fields.py#L2221

Oversight of 2054b59285
2018-07-25 16:11:39 +02:00
Raphael Collet 2054b59285 [FIX] models: make onchange return a smaller diff
Large diffs (specifically in x2many fields) cause performance issues.  They
overload the web client, which considers all returned fields as dirty.
2018-07-24 17:12:04 +02:00
Raphael Collet 4b1b70a77a [FIX] base: access rights on transient models 2018-07-23 16:21:07 +02:00
Raphael Collet ff45f22750 [FIX] models: correct regex for onchange_v7
Ensure, we only match the expected az-A-Z characters for old-style onchanges.
The \w allowed starting with 0-9 which should be prevented.
2018-07-12 13:55:42 +02:00
Raphael Collet e93fa78562 [FIX] base: access rights on transient models 2018-07-23 16:21:07 +02:00
Raphael Collet 2c9c7e770a [FIX] models: correct regex for onchange_v7
Ensure, we only match the expected az-A-Z characters for old-style onchanges.
The \w allowed starting with 0-9 which should be prevented.
2018-07-12 13:55:42 +02:00
Christophe Simonis 73652a0b19 [MERGE] forward port branch saas-11.3 up to 50860317cc
Note: 1aacc96262 has been ignored and will
be forward-ported later
2018-06-15 13:27:27 +02:00
Christophe Simonis 50860317cc [MERGE] forward port branch saas-11.2 up to b170a753e1 2018-06-15 11:30:27 +02:00
Christophe Simonis af1853775f [MERGE] forward port branch 11.0 up to e3658d6f56 2018-06-12 16:49:11 +02:00
Christophe Simonis e3658d6f56 [MERGE] forward port branch saas-15 up to d44cd77884 2018-06-12 16:31:54 +02:00
Christophe Simonis d44cd77884 [MERGE] forward port branch saas-14 up to 284ed9216c 2018-06-12 12:19:14 +02:00
Christophe Simonis b6496f8b38 [MERGE] forward port branch 10.0 up to 9032617120 2018-06-11 19:20:38 +02:00
Goffin Simon f6d69ff2d3 [FIX] odoo: copy_translation translates the wrong view
With website_version, when publishing a version and copying the current version,
the copy_translation wrote a new translation for the copy of master in the published
view instead of the copied view.

Reason:

When writing in the view, odoo checked in the context the current version and
wrote in the view corresponding to the key and the verion seen in the website.
So when copying a view, it translated the copied view instead of the copy of
the view.

The write is made by the function copy_translation with the line:

   "new_wo_lang[name] = old_wo_lang[name]"

opw:1856150
2018-06-11 13:22:01 +02:00
jem-odoo a7d9d966a5 [FIX] models: m2o display name as sudo in read_group
In 10.0, the resolution of the m2o field in a read group was
done with a `read` (which sudo the name_get). So, the access
rights were bypassed to get the display_name of the related
records.
In 11.0, a call to `name_get` but not as `sudo` causing access
error in some case. For instance;
- a user has read access on project
- he log some timesheets
- its access to project is removed, but not the timesheet ones
- trying to access its own timesheet via the grid view (which does
a read_group)
- the user gets the access error for project.

The read_group should reproduce the behavior of the `read` method,
so the `name_get` for m2o field during a read_group is now sudoed
to restore previous behavior.

opw-1855942
2018-06-07 16:52:00 +02:00
Christophe Simonis 2ab7ad8361 [MERGE] forward port branch saas-11.3 up to c00df14654 2018-06-07 11:43:07 +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
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
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
Christophe Simonis f36e6917bd [MERGE] forward port branch saas-11.3 up to 37eed7c509 2018-05-29 17:34:43 +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
Christophe Simonis 5a751fa200 [MERGE] forward port branch saas-11.2 up to aae54ecc15 2018-05-09 15:45:20 +02:00
Christophe Simonis eeae2b80ea [MERGE] forward port branch 11.0 up to b793e23ae5 2018-05-09 13:55:27 +02:00
xmo-odoo 020906659e [FIX] orm: "relate" binding type on actions
When ir.values was removed and the "action" ir.values were merged
directly into the actions themselves, "client_action_relate" was
discarded as unused (and possibly too similar to
client_action_multi?). *However*:

* it was actually used implicitly as "relate" was the default key2 of
  the <act_window> XML tag
* and it had a crucial difference from client_action_multi:
  client_action_multi is shown on both form and list views by default
  and only on list if multi=True, whereas relate is shown on *either*
  the form or list view (tree if multi else form)

This means without relate the actions which should be only visible on
the form view are now on both list and tree, which leads to
overpopulated `Action` menus and odd behaviours (e.g. actions relying
active_id on lists, which id do they get and why?)

=> reintroduce relate as "action_form_only" for the specific case of
multi=False and either no key2 or a key2 of client_action_relate. If
multi=True then binding_type=action.

Fixes #20124

Followup: Task 1843603 to remove #multi and redundancy
2018-05-09 09:45:29 +02:00
Christophe Simonis 013ce7f889 [MERGE] forward port branch 11.0 up to f2e105eeca 2018-05-08 19:08:18 +02:00
Christophe Simonis 9d6ea8ef3e [FIX] api: do not prefetch new records.
New records (with a NewId) are not necessary in the cache, but should
not be prefetched.
This check has been omitted during optimisation in b0c08a6846.

opw-1843566
opw-1843636
opw-1843683
opw-1843548
opw-1843629
opw-1843657

Closes #24595
2018-05-07 18:58:27 +02:00
Christophe Simonis ac63dfc8f4 [MERGE] forward port branch 11.0 up to 8dade01e2c 2018-05-04 16:10:50 +02:00