Xavier ALT (OpenERP) has proposed merging lp:~openerp-dev/openobject-client-web/6.0-opw-584956-xal into lp:openobject-client-web.
Requested reviews: OpenERP Core Team (openerp) For more details, see: https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-584956-xal/+merge/145338 Hi, This fix some problems (traceback + wrong items shown) with list view pagination when tree arch have an explicit limit set on it. Steps: 1. Go to Accounting > Configuration > Financial Accounting > Accounts > Accounts 2. Go to Actions menu and use "Manage View" 3. Edit the current view and set limit of tree tag to 50 4. Close the Manage Views 5. Relaunch Accounts view => the 50 first items are shown 6. Change limit to 100 => nothing happens. You have 50 items shown. 7. Click to have next items => system shown "101-150" and you "lost" some items 8. Change limit to "unlimited" and click to see next items => A let me fix appears Regards, Xavier -- https://code.launchpad.net/~openerp-dev/openobject-client-web/6.0-opw-584956-xal/+merge/145338 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-client-web/6.0-opw-584956-xal.
=== modified file 'addons/openerp/controllers/actions.py' --- addons/openerp/controllers/actions.py 2012-07-30 11:44:30 +0000 +++ addons/openerp/controllers/actions.py 2013-01-29 09:56:24 +0000 @@ -206,8 +206,15 @@ data['search_view'] = str(rpc.session.execute( 'object', 'execute', data['res_model'], 'fields_view_get', data['search_view_id'], 'search', data['context'])) + # store action limit within request and set it as None for action + # so that view specific can differenciate between defaults (i.e this + # act_window limit) and user's choosen value if data.get('limit'): - data['limit'] = 20 + # TODO: we're conservative here - so we set limit to 20, + # but we should really use act_window's limit (i.e data['limit']) + # once we're sure there is *no* performance impact. + cherrypy.request.action_limit = 20 + data['limit'] = None if action.get('target') and action['target'] == 'popup' and action.get('res_model') and isinstance(action.get('context'), dict): search_view_id = rpc.RPCProxy('ir.ui.view').search([('type','=', 'search'), ('model','=',action['res_model'])], 0, 0, 0, rpc.session.context) === modified file 'addons/openerp/controllers/form.py' --- addons/openerp/controllers/form.py 2012-11-05 17:35:08 +0000 +++ addons/openerp/controllers/form.py 2013-01-29 09:56:24 +0000 @@ -179,7 +179,6 @@ cherrypy.session['params'] = params params.offset = params.offset or 0 - params.limit = params.limit or 50 params.count = params.count or 0 params.view_type = params.view_type or params.view_mode[0] === modified file 'addons/openerp/widgets/listgrid.py' --- addons/openerp/widgets/listgrid.py 2012-11-15 12:41:38 +0000 +++ addons/openerp/widgets/listgrid.py 2013-01-29 09:56:24 +0000 @@ -173,7 +173,7 @@ self.view_mode = kw.get('view_mode', []) self.offset = kw.get('offset', 0) - self.limit = kw.get('limit', 0) + self.limit = None self.count = kw.get('count', 0) self.link = kw.get('nolinks') self.m2m = kw.get('m2m', 0) @@ -214,10 +214,18 @@ if elem not in self.domain: search_param.append(elem) - try: - self.limit = int(attrs.get('limit')) - except: - pass + # -- Limits -- + # 1. use action limit or default global listview limit: 20 + # 2. apply tree view limit if defined in attrs: <tree limit='..'>...</tree> + # 3. apply user limit if changed + self.limit = getattr(cherrypy.request, 'action_limit', 20) + if attrs.get('limit'): + try: + self.limit = int(attrs.get('limit')) + except Exception: + pass + if kw.get('limit') is not None: + self.limit = int(kw.get('limit')) self.colors = {} for color_spec in attrs.get('colors', '').split(';'): === modified file 'addons/openerp/widgets/screen.py' --- addons/openerp/widgets/screen.py 2011-11-11 07:05:12 +0000 +++ addons/openerp/widgets/screen.py 2013-01-29 09:56:24 +0000 @@ -106,6 +106,10 @@ if self.view_mode: self.add_view_id(self.view_id, self.view_type) + if self.limit is None: + # limit was not forced by view - use action of defaults + self.limit = getattr(cherrypy.request, 'action_limit', 20) + def add_view_id(self, view_id, view_type): self.view_id = view_id
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : openerp-dev-gtk@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp