[MERGE] forward port of branch 7.0 up to 5042d91
This commit is contained in:
commit
59d82e6fe7
|
@ -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):
|
||||
|
|
|
@ -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']),
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue