[IMP] account: improve display name of cancelled journal entries

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/odoo#70764

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
This commit is contained in:
Habib (ayh)
2021-05-17 13:14:16 +00:00
parent 4f437d119e
commit 6454de7af4
+8 -7
View File
@@ -2178,9 +2178,9 @@ class AccountMove(models.Model):
: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'),
@@ -2189,11 +2189,12 @@ class AccountMove(models.Model):
'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.