← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~xmo/openobject-client-web/layout-fixes into lp:openobject-client-web

 

Xavier (Open ERP) has proposed merging lp:~xmo/openobject-client-web/layout-fixes into lp:openobject-client-web.

Requested reviews:
  OpenERP SA's Web Client R&D (openerp-dev-web)


* Removal of various layouting javascript (adjustTopWidht, setRowWidth) for improved reliability
* Fix of the top bar layout (100% always automatically)
* Migration of central layout to table in order to get rid of JS for accordion height
* Simplification and unification of M2O widgets (regular and search)
* Cleanup of template in search filters
* Reduction of width of search text controls (for more horizontal room and less horizontal scrolling when possible)
* Merge of filters within controls (text inputs) into them at display time (remove space between field and its filter(s))
* Removal of dead/redundant code (Notebook in Search view parsing, type test on both TinyInputWidget and RangeWidget, wrapper around exception with only role of losing exception details)

Know minor issues to be handled later (after merge):
* Weird spacings in search view
-- 
https://code.launchpad.net/~xmo/openobject-client-web/layout-fixes/+merge/34676
Your team OpenERP SA's Web Client R&D is requested to review the proposed merge of lp:~xmo/openobject-client-web/layout-fixes into lp:openobject-client-web.
=== modified file 'addons/openerp/controllers/templates/form.mako'
--- addons/openerp/controllers/templates/form.mako	2010-08-31 13:07:03 +0000
+++ addons/openerp/controllers/templates/form.mako	2010-09-06 13:59:41 +0000
@@ -4,7 +4,6 @@
 	<script type="text/javascript">
         jQuery(document).ready(function() {
             document.title = '${title}' + ' - OpenERP';
-            adjustTopWidth();
         });
     </script>
 	% if form.screen.view_type == 'form':
@@ -163,10 +162,9 @@
 	            </td>
 	            <script type="text/javascript">
 	                jQuery('td.toggle_sidebar').click(function() {
+	                    jQuery(this).toggleClass('sidebar_open sidebar_close')
 	                    toggle_sidebar();
 	                    jQuery(window).trigger('on-appcontent-resize');
-	                    var total_win_width = jQuery('#main_form_body').width();
-	                    jQuery(window).scrollLeft(total_win_width);
 	                });
 	            </script>
             % endif

=== modified file 'addons/openerp/controllers/templates/header.mako'
--- addons/openerp/controllers/templates/header.mako	2010-09-01 13:57:08 +0000
+++ addons/openerp/controllers/templates/header.mako	2010-09-06 13:59:41 +0000
@@ -13,27 +13,11 @@
     shortcuts = []
     requests = []
     requests_message = None
-%>
-
-<script type="text/javascript">
-    function setRowWidth() {
-        var topWidth = jQuery('div#top').width();
-        var logoWidth = jQuery('p#cmp_logo').outerWidth();
-
-        var shortcuts = jQuery('#shortcuts');
-        var offset = shortcuts.outerWidth() - shortcuts.width();
-
-        shortcuts.css('width', topWidth - logoWidth - offset);
-    }
-
-    jQuery(document).ready(setRowWidth);
-    jQuery(window).resize(setRowWidth);
-</script>
-<%
-    if rpc.session.is_logged():
-        logged = True
-    else:
-        logged = False
+
+if rpc.session.is_logged():
+    logged = True
+else:
+    logged = False
 %>
 <div id="top">
     <p id="cmp_logo">
@@ -110,4 +94,4 @@
         </ul>
     % endif
     </div>
-</div>
\ No newline at end of file
+</div>

=== modified file 'addons/openerp/controllers/templates/menu.mako'
--- addons/openerp/controllers/templates/menu.mako	2010-08-26 10:36:28 +0000
+++ addons/openerp/controllers/templates/menu.mako	2010-09-06 13:59:41 +0000
@@ -23,8 +23,6 @@
             if(jQuery('div.sc_menu').width() > total_width) {
                 jQuery('a.scroll_right').css('display', 'none');
             }
