Commit Graph
100 Commits
Author SHA1 Message Date
Cédric Krier 9b94696b05 Speed up instantiation of Models
Pass as much possible, pre-computed parameters to __init__ to move their
computation outside the loop.

issue5294
review20721002
2016-03-15 19:01:47 +01:00
Cédric Krier 22dc3d23bc Remove __setattr__ from Model
This method is there to only skip the id attribute to be set using the field
__set__ but it has a cost as it is called each time an attribute is set.
So we store now the id value in the attribute '_id' which doesn't overload the
field and we adapt field __get__ for this new location.
The __getitem__ is also removed as it is deprecated since 2.6.

issue5296
review17031002
2016-03-04 00:19:18 +01:00
Cédric Krier bcd557da3b Many2Many are not sortable
fields_get should set sortable to False for Many2Many.

issue5123
review15821002
2015-11-15 12:45:41 -03:00
Cédric Krier 2c31955934 Make Property field on Many2One not searchable
issue4673
review14171002
2015-03-27 14:59:57 +01:00
Cédric Krier 0991a552de Add TimeDelta field
And remove float_time widget.

issue4026
review5911002
2015-02-09 22:58:56 +01:00
Sergi Almacellas Abellana c4e96f4a08 Improve error message when model does not have any docstring
issue4390
review12921002
2015-02-04 23:16:11 +01:00
Cédric Krier c144f8c349 Fix most flake8 errors
review8771002
2014-12-02 12:54:01 +01:00
Cédric Krier ab3a4692ee Don't compare record values
changeset 8e8f1a801098 introduced a equality comparison of records without id
using the values.  This prevents to store in a dictonary different instances
having by chance the same values.  So it seems better to consider only as equal
the same instances without id.

issue4306
review10621002
2014-10-31 10:54:30 +01:00
Cédric Krier fee97ca399 New API for on_change
Modify the instance instead of returning a dictionary.

issue4203
review8581002
2014-10-29 20:38:17 +01:00
Cédric Krier 0602387444 Keep fields.depends over multiple setup calls
Since changeset 690d629e0050, the field is always an original copy so it loose
the depends set on previous setup calls. The depends should be comptute all
over the mro.

issue4200
review13531002
2014-09-30 09:37:26 +02:00
Cédric Krier e740b5f432 Remove on_change call from default_get
The on_change call doesn't work for xxx2many fields, so it is moved on the
client side where it is properly managed.

issue3923
review6301002
2014-06-08 00:33:31 +02:00
Nicolas Évrard f7133b8670 Use total_ordering
issue3884
review8291003
2014-06-06 13:26:44 +02:00
Cédric Krier 22899c33e2 Set relation_field of one2many only when exists
The client use this value if it exists for string concatenation, so having None
fails.
2014-05-09 14:52:30 +02:00
Cédric Krier 5c00bf48bf Set relation_field only if there is no ambiguity
issue3899
review6271002
2014-05-09 14:37:30 +02:00
Cédric Krier a0093e8899 Copy the original field definition
To prevent side-affect with mutable attributes.

issue3814
review4821002
2014-05-06 22:42:42 +02:00
Cédric Krier f72b983c0f Check relation access in fields_get and for default fields in read
issue3750
review4261002
2014-03-15 11:01:14 +01:00
Cédric Krier a130816cbd Add support of domain for non-relation field
issue3743
review4181002
2014-03-15 10:44:45 +01:00
Cédric Krier 729aaa8a00 Better guess "selection_change_with" attribute
Testing on the instance for Selection field is not enough because some field
selection could come from a Function field.
So it is better to use a duck typing style in this case.

issue3649
review3451002
2014-02-14 00:04:31 +01:00
Cédric Krier 2e7c28d348 Add with_on_change switch to default_get
default_get should not call on_change when called in create because it could
modify values set by the caller.

issue3602
review2781002
2014-01-26 21:57:15 +01:00
Cédric Krier 905343c900 Add fields.depends decorator
issue3487
review2301002
2014-01-26 14:27:24 +01:00
Cédric Krier 3f5dba2235 Add relation_field for many2one
issue3173
review1201002
2013-10-27 19:31:36 +01:00
Cédric Krier fc6c6cfdda Migration to python-sql
* Use python-sql
* Add convert_domain method on Fields
* Add sql_format and sql_type methods on Fields
* Allow to return a full domain for Function.searcher
* Replace static backend by dynamic get method
* Replace order_field by order_<field name> method

