diff --git a/product_esc_code/README.rst b/product_alternative_code/README.rst similarity index 75% rename from product_esc_code/README.rst rename to product_alternative_code/README.rst index f7770ea7..54f7ce39 100644 --- a/product_esc_code/README.rst +++ b/product_alternative_code/README.rst @@ -1,6 +1,6 @@ -================ -Product ESC Code -================ +======================== +Product Alternative Code +======================== .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! @@ -14,13 +14,14 @@ Product ESC Code :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-qrtl%2Faxls--custom-lightgray.png?logo=github - :target: https://github.com/qrtl/axls-custom/tree/16.0/product_esc_code + :target: https://github.com/qrtl/axls-custom/tree/16.0/product_alternative_code :alt: qrtl/axls-custom |badge1| |badge2| |badge3| This module does the following: -- Give the product an ESC code so that it can be searched by ESC code. + +* Adds the alternative code field to the product, which should be part of the product display name presentation and can also be used in product search. **Table of contents** @@ -33,7 +34,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -48,6 +49,6 @@ Authors Maintainers ~~~~~~~~~~~ -This module is part of the `qrtl/axls-custom `_ project on GitHub. +This module is part of the `qrtl/axls-custom `_ project on GitHub. You are welcome to contribute. diff --git a/product_esc_code/__init__.py b/product_alternative_code/__init__.py similarity index 100% rename from product_esc_code/__init__.py rename to product_alternative_code/__init__.py diff --git a/product_esc_code/__manifest__.py b/product_alternative_code/__manifest__.py similarity index 90% rename from product_esc_code/__manifest__.py rename to product_alternative_code/__manifest__.py index 33b61073..3ccd9a62 100644 --- a/product_esc_code/__manifest__.py +++ b/product_alternative_code/__manifest__.py @@ -1,7 +1,7 @@ # Copyright 2022 Quartile Limited # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). { - "name": "Product ESC Code", + "name": "Product Alternative Code", "version": "16.0.1.0.0", "author": "Quartile Limited", "website": "https://www.quartile.co", diff --git a/product_alternative_code/i18n/ja.po b/product_alternative_code/i18n/ja.po new file mode 100644 index 00000000..9b87df20 --- /dev/null +++ b/product_alternative_code/i18n/ja.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * product_alternative_code +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-12-28 08:47+0000\n" +"PO-Revision-Date: 2022-12-28 08:47+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_alternative_code +#: model:ir.model.fields,field_description:product_alternative_code.field_product_product__alt_code +#: model:ir.model.fields,field_description:product_alternative_code.field_product_template__alt_code +msgid "Alternative Code" +msgstr "オルタナティブコード" + +#. module: product_alternative_code +#: model:ir.model.fields,help:product_alternative_code.field_product_product__alt_code +#: model:ir.model.fields,help:product_alternative_code.field_product_template__alt_code +msgid "Alternative product code." +msgstr "別のプロダクトコード" + +#. module: product_alternative_code +#: model:ir.model,name:product_alternative_code.model_product_template +msgid "Product" +msgstr "プロダクト" + +#. module: product_alternative_code +#: model:ir.model,name:product_alternative_code.model_product_product +msgid "Product Variant" +msgstr "プロダクトバリアント" diff --git a/product_esc_code/models/__init__.py b/product_alternative_code/models/__init__.py similarity index 100% rename from product_esc_code/models/__init__.py rename to product_alternative_code/models/__init__.py diff --git a/product_esc_code/models/product_product.py b/product_alternative_code/models/product_product.py similarity index 80% rename from product_esc_code/models/product_product.py rename to product_alternative_code/models/product_product.py index 58add8b1..8d8adbdf 100644 --- a/product_esc_code/models/product_product.py +++ b/product_alternative_code/models/product_product.py @@ -1,30 +1,28 @@ # Copyright 2022 Quartile Limited # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -from odoo import api, fields, models +from odoo import api, models class ProductProduct(models.Model): _inherit = "product.product" - esc_code = fields.Char(related="product_tmpl_id.esc_code") - def name_get(self): res = super().name_get() name_list = [] for rec in res: product = self.browse(rec[0]) - esc_code = product.esc_code - if not esc_code: + alt_code = product.alt_code + if not alt_code: name_list.append(rec) continue name = rec[1] if not product.default_code: - name = "[" + esc_code + "] " + name + name = "[" + alt_code + "] " + name name_list.append((rec[0], name)) continue pos = name.find("]") - name = name[:pos] + "/" + esc_code + name[pos:] + name = name[:pos] + "/" + alt_code + name[pos:] name_list.append((rec[0], name)) return name_list @@ -38,7 +36,7 @@ def _name_search( "|", "|", ("name", operator, name), - ("esc_code", operator, name), + ("alt_code", operator, name), ("default_code", operator, name), ] product_ids = self._search(args, limit=limit, access_rights_uid=name_get_uid) diff --git a/product_esc_code/models/product_template.py b/product_alternative_code/models/product_template.py similarity index 71% rename from product_esc_code/models/product_template.py rename to product_alternative_code/models/product_template.py index 28ad0869..ed9435d7 100644 --- a/product_esc_code/models/product_template.py +++ b/product_alternative_code/models/product_template.py @@ -7,4 +7,4 @@ class ProductTemplate(models.Model): _inherit = "product.template" - esc_code = fields.Char() + alt_code = fields.Char("Alternative Code", help="Alternative product code.") diff --git a/product_alternative_code/readme/DESCRIPTION.rst b/product_alternative_code/readme/DESCRIPTION.rst new file mode 100644 index 00000000..6f9d69f4 --- /dev/null +++ b/product_alternative_code/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module does the following: + +* Adds the alternative code field to the product, which should be part of the product display name presentation and can also be used in product search. diff --git a/product_esc_code/static/description/index.html b/product_alternative_code/static/description/index.html similarity index 92% rename from product_esc_code/static/description/index.html rename to product_alternative_code/static/description/index.html index c1384b8b..53263ef8 100644 --- a/product_esc_code/static/description/index.html +++ b/product_alternative_code/static/description/index.html @@ -4,7 +4,7 @@ -Product ESC Code +Product Alternative Code -
-