-            
-            setTimeout("adjustTopWidth()", 100);
         });
 
         jQuery(document).ready(function () {
@@ -34,7 +32,6 @@
             }
 
             jQuery('.open-close-menu').click(function() {
-            	setTimeout("adjustTopWidth()", 0);
                 jQuery('#content').toggleClass('hide-menu');
                 jQuery(window).trigger('on-appcontent-resize');
             });
@@ -69,35 +66,37 @@
             </div>
         </div>
                 
-        <div id="content" class="three-a">
-            <div id="secondary" class="sidenav-open">
-                <div class="wrap">
-                    <ul id="sidenav-a" class="accordion">
-                        % for tool in tools:
-                            % if tool.get('action'):
-                              <li class="accordion-title" id="${tool['id']}">
-                            % else:
-                              <li class="accordion-title">
-                            % endif
-                                <span>${tool['name']}</span>
-                            </li>
-                            <li class="accordion-content" id="content_${tool['id']}">
-                               ${tool['tree'].display()}
-                            </li>
-                        % endfor
-                    </ul>
-                    <script type="text/javascript">
-                        new Accordion("sidenav-a");
-                    </script>
-                </div>
-            </div>
-            <div id="toggle_accordion" class="open-close-menu hide_tools"></div>
-            <div id="primary">
-                <div class="wrap">
-                    <div id="appContent"></div>
-                </div>
-            </div>
-        </div>
+        <table id="content" class="three-a">
+            <tr>
+                <td id="secondary" class="sidenav-open">
+                    <div class="wrap">
+                        <ul id="sidenav-a" class="accordion">
+                            % for tool in tools:
+                                % if tool.get('action'):
+                                  <li class="accordion-title" id="${tool['id']}">
+                                % else:
+                                  <li class="accordion-title">
+                                % endif
+                                    <span>${tool['name']}</span>
+                                </li>
+                                <li class="accordion-content" id="content_${tool['id']}">
+                                   ${tool['tree'].display()}
+                                </li>
+                            % endfor
+                        </ul>
+                        <script type="text/javascript">
+                            new Accordion("sidenav-a");
+                        </script>
+                    </div>
+                </td>
+                <td id="toggle_accordion" class="open-close-menu hide_tools"></td>
+                <td id="primary">
+                    <div class="wrap">
+                        <div id="appContent"></div>
+                    </div>
+                </td>
+            </tr>
+        </table>
         <div id="footer_section">
 		   		% if cp.config('server.environment') == 'development':
 		            <div class="footer-a">

=== modified file 'addons/openerp/controllers/templates/search.mako'
--- addons/openerp/controllers/templates/search.mako	2010-09-03 06:44:33 +0000
+++ addons/openerp/controllers/templates/search.mako	2010-09-06 13:59:41 +0000
@@ -144,7 +144,7 @@
         <input type="hidden" id="_terp_filter_domain" name="_terp_filter_domain" value="${params.filter_domain}"/>
         <input type="hidden" id="_terp_search_data" name="_terp_search_data" value="${params.search_data}"/>
 
-        <table width="100%" border="0" cellpadding="2" xmlns="http://www.w3.org/1999/xhtml"; xmlns:py="http://purl.org/kid/ns#";>
+        <table width="100%" border="0" cellpadding="2" xmlns="http://www.w3.org/1999/xhtml";>
             <tr>
                 <td>
                     <table width="100%" class="titlebar" style="border: none;">
@@ -160,7 +160,7 @@
                 <td>${form.search.display()}</td>
             </tr>
             <tr>
-                <td class="toolbar" style="padding:0px">
+                <td class="toolbar" style="padding:0">
                     <table cellpadding="0" cellspacing="0">
                         <tr>
                             <td width="100%">

=== modified file 'addons/openerp/static/css/menu.css'
--- addons/openerp/static/css/menu.css	2010-08-25 07:17:13 +0000
+++ addons/openerp/static/css/menu.css	2010-09-06 13:59:41 +0000
@@ -52,7 +52,7 @@
     
     top: 35px;
     left: 183px;
-    width: 100%;
+    right: 0;
     height: 30px;
     line-height: 1.2;
 

=== modified file 'addons/openerp/static/css/screen.css'
--- addons/openerp/static/css/screen.css	2010-09-06 05:15:04 +0000
+++ addons/openerp/static/css/screen.css	2010-09-06 13:59:41 +0000
@@ -154,16 +154,13 @@
     height: 65px;
 }
 
-div #content {
-	float: left;
-	width: 100%;
+#content {
+    width: 100%;
 }
 
 #footer_section {
-	float: left;
+	clear: left;
 	vertical-align: bottom;
-	width: 100%;
-	display: none;
 }
 
 #company_logo {
@@ -606,8 +603,8 @@
 
 #primary {
     min-height: 100%;
-    margin: 0 0 0 200px;
     vertical-align: top;
+    padding: 0;
 }
 
 #primary div.wrap {
@@ -615,12 +612,14 @@
 }
 
 #secondary {
-    position: relative;
-    float: left;
-    min-height: 100%;
     border-right: 1px solid #3c3c3c;
+    /* hack to "fix" weird space under bar */
+    border-bottom: 1px solid #5a5858;
     background: #5a5858;
-    display: block;
+    padding: 0;
+    vertical-align: top;
+    /* Takes smallest possible width */
+    width: 1px;
 }
 
 div.customize {
@@ -955,12 +954,9 @@
 div.footer-b {
     background:none repeat scroll 0 0 #CCCCCC;
 	border:1px solid #AAAAAA;
-	display:block;
-	margin:0 -2px;
 	overflow:hidden;
 	padding:5px 0;
 	position:relative;
-	width:100%;
 }
 
 div.footer-a p,
@@ -1770,11 +1766,13 @@
 }
 
 .open-close-menu {
-    float: left;
     cursor: pointer;
     background: #CECBCB url(../images/arrow_left.png) no-repeat scroll 20% 50%;
     min-height: 100%;
     width: 11px;
+    padding: 0;
+    /* hack to fix weird space under bar */
+    border-bottom: 1px solid #CECBCB;
 }
 
 .hide-menu .open-close-menu {
@@ -1787,7 +1785,6 @@
 
 .hide-menu #secondary {
     display: none;
-    width: 0;
 }
 
 .hide-menu #sidenav_hide a {
@@ -2107,19 +2104,22 @@
     padding: 0;
 }
 
+/* TODO: refactor sidebar as well as the toggle_accordion/open-close-menu
+
+   Should not need to duplicate colors, borders (hack), images in open/close
+   status, width, height, padding, cursor
+*/
 .toggle_sidebar {
-	cursor: pointer;
+    cursor: pointer;
     height: 100%;
     width: 11px;
     padding: 0 5px;
 }
-
 .sidebar_close {
-	background: #CECBCB url(../images/arrow_left.png) no-repeat scroll 20% 50%;
+    background: #CECBCB url(../images/arrow_left.png) no-repeat scroll 20% 50%;
 }
