Click to define a new product.
@@ -290,6 +291,9 @@
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index d68dbac1942..d4d762dbb99 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -582,7 +582,7 @@ class stock_quant(osv.osv):
if remaining_to_solve_quant_ids:
self.write(cr, SUPERUSER_ID, remaining_to_solve_quant_ids, {'propagated_from_id': remaining_neg_quant.id}, context=context)
if solving_quant.propagated_from_id and solved_quant_ids:
- self.write(cr, uid, solved_quant_ids, {'propagated_from_id': solving_quant.propagated_from_id.id}, context=context)
+ self.write(cr, SUPERUSER_ID, solved_quant_ids, {'propagated_from_id': solving_quant.propagated_from_id.id}, context=context)
#delete the reconciled quants, as it is replaced by the solved quants
self.unlink(cr, SUPERUSER_ID, [quant_neg.id], context=context)
if solved_quant_ids:
diff --git a/doc/reference/orm.rst b/doc/reference/orm.rst
index 474f0eee895..6b609e52287 100644
--- a/doc/reference/orm.rst
+++ b/doc/reference/orm.rst
@@ -1,14 +1,19 @@
.. _reference/orm:
-===
-ORM
-===
+=======
+ORM API
+=======
Recordsets
==========
.. versionadded:: 8.0
+ This page documents the New API added in Odoo 8.0 which should be the
+ primary development API going forward. It also provides information about
+ porting from or bridging with the "old API" of versions 7 and earlier, but
+ does not explicitly document that API. See the old documentation for that.
+
Interaction with models and records is performed through recordsets, a sorted
set of records of the same model.
@@ -444,8 +449,8 @@ Clearing caches can be performed using the
.. _reference/orm/oldapi:
-Old API compatibility
-=====================
+Compatibility between new API and old API
+=========================================
Odoo is currently transitioning from an older (less regular) API, it can be
necessary to manually bridge from one to the other manually:
@@ -1026,9 +1031,10 @@ Domain criteria can be combined using logical operators in *prefix* form:
AND (language is NOT english)
AND (country is Belgium OR Germany)
-Porting from the old API
-========================
+Porting from the old API to the new API
+=======================================
+* bare lists of ids are to be avoided in the new API, use recordsets instead
* methods still written in the old API should be automatically bridged by the
ORM, no need to switch to the old API, just call them as if they were a new
API method. See :ref:`reference/orm/oldapi/bridging` for more details.
diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py
index 96f351b9ee3..5b2a013aa05 100644
--- a/openerp/addons/base/ir/ir_model.py
+++ b/openerp/addons/base/ir/ir_model.py
@@ -983,11 +983,15 @@ class ir_model_data(osv.osv):
def _update_dummy(self,cr, uid, model, module, xml_id=False, store=True):
if not xml_id:
return False
+ id = False
try:
- id = self.read(cr, uid, [self._get_id(cr, uid, module, xml_id)], ['res_id'])[0]['res_id']
- self.loads[(module,xml_id)] = (model,id)
- except:
- id = False
+ # One step to check the ID is defined and the record actually exists
+ record = self.get_object(cr, uid, module, xml_id)
+ if record:
+ id = record.id
+ self.loads[(module,xml_id)] = (model,id)
+ except Exception:
+ pass
return id
def clear_caches(self):
diff --git a/openerp/http.py b/openerp/http.py
index e3c4039c1c8..439be25c4ff 100644
--- a/openerp/http.py
+++ b/openerp/http.py
@@ -272,7 +272,8 @@ class WebRequest(object):
to abitrary responses. Anything returned (except None) will
be used as response."""
self._failed = exception # prevent tx commit
- if not isinstance(exception, NO_POSTMORTEM):
+ if not isinstance(exception, NO_POSTMORTEM) \
+ and not isinstance(exception, werkzeug.exceptions.HTTPException):
openerp.tools.debugger.post_mortem(
openerp.tools.config, sys.exc_info())
raise
diff --git a/setup/package.py b/setup/package.py
index 9ca97d19dd9..71de37bbf99 100755
--- a/setup/package.py
+++ b/setup/package.py
@@ -246,9 +246,14 @@ def _prepare_build_dir(o, win32=False):
if not win32:
cmd += ['--exclude', 'setup/win32']
system(cmd + ['%s/' % o.odoo_dir, o.build_dir])
- for i in glob(join(o.build_dir, 'addons/*')):
- if i.split(os.path.sep)[-1] not in ADDONS_NOT_TO_PUBLISH:
- shutil.move(i, join(o.build_dir, 'openerp/addons'))
+ try:
+ for addon_path in glob(join(o.build_dir, 'addons/*')):
+ if addon_path.split(os.path.sep)[-1] not in ADDONS_NOT_TO_PUBLISH:
+ shutil.move(addon_path, join(o.build_dir, 'openerp/addons'))
+ except shutil.Error:
+ # Thrown when the add-on is already in openerp/addons (if _prepare_build_dir
+ # has already been called once)
+ pass
def build_tgz(o):
system(['python2', 'setup.py', 'sdist', '--quiet', '--formats=gztar,zip'], o.build_dir)