[FIX] account: fix cutoff percent display

Before this commit : When using the cutoff option (e.g. on journal
entries), the percentage in the wizard is displayed with 6 digits precision

After this commit : The percentage is displayed using only 2 digits precision

opw-2896143

closes odoo/odoo#96876

X-original-commit: d71e46dc8369b4d4c929321277a104f6db3fa7a8
Signed-off-by: Laurent Smet <las@odoo.com>
This commit is contained in:
smdc-odoo
2022-07-29 15:53:21 +02:00
parent be3163e608
commit 81720212e8
@@ -225,7 +225,7 @@ class AutomaticEntryWizard(models.TransientModel):
'currency_id': self.journal_id.currency_id.id or self.journal_id.company_id.currency_id.id,
'move_type': 'entry',
'line_ids': [],
'ref': self._format_strings(_('Adjusting Entry of {date} ({percent:f}% recognized on {new_date})'), grouped_lines[0].move_id, amount),
'ref': self._format_strings(_('Adjusting Entry of {date} ({percent:.2f}% recognized on {new_date})'), grouped_lines[0].move_id, amount),
'date': fields.Date.to_string(date),
'journal_id': self.journal_id.id,
}
@@ -347,12 +347,12 @@ class AutomaticEntryWizard(models.TransientModel):
accrual_move_offsets[accrual_move] += 2
(accrual_move_lines + destination_move_lines).reconcile()
move.message_post(body=self._format_strings(_('Adjusting Entries have been created for this invoice:<ul><li>%(link1)s cancelling '
'{percent:f}%% of {amount}</li><li>%(link0)s postponing it to {new_date}</li></ul>',
'{percent:.2f}%% of {amount}</li><li>%(link0)s postponing it to {new_date}</li></ul>',
link0=self._format_move_link(destination_move),
link1=self._format_move_link(accrual_move),
), move, amount))
destination_messages += [self._format_strings(_('Adjusting Entry {link}: {percent:f}% of {amount} recognized from {date}'), move, amount)]
accrual_move_messages[accrual_move] += [self._format_strings(_('Adjusting Entry for {link}: {percent:f}% of {amount} recognized on {new_date}'), move, amount)]
destination_messages += [self._format_strings(_('Adjusting Entry {link}: {percent:.2f}% of {amount} recognized from {date}'), move, amount)]
accrual_move_messages[accrual_move] += [self._format_strings(_('Adjusting Entry for {link}: {percent:.2f}% of {amount} recognized on {new_date}'), move, amount)]
destination_move.message_post(body='<br/>\n'.join(destination_messages))
for accrual_move, messages in accrual_move_messages.items():