Guest User

Untitled

a guest
Oct 19th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. === modified file 'openerp/osv/orm.py'
  2. --- openerp/osv/orm.py 2011-07-05 12:22:22 +0000
  3. +++ openerp/osv/orm.py 2011-07-06 23:17:23 +0000
  4. @@ -2714,6 +2714,12 @@
  5. cr.execute('ALTER TABLE "%s" ALTER COLUMN "%s" DROP NOT NULL' % (self._table, column['attname']))
  6. self.__schema.debug("Table '%s': column '%s': dropped NOT NULL constraint",
  7. self._table, column['attname'])
  8. +
  9. + def _check_if_field_can_be_updated(self, f, context=None):
  10. + # Don't update custom (also called manual) fields
  11. + if f.manual and not context.get('update_custom_fields', False):
  12. + return False
  13. + return True
  14.  
  15. def _auto_init(self, cr, context=None):
  16. """
  17. @@ -2739,7 +2745,6 @@
  18. context = {}
  19. store_compute = False
  20. todo_end = []
  21. - update_custom_fields = context.get('update_custom_fields', False)
  22. self._field_create(cr, context=context)
  23. create = not self._table_exist(cr)
  24.  
  25. @@ -2767,7 +2772,7 @@
  26. if k in ('id', 'write_uid', 'write_date', 'create_uid', 'create_date'):
  27. continue
  28. # Don't update custom (also called manual) fields
  29. - if f.manual and not update_custom_fields:
  30. + if not self._check_if_field_can_be_updated(f, context=context):
  31. continue
  32.  
  33. if isinstance(f, fields.one2many):
Add Comment
Please, Sign In to add comment