[IMP] subscription_oca: pre-commit auto fixes

This commit is contained in:
sygel
2024-07-08 13:20:19 +02:00
parent 327486c8e0
commit 0498fedd67
12 changed files with 111 additions and 62 deletions

View File

@@ -17,18 +17,20 @@ Subscription management
: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
:target: https://github.com/OCA/contract/tree/16.0/subscription_oca
:target: https://github.com/OCA/contract/tree/17.0/subscription_oca
:alt: OCA/contract
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/contract-16-0/contract-16-0-subscription_oca
:target: https://translation.odoo-community.org/projects/contract-17-0/contract-17-0-subscription_oca
: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/contract&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/contract&target_branch=17.0
:alt: Try me on Runboat
|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows creating subscriptions that generate recurring invoices or orders. It also enables the sale of products that generate subscriptions.
This module allows creating subscriptions that generate recurring
invoices or orders. It also enables the sale of products that generate
subscriptions.
**Table of contents**
@@ -40,23 +42,37 @@ Usage
To make a subscription:
#. Go to *Subscriptions > Configuration > Subscription templates*.
#. Create the templates you consider, choosing the billing frequency: daily, monthly... and the method of creating the invoice and/or order.
#. Go to *Subscription > Subscriptions*.
#. Create a subscription and indicate the start date. When the *Subscriptions Management* cron job is executed, the subscription will begin and the first invoice will be created if the execution date matches the start date. The invoice will also be created when the execution date matches the next invoice date. Additionally, you can manually change the subscription status and create an invoice by using the *Create Invoice* button. This action creates just an invoice even if the subscription template has the *Sale Order & Invoice* option selected, because the *Invoicing mode* option is triggered through the cron job.
#. The cron job will also end the subscription if its end date has been reached.
1. Go to *Subscriptions > Configuration > Subscription templates*.
2. Create the templates you consider, choosing the billing frequency:
daily, monthly... and the method of creating the invoice and/or
order.
3. Go to *Subscription > Subscriptions*.
4. Create a subscription and indicate the start date. When the
*Subscriptions Management* cron job is executed, the subscription
will begin and the first invoice will be created if the execution
date matches the start date. The invoice will also be created when
the execution date matches the next invoice date. Additionally, you
can manually change the subscription status and create an invoice by
using the *Create Invoice* button. This action creates just an
invoice even if the subscription template has the *Sale Order &
Invoice* option selected, because the *Invoicing mode* option is
triggered through the cron job.
5. The cron job will also end the subscription if its end date has been
reached.
To create subscriptions with the sale of a product:
#. Go to *Subscriptions > Subscriptions > Products*.
#. Create the product and in the sales tab, complete the fields *Subscribable product* and *Subscription template*
#. Create a sales order with the product and confirm it.
1. Go to *Subscriptions > Subscriptions > Products*.
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.
Known issues / Roadmap
======================
* Refactor all the onchanges that have business logic to computed write-able fields when possible. Keep onchanges only for UI purposes.
* Add tests.
- Refactor all the onchanges that have business logic to computed
write-able fields when possible. Keep onchanges only for UI purposes.
- Add tests.
Bug Tracker
===========
@@ -64,7 +80,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/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 <https://github.com/OCA/contract/issues/new?body=module:%20subscription_oca%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/contract/issues/new?body=module:%20subscription_oca%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
@@ -72,23 +88,21 @@ Credits
=======
Authors
~~~~~~~
-------
* Domatix
Contributors
~~~~~~~~~~~~
------------
* Carlos Martínez <carlos@domatix.com>
* Carolina Ferrer <carolina@domatix.com>
- Carlos Martínez <carlos@domatix.com>
- Carolina Ferrer <carolina@domatix.com>
- `Ooops404 <https://www.ooops404.com>`__:
* `Ooops404 <https://www.ooops404.com>`__:
* Ilyas <irazor147@gmail.com>
- Ilyas <irazor147@gmail.com>
Maintainers
~~~~~~~~~~~
-----------
This module is maintained by the OCA.
@@ -100,6 +114,6 @@ 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/contract <https://github.com/OCA/contract/tree/16.0/subscription_oca>`_ project on GitHub.
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/17.0/subscription_oca>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -179,7 +179,7 @@ class SaleSubscription(models.Model):
template_code = record.template_id.code if record.template_id.code else ""
code = record.code if record.code else ""
slash = "/" if template_code and code else ""
record.name = "{}{}{}".format(template_code, slash, code)
record.name = f"{template_code}{slash}{code}"
@api.depends("template_id", "date_start")
def _compute_rule_boundary(self):

View File

@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"

View File

