Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions subscription_oca/README.rst
Original file line number Diff line number Diff line change
@@ -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
=======================
Expand All @@ -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
Expand Down Expand Up @@ -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
======================

Expand Down Expand Up @@ -113,6 +114,7 @@ Contributors
- Alberto Martínez

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

Maintainers
-----------
Expand Down
3 changes: 2 additions & 1 deletion subscription_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
],
Expand Down
1 change: 1 addition & 0 deletions subscription_oca/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from . import res_company
from . import account_move
from . import product_template
from . import res_partner
Expand Down
16 changes: 16 additions & 0 deletions subscription_oca/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2026 INVITU (<https://www.invitu.com>)
# 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",
)
12 changes: 7 additions & 5 deletions subscription_oca/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2023 Domatix - Carlos Martínez
# Copyright 2026 INVITU (<https://www.invitu.com>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from collections import defaultdict
from datetime import date
Expand Down Expand Up @@ -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):
"""
Expand Down
1 change: 1 addition & 0 deletions subscription_oca/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
- Valentin Vinagre
- Alberto Martínez
- Dennis Sluijk \<<d.sluijk@onestein.nl>\>
- Cyril Vinh-Tung \<<cyril@invitu.com>\>
4 changes: 4 additions & 0 deletions subscription_oca/readme/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*
34 changes: 17 additions & 17 deletions subscription_oca/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Subscription management</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="subscription-management">
<h1 class="title">Subscription management</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="subscription-management">
<h1>Subscription management</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ab6023e140886cb5c4fe2d8e969d404ab4a58de4701d6b906c424c9521d1b5d1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/contract/tree/18.0/subscription_oca"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/contract-18-0/contract-18-0-subscription_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/contract&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/contract/tree/18.0/subscription_oca"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/contract-18-0/contract-18-0-subscription_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/contract&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows creating subscriptions that generate recurring
invoices or orders. It also enables the sale of products that generate
subscriptions.</p>
Expand All @@ -393,7 +388,7 @@ <h1>Subscription management</h1>
</ul>
</div>
<div class="section" id="usage">
<h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<p>To make a subscription:</p>
<ol class="arabic simple">
<li>Go to <em>Subscriptions &gt; Configuration &gt; Subscription templates</em>.</li>
Expand Down Expand Up @@ -421,34 +416,39 @@ <h2><a class="toc-backref" href="#toc-entry-1">Usage</a></h2>
<em>Subscribable product</em> and <em>Subscription template</em></li>
<li>Create a sales order with the product and confirm it.</li>
</ol>
<p>To automatically start subscription when the sale order is confirmed :</p>
<ol class="arabic simple">
<li>Go to Sales/Configuration/Settings</li>
<li>Tick the option <em>Automatic Subscription Start</em></li>
</ol>
</div>
<div class="section" id="known-issues-roadmap">
<h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
<ul class="simple">
<li>Refactor all the onchanges that have business logic to computed
write-able fields when possible. Keep onchanges only for UI purposes.</li>
<li>Add tests.</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/contract/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/contract/issues/new?body=module:%20subscription_oca%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-4">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-5">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple">
<li>Domatix</li>
<li>Onestein</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple">
<li>Carlos Martínez &lt;<a class="reference external" href="mailto:carlos&#64;domatix.com">carlos&#64;domatix.com</a>&gt;</li>
<li>Carolina Ferrer &lt;<a class="reference external" href="mailto:carolina&#64;domatix.com">carolina&#64;domatix.com</a>&gt;</li>
Expand All @@ -463,10 +463,11 @@ <h3><a class="toc-backref" href="#toc-entry-6">Contributors</a></h3>
</ul>
</li>
<li>Dennis Sluijk &lt;<a class="reference external" href="mailto:d.sluijk&#64;onestein.nl">d.sluijk&#64;onestein.nl</a>&gt;</li>
<li>Cyril Vinh-Tung &lt;<a class="reference external" href="mailto:cyril&#64;invitu.com">cyril&#64;invitu.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
Expand All @@ -479,6 +480,5 @@ <h3><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
1 change: 1 addition & 0 deletions subscription_oca/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from . import res_config_settings
from . import close_subscription_wizard
12 changes: 12 additions & 0 deletions subscription_oca/wizard/res_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright 2026 INVITU (<https://www.invitu.com>)
# 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
)
22 changes: 22 additions & 0 deletions subscription_oca/wizard/res_config_settings_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.subscription</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="100" />
<field name="inherit_id" ref="sale.res_config_settings_view_form" />
<field name="arch" type="xml">
<block name="quotation_order_setting_container" position="after">
<block title="Subscriptions" name="subscription_setting_container">
<setting
id="automatic_subscription_start_setting"
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"
company_dependent="1"
>
<field name="automatic_subscription_start" />
</setting>
</block>
</block>
</field>
</record>
</odoo>
Loading