diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 7cf00f50390..9f6cedd9102 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -542,8 +542,9 @@ class account_bank_statement_line(osv.osv): ('reconcile_id', '=', False), ('state', '=', 'valid'), ('account_id.reconcile', '=', True), - ('id', 'not in', excluded_ids), - ('partner_id', 'in', (False, st_line.partner_id.id))] + ('id', 'not in', excluded_ids),] + if st_line.partner_id: + domain.append(('partner_id', '=', st_line.partner_id.id)) return domain def get_reconciliation_proposition(self, cr, uid, st_line, excluded_ids=None, context=None): diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 6bc84b1cce2..c08bb75df8f 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -354,7 +354,7 @@ class hr_holidays(osv.osv): """ Override to avoid automatic logging of creation """ if context is None: context = {} - context = dict(context, mail_create_nolog=True) + context = dict(context, mail_create_nolog=True, mail_create_nosubscribe=True) if values.get('state') and values['state'] not in ['draft', 'confirm', 'cancel'] and not self.pool['res.users'].has_group(cr, uid, 'base.group_hr_user'): raise AccessError(_('You cannot set a leave request as \'%s\'. Contact a human resource manager.') % values.get('state')) return super(hr_holidays, self).create(cr, uid, values, context=context) @@ -421,7 +421,8 @@ class hr_holidays(osv.osv): elif record.holiday_type == 'category': emp_ids = obj_emp.search(cr, uid, [('category_ids', 'child_of', [record.category_id.id])]) leave_ids = [] - for emp in obj_emp.browse(cr, uid, emp_ids): + batch_context = dict(context, mail_notify_force_send=False) + for emp in obj_emp.browse(cr, uid, emp_ids, context=context): vals = { 'name': record.name, 'type': record.type, @@ -434,7 +435,7 @@ class hr_holidays(osv.osv): 'parent_id': record.id, 'employee_id': emp.id } - leave_ids.append(self.create(cr, uid, vals, context=None)) + leave_ids.append(self.create(cr, uid, vals, context=batch_context)) for leave_id in leave_ids: # TODO is it necessary to interleave the calls? for sig in ('confirm', 'validate', 'second_validate'): diff --git a/addons/mail/ir_actions.py b/addons/mail/ir_actions.py index 381d9c2b79d..4da175d970d 100644 --- a/addons/mail/ir_actions.py +++ b/addons/mail/ir_actions.py @@ -78,3 +78,16 @@ class actions_server(osv.Model): self.pool['mail.template'].send_mail(cr, uid, action.template_id.id, context.get('active_id'), force_send=False, raise_exception=False, context=context) return False + + def _get_eval_context(self, cr, uid, action, context=None): + """ Override the method giving the evaluation context but also the + context used in all subsequent calls. Add the mail_notify_force_send + key set to False in the context. This way all notification emails linked + to the currently executed action will be set in the queue instead of + sent directly. This will avoid possible break in transactions. """ + eval_context = super(actions_server, self)._get_eval_context(cr, uid, action, context=context) + # re-dictify, because eval_context['context'] is a frozendict + ctx = dict(eval_context.get('context', {})) + ctx['mail_notify_force_send'] = False + eval_context['context'] = ctx + return eval_context diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 57a842e9ffd..5e0466f9993 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -405,6 +405,7 @@ + id="link-external" placeholder="https://www.odoo.com"/>