diff --git a/pos_supplierinfo_search/README.rst b/pos_supplierinfo_search/README.rst new file mode 100644 index 0000000000..bcb8adaa56 --- /dev/null +++ b/pos_supplierinfo_search/README.rst @@ -0,0 +1,100 @@ +=========================================== +Point of sale - Search products by supplier +=========================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:975e1869b8294c679963a615128337b656fa6839c9e640a5be615f249a691d0b + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png + :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html + :alt: License: LGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/17.0/pos_supplierinfo_search + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-17-0/pos-17-0-pos_supplierinfo_search + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/pos&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +In point of sale interface, allow to search products by supplier name, +supplier product code or supplier product name. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +In point of sale interface, just fill the "search products" box with +some supplier data. + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Tecnativa +* TAKOBI + +Contributors +------------ + +- Lorenzo Battistini (https://takobi.online) +- Dhara Solanki +- [Tecnativa](https://www.tecnativa.com): + + - Carlos Lopez + +- `Heliconia Solutions Pvt. Ltd. `__ + + - Bhavesh Heliconia + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-eLBati| image:: https://github.com/eLBati.png?size=40px + :target: https://github.com/eLBati + :alt: eLBati + +Current `maintainer `__: + +|maintainer-eLBati| + +This module is part of the `OCA/pos `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/pos_supplierinfo_search/__init__.py b/pos_supplierinfo_search/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/pos_supplierinfo_search/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_supplierinfo_search/__manifest__.py b/pos_supplierinfo_search/__manifest__.py new file mode 100644 index 0000000000..3f36d8512c --- /dev/null +++ b/pos_supplierinfo_search/__manifest__.py @@ -0,0 +1,24 @@ +# Copyright 2020 Lorenzo Battistini @ TAKOBI +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl). +{ + "name": "Point of sale - Search products by supplier", + "summary": "Search products by supplier data", + "version": "17.0.1.0.0", + "development_status": "Beta", + "category": "Point Of Sale", + "website": "https://github.com/OCA/pos", + "author": "Tecnativa, TAKOBI, Odoo Community Association (OCA)", + "maintainers": ["eLBati"], + "license": "LGPL-3", + "application": False, + "installable": True, + "auto_install": False, + "depends": [ + "point_of_sale", + ], + "assets": { + "point_of_sale._assets_pos": [ + "/pos_supplierinfo_search/static/src/js/db.esm.js", + ], + }, +} diff --git a/pos_supplierinfo_search/i18n/es.po b/pos_supplierinfo_search/i18n/es.po new file mode 100644 index 0000000000..d74d0c2e91 --- /dev/null +++ b/pos_supplierinfo_search/i18n/es.po @@ -0,0 +1,45 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_supplierinfo_search +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-07-11 09:09+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: pos_supplierinfo_search +#: model:ir.model,name:pos_supplierinfo_search.model_pos_session +msgid "Point of Sale Session" +msgstr "" + +#. module: pos_supplierinfo_search +#: model:ir.model,name:pos_supplierinfo_search.model_product_template +msgid "Product" +msgstr "" + +#. module: pos_supplierinfo_search +#: model:ir.model.fields,field_description:pos_supplierinfo_search.field_product_product__supplier_data_json +#: model:ir.model.fields,field_description:pos_supplierinfo_search.field_product_template__supplier_data_json +msgid "Supplier data dict" +msgstr "Dict de datos del proveedor" + +#. module: pos_supplierinfo_search +#: model:ir.model.fields,help:pos_supplierinfo_search.field_product_product__supplier_data_json +#: model:ir.model.fields,help:pos_supplierinfo_search.field_product_template__supplier_data_json +msgid "" +"Technical field: Used in POS frontend to search products by supplierinfo" +msgstr "" +"Campo técnico: se utiliza en la interfaz de POS para buscar productos por " +"proveedor" + +#~ msgid "Product Template" +#~ msgstr "Plantilla de producto" diff --git a/pos_supplierinfo_search/i18n/it.po b/pos_supplierinfo_search/i18n/it.po new file mode 100644 index 0000000000..0bd9a84f9b --- /dev/null +++ b/pos_supplierinfo_search/i18n/it.po @@ -0,0 +1,44 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_supplierinfo_search +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-07-22 08:58+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.6.2\n" + +#. module: pos_supplierinfo_search +#: model:ir.model,name:pos_supplierinfo_search.model_pos_session +msgid "Point of Sale Session" +msgstr "Sessione punto vendita" + +#. module: pos_supplierinfo_search +#: model:ir.model,name:pos_supplierinfo_search.model_product_template +msgid "Product" +msgstr "Prodotto" + +#. module: pos_supplierinfo_search +#: model:ir.model.fields,field_description:pos_supplierinfo_search.field_product_product__supplier_data_json +#: model:ir.model.fields,field_description:pos_supplierinfo_search.field_product_template__supplier_data_json +msgid "Supplier data dict" +msgstr "Dizionario dati fornitore" + +#. module: pos_supplierinfo_search +#: model:ir.model.fields,help:pos_supplierinfo_search.field_product_product__supplier_data_json +#: model:ir.model.fields,help:pos_supplierinfo_search.field_product_template__supplier_data_json +msgid "" +"Technical field: Used in POS frontend to search products by supplierinfo" +msgstr "" +"Campo tecnico: utilizzato nel frontend POS per cercare prodotti per fornitore" + +#~ msgid "Product Template" +#~ msgstr "Modello prodotto" diff --git a/pos_supplierinfo_search/i18n/pos_supplierinfo_search.pot b/pos_supplierinfo_search/i18n/pos_supplierinfo_search.pot new file mode 100644 index 0000000000..bc478a02e3 --- /dev/null +++ b/pos_supplierinfo_search/i18n/pos_supplierinfo_search.pot @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_supplierinfo_search +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \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: pos_supplierinfo_search +#: model:ir.model,name:pos_supplierinfo_search.model_pos_session +msgid "Point of Sale Session" +msgstr "" + +#. module: pos_supplierinfo_search +#: model:ir.model,name:pos_supplierinfo_search.model_product_template +msgid "Product" +msgstr "" + +#. module: pos_supplierinfo_search +#: model:ir.model.fields,field_description:pos_supplierinfo_search.field_product_product__supplier_data_json +#: model:ir.model.fields,field_description:pos_supplierinfo_search.field_product_template__supplier_data_json +msgid "Supplier data dict" +msgstr "" + +#. module: pos_supplierinfo_search +#: model:ir.model.fields,help:pos_supplierinfo_search.field_product_product__supplier_data_json +#: model:ir.model.fields,help:pos_supplierinfo_search.field_product_template__supplier_data_json +msgid "" +"Technical field: Used in POS frontend to search products by supplierinfo" +msgstr "" diff --git a/pos_supplierinfo_search/models/__init__.py b/pos_supplierinfo_search/models/__init__.py new file mode 100644 index 0000000000..b9c6ba3aa0 --- /dev/null +++ b/pos_supplierinfo_search/models/__init__.py @@ -0,0 +1,2 @@ +from . import product +from . import pos_session diff --git a/pos_supplierinfo_search/models/pos_session.py b/pos_supplierinfo_search/models/pos_session.py new file mode 100644 index 0000000000..71b9c0b908 --- /dev/null +++ b/pos_supplierinfo_search/models/pos_session.py @@ -0,0 +1,13 @@ +# Copyright 2024 Tecnativa - Carlos Lopez +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import models + + +class PosSession(models.Model): + _inherit = "pos.session" + + def _loader_params_product_product(self): + res = super()._loader_params_product_product() + res["search_params"]["fields"].append("supplier_data_json") + return res diff --git a/pos_supplierinfo_search/models/product.py b/pos_supplierinfo_search/models/product.py new file mode 100644 index 0000000000..0872152aa5 --- /dev/null +++ b/pos_supplierinfo_search/models/product.py @@ -0,0 +1,26 @@ +import json + +from odoo import fields, models + + +class ProductTemplate(models.Model): + _inherit = "product.template" + + supplier_data_json = fields.Char( + "Supplier data dict", + help="Technical field: Used in POS frontend to search products by supplierinfo", + compute="_compute_supplier_data_json", + ) + + def _compute_supplier_data_json(self): + for rec in self: + rec.supplier_data_json = json.dumps( + [ + { + "supplier_name": s.partner_id.display_name, + "supplier_product_code": s.product_code or "", + "supplier_product_name": s.product_name or "", + } + for s in rec.seller_ids + ] + ) diff --git a/pos_supplierinfo_search/pyproject.toml b/pos_supplierinfo_search/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/pos_supplierinfo_search/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/pos_supplierinfo_search/readme/CONTRIBUTORS.md b/pos_supplierinfo_search/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..d1390ab0a3 --- /dev/null +++ b/pos_supplierinfo_search/readme/CONTRIBUTORS.md @@ -0,0 +1,6 @@ +- Lorenzo Battistini () +- Dhara Solanki \<\> +- \[Tecnativa\](): + - Carlos Lopez +- [Heliconia Solutions Pvt. Ltd.](https://www.heliconia.io) + - Bhavesh Heliconia diff --git a/pos_supplierinfo_search/readme/DESCRIPTION.md b/pos_supplierinfo_search/readme/DESCRIPTION.md new file mode 100644 index 0000000000..a48810c50e --- /dev/null +++ b/pos_supplierinfo_search/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +In point of sale interface, allow to search products by supplier name, +supplier product code or supplier product name. diff --git a/pos_supplierinfo_search/readme/USAGE.md b/pos_supplierinfo_search/readme/USAGE.md new file mode 100644 index 0000000000..8dc7f128bf --- /dev/null +++ b/pos_supplierinfo_search/readme/USAGE.md @@ -0,0 +1,2 @@ +In point of sale interface, just fill the "search products" box with +some supplier data. diff --git a/pos_supplierinfo_search/static/description/icon.png b/pos_supplierinfo_search/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/pos_supplierinfo_search/static/description/icon.png differ diff --git a/pos_supplierinfo_search/static/description/index.html b/pos_supplierinfo_search/static/description/index.html new file mode 100644 index 0000000000..22c70c213e --- /dev/null +++ b/pos_supplierinfo_search/static/description/index.html @@ -0,0 +1,442 @@ + + + + + +Point of sale - Search products by supplier + + + +
+

Point of sale - Search products by supplier

+ + +

Beta License: LGPL-3 OCA/pos Translate me on Weblate Try me on Runboat

+

In point of sale interface, allow to search products by supplier name, +supplier product code or supplier product name.

+

Table of contents

+ +
+

Usage

+

In point of sale interface, just fill the “search products” box with +some supplier data.

+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Tecnativa
  • +
  • TAKOBI
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

eLBati

+

This module is part of the OCA/pos project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/pos_supplierinfo_search/static/src/js/db.esm.js b/pos_supplierinfo_search/static/src/js/db.esm.js new file mode 100644 index 0000000000..7e63cd0485 --- /dev/null +++ b/pos_supplierinfo_search/static/src/js/db.esm.js @@ -0,0 +1,25 @@ +/** @odoo-module */ + +import {PosDB} from "@point_of_sale/app/store/db"; +import {patch} from "@web/core/utils/patch"; + +patch(PosDB.prototype, { + _product_search_string(product) { + var res = super._product_search_string(product).replace("\n", ""); + var supplier_data_list = JSON.parse(product.supplier_data_json); + for (var i = 0, len = supplier_data_list.length; i < len; i++) { + var supplier_data = supplier_data_list[i]; + if (supplier_data.supplier_name) { + res += "|" + supplier_data.supplier_name.replace(/:/g, ""); + } + if (supplier_data.supplier_product_code) { + res += "|" + supplier_data.supplier_product_code.replace(/:/g, ""); + } + if (supplier_data.supplier_product_name) { + res += "|" + supplier_data.supplier_product_name.replace(/:/g, ""); + } + } + res += "\n"; + return res; + }, +});