Metadata-Version: 2.4
Name: odoo-addon-crm_lead_dms_category
Version: 16.0.1.2.0
Summary: Category to mark the required documents on crm.lead
Home-page: https://gitlab.com/somitcoop/erp-research/odoo-helpdesk
Author: Som It Cooperatiu SCCL, Som Connexió SCCL, Odoo Community Association (OCA)
Author-email: support@odoo-community.org
License: AGPL-3
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 16.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Requires-Python: >=3.10
Requires-Dist: odoo-addon-component_event<16.1dev,>=16.0dev
Requires-Dist: odoo-addon-dms<16.1dev,>=16.0dev
Requires-Dist: odoo<16.1dev,>=16.0a
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: license
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

#######################
 CRM LEAD DMS CATEGORY
#######################

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
   :alt: Beta
   :target: https://odoo-community.org/page/development-status

.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
   :alt: License: AGPL-3
   :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html

|badge1| |badge2|

This module lets a ``crm.lead`` be marked with the ``dms.category``
records it requires documentation for, and tracks whether that
documentation has actually been uploaded.

*********************
 Required categories
*********************

The ``dms_category_ids`` many2many field on ``crm.lead`` holds the
``dms.category`` records required for that lead. It is shown on the lead
form, next to the tags.

The ``dms_category_ids`` field is editable on the lead form, inside the
"documentation" tab. Also within the tab, the categories are shown as
tags, and the field ``has_all_required_documentation`` is shown as a
toggle button.

*********************************
 Required documentation tracking
*********************************

The ``has_all_required_documentation`` computed field (``store=True``)
on ``crm.lead`` is ``True`` when every category in ``dms_category_ids``
has a matching ``dms.file`` uploaded on the lead itself.

Because ``dms.file`` only references its record through a generic
``res_model``/``res_id`` pair (like ``ir.attachment``), the field cannot
be expressed with a plain ``@api.depends``. It is instead kept up to
date through a listener on ``dms.file`` creation, and through an
``unlink`` override - both scoped to files whose ``res_model`` is
``crm.lead``.

Extension points
================

This module only looks at documents uploaded directly on the lead. Other
modules can extend where documents are looked up, or react once the
required documentation is complete, by overriding:

-  ``_get_uploaded_document_categories``: which categories already have
   an uploaded document. ``crm_lead_personal_file_data`` overrides it to
   also count documents uploaded on the lead's partner.

-  ``_update_documentation_from_upload``: computes the already uploaded
   categories to check if the lead has all required documentation. It
   can be overridden to react to the documentation being complete

**Table of contents**

.. contents::
   :local:

Configuration
-------------

No specific configuration is required.

Usage
-----

Assign the required categories to a lead through the
``dms_category_ids`` field on its form view. From then on,
``has_all_required_documentation`` is kept up to date automatically as
documents are uploaded to or removed from the lead.

Known issues / Roadmap
----------------------

Documentation is not created directly on the partner for now, so uploads
or deletions scoped to ``res.partner`` do not refresh the flag by
themselves; see ``crm_lead_personal_file_data`` for the partner
extension.

Bug Tracker
-----------

Bugs are tracked on `GitLab Issues
<https://gitlab.com/somitcoop/erp-research/odoo-helpdesk/-/issues>`_. In
case of trouble, please check there if your issue has already been
reported. If you spotted it first, help us smashing it by providing a
detailed and welcomed feedback.

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

Credits
-------

*********
 Authors
*********

-  SomIT SCCL
-  Som Connexio SCCL

**************
 Contributors
**************

-  `SomIT SCCL <https://somit.coop>`_:

      -  Álvaro García <alvaro.garcia@somit.coop>
      -  José Robles <jose.robles@somit.coop>
      -  Juan Manuel Regalado <juanmanuel.regalado@somit.coop>

-  `Som Connexio SCCL <https://somconnexio.coop>`_:

      -  Gerard Funosas <gerard.funosas@somconnexio.coop>

*************
 Maintainers
*************

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

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.

You are welcome to contribute. To learn how please visit
https://odoo-community.org/page/Contribute.
