From f32fadf7e7cc8121c0b8c65bb8c359fc2fc7dfd2 Mon Sep 17 00:00:00 2001 From: Victor Champonnois Date: Thu, 9 Jan 2025 16:02:23 +0100 Subject: [PATCH] [ADD] sepa_sale_order_autoconfirm --- sepa_sale_order_autoconfirm/README.rst | 55 +++ sepa_sale_order_autoconfirm/__init__.py | 4 + sepa_sale_order_autoconfirm/__manifest__.py | 16 + .../models/__init__.py | 1 + .../models/sale_order.py | 17 + .../readme/DESCRIPTION.rst | 1 + .../static/description/index.html | 408 ++++++++++++++++++ .../odoo/addons/sepa_sale_order_autoconfirm | 1 + setup/sepa_sale_order_autoconfirm/setup.py | 6 + 9 files changed, 509 insertions(+) create mode 100644 sepa_sale_order_autoconfirm/README.rst create mode 100644 sepa_sale_order_autoconfirm/__init__.py create mode 100644 sepa_sale_order_autoconfirm/__manifest__.py create mode 100644 sepa_sale_order_autoconfirm/models/__init__.py create mode 100644 sepa_sale_order_autoconfirm/models/sale_order.py create mode 100644 sepa_sale_order_autoconfirm/readme/DESCRIPTION.rst create mode 100644 sepa_sale_order_autoconfirm/static/description/index.html create mode 120000 setup/sepa_sale_order_autoconfirm/odoo/addons/sepa_sale_order_autoconfirm create mode 100644 setup/sepa_sale_order_autoconfirm/setup.py diff --git a/sepa_sale_order_autoconfirm/README.rst b/sepa_sale_order_autoconfirm/README.rst new file mode 100644 index 000000000..07ddad4e8 --- /dev/null +++ b/sepa_sale_order_autoconfirm/README.rst @@ -0,0 +1,55 @@ +=========================== +SEPA Sale Order AutoConfirm +=========================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:da42c5a8eff3e77045d56c6ab4e80cabd3ac6e9be323555aa20035c9a2e65789 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-coopiteasy%2Faddons-lightgray.png?logo=github + :target: https://github.com/coopiteasy/addons/tree/16.0/sepa_sale_order_autoconfirm + :alt: coopiteasy/addons + +|badge1| |badge2| |badge3| + +Autoconfirm Sale orders created via ecommerce with SEPA products. + +**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 +~~~~~~~ + +* Coop IT Easy SC + +Maintainers +~~~~~~~~~~~ + +This module is part of the `coopiteasy/addons `_ project on GitHub. + +You are welcome to contribute. diff --git a/sepa_sale_order_autoconfirm/__init__.py b/sepa_sale_order_autoconfirm/__init__.py new file mode 100644 index 000000000..7fbcfccdd --- /dev/null +++ b/sepa_sale_order_autoconfirm/__init__.py @@ -0,0 +1,4 @@ +# SPDX-FileCopyrightText: 2024 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later +from . import models diff --git a/sepa_sale_order_autoconfirm/__manifest__.py b/sepa_sale_order_autoconfirm/__manifest__.py new file mode 100644 index 000000000..ee953ba59 --- /dev/null +++ b/sepa_sale_order_autoconfirm/__manifest__.py @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: 2024 Coop IT Easy SC +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +{ + "name": "SEPA Sale Order AutoConfirm", + "summary": "Autoconfirm Sale orders created via ecommerce with SEPA products", + "version": "16.0.1.0.0", + "category": "Website", + "website": "https://github.com/coopiteasy/addons", + "author": "Coop IT Easy SC", + "license": "AGPL-3", + "depends": [ + "payment_sepa_dd", + ], +} diff --git a/sepa_sale_order_autoconfirm/models/__init__.py b/sepa_sale_order_autoconfirm/models/__init__.py new file mode 100644 index 000000000..6aacb7531 --- /dev/null +++ b/sepa_sale_order_autoconfirm/models/__init__.py @@ -0,0 +1 @@ +from . import sale_order diff --git a/sepa_sale_order_autoconfirm/models/sale_order.py b/sepa_sale_order_autoconfirm/models/sale_order.py new file mode 100644 index 000000000..66f5cc8c0 --- /dev/null +++ b/sepa_sale_order_autoconfirm/models/sale_order.py @@ -0,0 +1,17 @@ +from odoo import models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + def create(self, vals): + record = super().create(vals) + website_sale = record.team_id == self.env.ref( + "sales_team.salesteam_website_sales" + ) + sepa_product = any( + self.order_line.mapped("product_id").mapped("allow_sepa_dd_payment") + ) + if website_sale and sepa_product: + record.action_confirm() + return record diff --git a/sepa_sale_order_autoconfirm/readme/DESCRIPTION.rst b/sepa_sale_order_autoconfirm/readme/DESCRIPTION.rst new file mode 100644 index 000000000..0214a0fc3 --- /dev/null +++ b/sepa_sale_order_autoconfirm/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Autoconfirm Sale orders created via ecommerce with SEPA products. diff --git a/sepa_sale_order_autoconfirm/static/description/index.html b/sepa_sale_order_autoconfirm/static/description/index.html new file mode 100644 index 000000000..abaf3f143 --- /dev/null +++ b/sepa_sale_order_autoconfirm/static/description/index.html @@ -0,0 +1,408 @@ + + + + + +SEPA Sale Order AutoConfirm + + + +
+

SEPA Sale Order AutoConfirm

+ + +

Beta License: AGPL-3 coopiteasy/addons

+

Autoconfirm Sale orders created via ecommerce with SEPA products.

+

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

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

Maintainers

+

This module is part of the coopiteasy/addons project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/setup/sepa_sale_order_autoconfirm/odoo/addons/sepa_sale_order_autoconfirm b/setup/sepa_sale_order_autoconfirm/odoo/addons/sepa_sale_order_autoconfirm new file mode 120000 index 000000000..049b8f198 --- /dev/null +++ b/setup/sepa_sale_order_autoconfirm/odoo/addons/sepa_sale_order_autoconfirm @@ -0,0 +1 @@ +../../../../sepa_sale_order_autoconfirm \ No newline at end of file diff --git a/setup/sepa_sale_order_autoconfirm/setup.py b/setup/sepa_sale_order_autoconfirm/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/sepa_sale_order_autoconfirm/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)