Merge lp:~therp-nl/therp-addons/6.1-web_mode_visibility_separator_use_override into lp:~therp-nl/therp-addons/6.1-web_mode_visibility_separator

Proposed by Holger Brunn (Therp)
Status: Merged
Merged at revision: 86
Proposed branch: lp:~therp-nl/therp-addons/6.1-web_mode_visibility_separator_use_override
Merge into: lp:~therp-nl/therp-addons/6.1-web_mode_visibility_separator
Diff against target: 129 lines (+21/-70)
5 files modified
web_mode_visibility_separator/__init__.py (+5/-1)
web_mode_visibility_separator/__openerp__.py (+1/-21)
web_mode_visibility_separator/model/__init__.py (+0/-1)
web_mode_visibility_separator/model/ir_ui_view.py (+0/-47)
web_mode_visibility_separator/view.rng.xsl (+15/-0)
To merge this branch: bzr merge lp:~therp-nl/therp-addons/6.1-web_mode_visibility_separator_use_override
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) (community) Approve
Review via email: mp+191221@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

lgtm.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'web_mode_visibility_separator/__init__.py'
2--- web_mode_visibility_separator/__init__.py 2013-05-16 09:33:02 +0000
3+++ web_mode_visibility_separator/__init__.py 2013-10-15 15:16:18 +0000
4@@ -1,1 +1,5 @@
5-import model
6+try:
7+ from openerp.addons.override_import_xml_schema import overrides_view
8+ overrides_view.append('web_mode_visibility_separator/view.rng.xsl')
9+except:
10+ pass
11
12=== modified file 'web_mode_visibility_separator/__openerp__.py'
13--- web_mode_visibility_separator/__openerp__.py 2013-05-16 09:33:02 +0000
14+++ web_mode_visibility_separator/__openerp__.py 2013-10-15 15:16:18 +0000
15@@ -24,7 +24,7 @@
16 "version": "6.1.1.0r1",
17 "author": "Therp BV",
18 "category": "Tools",
19- "depends": ['web_mode_visibility'],
20+ "depends": ['web_mode_visibility', 'override_import_xml_schema'],
21 "description": """
22 Use the following options keys on separator tags and other form widget
23 to hide them in either page or form mode:
24@@ -32,26 +32,6 @@
25 - page_invisible
26 - form_invisible
27
28-Please note that you need to allow the use of the options dictionary
29-on separators in openobject-server/openerp/addons/base/rng/view.rng,
30-or you will get view validation errors in modules that try to use
31-this functionality:
32-
33---- openerp/addons/base/rng/view.rng2012-02-13 10:17:58 +0000
34-+++ openerp/addons/base/rng/view.rng2013-05-07 09:40:10 +0000
35-@@ -442,6 +442,7 @@
36- <rng:optional><rng:attribute name="col"/></rng:optional>
37- <rng:optional><rng:attribute name="select"/></rng:optional>
38- <rng:optional><rng:attribute name="orientation"/></rng:optional>
39-+ <rng:optional><rng:attribute name="options"/></rng:optional>
40- <rng:zeroOrMore>
41- <rng:choice>
42- <rng:ref name="separator"/>
43-
44-You do not need this module to simply hide fields. This can be
45-done solely with the 'web_mode_visibility' module, without changes to the
46-rng file.
47-
48 This module is compatible with OpenERP 6.1.
49 """,
50 'js': [
51
52=== removed directory 'web_mode_visibility_separator/model'
53=== removed file 'web_mode_visibility_separator/model/__init__.py'
54--- web_mode_visibility_separator/model/__init__.py 2013-05-16 09:33:02 +0000
55+++ web_mode_visibility_separator/model/__init__.py 1970-01-01 00:00:00 +0000
56@@ -1,1 +0,0 @@
57-import ir_ui_view
58
59=== removed file 'web_mode_visibility_separator/model/ir_ui_view.py'
60--- web_mode_visibility_separator/model/ir_ui_view.py 2013-05-16 09:33:02 +0000
61+++ web_mode_visibility_separator/model/ir_ui_view.py 1970-01-01 00:00:00 +0000
62@@ -1,47 +0,0 @@
63-# -*- coding: utf-8 -*-
64-##############################################################################
65-#
66-# OpenERP, Open Source Management Solution
67-# This module copyright (C) 2013 Therp BV (<http://therp.nl>).
68-#
69-# This program is free software: you can redistribute it and/or modify
70-# it under the terms of the GNU Affero General Public License as
71-# published by the Free Software Foundation, either version 3 of the
72-# License, or (at your option) any later version.
73-#
74-# This program is distributed in the hope that it will be useful,
75-# but WITHOUT ANY WARRANTY; without even the implied warranty of
76-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
77-# GNU Affero General Public License for more details.
78-#
79-# You should have received a copy of the GNU Affero General Public License
80-# along with this program. If not, see <http://www.gnu.org/licenses/>.
81-#
82-##############################################################################
83-
84-import os
85-from lxml import etree
86-from openerp.osv import orm
87-from openerp.tools import file_open
88-from openerp.tools.translate import _
89-from openerp.modules import get_module_path
90-
91-class ir_ui_view(orm.Model):
92- _inherit = 'ir.ui.view'
93-
94- def _auto_init(self, cr, context=None):
95- """ Check for the necessary intervention in the rng file """
96- relaxng_doc = etree.parse(
97- file_open(os.path.join(
98- get_module_path('base'),'rng','view.rng')))
99- if not relaxng_doc.xpath(
100- '//rng:define[@name="separator"]'
101- '/rng:element[@name="separator"]'
102- '/rng:optional'
103- '/rng:attribute[@name="options"]',
104- namespaces={'rng': 'http://relaxng.org/ns/structure/1.0'}):
105- raise orm.except_orm(
106- _("Installation error"),
107- _("Please adapt file 'view.rng' to allow the options attribute "
108- "on separator elements"))
109- return super(ir_ui_view, self)._auto_init(cr, context=context)
110
111=== added file 'web_mode_visibility_separator/view.rng.xsl'
112--- web_mode_visibility_separator/view.rng.xsl 1970-01-01 00:00:00 +0000
113+++ web_mode_visibility_separator/view.rng.xsl 2013-10-15 15:16:18 +0000
114@@ -0,0 +1,15 @@
115+<xsl:stylesheet version="1.0"
116+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
117+ xmlns:rng="http://relaxng.org/ns/structure/1.0">
118+ <xsl:template match="@*|node()">
119+ <xsl:copy>
120+ <xsl:apply-templates select="@*|node()"/>
121+ </xsl:copy>
122+ </xsl:template>
123+ <xsl:template match="rng:element[@name='separator']">
124+ <xsl:copy>
125+ <xsl:apply-templates select="@*|node()"/>
126+ <rng:optional><rng:attribute name="options"/></rng:optional>
127+ </xsl:copy>
128+ </xsl:template>
129+</xsl:stylesheet>

Subscribers

People subscribed via source and target branches

to all changes: