diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index b39162ff80e..222d8f34c9c 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -863,11 +863,24 @@ class ir_model_data(osv.osv): def get_object_reference(self, cr, uid, module, xml_id): """Returns (model, res_id) corresponding to a given module and xml_id (cached) or raise ValueError if not found""" data_id = self._get_id(cr, uid, module, xml_id) + #assuming data_id is not False, as it was checked upstream res = self.read(cr, uid, data_id, ['model', 'res_id']) if not res['res_id']: raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_id)) return res['model'], res['res_id'] + def check_object_reference(self, cr, uid, module, xml_id, raise_on_access_error=False): + """Returns (model, res_id) corresponding to a given module and xml_id (cached), if and only if the user has the necessary access rights + to see that object, otherwise raise a ValueError if raise_on_access_error is True or returns a tuple (model found, False)""" + model, res_id = self.get_object_reference(cr, uid, module, xml_id) + #search on id found in result to check if current user has read access right + check_right = self.pool.get(model).search(cr, uid, [('id', '=', res_id)]) + if check_right: + return model, res_id + if raise_on_access_error: + raise ValueError('Not enough access rights on the external ID: %s.%s' % (module, xml_id)) + return model, False + def get_object(self, cr, uid, module, xml_id, context=None): """Returns a browsable record for the given module name and xml_id or raise ValueError if not found""" res_model, res_id = self.get_object_reference(cr, uid, module, xml_id) diff --git a/openerp/addons/base/res/res_company.py b/openerp/addons/base/res/res_company.py index c8ea8d7856e..cd17f6da3d9 100644 --- a/openerp/addons/base/res/res_company.py +++ b/openerp/addons/base/res/res_company.py @@ -253,7 +253,7 @@ class res_company(osv.osv): vals.update({'partner_id': partner_id}) self.cache_restart(cr) company_id = super(res_company, self).create(cr, uid, vals, context=context) - obj_partner.write(cr, uid, partner_id, {'company_id': company_id}, context=context) + obj_partner.write(cr, uid, [partner_id], {'company_id': company_id}, context=context) return company_id def write(self, cr, uid, ids, values, context=None): diff --git a/openerp/addons/base/res/res_partner.py b/openerp/addons/base/res/res_partner.py index c46fd71ce5f..6948a35b759 100644 --- a/openerp/addons/base/res/res_partner.py +++ b/openerp/addons/base/res/res_partner.py @@ -213,15 +213,19 @@ class res_partner(osv.osv, format_address): _commercial_partner_id = lambda self, *args, **kwargs: self._commercial_partner_compute(*args, **kwargs) _display_name = lambda self, *args, **kwargs: self._display_name_compute(*args, **kwargs) - _commercial_partner_store_triggers = { + _commercial_partner_store_triggers = { 'res.partner': (lambda self,cr,uid,ids,context=None: self.search(cr, uid, [('id','child_of',ids)]), ['parent_id', 'is_company'], 10) - } + } + _display_name_store_triggers = { + 'res.partner': (lambda self,cr,uid,ids,context=None: self.search(cr, uid, [('id','child_of',ids)]), + ['parent_id', 'is_company', 'name'], 10) + } _order = "display_name" _columns = { 'name': fields.char('Name', size=128, required=True, select=True), - 'display_name': fields.function(_display_name, type='char', string='Name', store=_commercial_partner_store_triggers), + 'display_name': fields.function(_display_name, type='char', string='Name', store=_display_name_store_triggers), 'date': fields.date('Date', select=1), 'title': fields.many2one('res.partner.title', 'Title'), 'parent_id': fields.many2one('res.partner', 'Related Company'), @@ -442,7 +446,7 @@ class res_partner(osv.osv, format_address): commercial_fields = self._commercial_fields(cr, uid, context=context) sync_vals = self._update_fields_values(cr, uid, partner.commercial_partner_id, commercial_fields, context=context) - return self.write(cr, uid, partner.id, sync_vals, context=context) + partner.write(sync_vals) def _commercial_sync_to_children(self, cr, uid, partner, context=None): """ Handle sync of commercial fields to descendants """ @@ -468,7 +472,7 @@ class res_partner(osv.osv, format_address): use_parent_address=partner.use_parent_address, parent_id=partner.parent_id.id, context=context).get('value', {}) - self.update_address(cr, uid, partner.id, onchange_vals, context=context) + partner.update_address(onchange_vals) # 2. To DOWNSTREAM: sync children if partner.child_ids: diff --git a/openerp/osv/expression.py b/openerp/osv/expression.py index 530eb83a2cc..55e286d33f2 100644 --- a/openerp/osv/expression.py +++ b/openerp/osv/expression.py @@ -790,7 +790,7 @@ class expression(object): leaf.add_join_context(next_model, working_model._inherits[next_model._name], 'id', working_model._inherits[next_model._name]) push(leaf) - elif not field and left == 'id' and operator == 'child_of': + elif left == 'id' and operator == 'child_of': ids2 = to_ids(right, working_model, context) dom = child_of_domain(left, ids2, working_model) for dom_leaf in reversed(dom): diff --git a/openerp/release.py b/openerp/release.py index 50bcd0c81e1..1ad35340496 100644 --- a/openerp/release.py +++ b/openerp/release.py @@ -30,7 +30,7 @@ RELEASE_LEVELS_DISPLAY = {ALPHA: ALPHA, # properly comparable using normal operarors, for example: # (6,1,0,'beta',0) < (6,1,0,'candidate',1) < (6,1,0,'candidate',2) # (6,1,0,'candidate',2) < (6,1,0,'final',0) < (6,1,2,'final',0) -version_info = (7, 0, 0, FINAL, 0) +version_info = (8, 0, 0, ALPHA, 1) version = '.'.join(map(str, version_info[:2])) + RELEASE_LEVELS_DISPLAY[version_info[3]] + str(version_info[4] or '') serie = major_version = '.'.join(map(str, version_info[:2])) diff --git a/openerp/report/render/rml2html/__init__.py b/openerp/report/render/rml2html/__init__.py index 8bb6fbb507b..5eb86ad0329 100644 --- a/openerp/report/render/rml2html/__init__.py +++ b/openerp/report/render/rml2html/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). # @@ -15,7 +15,7 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## diff --git a/openerp/report/render/rml2html/rml2html.py b/openerp/report/render/rml2html/rml2html.py index 0e82a5d3ea8..c80698150b8 100644 --- a/openerp/report/render/rml2html/rml2html.py +++ b/openerp/report/render/rml2html/rml2html.py @@ -1,25 +1,8 @@ # -*- coding: utf-8 -*- ############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - # Copyright (C) 2005, Fabien Pinckaers, UCL, FSA +# Copyright (C) 2004-2009 Tiny SPRL (). # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -34,6 +17,8 @@ # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +############################################################################## import sys import cStringIO diff --git a/openerp/report/render/rml2html/utils.py b/openerp/report/render/rml2html/utils.py index b811cc5d47b..c40118477f8 100644 --- a/openerp/report/render/rml2html/utils.py +++ b/openerp/report/render/rml2html/utils.py @@ -1,21 +1,22 @@ # -*- coding: utf-8 -*- ############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). # -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. +# Copyright (C) 2005, Fabien Pinckaers, UCL, FSA +# Copyright (C) 2004-2009 Tiny SPRL (). # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. # -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################## diff --git a/openerp/service/workers.py b/openerp/service/workers.py index ba831988a36..ecd5084b093 100644 --- a/openerp/service/workers.py +++ b/openerp/service/workers.py @@ -182,7 +182,7 @@ class Multicorn(object): self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.socket.setblocking(0) self.socket.bind(self.address) - self.socket.listen(8) + self.socket.listen(8*self.population) # long polling socket self.long_polling_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.long_polling_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)