[FIX] account_asset: fix move display name

Steps to reproduce:
- Install Accounting App.
- Go to the Accounting App.
- Click on 'Accounting' -> 'Assets'.
- Create a new asset and confirm it.
- Click on 'Modify Depreciation'.
- Select the 'Sell' action.
- Click on the empty 'Customer Invoice' field.

Observed behavior:
The invoices are listed based on their name, which is not very explicit/helpful.

Desired behavior:
In addition to the name, the partner and the date are also displayed in the list.

The search is also improved, in order to use the partner name
(in addition to the invoice name) to filter invoices.

closes odoo/odoo#103696

X-original-commit: 4075c4512cfb44cc3add8270b373f3a4e1e80419
Related: odoo/enterprise#33026
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: John Laterre (jol) <jol@odoo.com>
This commit is contained in:
John Laterre (jol)
2022-10-20 20:21:43 +02:00
parent da9b81f28d
commit d3264389c9
+6
View File
@@ -53,6 +53,7 @@ class AccountMove(models.Model):
_mail_post_access = 'read'
_check_company_auto = True
_sequence_index = "journal_id"
_rec_names_search = ['name', 'partner_id.name', 'ref']
@property
def _sequence_monthly_regex(self):
@@ -3060,6 +3061,11 @@ class AccountMove(models.Model):
name += '(* %s)' % str(self.id)
else:
name += self.name
if self.env.context.get('input_full_display_name'):
if self.partner_id:
name += f', {self.partner_id.name}'
if self.date:
name += f', {format_date(self.env, self.date)}'
return name + (f" ({shorten(self.ref, width=50)})" if show_ref and self.ref else '')
def _get_reconciled_amls(self):