Merge lp:~openerp-dev/openobject-server/trunk-bug-1100065-ishwar into lp:openobject-server

Proposed by Ishwar Malvi(OpenERP)
Status: Rejected
Rejected by: Vo Minh Thu
Proposed branch: lp:~openerp-dev/openobject-server/trunk-bug-1100065-ishwar
Merge into: lp:openobject-server
Diff against target: 28 lines (+9/-2)
1 file modified
openerp/osv/orm.py (+9/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-server/trunk-bug-1100065-ishwar
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+155923@code.launchpad.net

Description of the change

Hello,

      I have fixed a problem of customize view.

Thanks,
Ishwar Malvi

To post a comment you must log in.
Revision history for this message
Vo Minh Thu (thu) wrote :

It seems as your fix would work but it would be better to not change ir.ui.view's fields_view_get directly in ir_ui_view.py, but instead do something similar to the `board` module.

I.e. all the code for the custom views used in `base` and `board` should be inside some new module (which would be a dependency for `board`). I will create a task for that, see if it could get some love.

Unmerged revisions

4842. By Ishwar Malvi(OpenERP)

[FIX] customize view problem

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 2013-03-25 14:32:56 +0000
3+++ openerp/osv/orm.py 2013-03-28 10:20:36 +0000
4@@ -2209,15 +2209,22 @@
5 view_id = view_ref_res[0]
6
7 if view_id:
8- cr.execute("""SELECT arch,name,field_parent,id,type,inherit_id,model
9+ cr.execute("""SELECT original.id AS id,custom.user_id AS user_id,custom.arch AS arch,original.name AS name,original.field_parent AS field_parent,original.type AS type,original.inherit_id AS inherit_id,original.model AS model
10+ FROM ir_ui_view_custom custom
11+ INNER JOIN ir_ui_view original ON custom.ref_id = original.id
12+ WHERE custom.user_id=%s AND custom.ref_id=%s""", (user,view_id,))
13+ sql_res = cr.dictfetchone()
14+ if not sql_res:
15+ cr.execute("""SELECT arch,name,field_parent,id,type,inherit_id,model
16 FROM ir_ui_view
17 WHERE id=%s""", (view_id,))
18+ sql_res = cr.dictfetchone()
19 else:
20 cr.execute("""SELECT arch,name,field_parent,id,type,inherit_id,model
21 FROM ir_ui_view
22 WHERE model=%s AND type=%s AND inherit_id IS NULL
23 ORDER BY priority""", (self._name, view_type))
24- sql_res = cr.dictfetchone()
25+ sql_res = cr.dictfetchone()
26
27 if not sql_res:
28 break