diff --git a/pos_auto_invoice/README.rst b/pos_auto_invoice/README.rst new file mode 100644 index 0000000000..232d6f71e6 --- /dev/null +++ b/pos_auto_invoice/README.rst @@ -0,0 +1,88 @@ +=================================== +Point of Sale Automatically Invoice +=================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:2886f37cd3bd20fc08a85145afe135699467c5b843c9e82d99d523c3a34b5d6c + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/16.0/pos_auto_invoice + :alt: OCA/pos +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/pos-16-0/pos-16-0-pos_auto_invoice + :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=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Allow to set point-of-sale orders as to-invoice by default. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +This module adds an “Invoice By Default” option to the Accounting section of +the Point of Sale settings. + +To set orders as to-invoice by default, check the “Invoice By Default” +checkbox. + +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 +~~~~~~~ + +* Coop IT Easy SC + +Contributors +~~~~~~~~~~~~ + +* `Coop IT Easy SC `_: + + * Carmen Bianca Bakker + * hugues de keyzer + +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. + +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_auto_invoice/__init__.py b/pos_auto_invoice/__init__.py new file mode 100644 index 0000000000..3eb78877c5 --- /dev/null +++ b/pos_auto_invoice/__init__.py @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: 2024 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +from . import models diff --git a/pos_auto_invoice/__manifest__.py b/pos_auto_invoice/__manifest__.py new file mode 100644 index 0000000000..be570e1341 --- /dev/null +++ b/pos_auto_invoice/__manifest__.py @@ -0,0 +1,23 @@ +# Copyright 2022 Coop IT Easy SC +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Point of Sale Automatically Invoice", + "summary": "Allow to set POS orders as to-invoice by default", + "version": "16.0.1.0.0", + "category": "Point of Sale", + "website": "https://github.com/OCA/pos", + "author": "Coop IT Easy SC, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": [ + "point_of_sale", + ], + "data": [ + "views/res_config_settings_view.xml", + ], + "assets": { + "point_of_sale.assets": [ + "pos_auto_invoice/static/src/js/*.js", + ] + }, +} diff --git a/pos_auto_invoice/i18n/pos_auto_invoice.pot b/pos_auto_invoice/i18n/pos_auto_invoice.pot new file mode 100644 index 0000000000..d2e396f159 --- /dev/null +++ b/pos_auto_invoice/i18n/pos_auto_invoice.pot @@ -0,0 +1,14 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.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" + diff --git a/pos_auto_invoice/models/__init__.py b/pos_auto_invoice/models/__init__.py new file mode 100644 index 0000000000..7133ebc21e --- /dev/null +++ b/pos_auto_invoice/models/__init__.py @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: 2024 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +from . import pos_config +from . import res_config_settings diff --git a/pos_auto_invoice/models/pos_config.py b/pos_auto_invoice/models/pos_config.py new file mode 100644 index 0000000000..b69db852eb --- /dev/null +++ b/pos_auto_invoice/models/pos_config.py @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: 2024 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +from odoo import fields, models + + +class PosConfig(models.Model): + _inherit = "pos.config" + + invoice_by_default = fields.Boolean() diff --git a/pos_auto_invoice/models/res_config_settings.py b/pos_auto_invoice/models/res_config_settings.py new file mode 100644 index 0000000000..f0f8e611f6 --- /dev/null +++ b/pos_auto_invoice/models/res_config_settings.py @@ -0,0 +1,14 @@ +# SPDX-FileCopyrightText: 2024 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + pos_invoice_by_default = fields.Boolean( + related="pos_config_id.invoice_by_default", + readonly=False, + ) diff --git a/pos_auto_invoice/readme/CONFIGURE.rst b/pos_auto_invoice/readme/CONFIGURE.rst new file mode 100644 index 0000000000..03cf5260b3 --- /dev/null +++ b/pos_auto_invoice/readme/CONFIGURE.rst @@ -0,0 +1,5 @@ +This module adds an “Invoice By Default” option to the Accounting section of +the Point of Sale settings. + +To set orders as to-invoice by default, check the “Invoice By Default” +checkbox. diff --git a/pos_auto_invoice/readme/CONTRIBUTORS.rst b/pos_auto_invoice/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..26771b9d22 --- /dev/null +++ b/pos_auto_invoice/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Coop IT Easy SC `_: + + * Carmen Bianca Bakker + * hugues de keyzer diff --git a/pos_auto_invoice/readme/DESCRIPTION.rst b/pos_auto_invoice/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..448aad1f2a --- /dev/null +++ b/pos_auto_invoice/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Allow to set point-of-sale orders as to-invoice by default. diff --git a/pos_auto_invoice/static/description/index.html b/pos_auto_invoice/static/description/index.html new file mode 100644 index 0000000000..d66452506e --- /dev/null +++ b/pos_auto_invoice/static/description/index.html @@ -0,0 +1,432 @@ + + + + + +Point of Sale Automatically Invoice + + + +
+

Point of Sale Automatically Invoice

+ + +

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

+

Allow to set point-of-sale orders as to-invoice by default.

+

Table of contents

+ +
+

Configuration

+

This module adds an “Invoice By Default” option to the Accounting section of +the Point of Sale settings.

+

To set orders as to-invoice by default, check the “Invoice By Default” +checkbox.

+
+
+

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

+
    +
  • Coop IT Easy SC
  • +
+
+
+

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.

+

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_auto_invoice/static/src/js/models.js b/pos_auto_invoice/static/src/js/models.js new file mode 100644 index 0000000000..8919bb329f --- /dev/null +++ b/pos_auto_invoice/static/src/js/models.js @@ -0,0 +1,25 @@ +odoo.define("pos_auto_invoice.models", function (require) { + "use strict"; + + const {Order} = require("point_of_sale.models"); + const Registries = require("point_of_sale.Registries"); + + const AutoInvoiceOrder = (OriginalOrder) => + class extends OriginalOrder { + constructor(obj, options) { + super(...arguments); + if (!options.json && this.pos.config.invoice_by_default) { + this.to_invoice = true; + } + } + + init_from_JSON(json) { + super.init_from_JSON(...arguments); + // This should be done in the original method, but curiously + // it is not (to_invoice is always set to false). + this.to_invoice = json.to_invoice; + } + }; + + Registries.Model.extend(Order, AutoInvoiceOrder); +}); diff --git a/pos_auto_invoice/views/res_config_settings_view.xml b/pos_auto_invoice/views/res_config_settings_view.xml new file mode 100644 index 0000000000..7b26e0b026 --- /dev/null +++ b/pos_auto_invoice/views/res_config_settings_view.xml @@ -0,0 +1,30 @@ + + + + + + res.config.settings.view.form + res.config.settings + + + +
+
+ +
+
+
+
+
+
+
+ +
diff --git a/setup/pos_auto_invoice/odoo/addons/pos_auto_invoice b/setup/pos_auto_invoice/odoo/addons/pos_auto_invoice new file mode 120000 index 0000000000..48fa1c213b --- /dev/null +++ b/setup/pos_auto_invoice/odoo/addons/pos_auto_invoice @@ -0,0 +1 @@ +../../../../pos_auto_invoice \ No newline at end of file diff --git a/setup/pos_auto_invoice/setup.py b/setup/pos_auto_invoice/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/pos_auto_invoice/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)