From ffc001b4c312dbd901aee809cb2db91be78df554 Mon Sep 17 00:00:00 2001 From: "Gauthier Wala (gawa)" Date: Tue, 17 Oct 2023 16:06:16 +0200 Subject: [PATCH] [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) --- addons/l10n_pl/models/l10n_pl_tax_office.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/l10n_pl/models/l10n_pl_tax_office.py b/addons/l10n_pl/models/l10n_pl_tax_office.py index 78b49222987..94d754dcd4b 100644 --- a/addons/l10n_pl/models/l10n_pl_tax_office.py +++ b/addons/l10n_pl/models/l10n_pl_tax_office.py @@ -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}'