[FIX] account: Maturity date in reconciliation widget

Steps to reproduce the bug:

- Change the date format of your current lang
- Reconcile a statement

Bug:

The maturity date displayed in the widget didn't use the format of your
current lang.

opw:2068241

closes odoo/odoo#36944

X-original-commit: d2ad3d6542bfe1c900720148f22abe4b507e2a41
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
Goffin Simon
2019-09-16 12:36:24 +00:00
committed by fw-bot
parent 61459511aa
commit df28690c04
@@ -4,6 +4,7 @@ from odoo import api, fields, models, _
from odoo.exceptions import UserError
from odoo.osv import expression
from odoo.tools.misc import formatLang
from odoo.tools import misc
class AccountReconciliation(models.AbstractModel):
@@ -585,6 +586,8 @@ class AccountReconciliation(models.AbstractModel):
for line in move_lines:
company_currency = line.company_id.currency_id
line_currency = (line.currency_id and line.amount_currency) and line.currency_id or company_currency
date_maturity = misc.format_date(self.env, line.date_maturity, lang_code=self.env.user.lang)
ret_line = {
'id': line.id,
'name': line.name and line.name != '/' and line.move_id.name + ': ' + line.name or line.move_id.name,
@@ -596,7 +599,7 @@ class AccountReconciliation(models.AbstractModel):
'account_code': line.account_id.code,
'account_name': line.account_id.name,
'account_type': line.account_id.internal_type,
'date_maturity': line.date_maturity,
'date_maturity': date_maturity,
'date': line.date,
'journal_id': [line.journal_id.id, line.journal_id.display_name],
'partner_id': line.partner_id.id,
@@ -686,13 +689,14 @@ class AccountReconciliation(models.AbstractModel):
amount_currency = amount
amount_currency_str = ""
amount_str = formatLang(self.env, abs(amount), currency_obj=st_line.currency_id or statement_currency)
date = misc.format_date(self.env, st_line.date, lang_code=self.env.user.lang)
data = {
'id': st_line.id,
'ref': st_line.ref,
'note': st_line.note or "",
'name': st_line.name,
'date': st_line.date,
'date': date,
'amount': amount,
'amount_str': amount_str, # Amount in the statement line currency
'currency_id': st_line.currency_id.id or statement_currency.id,