diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index a2d38287062..c188530a3de 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -619,7 +619,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 614da5933ee..47b5925df18 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -253,19 +253,17 @@ class mrp_bom(osv.osv): return True def _check_product(self, cr, uid, ids, context=None): - all_prod = [] boms = self.browse(cr, uid, ids, context=context) - def check_bom(boms): + def check_bom(boms, all_prod): res = True for bom in boms: if bom.product_id.id in all_prod: - res = res and False - all_prod.append(bom.product_id.id) - lines = bom.bom_lines - if lines: - res = res and check_bom([bom_id for bom_id in lines if bom_id not in boms]) + return False + if bom.bom_lines: + res = res and check_bom([b for b in bom.bom_lines if b not in boms], all_prod + [bom.product_id.id]) return res - return check_bom(boms) + return check_bom(boms, []) + _constraints = [ (_check_recursion, 'Error ! You cannot create recursive BoM.', ['parent_id']), diff --git a/openerp/addons/base/ir/ir_attachment.py b/openerp/addons/base/ir/ir_attachment.py index 0095185ce29..b78a233cf23 100644 --- a/openerp/addons/base/ir/ir_attachment.py +++ b/openerp/addons/base/ir/ir_attachment.py @@ -198,10 +198,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 789515e7574..d02818763d2 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 b6a7a722ddb..f084c5aae47 100644 --- a/openerp/addons/base/ir/ir_translation.py +++ b/openerp/addons/base/ir/ir_translation.py @@ -110,18 +110,22 @@ 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 (ti.type != 'model' OR ti.res_id = irt.res_id) " + find_expr = """ + irt.lang = ti.lang + AND irt.type = ti.type + AND irt.name = ti.name + AND (ti.type IN ('field', 'help') OR irt.src = ti.src) + AND (ti.type != 'model' 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))