-
 .sidebar_open {
-	background: #CECBCB url("../images/arrow_right.png") no-repeat scroll 80% 50% 
+    background: #CECBCB url("../images/arrow_right.png") no-repeat scroll 80% 50%;
 }
 
 .sideheader-a {
@@ -2202,12 +2202,7 @@
 }
 
 .sidebar-closed {
-    width: 0px;
-}
-
-.sidebar-closed #sidebar {
     display: none;
-    
 }
 
 #sidebar_hide {

=== modified file 'addons/openerp/static/css/style-ie.css'
--- addons/openerp/static/css/style-ie.css	2009-04-20 08:10:56 +0000
+++ addons/openerp/static/css/style-ie.css	2010-09-06 13:59:41 +0000
@@ -1,10 +1,10 @@
 td.label,
-td.item {
-    padding: 0px 2px;
+.item {
+    padding: 0 2px;
 }
 
 td.label {
-    padding: 0px 4px;
+    padding: 0 4px;
 }
 
 img.imgSelect {
@@ -13,11 +13,11 @@
 
 table.tree-grid th,
 table.tree-grid td {
-    padding: 0px 5px;
+    padding: 0 5px;
 }
 
 div.box2 button {
-    margin: 0px 2px;
+    margin: 0 2px;
 }
 
 /* range widgets */
@@ -29,10 +29,10 @@
     width: 98%;
 }
 
-td.item input,
-td.item select,
-td.item textarea,
-td.item button {
+.item input,
+.item select,
+.item textarea,
+.item button {
     width: 98%;
 }
 
@@ -45,7 +45,7 @@
 }
 
 .grid-cell.selector {
-    padding: 0px 4px;
+    padding: 0 4px;
 }
 
 /* http://dean.edwards.name/my/base64-sordid.html */

=== modified file 'addons/openerp/static/css/style.css'
--- addons/openerp/static/css/style.css	2010-09-06 06:23:17 +0000
+++ addons/openerp/static/css/style.css	2010-09-06 13:59:41 +0000
@@ -23,16 +23,11 @@
 	float: right;
 }
 
-table#search_table td {
-    font-weight: bold;
-    text-align: left !important;
-}
-
 .filter_item {
     padding: 0;
 }
 
-td.item table {
+.item table {
     border: none;
 }
 
@@ -66,14 +61,14 @@
     font-size: 0.9em;
 }
 
-td.item button table {
+.item button table {
     margin: 0;
     border: none;
     font-weight: bold;
     font-size: 0.8em;
 }
 
-td.item button table td {
+.item button table td {
     border: none;
     padding: 0;
 }
@@ -86,24 +81,24 @@
     width: 0%;
 }
 
-table#filter_option_table {
+#filter_option_table {
     margin: 0;
 }
 
-table#filter_option_table td.filter_column {
+#filter_option_table .filter_column {
     padding: 0;
     text-align:right;
     white-space:nowrap;
 }
 
-table#filter_option_table td.filter_column select {
+#filter_option_table .filter_column select {
     width: 80px;
 }
 
-table#filter_option_table td.filter_column input.qstring,
-table#filter_option_table td.filter_column select.filter_fields,
-table#filter_option_table td.filter_column select.expr,
-table#filter_option_table td.and_or select.select_andor {
+#filter_option_table .filter_column .qstring,
+#filter_option_table .filter_column .filter_fields,
+#filter_option_table .filter_column .expr,
+#filter_option_table .and_or select. {
     width: 100px;
     -moz-border-radius: 3px;
     -webkit-border-radius: 3px;
@@ -118,7 +113,7 @@
     text-align: left;
 }
 
-table#filter_option_table label.and_or {
+#filter_option_table .and_or {
     padding-left: 5px;
     text-align: left;
 }
@@ -161,6 +156,17 @@
     color: #000;
     border: 1px solid #999999;
     width: 95px;
+    min-width: 95px;
+}
+#search_filter_data button,
+#search_filter_data .button {
+    padding: 0;
+}
+#search_filter_data .fields {
+    width: 100%;
+}
+#search_filter_data .fields .filters-group .fields {
+    width: 1px;
 }
 
 div.inactive_filter {
@@ -267,7 +273,23 @@
     padding: 0 5px 0 0;
 }
 
-table#search_table td {
+.search_table .filter-a {
+    display: inline;
+}
+.search_table .filter-a button.filter_icon {
+    vertical-align: bottom;
+    margin: 0;
+    min-width: 16px;
+    min-height: 16px;
+    height: 18px;
+}
+.search_table td {
+    text-align: left !important;
+}
+.search_table label {
+    font-weight: bold;
+}
+.search_table span.item {
     padding: 2px 0;
 }
 
@@ -547,8 +569,8 @@
 }
 
 td.label,
-td.item,
-#groupdata_table td.item {
+.item,
+#groupdata_table .item {
     padding: 2px 4px;
 }
 
@@ -560,18 +582,18 @@
     white-space: nowrap;
 }
 
-td.item input,
-td.item select {
+.item input,
+.item select {
     min-width: 150px;
 }
 
-td.item table.fields {
+.item .fields {
     width: 100%;
 }
 
-td.item input,
-td.item select,
-td.item textarea {
+.item input,
+.item select,
+.item textarea {
     border-radius: 3px;
     -moz-border-radius: 3px;
     -webkit-border-radius: 3px;
@@ -580,18 +602,25 @@
     vertical-align: middle;
 }
 
-td.item input {
+.item input {
     padding: 2px 3px;
 }
 
-td.item input.m2o,
-td.item input.reference {
+.item input.m2o,
+.item input.reference {
     padding-right: 18px;
     min-width: 132px;
 }
 
-td.item img.m2o_select,
-td.item img.datetime {
+.m2o {
+    position: relative;
+}
+.m2o_select {
+    position: absolute;
+    right: 2px;
+    top: 0;
+}
+.item img.datetime {
     margin-left: -18px;
 }
 
@@ -601,13 +630,13 @@
     cursor: pointer;
 }
 
-td.item table.item-wrapper td {
+.item .item-wrapper td {
     padding: 0;
     padding-right: 2px;
     white-space: nowrap;
 }
 
-td.item table.item-wrapper td img {
+.item .item-wrapper td img {
     vertical-align: middle;
 }
 
@@ -622,8 +651,8 @@
     overflow: hidden;
 }
 
-td.item .checkbox,
-td.item .radio {
+.item .checkbox,
+.item .radio {
     width: auto;
     min-width: 10px;
 }
@@ -819,8 +848,8 @@
     line-height: 1.25;
     white-space: nowrap;
     padding: 0;
-    min-height: 45px;
-    min-width: 45px;
+    min-height: 40px;
+    min-width: 30px;
 }
 
 td.grop_box_active div.filter-a button.active {
@@ -828,18 +857,26 @@
     color: #000000;
 }
 
-div.filter-a button.filter_with_icon:active,
-div.filter-a button.filter_with_icon:hover {
+.filter-a button {
+    padding: 1px 2px !important;
+}
+
+.filter-a .filter_with_icon img {
+    display: block;
+    margin: 1px auto;
+}
+.filter-a .filter_with_icon:active,
+.filter-a .filter_with_icon:hover {
     background-color: #cbced2;
     color: #000000;
 }
 
-div.filter-a button.filter_with_icon:focus {
+.filter-a .filter_with_icon:focus {
 	background-color: #DCDCDC;
 	color: #000000;
 }
 
-div.filter-a button.filter_icon {
+.filter-a .filter_icon {
     background: none;
     border: none;
     margin: 15px 0 0 0;
@@ -848,9 +885,9 @@
     max-width: 30px;
 }
 
-div.filter-a button.filter_icon:active,
-div.filter-a button.filter_icon:hover,
-div.filter-a button.filter_icon:focus {
+.filter-a .filter_icon:active,
+.filter-a .filter_icon:hover,
+.filter-a .filter_icon:focus {
     background-color: #cbced2;
     border-color: #cccbcb;
     border-radius: 4px;

=== modified file 'addons/openerp/static/javascript/accordion.js'
--- addons/openerp/static/javascript/accordion.js	2010-08-26 10:36:28 +0000
+++ addons/openerp/static/javascript/accordion.js	2010-09-06 13:59:41 +0000
@@ -101,7 +101,6 @@
             afterFinish: MochiKit.Base.bind(function() {
                 this.animate = false;
                 MochiKit.Signal.signal(this, "activate", this, title);
-                setTimeout(function() {adjustTopWidth();}, 500);
             }, this)
         });
 

=== modified file 'addons/openerp/static/javascript/listgrid.js'
--- addons/openerp/static/javascript/listgrid.js	2010-09-06 06:52:25 +0000
+++ addons/openerp/static/javascript/listgrid.js	2010-09-06 13:59:41 +0000
@@ -304,7 +304,6 @@
         }
         
         jQuery(group).toggleClass('group-collapse group-expand');
-		setTimeout(function() {adjustTopWidth();}, 100)
     },
 
     groupbyDrag: function(drag, drop, view) {
@@ -719,7 +718,6 @@
             data: args,
             dataType: 'json',
             type: 'POST',
-            complete: function() {adjustTopWidth();},
             success: function(obj) {
                 var _terp_id = openobject.dom.get(self.name + '/_terp_id') || openobject.dom.get('_terp_id');
                 var _terp_ids = openobject.dom.get(self.name + '/_terp_ids') || openobject.dom.get('_terp_ids');

=== modified file 'addons/openerp/static/javascript/notebook/notebook.js'
--- addons/openerp/static/javascript/notebook/notebook.js	2010-08-23 05:52:16 +0000
+++ addons/openerp/static/javascript/notebook/notebook.js	2010-09-06 13:59:41 +0000
@@ -475,7 +475,6 @@
             }
             
         }
-        setTimeout("adjustTopWidth()", 0);
     },
     
     activateScrollers: function() {

=== modified file 'addons/openerp/static/javascript/openerp/openerp.ui.js'
--- addons/openerp/static/javascript/openerp/openerp.ui.js	2010-09-03 09:14:56 +0000
+++ addons/openerp/static/javascript/openerp/openerp.ui.js	2010-09-06 13:59:41 +0000
@@ -47,56 +47,6 @@
     } else {
         Notebook.adjustSize(a);
     }
-    jQuery('td.toggle_sidebar').toggleClass('sidebar_open sidebar_close');
-    
-    adjustTopWidth();
-    
-}
-
-function adjustTopWidth() {
-    var docWidth = jQuery(document).width();
-    var accordionWidth = jQuery('#secondary div.wrap').width();
-    var accordionHeight = jQuery('#secondary div.wrap').height();
-    var $form = jQuery('#appContent table:first');
-    
-    if (!$form.get().length) {
-        $form = jQuery('#appContent');
-    }
-    
-    var formWidth = $form.width();
-    var formHeight = $form.height();
-    var toggle_accordion_width = jQuery('#toggle_accordion').width();
-    var totalWidth = accordionWidth + toggle_accordion_width + formWidth;
-    
-    var adjust_Width;
-    var adjust_Height;
-    
-    if(totalWidth < docWidth ) adjust_Width = totalWidth;
-    else adjust_Width = docWidth;
-    
-    
-    if(accordionHeight > formHeight) adjust_Height = accordionHeight;
-    else adjust_Height = formHeight;
-    
-    
-    jQuery('div#top, #main_nav').width(adjust_Width);
-    var logoWidth = jQuery('p#cmp_logo').outerWidth();
-    var shortcuts = jQuery('#shortcuts');
-    var offset = shortcuts.outerWidth() - shortcuts.width();
-    shortcuts.css('width', adjust_Width - logoWidth - offset);
-    
-    if (!window.browser.isGecko) {
-        if ($form.get(0).tagName == 'TABLE') {
-            
-            $form.parent().css('float', 'left')
-            if (formWidth > 750) 
-                $form.parent().width(700)
-        }
-    }
-    jQuery('#secondary, #toggle_accordion').height(adjust_Height);
-    
-    jQuery('#footer_section').width(adjust_Width);
-    jQuery('#footer_section').show();
 }
 
 jQuery(document).bind('shortcuts-alter', function () {
@@ -124,7 +74,6 @@
             shortcuts.scrollLeft(0);
         }
     }
-    setRowWidth();
 });
 
 // trigger on window load so all other handlers (including resizer) have executed
@@ -158,7 +107,7 @@
     });
     shortcuts.prepend(scroll_right).prepend(scroll_left);
     jQuery(document).trigger('shortcuts-alter');
-    jQuery(window).resize(function () {
-        jQuery(document).trigger('shortcuts-alter');
-    })
+});
+jQuery(window).resize(function () {
+    jQuery(document).trigger('shortcuts-alter');
 });