review1001002
2013-09-06 22:32:37 +02:00
Cédric Krier 58c81ee328 Add rich comparison methods on Model
review1027002
2013-08-21 18:02:30 +02:00
Cédric Krier 56fc82d954 Set correct instanciate for selection_change_with
issue3223
review886002
2013-06-01 00:10:30 +02:00
Cédric Krier 8710f2fd99 Fix Pool.setup to re-allow extra_depends behavior
review898002
2013-05-27 18:47:00 +02:00
Jean CAVALLO 25fea393a8 Fix model.fields_get for Function(Dict) fields
issue3147
review792002
2013-04-16 15:58:03 +02:00
Cédric Krier a95ae0dad9 Remove _inherits
review670002
2013-03-20 22:49:16 +01:00
Cédric Krier 5e01f5c068 Fix flake8 2013-02-27 22:50:31 +01:00
Cédric Krier d49fb4318d Add selection_change_with on Selection and Reference fields
review587002
2013-02-05 19:06:16 +01:00
Cédric Krier fd01a724f8 Add Dict fields
review501007
2013-01-26 15:18:41 +01:00
Cédric Krier 8e248e9922 Fix wrong access check read -> write
Typo introduced in changeset cc8493263998
2013-01-21 12:46:24 +01:00
Cédric Krier cf0636e095 Add ModelFieldAccess.get_access
review598002
2012-11-28 22:42:51 +01:00
Cédric Krier b57f044ba8 Fix pep8 and pyflakes 2012-10-19 12:29:05 +02:00
Bertrand Chenal 2a97cd8017 Fix model name when the docstring starts with an empty line
review565002
2012-10-16 18:26:37 +02:00
Cédric Krier 4337ce2776 Add pre-validation
review536002
2012-09-29 14:39:59 +02:00
Cédric Krier 0fe1b93864 Active Record 2012-09-24 22:16:53 +02:00
Nicolas Évrard a06af6f557 use None instead of False as default value
review351003
2012-09-21 16:03:48 +02:00
Cédric Krier 9d0d689b67 Add create/delete field access
review398002
2012-06-28 14:46:47 +02:00
Cédric Krier 6858187fc8 Add dynamic size limit on the One2Many, Many2Many and Char
review396001
2012-06-20 18:12:40 +02:00
Cédric Krier b33288c141 Allow client to manage model access
review346001
2012-05-19 15:47:43 +02:00
Cédric Krier 3ebda5c8ee Add time format validation
review342002
2012-05-16 13:04:36 +02:00
Cédric Krier 0ed77b30e2 Activate search on xxx2many fields 2012-04-25 13:11:02 +02:00
Cédric Krier 621ef764b1 Still search for res_id = 0 for model description translation
The translation of model description is loaded at early stage before the
migration of ir.translation.
2012-04-14 21:49:50 +02:00
Cédric Krier e41d330541 Fix model description translation
res_id is null now instead of 0
2012-04-14 13:37:40 +02:00
Cédric Krier ee3be37a36 Fix pep8 and pyflakes 2012-04-01 23:08:15 +02:00
Nicolas Évrard 184b4bcd91 resetting columns should also reset defaults
review290001
2012-03-29 12:19:43 +02:00
Cédric Krier d6c0ad5e6c Remove xxx2many clean cache
Since xxx2many are no more stored in the cursor cache, it is no more needed to
clean it.

review285001
2012-03-16 10:54:48 +01:00
Cédric Krier 6e88e99aae Add grouped calls to on_change_with
review251001
2012-03-05 23:39:58 +01:00
Cédric Krier a94ceb4321 Add default database language code
The configuration option defines which translated value will be stored in the
main field.
The methods of ir.translation which were already publicly used are now public.
Setting the main translation mark translations of other languages fuzzy.

review198001
2012-01-27 21:11:06 +01:00
Cédric Krier c0bb74366b Let's translate create and write fields
issue2278
review176002
2012-01-27 00:31:24 +01:00