summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/account/models/account_journal_dashboard.py8
-rw-r--r--addons/calendar/models/calendar.py4
-rw-r--r--addons/product/models/product_pricelist.py2
-rw-r--r--odoo/models.py2
4 files changed, 8 insertions, 8 deletions
diff --git a/addons/account/models/account_journal_dashboard.py b/addons/account/models/account_journal_dashboard.py
index 6a0d4ffbba2..b753323ac43 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/calendar/models/calendar.py b/addons/calendar/models/calendar.py
index c03e0df8856..8db6909b847 100644
--- a/addons/calendar/models/calendar.py
+++ b/addons/calendar/models/calendar.py
@@ -1199,11 +1199,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/product/models/product_pricelist.py b/addons/product/models/product_pricelist.py
index 45cc87d17ae..c4dc828b540 100644
--- a/addons/product/models/product_pricelist.py
+++ b/addons/product/models/product_pricelist.py
@@ -44,7 +44,7 @@ class Pricelist(models.Model):
if name and operator == '=' and not args:
# search on the name of the pricelist and its currency, opposite of name_get(),
# Used by the magic context filter in the product search view.
- query_args = {'name': name, 'limit': limit, 'lang': self._context.get('lang', 'en_US')}
+ query_args = {'name': name, 'limit': limit, 'lang': self._context.get('lang') or 'en_US'}
query = """SELECT p.id
FROM ((
SELECT pr.id, pr.name
diff --git a/odoo/models.py b/odoo/models.py
index ca920c0ccf4..4c8dc9c6630 100644
--- a/odoo/models.py
+++ b/odoo/models.py
@@ -1846,7 +1846,7 @@ class BaseModel(object):
if ftype == 'many2one':
value = value[0]
elif ftype in ('date', 'datetime'):
- locale = self._context.get('lang', 'en_US')
+ locale = self._context.get('lang') or 'en_US'
fmt = DEFAULT_SERVER_DATETIME_FORMAT if ftype == 'datetime' else DEFAULT_SERVER_DATE_FORMAT
tzinfo = None
range_start = value