=== modified file 'addons/openerp/static/javascript/openerp/openerp.ui.tips.js'
--- addons/openerp/static/javascript/openerp/openerp.ui.tips.js	2010-08-16 09:24:46 +0000
+++ addons/openerp/static/javascript/openerp/openerp.ui.tips.js	2010-09-06 13:59:41 +0000
@@ -197,7 +197,7 @@
             return false;
 
         var title;
-        var search_table = jQuery(e).find('table#search_table');
+        var search_table = jQuery(e).find('.search_table');
         if(search_table.length) {
             title = jQuery(search_table).find('td:first span').text().split(":")[0];
         } else {

=== modified file 'addons/openerp/static/javascript/search.js'
--- addons/openerp/static/javascript/search.js	2010-09-03 06:49:03 +0000
+++ addons/openerp/static/javascript/search.js	2010-09-06 13:59:41 +0000
@@ -131,7 +131,6 @@
     jQuery(grp_id).toggle();
     if (id)
         jQuery(id).css('display', 'block');
-    setTimeout(function() {adjustTopWidth()}, 0);
 }
 
 function switch_searchView(d) {

=== modified file 'addons/openerp/static/javascript/treegrid.js'
--- addons/openerp/static/javascript/treegrid.js	2010-08-26 10:36:28 +0000
+++ addons/openerp/static/javascript/treegrid.js	2010-09-06 13:59:41 +0000
@@ -628,10 +628,6 @@
         } else {
         	this.expand();
         }
-		setTimeout(function() {
-			jQuery('#footer_section').hide();
-			adjustTopWidth();
-		}, 100);
         return true;
     },
 

=== modified file 'addons/openerp/widgets/_interface.py'
--- addons/openerp/widgets/_interface.py	2010-08-10 12:08:29 +0000
+++ addons/openerp/widgets/_interface.py	2010-09-06 13:59:41 +0000
@@ -145,6 +145,7 @@
         'change_default',
         'onchange',
         'kind',
+        'filters' # filter buttons within an input widget, part of the same implicit "group"
     ]
 
     select = False
@@ -178,6 +179,8 @@
         self.callback = attrs.get('on_change', None)
         self.kind = attrs.get('type', None)
 
+        self.filters = []
+
     def set_state(self, state):
         if isinstance(self.states, dict) and state in self.states:
             attrs = dict(self.states[state])

=== modified file 'addons/openerp/widgets/form/templates/button.mako'
--- addons/openerp/widgets/form/templates/button.mako	2010-08-16 13:25:02 +0000
+++ addons/openerp/widgets/form/templates/button.mako	2010-09-06 13:59:41 +0000
@@ -4,15 +4,15 @@
    onclick="buttonClicked('${name}', '${btype}', '${model}', '${id}', '${confirm}', '${target}', getNodeAttribute(this, 'context'));"
    style="height: 18px;"
    ${py.attrs(attrs, context=ctx)}>
-        % if string:
-			% if icon:
-				<div class="button_wid_string" style="background-image: url(${icon}); padding-top: 3px;">${string}</div>
-			% else:
-				<div style="text-align: center; padding-top: 3px;">${string}</div>
-			% endif
-		%else:
-			<img align="middle" src="${icon}" width="16" height="16" alt="">
-		% endif
+    % if string:
+        % if icon:
+            <div class="button_wid_string" style="background-image: url(${icon}); padding-top: 3px;">${string}</div>
+        % else:
+            <div style="text-align: center; padding-top: 3px;">${string}</div>
+        % endif
+    %else:
+        <img align="middle" src="${icon}" width="16" height="16" alt="">
+    % endif
 </a>
 % if default_focus:
     <script type="text/javascript">

