diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py
index 62a760aa017..b41dbd4a384 100644
--- a/addons/account/models/account_journal_dashboard.py
+++ b/addons/account/models/account_journal_dashboard.py
@@ -56,7 +56,7 @@ class account_journal(models.Model):
last_bank_stmt = self.env['account.bank.statement'].search([('journal_id', 'in', self.ids),('date', '<=', last_month.strftime(DF))], order="date desc, id desc", limit=1)
start_balance = last_bank_stmt and last_bank_stmt[0].balance_end or 0
- locale = self._context.get('lang', 'en_US')
+ locale = self._context.get('lang') or 'en_US'
show_date = last_month
#get date in locale format
name = format_date(show_date, 'd LLLL Y', locale=locale)
@@ -94,7 +94,7 @@ class account_journal(models.Model):
data = []
today = datetime.strptime(fields.Date.context_today(self), DF)
data.append({'label': _('Past'), 'value':0.0, 'type': 'past'})
- day_of_week = int(format_datetime(today, 'e', locale=self._context.get('lang', 'en_US')))
+ day_of_week = int(format_datetime(today, 'e', locale=self._context.get('lang') or 'en_US'))
first_day_of_week = today + timedelta(days=-day_of_week+1)
for i in range(-1,4):
if i==0:
@@ -105,9 +105,9 @@ class account_journal(models.Model):
start_week = first_day_of_week + timedelta(days=i*7)
end_week = start_week + timedelta(days=6)
if start_week.month == end_week.month:
- label = str(start_week.day) + '-' +str(end_week.day)+ ' ' + format_date(end_week, 'MMM', locale=self._context.get('lang', 'en_US'))
+ label = str(start_week.day) + '-' +str(end_week.day)+ ' ' + format_date(end_week, 'MMM', locale=self._context.get('lang') or 'en_US')
else:
- label = format_date(start_week, 'd MMM', locale=self._context.get('lang', 'en_US'))+'-'+format_date(end_week, 'd MMM', locale=self._context.get('lang', 'en_US'))
+ label = format_date(start_week, 'd MMM', locale=self._context.get('lang') or 'en_US')+'-'+format_date(end_week, 'd MMM', locale=self._context.get('lang') or 'en_US')
data.append({'label':label,'value':0.0, 'type': 'past' if i<0 else 'future'})
# Build SQL query to find amount aggregated by week
diff --git a/addons/account/report/account_overdue_report.py b/addons/account/report/account_overdue_report.py
index 0fb7529e20b..fd032197233 100644
--- a/addons/account/report/account_overdue_report.py
+++ b/addons/account/report/account_overdue_report.py
@@ -25,7 +25,7 @@ class ReportOverdue(models.AbstractModel):
"FROM account_move_line l "
"JOIN account_account_type at ON (l.user_type_id = at.id) "
"JOIN account_move m ON (l.move_id = m.id) "
- "WHERE l.partner_id IN %s AND at.type IN ('receivable', 'payable') GROUP BY l.date, l.name, l.ref, l.date_maturity, l.partner_id, at.type, l.blocked, l.amount_currency, l.currency_id, l.move_id, m.name", (((fields.date.today(), ) + (tuple(partner_ids),))))
+ "WHERE l.partner_id IN %s AND at.type IN ('receivable', 'payable') AND NOT l.reconciled GROUP BY l.date, l.name, l.ref, l.date_maturity, l.partner_id, at.type, l.blocked, l.amount_currency, l.currency_id, l.move_id, m.name", (((fields.date.today(), ) + (tuple(partner_ids),))))
for row in self.env.cr.dictfetchall():
res[row.pop('partner_id')].append(row)
return res
diff --git a/addons/account/static/src/js/account_reconciliation_widgets.js b/addons/account/static/src/js/account_reconciliation_widgets.js
index 554354b31ae..54ff55fcdcc 100644
--- a/addons/account/static/src/js/account_reconciliation_widgets.js
+++ b/addons/account/static/src/js/account_reconciliation_widgets.js
@@ -453,6 +453,8 @@ var abstractReconciliationLine = Widget.extend({
start: function() {
var self = this;
+ // fail silently if reconciliation widget is removed (eg. mode is changed)
+ var parent = this.getParent();
return self._super().then(function() {
// no animation while loading
@@ -468,8 +470,8 @@ var abstractReconciliationLine = Widget.extend({
return $.when(self.render()).then(function(){
self.is_consistent = true;
// Make an entrance
- self.animation_speed = self.getParent().animation_speed;
- self.aestetic_animation_speed = self.getParent().aestetic_animation_speed;
+ self.animation_speed = parent.animation_speed;
+ self.aestetic_animation_speed = parent.aestetic_animation_speed;
if (self.context.animate_entrance) {
return self.$el.stop(true, true).fadeIn({ duration: self.aestetic_animation_speed, queue: false }).css('display', 'none').slideDown(self.aestetic_animation_speed);
}
@@ -2268,13 +2270,19 @@ var manualReconciliation = abstractReconciliation.extend({
animate_entrance = defaultIfUndef(animate_entrance, true);
var self = this;
var displayed_collections = self.getDisplayedCollections();
+ var plural = { 'customer': 'customers', 'supplier': 'suppliers', 'account': 'others' };
self.updateProgressbar();
+ // number of reconciliation items already displayed
+ var num_child_displayed = self.getChildren().length;
+
// Remove children that should not be displayed
if (self.mode !== 'all') {
_.each(self.getChildren(), function(child) {
- if (child.data.reconciliation_type !== self.mode) {
+ var type = plural[child.data.reconciliation_type];
+ if (type !== self.mode) {
+ num_child_displayed--;
child.$el.slideUp(self.aestetic_animation_speed, function(){ child.destroy() });
child.data.displayed = false;
}
@@ -2287,7 +2295,7 @@ var manualReconciliation = abstractReconciliation.extend({
var items_to_display = _.foldl(displayed_collections, function(prev, current){ return prev.concat(current.items) }, []);
// Filter out those which are already displayed
items_to_display = _.filter(items_to_display, function(item) { return item.displayed === false; })
- .slice(0, self.num_reconciliations_fetched_in_batch - self.getChildren().length);
+ .slice(0, self.num_reconciliations_fetched_in_batch - num_child_displayed);
_.each(items_to_display, function(item){
children_promises.push(self.displayReconciliation(item, animate_entrance));
});
diff --git a/addons/calendar/models/calendar.py b/addons/calendar/models/calendar.py
index c543f5ea830..f267c3b984e 100644
--- a/addons/calendar/models/calendar.py
+++ b/addons/calendar/models/calendar.py
@@ -1211,11 +1211,11 @@ class Meeting(models.Model):
elif interval == 'month':
# Localized month name and year
- result = babel.dates.format_date(date=date, format='MMMM y', locale=self._context.get('lang', 'en_US'))
+ result = babel.dates.format_date(date=date, format='MMMM y', locale=self._context.get('lang') or 'en_US')
elif interval == 'dayname':
# Localized day name
- result = babel.dates.format_date(date=date, format='EEEE', locale=self._context.get('lang', 'en_US'))
+ result = babel.dates.format_date(date=date, format='EEEE', locale=self._context.get('lang') or 'en_US')
elif interval == 'time':
# Localized time
diff --git a/addons/crm/models/crm_team.py b/addons/crm/models/crm_team.py
index 413f6230eb2..a402a79d84b 100644
--- a/addons/crm/models/crm_team.py
+++ b/addons/crm/models/crm_team.py
@@ -93,7 +93,7 @@ class Team(models.Model):
@api.multi
def write(self, vals):
result = super(Team, self).write(vals)
- if vals.get('use_leads') or vals.get('alias_defaults'):
+ if 'use_leads' in vals or 'alias_defaults' in vals:
for team in self:
team.alias_id.write(team.get_alias_values())
return result
diff --git a/addons/crm/wizard/base_partner_merge.py b/addons/crm/wizard/base_partner_merge.py
index 18fd4c6a3e6..27f3f3e002d 100644
--- a/addons/crm/wizard/base_partner_merge.py
+++ b/addons/crm/wizard/base_partner_merge.py
@@ -489,13 +489,19 @@ class MergePartnerAutomatic(models.TransientModel):
counter = 0
for min_id, aggr_ids in self._cr.fetchall():
- # exclude partner according to options
- if model_mapping and self._partner_use_in(aggr_ids, model_mapping):
+ # To ensure that the used partners are accessible by the user
+ partners = self.env['res.partner'].search([('id', 'in', aggr_ids)])
+ if len(partners) < 2:
continue
+
+ # exclude partner according to options
+ if model_mapping and self._partner_use_in(partners.ids, model_mapping):
+ continue
+
self.env['base.partner.merge.line'].create({
'wizard_id': self.id,
'min_id': min_id,
- 'aggr_ids': aggr_ids,
+ 'aggr_ids': partners.ids,
})
counter += 1
diff --git a/addons/event/models/event.py b/addons/event/models/event.py
index 03aa47bbb27..d6892e927af 100644
--- a/addons/event/models/event.py
+++ b/addons/event/models/event.py
@@ -70,7 +70,7 @@ class EventEvent(models.Model):
'interval_unit': 'days',
'interval_type': 'before_event',
'template_id': self.env.ref('event.event_reminder')
- })] if self.user_has_groups('event.group_email_scheduling') else []
+ })]
# Seats and computation
seats_max = fields.Integer(
diff --git a/addons/hr_maintenance/views/maintenance_views.xml b/addons/hr_maintenance/views/maintenance_views.xml
index 2c56a9f2538..72970f9cd77 100644
--- a/addons/hr_maintenance/views/maintenance_views.xml
+++ b/addons/hr_maintenance/views/maintenance_views.xml
@@ -54,6 +54,20 @@
+