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
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:

Loading…
Cancel
Save