diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 455dae7dac7..2b3c4260b99 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -590,7 +590,8 @@ class mail_message(osv.Model): def _find_allowed_model_wise(self, cr, uid, doc_model, doc_dict, context=None): 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]]) def _find_allowed_doc_ids(self, cr, uid, model_ids, context=None): diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 3d933fc0dbf..e85846603e4 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -204,6 +204,7 @@ class mrp_bom(osv.osv): } _order = "sequence" + 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. @param product_tmpl_id: Selected product. diff --git a/openerp/addons/base/ir/ir_attachment.py b/openerp/addons/base/ir/ir_attachment.py index 13d788799dc..a4927931d08 100644 --- a/openerp/addons/base/ir/ir_attachment.py +++ b/openerp/addons/base/ir/ir_attachment.py @@ -231,10 +231,11 @@ class ir_attachment(osv.osv): if ids: if isinstance(ids, (int, long)): ids = [ids] - cr.execute('SELECT DISTINCT res_model, res_id FROM ir_attachment WHERE id = ANY (%s)', (ids,)) - for rmod, rid in cr.fetchall(): + cr.execute('SELECT DISTINCT res_model, res_id, create_uid FROM ir_attachment WHERE id = ANY (%s)', (ids,)) + for rmod, rid, create_uid in cr.fetchall(): if not (rmod and rid): - require_employee = True + if create_uid != uid: + require_employee = True continue res_ids.setdefault(rmod,set()).add(rid) if values: diff --git a/openerp/addons/base/ir/ir_mail_server.py b/openerp/addons/base/ir/ir_mail_server.py index d16d652bdab..81c8ab7f799 100644 --- a/openerp/addons/base/ir/ir_mail_server.py +++ b/openerp/addons/base/ir/ir_mail_server.py @@ -377,10 +377,10 @@ class ir_mail_server(osv.osv): ''' 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', 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: return '%s@%s' % (postmaster, domain) diff --git a/openerp/addons/base/ir/ir_translation.py b/openerp/addons/base/ir/ir_translation.py index ac00fb34f5c..d2e5ce7a98e 100644 --- a/openerp/addons/base/ir/ir_translation.py +++ b/openerp/addons/base/ir/ir_translation.py @@ -118,23 +118,26 @@ class ir_translation_import_cursor(object): # Records w/o res_id must _not_ be inserted into our db, because they are # referencing non-existent data. - cr.execute("DELETE FROM %s WHERE res_id IS NULL AND module IS NOT NULL" % \ - self._table_name) + cr.execute("DELETE FROM %s WHERE res_id IS NULL AND module IS NOT NULL" % self._table_name) - find_expr = "irt.lang = ti.lang AND irt.type = ti.type " \ - " AND irt.name = ti.name AND irt.src = ti.src " \ - " AND irt.module = ti.module " \ - " AND ( " \ - " (ti.type NOT IN ('model', 'view')) " \ - " OR (ti.type = 'model' AND ti.res_id = irt.res_id) " \ - " OR (ti.type = 'view' AND irt.res_id IS NULL) " \ - " OR (ti.type = 'view' AND irt.res_id IS NOT NULL AND ti.res_id = irt.res_id)) " + find_expr = """ + irt.lang = ti.lang + AND irt.type = ti.type + AND irt.module = ti.module + AND irt.name = ti.name + AND (ti.type IN ('field', 'help') OR irt.src = ti.src) + AND ( ti.type NOT IN ('model', 'view') + 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 if self._overwrite: cr.execute("""UPDATE ONLY %s AS irt SET value = ti.value, - state = 'translated' + src = ti.src, + state = 'translated' FROM %s AS ti WHERE %s AND ti.value IS NOT NULL AND ti.value != '' """ % (self._parent_table, self._table_name, find_expr))