[MERGE] forward port of branch saas-3 up to 59d82e6

This commit is contained in:
Christophe Simonis 2015-04-07 14:06:36 +02:00
commit b5e1e14c5d
5 changed files with 23 additions and 17 deletions

View File

@ -590,7 +590,8 @@ class mail_message(osv.Model):
def _find_allowed_model_wise(self, cr, uid, doc_model, doc_dict, context=None): def _find_allowed_model_wise(self, cr, uid, doc_model, doc_dict, context=None):
doc_ids = doc_dict.keys() doc_ids = doc_dict.keys()
allowed_doc_ids = self.pool[doc_model].search(cr, uid, [('id', 'in', doc_ids)], context=context) ctx = dict(context or {}, active_test=False)
allowed_doc_ids = self.pool[doc_model].search(cr, uid, [('id', 'in', doc_ids)], context=ctx)
return set([message_id for allowed_doc_id in allowed_doc_ids for message_id in doc_dict[allowed_doc_id]]) return set([message_id for allowed_doc_id in allowed_doc_ids for message_id in doc_dict[allowed_doc_id]])
def _find_allowed_doc_ids(self, cr, uid, model_ids, context=None): def _find_allowed_doc_ids(self, cr, uid, model_ids, context=None):

View File

@ -204,6 +204,7 @@ class mrp_bom(osv.osv):
} }
_order = "sequence" _order = "sequence"
def _bom_find(self, cr, uid, product_tmpl_id=None, product_id=None, properties=None, context=None): def _bom_find(self, cr, uid, product_tmpl_id=None, product_id=None, properties=None, context=None):
""" Finds BoM for particular product and product uom. """ Finds BoM for particular product and product uom.
@param product_tmpl_id: Selected product. @param product_tmpl_id: Selected product.

View File

@ -231,9 +231,10 @@ class ir_attachment(osv.osv):
if ids: if ids:
if isinstance(ids, (int, long)): if isinstance(ids, (int, long)):
ids = [ids] ids = [ids]
cr.execute('SELECT DISTINCT res_model, res_id FROM ir_attachment WHERE id = ANY (%s)', (ids,)) cr.execute('SELECT DISTINCT res_model, res_id, create_uid FROM ir_attachment WHERE id = ANY (%s)', (ids,))
for rmod, rid in cr.fetchall(): for rmod, rid, create_uid in cr.fetchall():
if not (rmod and rid): if not (rmod and rid):
if create_uid != uid:
require_employee = True require_employee = True
continue continue
res_ids.setdefault(rmod,set()).add(rid) res_ids.setdefault(rmod,set()).add(rid)

View File

@ -377,10 +377,10 @@ class ir_mail_server(osv.osv):
''' '''
get_param = self.pool['ir.config_parameter'].get_param get_param = self.pool['ir.config_parameter'].get_param
postmaster = get_param(cr, uid, 'mail.bounce.alias', postmaster = get_param(cr, SUPERUSER_ID, 'mail.bounce.alias',
default='postmaster-odoo', default='postmaster-odoo',
context=context,) context=context,)
domain = get_param(cr, uid, 'mail.catchall.domain', context=context) domain = get_param(cr, SUPERUSER_ID, 'mail.catchall.domain', context=context)
if postmaster and domain: if postmaster and domain:
return '%s@%s' % (postmaster, domain) return '%s@%s' % (postmaster, domain)

View File

@ -118,22 +118,25 @@ class ir_translation_import_cursor(object):
# Records w/o res_id must _not_ be inserted into our db, because they are # Records w/o res_id must _not_ be inserted into our db, because they are
# referencing non-existent data. # referencing non-existent data.
cr.execute("DELETE FROM %s WHERE res_id IS NULL AND module IS NOT NULL" % \ cr.execute("DELETE FROM %s WHERE res_id IS NULL AND module IS NOT NULL" % self._table_name)
self._table_name)
find_expr = "irt.lang = ti.lang AND irt.type = ti.type " \ find_expr = """
" AND irt.name = ti.name AND irt.src = ti.src " \ irt.lang = ti.lang
" AND irt.module = ti.module " \ AND irt.type = ti.type
" AND ( " \ AND irt.module = ti.module
" (ti.type NOT IN ('model', 'view')) " \ AND irt.name = ti.name
" OR (ti.type = 'model' AND ti.res_id = irt.res_id) " \ AND (ti.type IN ('field', 'help') OR irt.src = ti.src)
" OR (ti.type = 'view' AND irt.res_id IS NULL) " \ AND ( ti.type NOT IN ('model', 'view')
" OR (ti.type = 'view' AND irt.res_id IS NOT NULL AND ti.res_id = irt.res_id)) " OR (ti.type = 'model' AND ti.res_id = irt.res_id)
OR (ti.type = 'view' AND (irt.res_id IS NULL OR ti.res_id = irt.res_id))
)
"""
# Step 2: update existing (matching) translations # Step 2: update existing (matching) translations
if self._overwrite: if self._overwrite:
cr.execute("""UPDATE ONLY %s AS irt cr.execute("""UPDATE ONLY %s AS irt
SET value = ti.value, SET value = ti.value,
src = ti.src,
state = 'translated' state = 'translated'
FROM %s AS ti FROM %s AS ti
WHERE %s AND ti.value IS NOT NULL AND ti.value != '' WHERE %s AND ti.value IS NOT NULL AND ti.value != ''