Commit Graph
403 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 4f62d6dd8f [MERGE] forward port branch saas-11.4 up to ef6b574eda 2018-08-22 12:02:30 +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
Stefan Rijnhart b3824aa6cb [RFR] Hide implementation of constraint definition storage, courtesy of Raphael Collet 2018-08-16 10:33:06 +02:00
Stefan Rijnhart 6327b8f97f [IMP] Store the original constraint definition as a comment on the constraint
and use it to determine if the constraint definition was changed. This prevents
endless readding of constraints that are reformatted by postgresql in an
unrecognizable way (in which e.g. "CHECK (credit*debit=0)" becomes
"CHECK ((credit * debit) = 0::numeric)")
2018-08-16 10:33:06 +02:00
Florent de Labarre d319160d3d [IMP] models: keep a consistent order for record metadata
When reading the metadata of a record, ensure the order is consistent.
The retrieval of ir.model.data is now done using an order=id query

Use the ORM to retrieve ir.model.data instead of making an SQL to clean old
code (introduced at b3b22afc68)

Closes #25658
2018-08-13 16:44:08 +02:00
Francois Volral 914bbd363c [FIX] orm: Fix a bug in _read_group_fill_temporal.
_read_group_fill_temporal was returning a None value instand of a [] when its
'data' parameter was an empty array, resulting in crash in graph_view.
2018-08-13 15:45:38 +02:00
Francois Volral 6caf5ed7d2 [FIX] orm: Adapt test and read_group_fill_temporal
In the commit 4a40db2. the implementation of read_group_fill_temporal was
simplified during final review and tests needed to be adapted.

Also fix the implementation issues as detected by the tests.
2018-08-10 18:15:27 +02:00
Francois Volral 4a40db2097 [IMP] orm: add support to fill temporal holes (read_group)
This commit add an extra parameter 'fill_temporal' to read_group which allows
the orm to add missing groups for date intervals. This is useful for charts.

Suppose that we are in a use case where data are grouped by a date fields
(typically months but it could be another interval) and displayed in a Bar Chart
or a Line Char.
Let's says a request has to group records by month for August, September
and ...December.  If we don't changed anything, we would get a Bar Chart
looking like this :
                                        ___
                              ___      |   |
                             |   |     |   |
                             |   | ___ |   |
                             |   ||   ||   |
                             |___||___||___|
                              Aug  Sep  D
December follows directly after September, it can be unintuitive for the
user, so we change that. We add some fake records for each missing months
between the earliest and the lastest date of the result
                                             ___
                         ___                |   |
                        |   |               |   |
                        |   | ___           |   |
                        |   ||   |          |   |
                        |___||___| ___  ___ |___|
                         Aug  Sep  Oct  Nov  Dec

This commit is part of task #1835644
2018-08-10 17:21:17 +02:00
XavierDo 1de9496f14 [IMP] mail: add activity view
A simple new view to easily display all activity on a model grouped
by res_id and activity_type_id. Some action are possible like sending
a mail template for all record having an activity with this activity type
and present in the view (depends on the filter).

The view use the Kanban activity view on cells. It could be a good idea
to rename this widget to something like "DropdownActivityView" (maybe
after the freeze)

Task: #1870662
PR: #26272
2018-08-10 15:20:37 +02:00
Christophe Simonis 7499b47ffa [MERGE] forward port branch saas-11.4 up to edd586002e 2018-08-10 13:37:21 +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 0ab6845ed8 [FIX] models: make read_group() call name_get() on demand only
This improves the performance of code using read_group() without actually using
the display names of the result.  It also optimizes name_search().
2018-07-24 17:02:07 +02:00
Raphael Collet fdeeedc2b9 [FIX] models: inverse fields in dependency order
The result of inversing several fields on a record is non-deterministic if one
of those fields depend on another one.
2018-07-24 16:58:14 +02:00
Raphael Collet 3b710ed640 [IMP] fields: optimize field.write for batch creation 2018-07-24 16:58:14 +02:00
Raphael Collet d5b687a48f [REF] models: import records in batch
Create new methods on `BaseModel` to create records with given xml ids in
batch.  Those methods replace the methods `_update` and `_update_dummy` of
model 'ir.model.data', which are now deprecated.

Adapt XML and CSV import code to create records in batch.
2018-07-24 16:58:14 +02:00
Raphael Collet b1e83fd7b8 [REF] models: make create work in batch
Add a decorator `model_create_multi` to indicate whether a `create` method is
implemented to work in batch.
2018-07-24 16:58:14 +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