[MERGE] forward port of branch 8.0 up to 3e03cfe

This commit is contained in:
Denis Ledoux
2015-11-24 16:51:45 +01:00
6 changed files with 25 additions and 9 deletions
+3 -2
View File
@@ -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):
+4 -3
View File
@@ -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'):
+13
View File
@@ -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
+1
View File
@@ -405,6 +405,7 @@
<field name="project_id" domain="[('state','not in', ('close', 'cancelled'))]" on_change="onchange_project(project_id)" context="{'default_use_tasks':1}"/>
<field name="user_id"
options='{"no_open": True}'
on_change="onchange_user_id(user_id, context)"
context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'project.group_project_user']}"/>
<field name="planned_hours" widget="float_time"
groups="project.group_time_work_estimation_tasks"
+3 -3
View File
@@ -319,7 +319,7 @@ class project_issue(osv.Model):
context = dict(context or {})
if vals.get('project_id') and not context.get('default_project_id'):
context['default_project_id'] = vals.get('project_id')
if vals.get('user_id'):
if vals.get('user_id') and not vals.get('date_open'):
vals['date_open'] = fields.datetime.now()
if 'stage_id' in vals:
vals.update(self.onchange_stage_id(cr, uid, None, vals.get('stage_id'), context=context)['value'])
@@ -335,8 +335,8 @@ class project_issue(osv.Model):
vals['date_last_stage_update'] = fields.datetime.now()
if 'kanban_state' not in vals:
vals['kanban_state'] = 'normal'
# user_id change: update date_start
if vals.get('user_id'):
# user_id change: update date_open
if vals.get('user_id') and 'date_open' not in vals:
vals['date_open'] = fields.datetime.now()
return super(project_issue, self).write(cr, uid, ids, vals, context)
@@ -74,7 +74,7 @@
</label>
</h4>
<input type="text" class="form-control url email-address url-source"
id="link-external" placeholder="http://openerp.com"/>
id="link-external" placeholder="https://www.odoo.com"/>
</li>
</ul>
<div class="form-horizontal link-style">