=== modified file 'addons/openerp/widgets/form/templates/frame.mako'
--- addons/openerp/widgets/form/templates/frame.mako	2010-09-01 05:29:24 +0000
+++ addons/openerp/widgets/form/templates/frame.mako	2010-09-06 13:59:41 +0000
@@ -9,7 +9,7 @@
         <td ${py.attrs(attrs)}>
             % if isinstance(widget, basestring):
                 % if attrs.get('label_position'):
-                <table id="search_table">
+                <table class="search_table">
                     <tr>
                         <td ${py.attrs(attrs.get('widget_item')[0])} width="${attrs.get('width')}">
                             <label for="${attrs.get('for')}">
@@ -23,17 +23,16 @@
                     </tr>
                     <tr>
                          <td ${py.attrs(attrs.get('widget_item')[0])} width="${attrs.get('width')}">
-                                % if attrs.get('widget_item')[1].kind in ('char', 'selection', 'one2many', 'many2many'):
-                                    <table>
-                                        <tr>
-                                            <td class="filter_item">
-                                                ${display_member(attrs.get('widget_item')[1])}
-                                            </td>
-                                        </tr>
-                                    </table>
-                                % else:
+                            % if attrs.get('widget_item')[1].kind in ('char', 'selection', 'one2many', 'many2many'):
+                                <span class="filter_item">
                                     ${display_member(attrs.get('widget_item')[1])}
-                                % endif
+                                </span>
+                            % else:
+                                ${display_member(attrs.get('widget_item')[1])}
+                            % endif
+                            % for filter_widget in attrs.get('widget_item')[1].filters:
+                                ${display_member(filter_widget)}
+                            % endfor
                          </td>
                     </tr>
                 </table>
@@ -47,8 +46,7 @@
                 :
                 </sup>
                 % endif
-            % endif
-            % if not isinstance(widget, basestring) and widget.visible:
+            % elif widget.visible:
             ${display_member(widget)}
             % endif
         </td>

=== modified file 'addons/openerp/widgets/form/templates/many2one.mako'
--- addons/openerp/widgets/form/templates/many2one.mako	2010-08-30 11:36:43 +0000
+++ addons/openerp/widgets/form/templates/many2one.mako	2010-09-06 13:59:41 +0000
@@ -1,43 +1,31 @@
 % if editable:
-<table class="item-wrapper">
-<tr>
-    <td>
-        <input type="hidden" id="${name}" name="${name}" class="${css_class}" value="${value}"
-            ${py.attrs(attrs, kind=kind, domain=domain, context=ctx, relation=relation)}/>
-        <input type="text" id="${name}_text" class="${css_class}"
-            ${py.attrs(attrs, kind=kind, relation=relation, value=text)}/>
+<span class="m2o">
+    <input type="hidden" id="${name}" name="${name}" class="${css_class}" value="${value}"
+        ${py.attrs(attrs, kind=kind, domain=domain, context=ctx, relation=relation)}/>
+    <input type="text" id="${name}_text" class="${css_class}"
+        ${py.attrs(attrs, kind=kind, relation=relation, value=text)}/>
 
-        <input type="hidden" id="_hidden_${name}" value=""/>
-        <div id="autoCompleteResults_${name}" class="autoTextResults"></div>
-        % if error:
+    <input type="hidden" id="_hidden_${name}" value=""/>
+    % if error:
         <span class="fielderror">${error}</span>
-        % endif
-    </td>
-    <td>
-        <img id="${name}_select" alt="${_('Search')}" title="${_('Search')}"
-            src="/openerp/static/images/fields-a-lookup-a.gif" class="m2o_select"/>
-    </td>
-    <td class="item-image">
-	    <img id="${name}_open" alt="${_('Open')}" title="${_('Open a resource')}"
-    	    src="/openerp/static/images/iconset-d-drop.gif" class="m2o_open"/>
-    </td>
-</tr>
-</table>
-% endif
-
-% if editable:
-    <script type="text/javascript">
-        new ManyToOne('${name}');
-    </script>
+    % endif
+    <img id="${name}_select" alt="${_('Search')}" title="${_('Search')}"
+        src="/openerp/static/images/fields-a-lookup-a.gif" class="m2o_select"/>
+</span>
+<img id="${name}_open" alt="${_('Open')}" title="${_('Open a resource')}"
+    src="/openerp/static/images/iconset-d-drop.gif" class="m2o_open"/>
+    <div id="autoCompleteResults_${name}" class="autoTextResults"></div>
+<script type="text/javascript">
+    new ManyToOne('${name}');
+</script>
 % endif
 
 % if not editable and link:
-    % if link=='1':
+    % if link == '1':
         <span id="${name}" name="${name}" ${py.attrs(kind=kind, value=value, relation=relation, context=ctx, domain=domain, link=link)}>
             <a style="color:#9A0404;" href="javascript: void(0)" onclick="new ManyToOne('${name}').open_record('${value}')">${text}</a>
         </span>
-    % endif
-    % if link=='0':
+    % elif link == '0':
         <span id="${name}" ${py.attrs(kind=kind, value=value, relation=relation, link=link)}>${text}</span>
     % endif
 % endif

