Commit Graph
207 Commits
Author SHA1 Message Date
Christophe Simonis ddb0fb2739 [MERGE] forward port of branch saas-9 up to 59d3f63 2016-03-24 16:53:45 +01:00
Raphael Collet ce217acf18 [FIX] fields: *2many convert_to_cache for new records
When interpreting commands, the initial value for new records is an empty list.
This regression was introduced by 0939738479.

Fixes #11239.
2016-03-15 10:40:38 +01:00
Raphael Collet a4ea258176 [FIX] fields: company-dependent (property) fields should not be stored or copied 2016-03-03 16:47:05 +01:00
Thibault Delavallée fd25fd4d44 [FIX] fields: do not strip class by default
Do not strip class by default on html fields, this was an error. Currently
only mail_message body field should not contain classes. Indeed as external
content can be stored through the mail gateway we do not want to keep the
classes.
2016-03-02 16:43:04 +01:00
Thibault Delavallée c9e38cae9f [FIX] fields: html: strip_style / strip_classes
Added the support of strip_classes, like the already existing strip_style
parameter of html fields.. This parameter is missing but allow full
customization of html fields.

Also fixed the call to the sanitizer in fields. Indeed the strict mode is
set to False. When not in strict mode the classes are never stripped whatever
the value of strip_classes.

Sanitizer is now called always in strict mode to ensure the sanitize process
is correct and really take into account strip_style and strip_classes.

This fix is done in master due to possible side effects and possible behavior
changes that are not welcomed in stable versions.
2016-03-02 14:31:39 +01:00
Christophe Simonis 9a805c90ed [MERGE] forward port of branch saas-9 up to d70fde0 2016-02-10 18:40:56 +01:00
Denis Ledoux 04b2d910ac [MERGE] forward port of branch saas-6 up to fead627 2016-02-08 13:39:28 +01:00
Denis Ledoux fead627dd5 [MERGE] forward port of branch 8.0 up to 3ff4dae 2016-02-08 13:31:27 +01:00
Raphael Collet 408330a655 [FIX] fields: track correctly which module introduced a given field
If a module adds a field on a given model, deinstalling that module must remove
the field from all the models that inherited the given field.
2016-02-04 15:52:06 +01:00
Raphael Collet 58292bf311 [FIX] fields: in _setup_default, do not lookup _default in model classes 2016-02-04 15:52:06 +01:00
Raphael Collet 8a7552e5b7 [FIX] models: exclude magic, custom and inherited fields from a model's proper fields
Those cases can now appear, since a model inheriting (with `_inherit`) from
another model can observe those extra fields from its parent model's class.
2016-02-04 15:52:05 +01:00
Raphael Collet a3ec5a35a5 [FIX] fields: in copy_cache, add single records to set todo 2016-02-04 14:33:53 +01:00
Raphael Collet 0f2e7d783e [FIX] fields: make copy_cache use a todo list instead of recursion
The recursion was based on an incorrect assumption: the cache of the target
environment is initially empty.  If another computation left some value there,
the copying is incomplete, and that causes bugs in onchanges.
2016-02-04 13:48:28 +01:00
Christophe Simonis 04416a5a6f [MERGE] forward port of branch saas-9 up to 469e04e 2016-02-02 14:55:52 +01:00
Christophe Simonis 9ca7ad87b2 [MERGE] forward port of branch 8.0 up to 3ac46ee 2016-02-02 12:25:06 +01:00
Raphael Collet a688bcdbbd [FIX] fields: make copy_cache not invalidate the cache! 2016-02-01 18:01:02 +01:00
Raphael Collet bac6889c53 [FIX] fields: make related_sudo work for draft records (used by onchange)
Accessing a related field with `related_sudo=True` on a draft record should
effectively traverse the fields as the admin user.  Traversing new records in a
different cache requires that all new records on the path are copied across
caches.  Make the copy across caches recursive when the first record on the
path is a new record.
2016-02-01 17:59:31 +01:00
Denis Ledoux 6c8bbc3d46 Revert "[FIX] fields: make related_sudo work for draft records (used by onchange)"
This reverts commits
 - 995b257a6c
 - 2ebdb5f36e
 - 748a719fd9.

The commit 748a719fd9 leads to an issue
bigger than what it aims to solve:
 - as demo user
 - create a new invoice
 - add a new line
 - select a product
-> traceback

opw-668141
2016-01-29 16:55:23 +01:00
Denis Ledoux a842199687 [MERGE] forward port of branch saas-6 up to 2616def 2016-01-29 12:29:17 +01:00
Denis Ledoux 2616defe35 [MERGE] forward port of branch 8.0 up to edeb5a8 2016-01-29 11:41:24 +01:00
Raphael Collet 812332855a [IMP] fields: speedup Float.convert_to_cache by not rounding the value 2016-01-29 09:37:27 +01:00
Raphael Collet f0646cb51b [IMP] fields: use a "lazy" cursor to compute attribute digits
Borrowing a cursor each time you access `field.digits` may be costly, because
of the connection reset.  Moreover, in most cases, the cursor is not used at
all, since the decimal precision are kept in cache.

