summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2011-02-21 18:27:57 +0100
committerOlivier Dony <odo@openerp.com>2011-02-21 18:27:57 +0100
commit95de9e8cb45dc3fbde9e583cd36dd338403fcc29 (patch)
tree04bfb4a7728a2752edbfba1af855de8535c748f0
parent2621b707e0a72f53b7a5fd236b8001b0d51bbc48 (diff)
[IMP] orm.fields_view_get: allow passing a view_id from a different model for creative inheritance
There are cases where several objects would like to use a single view, but by default they cannot because a view belongs to only one model. With this change, it becomes possible to do inheritance "by copy", reusing a view from another model without having to redefine it, just by specifying its view_id in the relevant actions. If the original view needs to be modified, it is also possible to explicitly inherit the parent view from the other model, and the effect will be what is expected: the child view can be specified in an action, and will be the result of the inheritance applied on the parent view; but on the other hande the parent view itself is unaffected when used in the context of its own model. bzr revid: odo@openerp.com-20110221172757-qepq5osjqgd9uf8x
-rw-r--r--openerp/osv/orm.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py
index 3c8d81bd055..2112075ae52 100644
--- a/openerp/osv/orm.py
+++ b/openerp/osv/orm.py
@@ -1553,12 +1553,9 @@ class orm_template(object):
view_id = view_ref_res[0]
if view_id:
- query = "SELECT arch,name,field_parent,id,type,inherit_id,model FROM ir_ui_view WHERE id=%s"
- params = (view_id,)
- if model:
- query += " AND model=%s"
- params += (self._name,)
- cr.execute(query, params)
+ cr.execute("""SELECT arch,name,field_parent,id,type,inherit_id,model
+ FROM ir_ui_view
+ WHERE id=%s""", (view_id,))
else:
cr.execute('''SELECT
arch,name,field_parent,id,type,inherit_id,model