Fix date formatting in Partner Ledger report to use locale settings

The _lines() method fetched the language date_format but never applied
it (line was a no-op: r['date'] = r['date']). Now formats dates using
strftime with the user's locale format (e.g. dd.mm.yyyy for bs_BA).
Also added widget='date' to header date_from/date_to fields.

🤖 assisted by claude
This commit is contained in:
Ernad Husremovic 2026-02-09 09:24:08 +01:00
parent 6be693d7af
commit 652a582f8d
3 changed files with 4 additions and 4 deletions

View file

@ -2,7 +2,7 @@
{
'name': 'Odoo 16 Accounting Financial Reports',
'version': '16.0.2.0.5',
'version': '16.0.2.0.6',
'category': 'Invoicing Management',
'description': 'Accounting Reports For Odoo 16, Accounting Financial Reports, '
'Odoo 16 Financial Reports',

View file

@ -34,7 +34,7 @@ class ReportPartnerLedger(models.AbstractModel):
lang_id = lang._lang_get(lang_code)
date_format = lang_id.date_format
for r in res:
r['date'] = r['date']
r['date'] = r['date'].strftime(date_format)
r['displayed_name'] = '-'.join(
r[field_name] for field_name in ('move_name', 'ref', 'name')
if r[field_name] not in (None, '', '/')

View file

@ -17,12 +17,12 @@
<div class="col-3">
<t t-if="data['form']['date_from']">
<strong>Date from :</strong>
<span t-esc="data['form']['date_from']"/>
<span t-esc="data['form']['date_from']" t-options="{'widget': 'date'}"/>
<br/>
</t>
<t t-if="data['form']['date_to']">
<strong>Date to :</strong>
<span t-esc="data['form']['date_to']"/>
<span t-esc="data['form']['date_to']" t-options="{'widget': 'date'}"/>
</t>
</div>
<div class="col-3">