Product ESC Code

+
+

Product Alternative Code

-

Beta License: LGPL-3 qrtl/axls-custom

-

This module does the following: -- Give the product an ESC code so that it can be searched by ESC code.

+

Beta License: LGPL-3 qrtl/axls-custom

+

This module does the following:

+
    +
  • Adds the alternative code field to the product, which should be part of the product display name presentation and can also be used in product search.
  • +

Table of contents

    @@ -386,7 +388,7 @@

    Bug Tracker

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

@@ -399,7 +401,7 @@

Authors

Maintainers

-

This module is part of the qrtl/axls-custom project on GitHub.

+

This module is part of the qrtl/axls-custom project on GitHub.

You are welcome to contribute.

diff --git a/product_esc_code/views/product_template_views.xml b/product_alternative_code/views/product_template_views.xml similarity index 90% rename from product_esc_code/views/product_template_views.xml rename to product_alternative_code/views/product_template_views.xml index a7ca77e3..2a955ec5 100644 --- a/product_esc_code/views/product_template_views.xml +++ b/product_alternative_code/views/product_template_views.xml @@ -6,7 +6,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/product_esc_code/i18n/ja.po b/product_esc_code/i18n/ja.po deleted file mode 100644 index e69de29b..00000000 diff --git a/product_esc_code/readme/DESCRIPTION.rst b/product_esc_code/readme/DESCRIPTION.rst deleted file mode 100644 index 7c33ab11..00000000 --- a/product_esc_code/readme/DESCRIPTION.rst +++ /dev/null @@ -1,2 +0,0 @@ -This module does the following: -- Give the product an ESC code so that it can be searched by ESC code. diff --git a/setup/product_alternative_code/odoo/addons/product_alternative_code b/setup/product_alternative_code/odoo/addons/product_alternative_code new file mode 120000 index 00000000..da73e270 --- /dev/null +++ b/setup/product_alternative_code/odoo/addons/product_alternative_code @@ -0,0 +1 @@ +../../../../product_alternative_code \ No newline at end of file diff --git a/setup/product_esc_code/setup.py b/setup/product_alternative_code/setup.py similarity index 100% rename from setup/product_esc_code/setup.py rename to setup/product_alternative_code/setup.py diff --git a/setup/product_esc_code/odoo/addons/product_esc_code b/setup/product_esc_code/odoo/addons/product_esc_code deleted file mode 120000 index 22755b92..00000000 --- a/setup/product_esc_code/odoo/addons/product_esc_code +++ /dev/null @@ -1 +0,0 @@ -../../../../product_esc_code \ No newline at end of file