Browse Source

[IMP] - read may be harmful to performance

pull/1461/head
sbejaoui 5 years ago
parent
commit
a22f10e2ad
  1. 3
      onchange_helper/__manifest__.py
  2. 7
      onchange_helper/models/base.py
  3. 2
      onchange_helper/readme/CONTRIBUTORS.rst
  4. 2
      onchange_helper/readme/DESCRIPTION.rst

3
onchange_helper/__manifest__.py

@ -4,7 +4,8 @@
{
'name': 'Onchange Helper',
'version': '12.0.1.0.0',
'summary': 'Technical module that ease execution of onchange in Python code',
'summary': 'Technical module that ease execution'
' of onchange in Python code',
'author': 'Akretion,Camptocamp,Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/server-tools',
'license': 'AGPL-3',

7
onchange_helper/models/base.py

@ -31,7 +31,12 @@ class Base(models.AbstractModel):
# If self is an empty record we will have an empty value
if self:
self.ensure_one()
record_values = self._convert_to_write(self.read()[0])
record_values = self._convert_to_write(
{
field_name: self[field_name]
for field_name, field in self._fields.items()
}
)
else:
record_values = {}
for field in self._fields:

2
onchange_helper/readme/CONTRIBUTORS.rst

@ -1,3 +1,3 @@
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Florian da Costa <florian.dacosta@akretion.com>
* Andrea Stirpe <a.stirpe@onestein.nl>
* Andrea Stirpe <a.stirpe@onestein.nl>

2
onchange_helper/readme/DESCRIPTION.rst

@ -1 +1 @@
This is a technical module. Its goal is to ease the play of onchange method directly called from Python code.
This is a technical module. Its goal is to ease the play of onchange method directly called from Python code.
Loading…
Cancel
Save