[FIX] l10n_pl: name_get deprecated

Since https://github.com/odoo/odoo/commit/3c62ca1eb96d571b2b686b5caee370324c589ab4, name_get is deprecated.
We should replace it with a _compute_display_name.

Linked to runbot error 25698

closes odoo/odoo#139082

Signed-off-by: Laurent Smet (las) <las@odoo.com>
This commit is contained in:
Gauthier Wala (gawa)
2023-10-30 16:41:37 +00:00
parent 384c4e2f21
commit ffc001b4c3
+4 -6
View File
@@ -1,4 +1,4 @@
from odoo import fields, models
from odoo import api, fields, models
class TaxOffice(models.Model):
@@ -14,9 +14,7 @@ class TaxOffice(models.Model):
('code_company_uniq', 'unique (code)', 'The code of the tax office must be unique !')
]
def name_get(self):
result = []
@api.depends('name', 'code')
def _compute_display_name(self):
for tax_office in self:
name = tax_office.code + ' ' + tax_office.name
result.append((tax_office.id, name))
return result
tax_office.display_name = f'{tax_office.code} {tax_office.name}'