Commit Graph

23 Commits

Author SHA1 Message Date
Jeremy Kersten de3b64018a [FIX] osv: fix boolean in domain for custom field
When a new column has been added after that some data already exists,
the old lines will keep an empty/null value. So when we search is the new field
is equals to False or if it is different of True, we need to match the null
values.

close #9925
2015-12-04 16:31:31 +01:00
Raphael Collet a9c43bba82 [FIX] fields: fix assignment of related field on several records 2015-10-02 17:05:35 +02:00
Olivier LAURENT 017688cc29 [FIX] models: old api, prevent infinite recursion in stored function fields
The risk was introduced by b7f1b9c.
IF _store_set_values() recall another _create() or _write(),
the recomputation mechanism enter in an infinite recursion
trying to reevaluate for each call exactly the same fields
for the same records than the previous one

This revision replaces the loop of _store_set_values()
by 2 nested loops:

 - that not breaks the entire consumption
   of recompute_old queue
   (Tested thanks to revision a922d39),
 - that allows to clear the queue
   before each recomputations bundle fixing thereby the recursion

Closes #7558
2015-08-31 17:45:21 +02:00
Christophe Simonis af9393d505 [FIX] orm: access error due to prefetch of indirectly referenced records.
The new-api record prefetching algorithm attempts
to load data for all known records from the requested
model (i.e. all IDs present in the environment cache),
regardless of how indirectly/remotely they were
referenced. An indirect parent record may therefore
be prefetched along with its directly browsed children,
possibly crossing company boundaries involuntarily.

This patch implements a fallback mechanism when
the prefetching failed due to what looks like an
ACL restriction.

The implementation of `_read_from_database` handle
ACL directly and set an `AccessError` as cache value
for restricted records.

If a model (like `mail.message`) overwrites `read` to
implements its own ACL checks and raises an `AccessError`
before calling `super()` (which will then call
`_read_from_database`), the cache will be not fill,
leading to an unexpected exception.

If this commit messae looks familiar to you, that's
simply because this is the new-api counterpart of
b7865502e4
2015-07-24 14:01:09 +02:00
Raphael Collet 0f9b452c33 [IMP] models: convert deprecated model._all_columns into a dynamic property
The mappings model._all_columns takes quite some memory (around 2MB per
registry) because of the numerous dictionaries (one per model) and inefficient
memory storage of column_info.  Since it is deprecated and almost no longer
used, it can be computed on demand.
2015-03-23 14:36:14 +01:00
Olivier Dony 13476c844d [FIX] fields.html, forum: opt-in stripping of @style attrs
For public-facing HTML content provided by the user,
`<style>` tags and `style` attributes should be stripped
automatically, as they can easily be abused to deface
pages for abusive users and spammers.
<style> tags were already stripped, the optional `strip_style`
for fields.html enables the automatic stripping of style
attributes.

This is opt-in because custom style attributes are still
desirable in trusted HTML fields.
2015-03-09 14:41:14 +01:00
Raphael Collet 121b8e6800 [FIX] models: in onchange, false changes where detected in many2many fields
This was due to secondary fields loaded from database in 'onchange' mode.  In
that mode, the secondary fields were marked 'dirty', and therefore returned by
the method `onchange`.  The fix consists in loading those secondary fields in
cache before processing the onchanges.

This incidentally fixes a test on method `onchange`: in a one2many field, some
dirty fields were unexpectedly returned in the result.  This was due to those
fields being loaded while processing onchanges.
2015-02-21 11:29:13 +01:00
Raphael Collet 1439fcc40e [IMP] test_new_api: move test on delegate=True to module test_inherit
Group together the tests on fields that deal with _inherit and _inherits, and
avoid warnings about the field that uses delegate=True.
2015-02-18 16:43:20 +01:00
Christophe Simonis edbb14143e [FIX] test_new_api: it works by accident but company_id <> partner_id 2015-01-19 20:26:31 +01:00
Xavier Morel af90f5f638 [IMP] test experience and documentation
closes #3152
2015-01-15 15:23:08 +01:00
Xavier Morel 65cd4a2a33 [FIX] remove deprecated checks/fast_suite test attributes from standard modules 2015-01-15 14:31:40 +01:00
Raphael Collet 698981eccb [FIX] fields: do not set the inverse function on a readonly related field
This fixes #4681: prevent method copy() to write on the field.
2015-01-15 13:40:15 +01:00
Raphael Collet cd2a432362 Merge pull request #3645 from odoo-dev/8.0-fix2manyupdateonchanges-chs
[FIX] api: avoid to return all fields *2many in onchanges
2014-11-25 12:42:36 +01:00
Raphael Collet ebdbd9f8b7 [FIX] fields: in *2many convert_to_write(), return all fields for new records and dirty fields for existing records 2014-11-25 11:25:50 +01:00
Raphael Collet 5ae3215f21 [FIX] test_new_api: fix/simplify the result of the onchange on one2many fields 2014-11-24 17:22:47 +01:00
Raphael Collet 908252ec88 [FIX] tests: make sure that a failed tests does not leave the environment dirty
When a failure occurs, or when exiting an assertRaises(), the environment
should not contain fields to recompute.
2014-11-17 14:07:42 +01:00
Raphael Collet 83b8e413ff [IMP] test_new_api, test_inherit: improve code of tests 2014-10-16 12:32:23 +02:00
Raphael Collet 5db84cb07e [IMP] models: do not use compute methods to determine default values anymore
Compute methods could give results that should not be considered as default
values.  For instance, a related field usually defaults to a null value, which
is then set to the field with its inverse method by create().  This may violate
a non-null constraint if the original field is required.  Therefore, compute
methods are no longer used to determine default values.
2014-10-13 13:44:07 +02:00
Raphael Collet 2cbdd7ab0e Merge branch 'acsone-8.0-onchange-one2many-test': add test for onchange on one2many field 2014-09-16 10:56:43 +02:00
Cédric Pigeon 919869907d [ADD] add new test for onchange on one2many field 2014-09-02 16:11:37 +02:00
Denis Ledoux 3eaa2f8371 [FIX] test_new_api: missing parent menu 2014-08-14 16:48:32 +02:00
Olivier Dony b41599e17c [FIX] base: tests: move test menu under correct root 2014-08-08 14:17:37 +02:00
Raphael Collet cbe2dbb672 [MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.

- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
2014-07-06 17:05:41 +02:00