Metadata-Version: 2.1
Name: hb_tryton_sale_subscription_automatic_post
Version: 1.0.0
Summary: Define in the sale subscription if the invoice must be posted or validated
Home-page: https://hashbang.fr/
Author: HashBang
Author-email: contact@hashbang.fr
License: GPL-3
Project-URL: Bug Tracker, https://gitlab.com/hashbangfr/tryton-modules/tryton_hb_sale_subscription_automatic_post/-/issues
Project-URL: Source Code, https://gitlab.com/hashbangfr/tryton-modules/tryton_hb_sale_subscription_automatic_post/
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Intended Audience :: Legal Industry
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Natural Language :: English
Classifier: Natural Language :: French
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Office/Business
Requires-Python: >=3.6
License-File: LICENSE

#########################################
Hb Bank Statement Machine Learning Module
#########################################

...


*******
Install
*******

Dependencies for ArchLinux

.. code-block::

    sudo pacman -S cairo pkgconf gobject-introspection


Dependencies for debian


.. code-block::

    sudo apt-get install libcairo2-dev libgirepository1.0-dev


Install the package

.. code-block::

    # installs python deps
    pip install hb_tryton_sale_subscription_automatic_post
    # install the module
    trytond-admin -u sale_subscription_automatic_post --activate-dependencies


Install the db by hb-tryton-devtools

.. code-block::

    pip install git+https://gitlab.com/hashbangfr/tryton-modules/hb_tryton_devtools.git#egg=hb_tryton_devtools
    export TRYTON_DATABASE_URI=postgresql:///
    export TRYTON_DATABASE_NAME=test
    hb-tryton-admin create-db --modules sale_subscription_automatic_post


************
Test package
************

The package need pytest and hb-tryton-devtools

.. code-block::

    pip install pytest pytest-cov
    pip install git+ssh://git@gitlab.com/hashbangfr/tryton-modules/hb_tryton_devtools.git#egg=hb_tryton_devtools


Run the test with pytest with environ variable

.. code-block::

    export TRYTON_DATABASE_URI=postgresql:///
    export TRYTON_DATABASE_NAME=test
    pytest sale_subscription_automatic_post/tests

******
Design
******

This module adds new fields to the Subscription Model and the Sale Configuration
model.

The field "Invoice State" of the Subscription Model allows to set, for each
instance of Subscription, to set the state of the invoices that will be
generated : draft, validated or posted.

The default value of this field is set by the field "Default Subscription
invoice state" of the Sale Configuration model.

*****
Usage
*****

Setting the state of the invoices generated by a subscription
-------------------------------------------------------------

When creating a new subscription, select a state (draft, validated or posted) in
the "Invoice State" field, set up all the subscription, quote and run. Then,
when running the Consumption Creation wizard and the Invoice Creation wizard,
all the invoices linked to this subscription will have the state of the "Invoice
State" field of the subscription.

Setting the default value of the invoice state of a subscription
----------------------------------------------------------------

Open the Sale Configuration menu, and select a state (draft, validated or
posted) in the "Default Subscription invoice state" field. Then, when creating a
new Subscription, the default value of the "Invoice State" will be the value
selected in the Sale Configuration. The value of "Invoice State" is still
editable.

When the "Default Subscription invoice state" field is empty, the default value
of "Invoice State" is draft.


*********
CHANGELOG
*********

1.0.0 (2022-05-17)
------------------

* Added field on subcription to indicate if the invoice will be posted or not.
