diff --git a/pos_partner_ref/README.rst b/pos_partner_ref/README.rst new file mode 100644 index 0000000000..d0bef3d444 --- /dev/null +++ b/pos_partner_ref/README.rst @@ -0,0 +1,89 @@ +=================================== +Point of Sale - Partner contact ref +=================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:f4e560cdcb93e60d8824aefae214926947a93514b2ab7beeeac48942d9dc984d + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpos-lightgray.png?logo=github + :target: https://github.com/OCA/pos/tree/18.0/pos_partner_ref + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-18-0/pos-18-0-pos_partner_ref + :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=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Adds the ref field in the POS Customer Screen so that the information +can be directly entered there. + +**Table of contents** + +.. contents:: + :local: + +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 +------- + +* INVITU + +Contributors +------------ + +- Emanuel Cino +- Juan Carlos Bonilla Bravo +- Enric Tobella +- Cyril VINH-TUNG +- Denis Roussel + +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-invitu| image:: https://github.com/invitu.png?size=40px + :target: https://github.com/invitu + :alt: invitu + +Current `maintainer `__: + +|maintainer-invitu| + +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_partner_ref/__init__.py b/pos_partner_ref/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/pos_partner_ref/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/pos_partner_ref/__manifest__.py b/pos_partner_ref/__manifest__.py new file mode 100644 index 0000000000..ef024e0335 --- /dev/null +++ b/pos_partner_ref/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2023 INVITU +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Point of Sale - Partner contact ref", + "summary": "Adds the partner ref in the customer screen of POS", + "version": "18.0.1.0.0", + "development_status": "Beta", + "category": "Point of sale", + "website": "https://github.com/OCA/pos", + "author": "INVITU, Odoo Community Association (OCA)", + "maintainers": ["invitu"], + "license": "AGPL-3", + "installable": True, + "depends": [ + "point_of_sale", + ], + "assets": { + "point_of_sale._assets_pos": [ + "pos_partner_ref/static/src/xml/screens.xml", + "pos_partner_ref/static/src/js/*.js", + ] + }, +} diff --git a/pos_partner_ref/i18n/es.po b/pos_partner_ref/i18n/es.po new file mode 100644 index 0000000000..0aeca14640 --- /dev/null +++ b/pos_partner_ref/i18n/es.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_partner_ref +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-02-11 19:34+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_partner_ref +#: model:ir.model,name:pos_partner_ref.model_pos_session +msgid "Point of Sale Session" +msgstr "Sesión del Punto de Venta" + +#. module: pos_partner_ref +#. odoo-javascript +#: code:addons/pos_partner_ref/static/src/xml/screens.xml:0 +#: code:addons/pos_partner_ref/static/src/xml/screens.xml:0 +#: code:addons/pos_partner_ref/static/src/xml/screens.xml:0 +#, python-format +msgid "Reference" +msgstr "Referencia" diff --git a/pos_partner_ref/i18n/fr.po b/pos_partner_ref/i18n/fr.po new file mode 100644 index 0000000000..70530dd8da --- /dev/null +++ b/pos_partner_ref/i18n/fr.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_partner_ref +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-02-04 12:37+0000\n" +"Last-Translator: Cyril VINH-TUNG \n" +"Language-Team: none\n" +"Language: fr\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_partner_ref +#: model:ir.model,name:pos_partner_ref.model_pos_session +msgid "Point of Sale Session" +msgstr "Session du point de vente" + +#. module: pos_partner_ref +#. odoo-javascript +#: code:addons/pos_partner_ref/static/src/xml/screens.xml:0 +#: code:addons/pos_partner_ref/static/src/xml/screens.xml:0 +#: code:addons/pos_partner_ref/static/src/xml/screens.xml:0 +#, python-format +msgid "Reference" +msgstr "Référence" diff --git a/pos_partner_ref/i18n/it.po b/pos_partner_ref/i18n/it.po new file mode 100644 index 0000000000..970cd2aca9 --- /dev/null +++ b/pos_partner_ref/i18n/it.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_partner_ref +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-02-04 23:43+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 4.17\n" + +#. module: pos_partner_ref +#: model:ir.model,name:pos_partner_ref.model_pos_session +msgid "Point of Sale Session" +msgstr "Sessione punto vendita" + +#. module: pos_partner_ref +#. odoo-javascript +#: code:addons/pos_partner_ref/static/src/xml/screens.xml:0 +#: code:addons/pos_partner_ref/static/src/xml/screens.xml:0 +#: code:addons/pos_partner_ref/static/src/xml/screens.xml:0 +#, python-format +msgid "Reference" +msgstr "Riferimento" diff --git a/pos_partner_ref/i18n/pos_partner_ref.pot b/pos_partner_ref/i18n/pos_partner_ref.pot new file mode 100644 index 0000000000..23fd216b8a --- /dev/null +++ b/pos_partner_ref/i18n/pos_partner_ref.pot @@ -0,0 +1,28 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_partner_ref +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.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_partner_ref +#: model:ir.model,name:pos_partner_ref.model_pos_session +msgid "Point of Sale Session" +msgstr "" + +#. module: pos_partner_ref +#. odoo-javascript +#: code:addons/pos_partner_ref/static/src/xml/screens.xml:0 +#: code:addons/pos_partner_ref/static/src/xml/screens.xml:0 +#: code:addons/pos_partner_ref/static/src/xml/screens.xml:0 +#, python-format +msgid "Reference" +msgstr "" diff --git a/pos_partner_ref/models/__init__.py b/pos_partner_ref/models/__init__.py new file mode 100644 index 0000000000..3d937eb7aa --- /dev/null +++ b/pos_partner_ref/models/__init__.py @@ -0,0 +1,2 @@ +from . import pos_session +from . import res_partner diff --git a/pos_partner_ref/models/pos_session.py b/pos_partner_ref/models/pos_session.py new file mode 100644 index 0000000000..89e93d30c2 --- /dev/null +++ b/pos_partner_ref/models/pos_session.py @@ -0,0 +1,12 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + + +class POSSession(models.Model): + _inherit = "pos.session" + + def _loader_params_res_partner(self): + res = super()._loader_params_res_partner() + res["search_params"]["fields"].append("ref") + return res diff --git a/pos_partner_ref/models/res_partner.py b/pos_partner_ref/models/res_partner.py new file mode 100644 index 0000000000..827a4f49ec --- /dev/null +++ b/pos_partner_ref/models/res_partner.py @@ -0,0 +1,14 @@ +# Copyright 2026 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import api, models + + +class ResPartner(models.Model): + _inherit = "res.partner" + + @api.model + def _load_pos_data_fields(self, config_id) -> list: + res = super()._load_pos_data_fields(config_id) + if "ref" not in res: + res.append("ref") + return res diff --git a/pos_partner_ref/pyproject.toml b/pos_partner_ref/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/pos_partner_ref/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/pos_partner_ref/readme/CONTRIBUTORS.md b/pos_partner_ref/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..48124f5bd7 --- /dev/null +++ b/pos_partner_ref/readme/CONTRIBUTORS.md @@ -0,0 +1,5 @@ + - Emanuel Cino \<\> + - Juan Carlos Bonilla Bravo \<\> + - Enric Tobella + - Cyril VINH-TUNG \<\> + - Denis Roussel \<\> diff --git a/pos_partner_ref/readme/DESCRIPTION.md b/pos_partner_ref/readme/DESCRIPTION.md new file mode 100644 index 0000000000..47c75b1876 --- /dev/null +++ b/pos_partner_ref/readme/DESCRIPTION.md @@ -0,0 +1,2 @@ +Adds the ref field in the POS Customer Screen so that the +information can be directly entered there. diff --git a/pos_partner_ref/readme/newsfragments/.gitkeep b/pos_partner_ref/readme/newsfragments/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pos_partner_ref/static/description/icon.png b/pos_partner_ref/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/pos_partner_ref/static/description/icon.png differ diff --git a/pos_partner_ref/static/description/index.html b/pos_partner_ref/static/description/index.html new file mode 100644 index 0000000000..34c88e375b --- /dev/null +++ b/pos_partner_ref/static/description/index.html @@ -0,0 +1,430 @@ + + + + + +Point of Sale - Partner contact ref + + + +
+

