diff --git a/pos_partner_firstname_required/README.rst b/pos_partner_firstname_required/README.rst new file mode 100644 index 0000000000..2fe57b0589 --- /dev/null +++ b/pos_partner_firstname_required/README.rst @@ -0,0 +1,87 @@ +============================== +POS Partner Firstname Required +============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5226d79fcac096aee71048a5b183b24c5a2ba31bac66939253c5b877e3cec602 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/17.0/pos_partner_firstname_required + :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_partner_firstname_required + :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| + +The module put the firstname required on POS partner view. + +**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 +------- + +* Antoni Marroig +* APSL-Nagarro + +Contributors +------------ + +- [APSL-Nagarro](https://apsl.tech): + + - Antoni Marroig + +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-peluko00| image:: https://github.com/peluko00.png?size=40px + :target: https://github.com/peluko00 + :alt: peluko00 + +Current `maintainer `__: + +|maintainer-peluko00| + +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_firstname_required/__init__.py b/pos_partner_firstname_required/__init__.py new file mode 100644 index 0000000000..ef5ae3587f --- /dev/null +++ b/pos_partner_firstname_required/__init__.py @@ -0,0 +1 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). diff --git a/pos_partner_firstname_required/__manifest__.py b/pos_partner_firstname_required/__manifest__.py new file mode 100644 index 0000000000..9c9efcd66d --- /dev/null +++ b/pos_partner_firstname_required/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2024 Antoni Marroig(APSL-Nagarro) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "POS Partner Firstname Required", + "summary": "Put partner firstname required in pos", + "version": "17.0.1.0.0", + "category": "Point Of Sale", + "website": "https://github.com/OCA/pos", + "author": "Antoni Marroig, APSL-Nagarro, Odoo Community Association (OCA)", + "maintainers": ["peluko00"], + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + "pos_partner_firstname", + ], + "assets": { + "point_of_sale._assets_pos": [ + "pos_partner_firstname_required/static/src/app/PartnerDetailsEdit.esm.js", + ], + }, +} diff --git a/pos_partner_firstname_required/i18n/ca_ES.po b/pos_partner_firstname_required/i18n/ca_ES.po new file mode 100644 index 0000000000..56cd6617e4 --- /dev/null +++ b/pos_partner_firstname_required/i18n/ca_ES.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_partner_firstname_required +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-27 11:47+0000\n" +"PO-Revision-Date: 2024-09-27 11: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: pos_partner_firstname_required +#. odoo-javascript +#: code:addons/pos_partner_firstname_required/static/src/app/PartnerDetailsEdit.esm.js:0 +#, python-format +msgid "Customer firstname and lastname is required" +msgstr "Es requereix el nom i llinatges del client" + +#. module: pos_partner_firstname_required +#. odoo-javascript +#: code:addons/pos_partner_firstname_required/static/src/app/PartnerDetailsEdit.esm.js:0 +#, python-format +msgid "Missing information" +msgstr "InformaciĆ³ que falta" diff --git a/pos_partner_firstname_required/i18n/es.po b/pos_partner_firstname_required/i18n/es.po new file mode 100644 index 0000000000..c38e2c503f --- /dev/null +++ b/pos_partner_firstname_required/i18n/es.po @@ -0,0 +1,30 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * pos_partner_firstname_required +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-27 11:47+0000\n" +"PO-Revision-Date: 2024-09-27 11: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: pos_partner_firstname_required +#. odoo-javascript +#: code:addons/pos_partner_firstname_required/static/src/app/PartnerDetailsEdit.esm.js:0 +#, python-format +msgid "Customer firstname and lastname is required" +msgstr "Se requiere el nombre y apellido del cliente" + +#. module: pos_partner_firstname_required +#. odoo-javascript +#: code:addons/pos_partner_firstname_required/static/src/app/PartnerDetailsEdit.esm.js:0 +#, python-format +msgid "Missing information" +msgstr "InformaciĆ³n que falta" diff --git a/pos_partner_firstname_required/pyproject.toml b/pos_partner_firstname_required/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/pos_partner_firstname_required/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/pos_partner_firstname_required/readme/CONTRIBUTORS.md b/pos_partner_firstname_required/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..c5177d8c59 --- /dev/null +++ b/pos_partner_firstname_required/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- \[APSL-Nagarro\](): + - Antoni Marroig \<\> diff --git a/pos_partner_firstname_required/readme/DESCRIPTION.md b/pos_partner_firstname_required/readme/DESCRIPTION.md new file mode 100644 index 0000000000..163194958a --- /dev/null +++ b/pos_partner_firstname_required/readme/DESCRIPTION.md @@ -0,0 +1 @@ +The module put the firstname required on POS partner view. diff --git a/pos_partner_firstname_required/static/description/icon.png b/pos_partner_firstname_required/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/pos_partner_firstname_required/static/description/icon.png differ diff --git a/pos_partner_firstname_required/static/description/icon.svg b/pos_partner_firstname_required/static/description/icon.svg new file mode 100644 index 0000000000..a7a26d0932 --- /dev/null +++ b/pos_partner_firstname_required/static/description/icon.svg @@ -0,0 +1,79 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/pos_partner_firstname_required/static/description/index.html b/pos_partner_firstname_required/static/description/index.html new file mode 100644 index 0000000000..f92d18ab8d --- /dev/null +++ b/pos_partner_firstname_required/static/description/index.html @@ -0,0 +1,124 @@ +
+
+
+

Module name

+

This module was written to extend the functionality of ... to support ... and allow you to ...

+
+
+
+ +
+
+
+

Installation

+
+
+

To install this module, you need to: +

    +
  • ...
  • +
+

+
+
+
+ + + +
+
+
+
+ +
+
+
+

Configuration

+
+
+

To configure this module, you need to: +

    +
  • ...
  • +
+

+
+
+
+ + + +
+
+
+
+ +
+
+
+

Usage

+
+
+

To use this module, you need to: +

    +
  • ...
  • +
+

+

For further information, please visit: +

+

+
+
+
+ + + +
+
+
+
+ +
+
+
+

Known issues / Roadmap

+
+
+

+

    +
  • ...
  • +
+

+
+
+
+ + + +
+
+
+
+ +
+
+
+

Credits

+
+
+

Contributors

+ +
+
+

Maintainer

+

+ This module is maintained by the OCA.
+ 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.
+ To contribute to this module, please visit http://odoo-community.org.
+ +

+
+
+
diff --git a/pos_partner_firstname_required/static/src/app/PartnerDetailsEdit.esm.js b/pos_partner_firstname_required/static/src/app/PartnerDetailsEdit.esm.js new file mode 100644 index 0000000000..ba49026675 --- /dev/null +++ b/pos_partner_firstname_required/static/src/app/PartnerDetailsEdit.esm.js @@ -0,0 +1,33 @@ +/** @odoo-module **/ + +/* Copyright 2024 Antoni Marroig(APSL-Nagarro) + * License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). */ + +import {ErrorPopup} from "@point_of_sale/app/errors/popups/error_popup"; +import {PartnerDetailsEdit} from "@point_of_sale/app/screens/partner_list/partner_editor/partner_editor"; +import {_t} from "@web/core/l10n/translation"; +import {patch} from "@web/core/utils/patch"; + +patch(PartnerDetailsEdit.prototype, { + checkPartnerPersonName() { + /* We add this hook in order to check second last name later */ + return !this.changes.firstname | !this.changes.lastname; + }, + saveChanges() { + if (this.changes.is_company) { + this.changes.lastname = this.changes.firstname = undefined; + } else { + if (this.checkPartnerPersonName()) { + return this.popup.add(ErrorPopup, { + title: _t("Missing information"), + body: _t("Customer firstname and lastname is required"), + }); + } + this.changes.name = this._updatePartnerName( + this.changes.firstname, + this._getLastName(this.changes) + ); + } + super.saveChanges(); + }, +});