diff --git a/subscription_oca/README.rst b/subscription_oca/README.rst index 57a6d31363..72f904d4bb 100644 --- a/subscription_oca/README.rst +++ b/subscription_oca/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ======================= Subscription management ======================= @@ -17,7 +13,7 @@ Subscription management .. |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/license-AGPL--3-blue.png +.. |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%2Fcontract-lightgray.png?logo=github @@ -71,6 +67,11 @@ To create subscriptions with the sale of a product: *Subscribable product* and *Subscription template* 3. Create a sales order with the product and confirm it. +To automatically start subscription when the sale order is confirmed : + +1. Go to Sales/Configuration/Settings +2. Tick the option *Automatic Subscription Start* + Known issues / Roadmap ====================== @@ -113,6 +114,7 @@ Contributors - Alberto Martínez - Dennis Sluijk +- Cyril Vinh-Tung Maintainers ----------- diff --git a/subscription_oca/__manifest__.py b/subscription_oca/__manifest__.py index 583ac368f9..3ffebf0629 100644 --- a/subscription_oca/__manifest__.py +++ b/subscription_oca/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Subscription management", "summary": "Generate recurring invoices.", - "version": "18.0.1.0.0", + "version": "18.0.1.1.0", "development_status": "Beta", "category": "Subscription Management", "website": "https://github.com/OCA/contract", @@ -21,6 +21,7 @@ "views/res_partner_views.xml", "data/ir_cron.xml", "data/sale_subscription_data.xml", + "wizard/res_config_settings_views.xml", "wizard/close_subscription_wizard.xml", "security/ir.model.access.csv", ], diff --git a/subscription_oca/models/__init__.py b/subscription_oca/models/__init__.py index 6fa4481885..69f10de92d 100644 --- a/subscription_oca/models/__init__.py +++ b/subscription_oca/models/__init__.py @@ -1,3 +1,4 @@ +from . import res_company from . import account_move from . import product_template from . import res_partner diff --git a/subscription_oca/models/res_company.py b/subscription_oca/models/res_company.py new file mode 100644 index 0000000000..110b956b81 --- /dev/null +++ b/subscription_oca/models/res_company.py @@ -0,0 +1,16 @@ +# Copyright 2026 INVITU () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + automatic_subscription_start = fields.Boolean( + default=False, + help="The subscription is automatically started when the sale order is" + "confirmed. You may activate this feature if you don't want to review" + "the subscription and you want to start the subscription at the order" + "confirmation date", + ) diff --git a/subscription_oca/models/sale_order.py b/subscription_oca/models/sale_order.py index 43d4f9bbea..e60c817908 100644 --- a/subscription_oca/models/sale_order.py +++ b/subscription_oca/models/sale_order.py @@ -1,4 +1,5 @@ # Copyright 2023 Domatix - Carlos Martínez +# Copyright 2026 INVITU () # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from collections import defaultdict from datetime import date @@ -65,11 +66,12 @@ def create_subscription(self, lines, subscription_tmpl): "sale_subscription_line_ids": subscription_lines, } ) - rec.action_start_subscription() - rec.recurring_next_date = self.get_next_interval( - subscription_tmpl.recurring_rule_type, - subscription_tmpl.recurring_interval, - ) + if self.company_id.automatic_subscription_start: + rec.action_start_subscription() + rec.recurring_next_date = self.get_next_interval( + subscription_tmpl.recurring_rule_type, + subscription_tmpl.recurring_interval, + ) def group_subscription_lines(self): """ diff --git a/subscription_oca/readme/CONTRIBUTORS.md b/subscription_oca/readme/CONTRIBUTORS.md index 885a89aa19..2807c51d2e 100644 --- a/subscription_oca/readme/CONTRIBUTORS.md +++ b/subscription_oca/readme/CONTRIBUTORS.md @@ -7,3 +7,4 @@ - Valentin Vinagre - Alberto Martínez - Dennis Sluijk \<\> +- Cyril Vinh-Tung \<\> diff --git a/subscription_oca/readme/USAGE.md b/subscription_oca/readme/USAGE.md index 707414ff28..0fd3d00015 100644 --- a/subscription_oca/readme/USAGE.md +++ b/subscription_oca/readme/USAGE.md @@ -24,3 +24,7 @@ To create subscriptions with the sale of a product: 2. Create the product and in the sales tab, complete the fields *Subscribable product* and *Subscription template* 3. Create a sales order with the product and confirm it. + +To automatically start subscription when the sale order is confirmed : +1. Go to Sales/Configuration/Settings +2. Tick the option *Automatic Subscription Start* diff --git a/subscription_oca/static/description/index.html b/subscription_oca/static/description/index.html index 50e903fc3d..5d672b8a70 100644 --- a/subscription_oca/static/description/index.html +++ b/subscription_oca/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Subscription management -
+
+

Subscription management

- - -Odoo Community Association - -
-

Subscription management

-

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

+

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

This module allows creating subscriptions that generate recurring invoices or orders. It also enables the sale of products that generate subscriptions.

@@ -393,7 +388,7 @@

Subscription management

-

Usage

+

Usage

To make a subscription:

  1. Go to Subscriptions > Configuration > Subscription templates.
  2. @@ -421,9 +416,14 @@

    Usage

    Subscribable product and Subscription template
  3. Create a sales order with the product and confirm it.
+

To automatically start subscription when the sale order is confirmed :

+
    +
  1. Go to Sales/Configuration/Settings
  2. +
  3. Tick the option Automatic Subscription Start
  4. +
-

Known issues / Roadmap

+

Known issues / Roadmap

  • Refactor all the onchanges that have business logic to computed write-able fields when possible. Keep onchanges only for UI purposes.
  • @@ -431,7 +431,7 @@

    Known issues / Roadmap

-

Bug Tracker

+

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 @@ -439,16 +439,16 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Domatix
  • Onestein
-

Contributors

+

Contributors

  • Dennis Sluijk <d.sluijk@onestein.nl>
  • +
  • Cyril Vinh-Tung <cyril@invitu.com>
  • -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    Odoo Community Association @@ -479,6 +480,5 @@

    Maintainers

    -
    diff --git a/subscription_oca/wizard/__init__.py b/subscription_oca/wizard/__init__.py index a1aca59def..a21c66120a 100644 --- a/subscription_oca/wizard/__init__.py +++ b/subscription_oca/wizard/__init__.py @@ -1 +1,2 @@ +from . import res_config_settings from . import close_subscription_wizard diff --git a/subscription_oca/wizard/res_config_settings.py b/subscription_oca/wizard/res_config_settings.py new file mode 100644 index 0000000000..bcc9ca9170 --- /dev/null +++ b/subscription_oca/wizard/res_config_settings.py @@ -0,0 +1,12 @@ +# Copyright 2026 INVITU () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + automatic_subscription_start = fields.Boolean( + related="company_id.automatic_subscription_start", readonly=False + ) diff --git a/subscription_oca/wizard/res_config_settings_views.xml b/subscription_oca/wizard/res_config_settings_views.xml new file mode 100644 index 0000000000..b31daaa261 --- /dev/null +++ b/subscription_oca/wizard/res_config_settings_views.xml @@ -0,0 +1,22 @@ + + + + res.config.settings.view.form.inherit.subscription + res.config.settings + + + + + + + + + + + + +