=== modified file 'addons/openerp/widgets/search.py'
--- addons/openerp/widgets/search.py	2010-09-06 10:32:46 +0000
+++ addons/openerp/widgets/search.py	2010-09-06 13:59:41 +0000
@@ -38,8 +38,7 @@
 import copy
 from openerp.utils import rpc, cache, icons, node_attributes, expr_eval
 from openerp.widgets import TinyInputWidget
-from openerp.widgets.form import Char, Frame, Float, DateTime, Integer, Selection, Notebook
-from openerp.widgets.form import Separator, FiltersGroup, Group, NewLine, M2O
+from openerp.widgets import form
 
 from openobject.widgets import JSLink, locations
 
@@ -172,44 +171,13 @@
         self.last_box = attrs.get('last_box')
         self.first_last_box = attrs.get('first_last_box')
 
-class M2O_search(M2O):
-    template = """
-        <table width="100%" cellpadding="0" cellspacing="0">
-            <tr>
-                <td>
-                    <input type="hidden" id="${name}" name="${name}" class="${css_class}" value="${value}"
-                        ${py.attrs(attrs, kind=kind, domain=domain, relation=relation, m2o_filter_domain=filter_domain)}/>
-                    <input type="text" id="${name}_text" class="${css_class}"
-                        ${py.attrs(attrs, kind=kind, relation=relation, value=text, m2o_filter_domain=filter_domain)}/>
-                    <input type="hidden" id="_hidden_${name}" value=""/>
-                    <div id="autoCompleteResults_${name}" class="autoTextResults"></div>
-                    % if error:
-                        <span class="fielderror">${error}</span>
-                    % endif
-                </td>
-                <td>
-                    <img id="${name}_select" alt="${_('Search')}" title="${_('Search')}"
-                        src="/openerp/static/images/fields-a-lookup-a.gif" class="${css_class} m2o_select"/>
-                </td>
-                <td class="item-image">
-                    <img id="${name}_open" alt="${_('Open')}" title="${_('Open a resource')}"
-                        src="/openerp/static/images/iconset-d-drop.gif" class="m2o_open"/>
-                </td>
-            </tr>
-        </table>
-        <script type="text/javascript">
-            new ManyToOne('${name}');
-        </script>
-    """
-    params = ['filter_domain']
-
+class M2O_search(form.M2O):
     def __init__(self, **attrs):
         if attrs.get('default', False) == 'uid':
             attrs['default'] = rpc.session.uid
 
-        filter_domain = None
-        if attrs.get('filter_domain'):
-            filter_domain = attrs['filter_domain']
+        attrs['m2o_filter_domain'] = attrs.get('filter_domain')
+
         super(M2O_search, self).__init__(**attrs)
 
 class Search(TinyInputWidget):
@@ -219,8 +187,6 @@
     params = ['fields_type', 'filters_list', 'operators_map', 'fields_list', 'filter_domain', 'flt_domain']
     member_widgets = ['frame']
 
-    _notebook = Notebook(name="search_notebook")
-
     def __init__(self, model, domain=None, context=None, values={}, filter_domain=None, search_view=None, group_by_ctx=[], **kw):
 
         super(Search, self).__init__(model=model)
@@ -250,13 +216,13 @@
 
         if isinstance (self.search_view, basestring):
             self.search_view = eval(self.search_view)
-        
+
         if not self.search_view:
-            self.search_view = cache.fields_view_get(self.model, view_id, 'search', ctx, True)            
-            
+            self.search_view = cache.fields_view_get(self.model, view_id, 'search', ctx, True)
+
         self.fields_list = []
-        fields = self.search_view.get('fields')       
-        
+        fields = self.search_view['fields']
+
         try:
             dom = xml.dom.minidom.parseString(self.search_view['arch'])
         except:
@@ -312,7 +278,7 @@
         sorted_filters.sort(lambda x, y: cmp(x[1], y[1]))
 
         self.filters_list = [("blk", "-- Filters --")] \
