~numerigraphe-team/ocb-server/7.0-import-non-local-warning-mat

« back to all changes in this revision

Viewing changes to openerp/addons/base/ir/ir_model.py

  • Committer: Martin Trigaux
  • Date: 2014-02-24 16:25:12 UTC
  • mfrom: (5244.1.1 staging)
  • Revision ID: mat@openerp.com-20140224162512-i5ay1jv7k8lan2rv
[MERGE] [FIX] models: do not drop low level columns (aka 'magic columns') when deleting ir.model.fields

Without this fix, uninstalling modules using id, create_date,... in their field declaration while inheriting from existing module would drop these columns

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
from openerp.tools.safe_eval import safe_eval as eval
34
34
from openerp.tools import config
35
35
from openerp.tools.translate import _
36
 
from openerp.osv.orm import except_orm, browse_record
 
36
from openerp.osv.orm import except_orm, browse_record, MAGIC_COLUMNS
37
37
 
38
38
_logger = logging.getLogger(__name__)
39
39
 
302
302
 
303
303
    def _drop_column(self, cr, uid, ids, context=None):
304
304
        for field in self.browse(cr, uid, ids, context):
 
305
            if field.name in MAGIC_COLUMNS:
 
306
                continue
305
307
            model = self.pool.get(field.model)
306
308
            cr.execute('select relkind from pg_class where relname=%s', (model._table,))
307
309
            result = cr.fetchone()