[FIX] website_sale: compute the display name of new category records

task-3582238

closes odoo/odoo#141017

Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
This commit is contained in:
Antoine Vandevenne (anv)
2023-11-06 18:11:34 +00:00
parent fee70e64fc
commit df80bb297d
2 changed files with 12 additions and 3 deletions
+9 -2
View File
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 17.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-26 21:55+0000\n"
"PO-Revision-Date: 2023-10-26 21:55+0000\n"
"POT-Creation-Date: 2023-11-03 16:14+0000\n"
"PO-Revision-Date: 2023-11-03 16:14+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -2306,6 +2306,13 @@ msgstr ""
msgid "Name Short"
msgstr ""
#. module: website_sale
#. odoo-python
#: code:addons/website_sale/models/product_public_category.py:0
#, python-format
msgid "New"
msgstr ""
#. module: website_sale
#: model:ir.actions.act_window,name:website_sale.product_product_action_add
msgid "New Product"
@@ -40,7 +40,9 @@ class ProductPublicCategory(models.Model):
@api.depends('parents_and_self')
def _compute_display_name(self):
for category in self:
category.display_name = " / ".join(category.parents_and_self.mapped('name'))
category.display_name = " / ".join(category.parents_and_self.mapped(
lambda cat: cat.name or _("New")
))
def _compute_parents_and_self(self):
for category in self: