Merge lp:~akretion-team/openobject-server/openobject-server-fix-ir_model-field_description into lp:openobject-server/7.0

Proposed by David BEAL (ak)
Status: Needs review
Proposed branch: lp:~akretion-team/openobject-server/openobject-server-fix-ir_model-field_description
Merge into: lp:openobject-server/7.0
Diff against target: 43 lines (+5/-5)
1 file modified
openerp/addons/base/ir/ir_model.py (+5/-5)
To merge this branch: bzr merge lp:~akretion-team/openobject-server/openobject-server-fix-ir_model-field_description
Reviewer Review Type Date Requested Status
Raphaël Valyi - http://www.akretion.com (community) Approve
OpenERP Core Team Pending
Review via email: mp+188005@code.launchpad.net

Description of the change

Avoid to crash when you change 'field_description' value with some non ascii 128 chars

[FIX] replace 'str' by 'unicode' in 'ir_model_fields' class (write method) in 'model_props' list for 'field_description' field

How to reproduce the bug
see https://bugs.launchpad.net/openobject-server/+bug/1231900

To post a comment you must log in.
Revision history for this message
David BEAL (ak) (davidbeal) wrote :

my IDE delete spaces in the end of lines like in lines 17, 26, 35

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

I confirm both the bug and the fact this is a valid fix for it (tested here). Thanks for merging.

review: Approve

Unmerged revisions

5089. By David BEAL (ak)

[FIX] replace 'str' by 'unicode' in 'ir_model_fields' class (write method) in 'model_props' list for 'field_description' field : avoid to crash when you change 'field_description' value with some non ascii chars

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openerp/addons/base/ir/ir_model.py'
--- openerp/addons/base/ir/ir_model.py 2013-07-30 11:46:45 +0000
+++ openerp/addons/base/ir/ir_model.py 2013-09-27 10:04:00 +0000
@@ -381,7 +381,7 @@
381381
382 # static table of properties382 # static table of properties
383 model_props = [ # (our-name, fields.prop, set_fn)383 model_props = [ # (our-name, fields.prop, set_fn)
384 ('field_description', 'string', str),384 ('field_description', 'string', unicode),
385 ('required', 'required', bool),385 ('required', 'required', bool),
386 ('readonly', 'readonly', bool),386 ('readonly', 'readonly', bool),
387 ('domain', '_domain', eval),387 ('domain', '_domain', eval),
@@ -504,7 +504,7 @@
504 def _module_data_uninstall(self, cr, uid, ids, context=None):504 def _module_data_uninstall(self, cr, uid, ids, context=None):
505 """505 """
506 Delete PostgreSQL foreign keys and constraints tracked by this model.506 Delete PostgreSQL foreign keys and constraints tracked by this model.
507 """ 507 """
508508
509 if uid != SUPERUSER_ID and not self.pool.get('ir.model.access').check_groups(cr, uid, "base.group_system"):509 if uid != SUPERUSER_ID and not self.pool.get('ir.model.access').check_groups(cr, uid, "base.group_system"):
510 raise except_orm(_('Permission Denied'), (_('Administrator access is required to uninstall a module')))510 raise except_orm(_('Permission Denied'), (_('Administrator access is required to uninstall a module')))
@@ -565,7 +565,7 @@
565 def _module_data_uninstall(self, cr, uid, ids, context=None):565 def _module_data_uninstall(self, cr, uid, ids, context=None):
566 """566 """
567 Delete PostgreSQL many2many relations tracked by this model.567 Delete PostgreSQL many2many relations tracked by this model.
568 """ 568 """
569569
570 if uid != SUPERUSER_ID and not self.pool.get('ir.model.access').check_groups(cr, uid, "base.group_system"):570 if uid != SUPERUSER_ID and not self.pool.get('ir.model.access').check_groups(cr, uid, "base.group_system"):
571 raise except_orm(_('Permission Denied'), (_('Administrator access is required to uninstall a module')))571 raise except_orm(_('Permission Denied'), (_('Administrator access is required to uninstall a module')))
@@ -1020,11 +1020,11 @@
1020 ``ids`` along with their corresponding database backed (including1020 ``ids`` along with their corresponding database backed (including
1021 dropping tables, columns, FKs, etc, as long as there is no other1021 dropping tables, columns, FKs, etc, as long as there is no other
1022 ir.model.data entry holding a reference to them (which indicates that1022 ir.model.data entry holding a reference to them (which indicates that
1023 they are still owned by another module). 1023 they are still owned by another module).
1024 Attempts to perform the deletion in an appropriate order to maximize1024 Attempts to perform the deletion in an appropriate order to maximize
1025 the chance of gracefully deleting all records.1025 the chance of gracefully deleting all records.
1026 This step is performed as part of the full uninstallation of a module.1026 This step is performed as part of the full uninstallation of a module.
1027 """ 1027 """
10281028
1029 ids = self.search(cr, uid, [('module', 'in', modules_to_remove)])1029 ids = self.search(cr, uid, [('module', 'in', modules_to_remove)])
10301030