Skip to content

Commit

Permalink
[IMP] account: improve display name of cancelled journal entries
Browse files Browse the repository at this point in the history
The display name of cancelled entries is "/"
This provides no information to the user - especially when the duplication message is logged.

This aims to improve the display_name of account.move so draft and cancelled entries display the id as a reference

closes odoo#70764

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
  • Loading branch information
h4818 committed May 17, 2021
1 parent 4f437d1 commit 6454de7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions addons/account/models/account_move.py
Expand Up @@ -2178,9 +2178,9 @@ def _get_move_display_name(self, show_ref=False):
:return: A string representing the invoice.
'''
self.ensure_one()
draft_name = ''
name = ''
if self.state == 'draft':
draft_name += {
name += {
'out_invoice': _('Draft Invoice'),
'out_refund': _('Draft Credit Note'),
'in_invoice': _('Draft Bill'),
Expand All @@ -2189,11 +2189,12 @@ def _get_move_display_name(self, show_ref=False):
'in_receipt': _('Draft Purchase Receipt'),
'entry': _('Draft Entry'),
}[self.move_type]
if not self.name or self.name == '/':
draft_name += ' (* %s)' % str(self.id)
else:
draft_name += ' ' + self.name
return (draft_name or self.name) + (show_ref and self.ref and ' (%s%s)' % (self.ref[:50], '...' if len(self.ref) > 50 else '') or '')
name += ' '
if not self.name or self.name == '/':
name += '(* %s)' % str(self.id)
else:
name += self.name
return name + (show_ref and self.ref and ' (%s%s)' % (self.ref[:50], '...' if len(self.ref) > 50 else '') or '')

def _get_invoice_delivery_partner_id(self):
''' Hook allowing to retrieve the right delivery address depending of installed modules.
Expand Down

0 comments on commit 6454de7

Please sign in to comment.