@@ -0,0 +1,4 @@
- Carlos Martínez \<<carlos@domatix.com>\>
- Carolina Ferrer \<<carolina@domatix.com>\>
- [Ooops404](https://www.ooops404.com):
- Ilyas \<<irazor147@gmail.com>\>

View File

@@ -1,7 +0,0 @@
* Carlos Martínez <carlos@domatix.com>
* Carolina Ferrer <carolina@domatix.com>
* `Ooops404 <https://www.ooops404.com>`__:
* Ilyas <irazor147@gmail.com>

View File

@@ -0,0 +1,3 @@
This module allows creating subscriptions that generate recurring
invoices or orders. It also enables the sale of products that generate
subscriptions.

View File

@@ -1 +0,0 @@
This module allows creating subscriptions that generate recurring invoices or orders. It also enables the sale of products that generate subscriptions.

View File

@@ -0,0 +1,3 @@
- Refactor all the onchanges that have business logic to computed
write-able fields when possible. Keep onchanges only for UI purposes.
- Add tests.

View File

@@ -1,2 +0,0 @@
* Refactor all the onchanges that have business logic to computed write-able fields when possible. Keep onchanges only for UI purposes.
* Add tests.

View File

@@ -0,0 +1,26 @@
To make a subscription:
1. Go to *Subscriptions \> Configuration \> Subscription templates*.
2. Create the templates you consider, choosing the billing frequency:
daily, monthly... and the method of creating the invoice and/or
order.
3. Go to *Subscription \> Subscriptions*.
4. Create a subscription and indicate the start date. When the
*Subscriptions Management* cron job is executed, the subscription
will begin and the first invoice will be created if the execution
date matches the start date. The invoice will also be created when
the execution date matches the next invoice date. Additionally, you
can manually change the subscription status and create an invoice by
using the *Create Invoice* button. This action creates just an
invoice even if the subscription template has the *Sale Order &
Invoice* option selected, because the *Invoicing mode* option is
triggered through the cron job.
5. The cron job will also end the subscription if its end date has been
reached.
To create subscriptions with the sale of a product:
1. Go to *Subscriptions \> Subscriptions \> Products*.
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.

View File

@@ -1,13 +0,0 @@
To make a subscription:
#. Go to *Subscriptions > Configuration > Subscription templates*.
#. Create the templates you consider, choosing the billing frequency: daily, monthly... and the method of creating the invoice and/or order.
#. Go to *Subscription > Subscriptions*.
#. Create a subscription and indicate the start date. When the *Subscriptions Management* cron job is executed, the subscription will begin and the first invoice will be created if the execution date matches the start date. The invoice will also be created when the execution date matches the next invoice date. Additionally, you can manually change the subscription status and create an invoice by using the *Create Invoice* button. This action creates just an invoice even if the subscription template has the *Sale Order & Invoice* option selected, because the *Invoicing mode* option is triggered through the cron job.
#. The cron job will also end the subscription if its end date has been reached.
To create subscriptions with the sale of a product:
#. Go to *Subscriptions > Subscriptions > Products*.
#. Create the product and in the sales tab, complete the fields *Subscribable product* and *Subscription template*
#. Create a sales order with the product and confirm it.

View File

@@ -8,10 +8,11 @@
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
@@ -274,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -300,7 +301,7 @@ span.option {
span.pre {
white-space: pre }
span.problematic {
span.problematic, pre.problematic {
color: red }
span.section-subtitle {
@@ -368,8 +369,10 @@ ul.auto-toc {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7f85e1d860d2d5332db014c46c57b9bece8f76a849049bda632499d422ba6dd8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/16.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-16-0/contract-16-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=16.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>
<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/17.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-17-0/contract-17-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=17.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>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
@@ -389,22 +392,36 @@ ul.auto-toc {
<p>To make a subscription:</p>
<ol class="arabic simple">
<li>Go to <em>Subscriptions &gt; Configuration &gt; Subscription templates</em>.</li>
<li>Create the templates you consider, choosing the billing frequency: daily, monthly… and the method of creating the invoice and/or order.</li>
<li>Create the templates you consider, choosing the billing frequency:
daily, monthly… and the method of creating the invoice and/or
order.</li>
<li>Go to <em>Subscription &gt; Subscriptions</em>.</li>
<li>Create a subscription and indicate the start date. When the <em>Subscriptions Management</em> cron job is executed, the subscription will begin and the first invoice will be created if the execution date matches the start date. The invoice will also be created when the execution date matches the next invoice date. Additionally, you can manually change the subscription status and create an invoice by using the <em>Create Invoice</em> button. This action creates just an invoice even if the subscription template has the <em>Sale Order &amp; Invoice</em> option selected, because the <em>Invoicing mode</em> option is triggered through the cron job.</li>
<li>The cron job will also end the subscription if its end date has been reached.</li>
<li>Create a subscription and indicate the start date. When the
<em>Subscriptions Management</em> cron job is executed, the subscription
will begin and the first invoice will be created if the execution
date matches the start date. The invoice will also be created when
the execution date matches the next invoice date. Additionally, you
can manually change the subscription status and create an invoice by
using the <em>Create Invoice</em> button. This action creates just an
invoice even if the subscription template has the <em>Sale Order &amp;
Invoice</em> option selected, because the <em>Invoicing mode</em> option is
triggered through the cron job.</li>
<li>The cron job will also end the subscription if its end date has been
reached.</li>
</ol>
<p>To create subscriptions with the sale of a product:</p>
<ol class="arabic simple">
<li>Go to <em>Subscriptions &gt; Subscriptions &gt; Products</em>.</li>
<li>Create the product and in the sales tab, complete the fields <em>Subscribable product</em> and <em>Subscription template</em></li>
<li>Create the product and in the sales tab, complete the fields
<em>Subscribable product</em> and <em>Subscription template</em></li>
<li>Create a sales order with the product and confirm it.</li>
</ol>
</div>
<div class="section" id="known-issues-roadmap">
<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>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>
@@ -413,7 +430,7 @@ ul.auto-toc {
<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:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/contract/issues/new?body=module:%20subscription_oca%0Aversion:%2017.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">
@@ -438,11 +455,13 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<div class="section" id="maintainers">
<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" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/16.0/subscription_oca">OCA/contract</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/17.0/subscription_oca">OCA/contract</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>