-                          + sorted_filters                          
+                          + sorted_filters
 
         self.operators_map = [
             ('ilike', _('contains')), ('not ilike', _('doesn\'t contain')),
@@ -442,30 +408,44 @@
                             self.listof_domain += [i for i in domain if not i in self.listof_domain]
                             self.context.update(expr_eval(attrs.get('context',"{}"), {'self': s}))
 
-                    if (not default_search) and name in values and isinstance(field, (TinyInputWidget, RangeWidget)):
+                    if (not default_search) and name in values and isinstance(field, TinyInputWidget):
                         field.set_value(values[name])
 
                     views.append(field)
                     for n in node.childNodes:
                         if n.localName=='filter':
-                            attrs_child = node_attributes(n)
-                            attrs_child['default_domain'] = self.domain
-                            attrs_child['screen_context'] = self.context
-                            if attrs_child.get('string'):
-                                attrs_child['string'] = ''
+                            attrs_child = dict(
+                                node_attributes(n),
+                                default_domain=self.domain,
+                                screen_context=self.context)
+                            if 'string' in attrs_child: del attrs_child['string']
                             if values and values.get('group_by_ctx'):
                                 attrs['group_by_ctx'] = values['group_by_ctx']
+
                             filter_field = Filter(**attrs_child)
                             filter_field.onchange = None
                             filter_field.callback = None
+
                             if filter_field.groupcontext and filter_field.groupcontext not in self.groupby:
                                 self.groupby.append(filter_field.groupcontext)
-                            self.listof_domain += [i for i in filter_field.global_domain if not i in self.listof_domain]
-                            views.append(filter_field)
+                            self.listof_domain.extend(i for i in filter_field.global_domain
+                                                        if i not in self.listof_domain)
+                            field.filters.append(filter_field)
         if filters_run:
             views.append(FiltersGroup(children=filters_run))
         return views
 
+class Char(form.Char): pass
+class DateTime(form.DateTime): pass
+class FiltersGroup(form.FiltersGroup): pass
+class Float(form.Float): pass
+class Frame(form.Frame): pass
+class Group(form.Group): pass
+class Integer(form.Integer): pass
+class NewLine(form.NewLine): pass
+class Selection(form.Selection): pass
+class Separator(form.Separator): pass
+
 RANGE_WIDGETS = {
     'date': DateTime,
     'time': DateTime,
@@ -492,5 +472,3 @@
     'url' : Char,
     'separator': Separator
 }
-
-# vim: ts=4 sts=4 sw=4 si et

=== modified file 'addons/openerp/widgets/templates/filter.mako'
--- addons/openerp/widgets/templates/filter.mako	2010-08-27 08:36:14 +0000
+++ addons/openerp/widgets/templates/filter.mako	2010-09-06 13:59:41 +0000
@@ -16,43 +16,21 @@
 	%>
 	
 	<button type="button" class="${ul_class} ${a_class}" title="${help}" onclick="search_filter(jQuery('#${filter_id}'), this);">
-	   <table align="center">
-	       % if icon:
-	       <tr>
-	           <td>
-	               <img src="${icon}" width="16" height="16"/>
-	           </td>
-	       </tr>
-	       % endif
-	       % if text:
-	       <tr>
-	           <td>
-	               ${text}
-	           </td>
-	       </tr>
-	       % endif
-	   </table>
+       % if icon:
+           <img src="${icon}" width="16" height="16" alt="">
+       % endif
+       % if text:
+           ${text}
+       % endif
 	</button>
-	% if def_checked:
-            <input ${py.attrs(attrs)} style="display:none;"
-                type="checkbox"
-                id="${filter_id}"
-                name="${filter_id}"
-                class="grid-domain-selector"
-                onclick="search_filter(this);"
-                value="${filter_domain}"
-                group_by_ctx="${group_context}"
-                checked
-                title="${help}" filter_context="${filter_context}"/>
-        % else:
-            <input ${py.attrs(attrs)} style="display:none;"
-                type="checkbox"
-                id="${filter_id}"
-                name="${filter_id}"
-                class="grid-domain-selector"
-                onclick="search_filter(this);"
-                value="${filter_domain}"
-                group_by_ctx="${group_context}"
-                title="${help}" filter_context="${filter_context}"/>
-        % endif
+    <input ${py.attrs(attrs)} style="display:none;"
+        type="checkbox"
+        id="${filter_id}"
+        name="${filter_id}"
+        class="grid-domain-selector"
+        onclick="search_filter(this);"
+        value="${filter_domain}"
+        group_by_ctx="${group_context}"
+        title="${help}" filter_context="${filter_context}"
+        ${'checked' if def_checked else ''}/>
 </div>

=== modified file 'addons/view_calendar/static/javascript/calendar_utils.js'
--- addons/view_calendar/static/javascript/calendar_utils.js	2010-08-26 10:36:28 +0000
+++ addons/view_calendar/static/javascript/calendar_utils.js	2010-09-06 13:59:41 +0000
@@ -73,7 +73,6 @@
     if(window.CAL_INSTANCE) {
         setTimeout(function() {
 			jQuery.proxy(window.CAL_INSTANCE, 'onResize')
-			adjustTopWidth();
 		}, 100);
     }
 });

=== modified file 'addons/view_diagram/static/javascript/process.js'
--- addons/view_diagram/static/javascript/process.js	2010-08-26 12:07:57 +0000
+++ addons/view_diagram/static/javascript/process.js	2010-09-06 13:59:41 +0000
@@ -152,7 +152,6 @@
         if (elems.length) {
             new openerp.ui.Tips(elems);
         }
-        adjustTopWidth();
     },
 
     _create_note:  function(notes, subflows, perm, related) {

=== modified file 'addons/view_graph/static/javascript/graph.js'
--- addons/view_graph/static/javascript/graph.js	2010-08-30 05:57:20 +0000
+++ addons/view_graph/static/javascript/graph.js	2010-09-06 13:59:41 +0000
@@ -10,13 +10,6 @@
 		var chart_id = name.slice(0, -1);
 		swfobject.embedSWF(openobject.http.getURL("/view_graph/static/open-flash-chart.swf"), name, '100%', 350, "9.0.0",
 			"expressInstall.swf", {'get-data': 'get_chart', 'id': chart_id}, {'wmode': 'transparent'});
-		
-		if(index == (last_chart -1)) {
-			setTimeout(function() {
-				jQuery('#footer_section').hide();
-				adjustTopWidth();
-			}, 1000);
-		}
 	});
 	
 }

=== modified file 'openobject/tools/_utils.py'
--- openobject/tools/_utils.py	2010-08-17 12:15:17 +0000
+++ openobject/tools/_utils.py	2010-09-06 13:59:41 +0000
@@ -119,10 +119,7 @@
     kv = {}
 
     for arg in args:
-        if isinstance(arg, dict):
-            kv.update(arg)
-        else:
-            raise TypeError
+        kv.update(arg)
 
     kv.update(kw)
 


Follow ups