summaryrefslogtreecommitdiff
path: root/odoo/fields.py
AgeCommit message (Collapse)Author
2019-04-12[MERGE] forward port branch saas-12.3 up to 120359bf0c9Christophe Simonis
2019-04-11[FIX] fields: prevent caching wrong value when it's altered by writeSébastien Theys
Before this commit, the field assignment would cache the value it received, even if that value was altered during `write`. This can happen if `write` is overridden (for example to resize images), or it could also happen if a database procedure is altering the value. To fix this issue, we do not cache the value that was assigned. This implies that additional queries may be necessary to retrieve the value, but those were already necessary most of the time, so it does not have a significant impact on performances.
2019-04-09[MERGE] forward port branch saas-12.1 up to 6d4940675f1Christophe Simonis
2019-04-09[MERGE] forward port branch 12.0 up to ea1fc124efcChristophe Simonis
2019-04-08[MERGE] forward port branch saas-11.3 up to 4c61621efbbChristophe Simonis
2019-04-08[MERGE] forward port branch 11.0 up to 9a7e3c8b498Christophe Simonis
2019-04-04[FIX] orm: don't crash on index creationDamien Bouvy
Creating field indexes might not always be possible. For instance, adding an index on an existing Char/Text field will fail if the column contains values longer than 8192 bytes (PostgreSQL limit for BTrees). Instead of failing miserably during the schema modification, simply log the problem and continue. closes odoo/odoo#32416 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-03-21[MERGE] forward port branch saas-12.1 up to 6878c9f3424Christophe Simonis
2019-03-19[MERGE] forward port branch 12.0 up to 82c4393fd02Christophe Simonis
2019-03-11[MERGE] forward port branch saas-12.1 up to 2b3296bbf8bChristophe Simonis
2019-03-08[MERGE] forward port branch 12.0 up to c023d0784f2Christophe Simonis
2019-03-05[MERGE] forward port branch 11.0 up to 27081bf6f5fChristophe Simonis
2019-03-15[FIX] fields: safe check on ondelete cascadeNans Lefebvre
In the case of attachment_ids, comodel._fields[inverse] can be res_id, an integer field. Such fields do not have a default ondelete attribute. opw 1945926 closes odoo/odoo#31864 Signed-off-by: Nans Lefebvre (len) <len@odoo.com>
2019-02-22[MERGE] forward port branch saas-12.1 up to 0f4abc5c228Christophe Simonis
2019-02-21[MERGE] forward port branch 12.0 up to 84143a34b31Christophe Simonis
2019-02-20[MERGE] forward port branch 11.0 up to de8cefcef4dChristophe Simonis
2019-02-20[MERGE] forward port branch saas-11.3 up to 2c495502aa3Christophe Simonis
2019-02-13[FIX] fields: read/write company-dependent fields without ir.property accessLucas Perais (lpe)
This is the first step to a more comprehensive handling of company-dependent fields which are ir_properties. With model-specific access rights, users should be able to read/update a company-dependent field no matter their access rights on ir_property. Before this commit, a user having access to res.partner, but not to ir.property couldn't write on property_account_receivable/payable just because he couldn't write the corresponding ir.property. After this commit, he can. OPW 1923345
2019-02-14[MERGE] forward port branch saas-15 up to c0f24d54cfaChristophe Simonis
2019-02-14[MERGE] forward port branch saas-14 up to c1fe9f18d5aChristophe Simonis
2019-02-14[MERGE] forward port branch 10.0 up to 69719f598aaChristophe Simonis
2019-02-13[FIX] fields: read/write company-dependent fields without ir.property accessLucas Perais (lpe)
This is the first step to a more comprehensive handling of company-dependent fields which are ir_properties. With model-specific access rights, users should be able to read/update a company-dependent field no matter their access rights on ir_property. Before this commit, a user having access to res.partner, but not to ir.property couldn't write on property_account_receivable/payable just because he couldn't write the corresponding ir.property. After this commit, he can. OPW 1923345
2019-02-07[IMP] fields: dummy updates of one2many fields should not trigger recomputationsRaphael Collet
2019-02-06[IMP] access errors through related fieldsXavier Morel
When an access error bubbles through a related field (aka the user doesn't have access to the delegate or the delegate's field), append the "intermediate step" so that it's easier to understand e.g. that the access error to a partner really comes from accessing a user or somesuch.
2019-02-06[FIX] fields: setting an integer field invalidates its inverse one2manyXavierDo
In particular, creating a `mail.message` automatically invalidates the corresponding `record.message_ids`. closes odoo/odoo#30737
2019-01-29[MERGE] forward port branch 11.0 up to 36d96e01503Christophe Simonis
2019-01-10[FIX] fields: inherited fields keep parent's modulesMartin Trigaux
On a field created through a _inherits, the fields on the child model did not benefit from the parent _modules information. If two models are created in module base class Partner(models.Model): _name = 'res.partner' class User(models.Model): _inherits = {'res.partner': 'partner_id'} partner_id = fields.Many2one('res.partner') and a second module auth_signup adds a field on the parent model class ResPartner(models.Model): _inherit = 'res.partner' signup_token = fields.Char() Both res.users and res.partner should have an ir.model.data create base_setup.field_res_partner__signup_token was correctly created but base_setup.field_res_users__signup_token was not created The reason is was, in the call to _reflect_model, since 574f4c3deb2671b7, the creation of ir.model.data is based on the field._modules However, the field res.partner.signup_token did not propagate its _modules value to the related field res.users.signup_token With this patch, both ir.model.data are created. This allow a proper uninstallation of fields as well as translation.
2019-01-03[IMP] api: gain some memory by not creating the cache_key tuple multiple timesDenis Ledoux
2019-02-11[IMP] fields: faster convert_to_record for many2one fieldsDenis Ledoux
Use `env.registry` instead of `env` to get the comodel as a class instead of an instance, which saves one call to `_browse` each time we access a relational field. This saves time because of the cost of `object.__new__` and prefetch update in `_browse`.
2019-02-11[IMP] fields: faster `record.id` accessDenis Ledoux
This is a partial backport of revision ed32700925132943fc4957ae2f43deaeeec7a278 to speed up the access of browse record id field.
2019-01-14[MERGE] forward port branch 12.0 up to 6a0675d36ddChristophe Simonis
2019-01-09[MERGE] forward port branch 12.0 up to 3e4138deaa2Christophe Simonis
closes odoo/odoo#30045
2018-12-11[MERGE] forward port branch saas-14 up to 5a147acf1beChristophe Simonis
2018-12-11[MERGE] forward port branch 10.0 up to f69c004795eChristophe Simonis
2018-12-12[MERGE] forward port branch 12.0 up to 047e2b28de4Christophe Simonis
2018-12-11[MERGE] forward port branch saas-11.3 up to 55dafc20f6bChristophe Simonis
2018-12-11[MERGE] forward port branch 11.0 up to 7e5d5045bfaChristophe Simonis
2018-12-11[MERGE] forward port branch saas-15 up to 1ace2ed88beChristophe Simonis
2018-12-07[FIX] mail: wrong many2many definitionRaphael Collet
The definition of `attachment_ids` on model `email_template.preview` is wrong, because its table/columns refer to the model `mail.template`. As the field is only used to preview a result in a wizard form, it does not need to be stored. closes odoo/odoo#29349
2018-12-18[FIX] fields, test_impex: export DatetimeNicolas Martinelli
- Set a TZ on the user different from UTC - Export a record containing a datetime, e.g. the Order Date of a SO - Import the file The Order Date is changed on the record. The data export is always in UTC, but the data import takes into account the user TZ, which explains the difference. There is no good way of solving this in stable. We have 3 choices: 1. Do nothing: the flow export then import the same data is broken, as explained above. 2. Export in the user TZ: if the file is imported in a third-party software, we break the flow. 3. Import in UTC: if the file is generated from a third-party software, we break the flow. Whatever the choice is, we either break a flow or keep an inconsistent behavior. We choose option 2, assuming that in most cases the user wants to export the data in his TZ, therefore keeping the values displayed. We only do it in v12 in order to mitigate the impact on existing installations. A proper fix should be discussed for v13. opw-1915631 closes odoo/odoo#29576
2018-11-28[MERGE] forward port branch 11.0 up to bb6f6c57f97Christophe Simonis
2018-11-29[MERGE] forward port branch saas-11.3 up to c0eef427111Christophe Simonis
2019-01-25[IMP] api: gain some memory by not creating the cache_key tuple multiple timesDenis Ledoux
2018-11-29[MERGE] forward port branch 12.0 up to 82a1e1dcc33Christophe Simonis
2018-11-29[REM] pycompat: remove python 2 shims and helpersAdrian Torres
Odoo no longer supports python 2, thus some of these helpers can and have been replaced by python 3 built-ins, therefore there is no need for them to stay defined. The removed helpers are: * izip, imap and ifilter * unichr, text_type * implements_to_string, implements_iterator * string_types, integer_types * to_native The python 2 shims have also been removed, and only the python 3 helpers have been kept, because they can still be usable (i.e. accepting both bytes and str for functions that can only accept one of the two) [REM] pyjsparser: remove PY3 shims They're no longer necessary as Odoo doesn't officially support python 2 anymore. closes odoo/odoo#28519
2018-11-29[REF] *: replace deprecated pycompat helpers for builtinsAdrian Torres
This commit replaces calls to pycompat helpers that were intended for python 2 <-> python 3 interoperability for python 3 builtins, as python 2 is no longer officially supported by Odoo. This includes: * calls to imap/izip/ifilter replaced by map/zip/filter * uses of text_type replaced by str * uses of unichr replaced by chr * calls to implements_to_string, implements_iterator removed * string_types and integer_types replaced by str, int respectively * calls to to_native replaced by calls to to_text This is done in preparation to the removal of these deprecated helpers in the following commit.
2018-11-16[MERGE] forward port branch 12.0 up to bc744a1da46Christophe Simonis
2018-11-14[FIX] fields, test_new_api: monetary related customLucas Perais (lpe)
This commit allows for not copying the currency_field attribute of a monetary field when the monetary field is related, and when the currency_field attribute is not explicit Before this commit, the currency_field attribute on the related monetary was set as the one on the distant model After this commit, the currency_field attribute takes the field on the current model Though the test may appear like an incoherent use case, it is on the contrary totally legit, as web_studio allows it OPW 1903113 closes odoo/odoo#28144
2019-01-29[IMP] fields: forbid required m2o ondelete set nullAdrian Torres
A many2one field that is required means that its column cannot contain null values, however the default ondelete policy for all m2o fields is `set null`, which contradicts `required=True`. This patch will, by default, apply the `restrict` policy to required m2o fields unless the ondelete attribute is explicitly specified. However, if the policy specified is `set null`, a ValueError will be raised whenever the registry registers the field as this makes no sense. The default ondelete policy remains unchanged for non-required m2o fields (set null) closes odoo/odoo#30122
2019-01-26[IMP] fields: selection fields only use stringsXavier Morel
closes odoo/odoo#29039