Metadata-Version: 2.5
Name: trytond_cmdb_contract
Version: 8.0.0.2
Summary: Tryton module cmdb_contract
Author: Clemens Hupka
Maintainer-email: Clemens Hupka <issues@tryton-erp.eu>
License-Expression: GPL-3.0-or-later
License-File: COPYRIGHT
License-File: LICENSE
License-File: icons/LICENSE
Keywords: cmdb_contract,tryton
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Topic :: Office/Business
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: trytond-cmdb<8.1,>=8.0
Requires-Dist: trytond-currency<8.1,>=8.0
Requires-Dist: trytond-party<8.1,>=8.0
Requires-Dist: trytond<8.1,>=8.0
Provides-Extra: test
Requires-Dist: trytond-account-invoice<8.1,>=8.0; extra == 'test'
Requires-Dist: trytond-purchase<8.1,>=8.0; extra == 'test'
Description-Content-Type: text/x-rst

CMDB Contract Module
====================

The ``cmdb_contract`` module records the agreements that cover the
configuration items of the CMDB: warranty, support, maintenance, lease,
rental, insurance and service level contracts.

A production CMDB has to answer *what does this asset cost us and until
when is it covered*.  The assets carry their warranty and end-of-life
dates, but until this module there was no contract entity: no vendor
agreement, no renewal date, no notice period, no cost and no SLA data.
``cmdb_license`` covers software licences (entitlements and quantities)
only, with no date-based contract semantics, and ``party.party`` records
the vendor link but not the agreement.

Scope
-----

- Contract definitions: name, unique code, type, vendor, start, end and
  renewal dates, auto-renewal, notice period, cost with currency and
  payment period, reference, description, documents and the CMDB state
  fields.
- Coverage: a contract links to the configuration items it covers,
  chosen from the CI models of the suite, each line carrying a covered
  flag and the covered serial or quantity.
- SLA data: response and resolution times, availability target, support
  hours and an escalation contact -- the fields an incident is measured
  against.
- Expiry automation: a derived, searchable status and a cron that
  gathers the contracts due inside a configurable horizon and, when
  asked, opens a CMDB incident for the expired ones.
- Cost roll-up: an annualised cost per contract and the roll-up of the
  contracts in force per configuration item.

States
------

The **status** of a contract is derived from its dates, its notice
period and its termination flag:

- ``terminated`` -- the ``terminated`` flag is set.
- ``draft`` -- it has not started (no ``start_date`` or one in the
  future).
- ``expired`` -- its ``end_date`` has passed.
- ``expiring`` -- today is inside the notice period before the renewal
  date (an auto-renewed contract) or before the end date.
- ``active`` -- in force and outside the notice window.

The status is searchable and drives the *Expiring Contracts* window.

Cost
----

``annualised_cost`` normalises the ``cost`` of one payment period to a
year: monthly costs are multiplied by twelve, quarterly by four, yearly
stay as they are and a one-off cost does not roll up.  The roll-up of
the contracts in force that cover a configuration item is exposed as
``cmdb.cmdb.cmdb_contract_cost`` and the covered contracts as
``cmdb.cmdb.cmdb_contracts``.

Expiry cron
-----------

``cmdb_contract.contract|warn_expiring`` lists every contract that is
not terminated and whose end date or renewal date falls inside the
``contract_renewal_horizon`` of the CMDB configuration.  When the
``contract_expiry_create_incident`` setting is checked, the cron opens a
CMDB incident for each expired contract.

Optional dependencies
---------------------

``purchase`` and ``account_invoice`` are *extra* dependencies, never a
hard one: the module installs without them, links a contract to the
purchase line it originates from when ``purchase`` is present, and to
the invoice lines that carry its cost when ``account_invoice`` is
present.

Constraints
-----------

- ``code`` is unique on a contract.
- A configuration item can only be linked once to a contract (a unique
  ``(contract, ci)`` pair).
- ``end_date`` and ``renewal_date`` must be on or after ``start_date``.
- ``notice_period_days`` and ``cost`` must be non-negative, the notice
  window must not start before ``start_date``, and the availability
  target must be a percentage between 0 and 100.