Point of Sale - Partner contact ref

+ + +

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

+

Adds the ref field in the POS Customer Screen so that the information +can be directly entered there.

+

Table of contents

+ +
+

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

+
    +
  • INVITU
  • +
+
+
+

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:

+

invitu

+

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_partner_ref/static/src/js/PartnerList.esm.js b/pos_partner_ref/static/src/js/PartnerList.esm.js new file mode 100644 index 0000000000..c775c26813 --- /dev/null +++ b/pos_partner_ref/static/src/js/PartnerList.esm.js @@ -0,0 +1,37 @@ +// Copyright 2026 ACSONE SA/NV +// License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +import {PartnerList} from "@point_of_sale/app/screens/partner_list/partner_list"; +import {patch} from "@web/core/utils/patch"; + +patch(PartnerList.prototype, { + async getNewPartners() { + // TODO: Should be optimized as this will do a second query as + // in point_of_sale, search arguments could not be overidden + let res = super.getNewPartners; + let domain = []; + const limit = 30; + if (this.state.query) { + const search_fields = ["ref"]; + domain = [ + ...Array(search_fields.length - 1).fill("|"), + ...search_fields.map((field) => [ + field, + "ilike", + this.state.query + "%", + ]), + ]; + } + + const result = await this.pos.data.searchRead("res.partner", domain, [], { + limit: limit, + offset: this.state.currentOffset, + }); + + if (res.length > 0) { + res = res.append(result); + } else { + res = result; + } + return res; + }, +}); diff --git a/pos_partner_ref/static/src/js/ResPartner.esm.js b/pos_partner_ref/static/src/js/ResPartner.esm.js new file mode 100644 index 0000000000..b61e22afcb --- /dev/null +++ b/pos_partner_ref/static/src/js/ResPartner.esm.js @@ -0,0 +1,12 @@ +import {ResPartner} from "@point_of_sale/app/models/res_partner"; +import {patch} from "@web/core/utils/patch"; + +patch(ResPartner.prototype, { + get searchString() { + let res = super.searchString; + if (this.ref) { + res += " " + this.ref; + } + return res; + }, +}); diff --git a/pos_partner_ref/static/src/xml/screens.xml b/pos_partner_ref/static/src/xml/screens.xml new file mode 100644 index 0000000000..cbd5184441 --- /dev/null +++ b/pos_partner_ref/static/src/xml/screens.xml @@ -0,0 +1,32 @@ + + + + + + +
+ + +
+
+ +
+ + +
+
+
+ +