For the installation of module `product` with its demo data, the number of
cursor allocations was reduced from ~1500 to about 50!
2016-01-29 09:37:27 +01:00
Raphael Collet 995b257a6c [FIX] fields: make related_sudo work for draft records (2)
Traversing new records in a different cache requires that all new records on
the path are copied across caches.  Make the copy across caches recursive when
the first record on the path is a new record.
2016-01-28 16:33:09 +01:00
Christophe Simonis 1231585df1 [MERGE] forward port of branch saas-9 up to 78d20b5 2016-01-27 12:27:01 +01:00
Christophe Simonis 2ebdb5f36e [FIX] fields: correct related_sudo computation.
Correctly merge commit 748a719fd9 in 9.0
2016-01-26 19:46:55 +01:00
Christophe Simonis 2ce9311cfe [MERGE] forward port of branch saas-6 up to a576f2b 2016-01-26 19:13:41 +01:00
Christophe Simonis 50b0b075a9 [MERGE] forward port of branch 8.0 up to ab245fc 2016-01-26 14:04:55 +01:00
Raphael Collet 748a719fd9 [FIX] fields: make related_sudo work for draft records (used by onchange)
Accessing a related field with `related_sudo=True` on a draft record should
effectively traverse the fields as the admin user.

This fixes #5121, #7138.
2016-01-22 16:06:27 +01:00
Raphael Collet a5f6622670 [IMP] fields: add documentation for default=None on fields 2016-01-15 15:58:38 +01:00
Raphael Collet ef8d6eda01 [IMP] fields: overriding a field with default=None discards its default value 2016-01-15 13:55:13 +01:00
Raphael Collet d6d3821149 [IMP] fields: make it possible to use None as the value of a field parameter 2016-01-15 13:27:55 +01:00
Raphael Collet 1fb0136f5a [FIX] fields: in onchange, do not serialize the inverse field of a one2many 2015-12-16 15:39:15 +01:00
Denis Ledoux 56ef99d050 [MERGE] forward port of branch saas-6 up to 105b1c0014 2015-10-23 18:31:55 +02:00
Raphael Collet 6c8e53a087 [FIX] translate: separate html_translate from xml_translate, fix serialization
The serialization gives different results for some elements.  For instance, an
empty element `i` must be serialized as `<i/>` in XML and `<i></i>` in HTML.
It must be done like that, otherwise the world (of web browsers) would break.

Add a test case for `html_translate`.
2015-10-22 16:33:56 +02:00
Raphael Collet 061a1d7255 [IMP] fields: improve performance of method field.modified(records)
Reduce the number of calls to `search` by grouping fields by model and by path.
2015-10-09 15:22:10 +02:00
Denis Ledoux 105b1c0014 [MERGE] forward port of branch 8.0 up to 25634df 2015-10-05 16:20:13 +02:00
Raphael Collet a9c43bba82 [FIX] fields: fix assignment of related field on several records 2015-10-02 17:05:35 +02:00
Raphael Collet 20da3a3915 [IMP] fields: enable grouping of fields that are computed together
Do not convert the value of `field.compute`, as this conversion prevents the
grouping of fields that have the same `field.compute` otherwise.
2015-09-29 14:14:48 +02:00
Raphael Collet 1bb61c970e [ADD] fields: add option to store binary fields into attachments
Such a field is declared as:

    image = fields.Binary("Image", attachment=True)

With this option, the value of a binary field F is stored in an attachment with
`res_field=F`.  When attachments are stored into the filestore, binary fields
are consequently stored in the filestore as well.  Note that the option does
not work on old-API function fields.

By default searching on `ir.attachment` filters out attachments for binary
fields: the condition `res_field=False` is added to the domain unless a
condition on field `id` or `res_field` is already present.  The client uses
`search_read` with a domain like `[('id', 'in', ids)]` for reading the data on
a form view.  In that case, we should not filter out attachments that store
binary fields.

Also, do not filter search results for the superuser.
2015-09-28 15:19:47 +02:00
qdp-odoo bacd60dc1d [FIX] orm, fields: read_group on monetary fields now correctly makes the sum instead of ignoring them 2015-09-24 10:33:34 +02:00
Christophe Simonis 57168a9e90 [MERGE] forward port of branch saas-6 up to a669433 2015-09-23 14:34:26 +02:00
Raphael Collet 3a1483635e [IMP] fields: avoid search when recomputing a field on the same records
This avoids a few dumb queries.
2015-09-18 18:12:23 +02:00
Xavier Morel 1e2e38b96a [FIX] translate docstrings
rst literals are double-quoted
2015-09-16 10:02:37 +02:00
Raphael Collet 7e9e747a0c [IMP] fields: optimize invalidation of fields in draft mode 2015-09-14 13:26:54 +02:00
Christophe Simonis fa5fe2e693 [MERGE] forward port of branch 8.0 up to c345d29 2015-09-07 11:24:14 +02:00
Raphael Collet 1c4c64fe01 [FIX] fields: add support for date/datetime null values in field methods 2015-09-07 10:27:34 +02:00
Raphael Collet dc798e317e [IMP] models: add a check on table and column names
In particular, this checks that table names are less than 64 bytes.
2015-08-31 11:06:48 +02:00
Raphael Collet ab19215261 [IMP] fields: translated html fields must use xml_translate or a callable 2015-08-25 12:01:37 +02:00
Raphael Collet a0fb9d83c7 Revert "[IMP] fields: translated html fields must use xml_translate or a callable"
This reverts commit 75140d7ea1.
2015-08-21 16:44:48 +02:00
Raphael Collet 75140d7ea1 [IMP] fields: translated html fields must use xml_translate or a callable 2015-08-21 15:39:53 +02:00