-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] product_trim_name: Product trim name.
- Loading branch information
1 parent
abc61ad
commit 9170928
Showing
7 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
================= | ||
Product Trim Name | ||
================= | ||
|
||
Product name without spaces for importers' research. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/avanzosc/odoo-addons/issues>`_. In case of trouble, | ||
please check there if your issue has already been reported. If you spotted | ||
it first, help us smash it by providing detailed and welcomed feedback. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Berezi Amubieta <[email protected]> | ||
* Ana Juaristi <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2023 Berezi Amubieta - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
"name": "Product Trim Name", | ||
"version": "16.0.1.0.0", | ||
"category": "Hidden/Tools", | ||
"license": "AGPL-3", | ||
"author": "AvanzOSC", | ||
"website": "https://github.com/avanzosc/odoo-addons", | ||
"depends": [ | ||
"product", | ||
], | ||
"data": [], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * product_trim_name | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-03-23 08:32+0000\n" | ||
"PO-Revision-Date: 2023-03-23 08:32+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: product_trim_name | ||
#: model:ir.model.fields,field_description:product_trim_name.field_product_template__display_name | ||
msgid "Display Name" | ||
msgstr "Nombre mostrado" | ||
|
||
#. module: product_trim_name | ||
#: model:ir.model.fields,field_description:product_trim_name.field_product_template__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: product_trim_name | ||
#: model:ir.model.fields,field_description:product_trim_name.field_product_template____last_update | ||
msgid "Last Modified on" | ||
msgstr "Última modificación el" | ||
|
||
#. module: product_trim_name | ||
#: model:ir.model,name:product_trim_name.model_product_template | ||
msgid "Product Template" | ||
msgstr "Plantilla de producto" | ||
|
||
#. module: product_trim_name | ||
#: model:ir.model.fields,field_description:product_trim_name.field_product_product__trim_name | ||
#: model:ir.model.fields,field_description:product_trim_name.field_product_template__trim_name | ||
msgid "Trim Name" | ||
msgstr "Nombre sin espacios" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * product_trim_name | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-03-23 08:32+0000\n" | ||
"PO-Revision-Date: 2023-03-23 08:32+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: product_trim_name | ||
#: model:ir.model.fields,field_description:product_trim_name.field_product_template__display_name | ||
msgid "Display Name" | ||
msgstr "" | ||
|
||
#. module: product_trim_name | ||
#: model:ir.model.fields,field_description:product_trim_name.field_product_template__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: product_trim_name | ||
#: model:ir.model.fields,field_description:product_trim_name.field_product_template____last_update | ||
msgid "Last Modified on" | ||
msgstr "" | ||
|
||
#. module: product_trim_name | ||
#: model:ir.model,name:product_trim_name.model_product_template | ||
msgid "Product Template" | ||
msgstr "" | ||
|
||
#. module: product_trim_name | ||
#: model:ir.model.fields,field_description:product_trim_name.field_product_product__trim_name | ||
#: model:ir.model.fields,field_description:product_trim_name.field_product_template__trim_name | ||
msgid "Trim Name" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import product_template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2023 Berezi Amubieta - AvanzOSC | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
import unicodedata | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = "product.template" | ||
|
||
trim_name = fields.Char(compute="_compute_trim_name", store=True) | ||
|
||
@api.depends("name") | ||
def _compute_trim_name(self): | ||
for product in self: | ||
trim_name = product.name.replace(" ", "") | ||
trim_name = "".join( | ||
c | ||
for c in unicodedata.normalize("NFD", trim_name) | ||
if unicodedata.category(c) != "Mn" | ||
) | ||
product.trim_name = trim_name |