Merge lp:~florent.x/openobject-server/6.1-osv_parent_model into lp:openobject-server/6.1

Proposed by Florent
Status: Merged
Merged at revision: 4095
Proposed branch: lp:~florent.x/openobject-server/6.1-osv_parent_model
Merge into: lp:openobject-server/6.1
Diff against target: 17 lines (+2/-2)
1 file modified
openerp/osv/orm.py (+2/-2)
To merge this branch: bzr merge lp:~florent.x/openobject-server/6.1-osv_parent_model
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+95883@code.launchpad.net

Description of the change

Reorder few lines to check the existence of the parent_model before accessing its attributes.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp/osv/orm.py'
2--- openerp/osv/orm.py 2012-02-23 17:58:51 +0000
3+++ openerp/osv/orm.py 2012-03-05 12:20:23 +0000
4@@ -872,11 +872,11 @@
5
6 for parent_name in ((type(parent_names)==list) and parent_names or [parent_names]):
7 parent_model = pool.get(parent_name)
8- if not getattr(cls, '_original_module', None) and name == parent_model._name:
9- cls._original_module = parent_model._original_module
10 if not parent_model:
11 raise TypeError('The model "%s" specifies an unexisting parent class "%s"\n'
12 'You may need to add a dependency on the parent class\' module.' % (name, parent_name))
13+ if not getattr(cls, '_original_module', None) and name == parent_model._name:
14+ cls._original_module = parent_model._original_module
15 parent_class = parent_model.__class__
16 nattr = {}
17 for s in attributes: