Skip to content

Commit

Permalink
[17.0][MIG] documents_quality (#831)
Browse files Browse the repository at this point in the history
  • Loading branch information
santiagordz authored Aug 30, 2024
1 parent 9c25c69 commit c1e57cc
Show file tree
Hide file tree
Showing 15 changed files with 535 additions and 0 deletions.
98 changes: 98 additions & 0 deletions documents_quality/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
=====================
Documents for Quality
=====================

.. |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/licence-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fosi--addons-lightgray.png?logo=github
:target: https://github.com/OCA/osi-addons/tree/14.0/osi_custom_profit_loss
:alt: OCA/osi-addons

|badge1| |badge2| |badge3|

This module provides 3 documents folders where all the files attached to:

* quality control points
* quality checks
* quality alerts

will be available.

**Table of contents**

.. contents::
:local:

Configure
=========

* Go to Documents > Settings
* Activate the settings
* Change the folder
* Set the tags

Usage
=====

* Go to Quality > Quality Control > Control Points (or Quality Checks or Quality Alerts)
* Create or open a record
* Upload a file as an attachment
* Go to Documents
* Select the Quality Control Points (or Quality Checks or Quality Alerts) folder
* Select the file uploaded previously. It is linked to the quality control point
(or quality check or quality alert).

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/osi-addons/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 <https://github.com/OCA/osi-addons/issues/new?body=module:%20documents_quality%0Aversion:%2014.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.

Credits
=======

Authors
~~~~~~~

* Open Source Integrators

Contributors
~~~~~~~~~~~~

* `Open Source Integrators <https://www.opensourceintegrators.com>`__:

* Antonio Yamuta <[email protected]>
* Maxime Chambreuil <[email protected]>
* Melody Fetterly <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by Open Source Integrators.

.. image:: https://github.com/ursais.png
:alt: Open Source Integrators
:target: https://www.opensourceintegrators.com

Open Source Integrators™ (OSI) provides customers a unique combination of
open source business process consulting and implementations.

.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px
:target: https://github.com/max3903
:alt: max3903

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-max3903|

This module is part of the `OSI Addons <https://github.com/ursais/osi-addons>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions documents_quality/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (C) 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from . import models
22 changes: 22 additions & 0 deletions documents_quality/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (C) 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
{
"name": "Documents - Quality",
"summary": "Documents for Quality Control Points, Checks and Alerts",
"category": "Productivity/Documents",
"website": "https://github.com/ursais/osi-addons",
"author": "Open Source Integrators",
"maintainer": "Open Source Integrators",
"version": "17.0.1.0.0",
"license": "LGPL-3",
"depends": ["documents", "quality"],
"data": [
"data/documents_folder.xml",
"data/res_company.xml",
"data/documents_facet.xml",
"data/documents_tag.xml",
"views/res_config_settings.xml",
],
"development_status": "Beta",
"maintainers": ["max3903"],
}
21 changes: 21 additions & 0 deletions documents_quality/data/documents_facet.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<odoo noupdate="1">

<record id="documents_quality_point_facet" model="documents.facet">
<field name="name">Documents</field>
<field name="sequence">5</field>
<field name="folder_id" ref="documents_quality_point_folder" />
</record>

<record id="documents_quality_check_facet" model="documents.facet">
<field name="name">Documents</field>
<field name="sequence">5</field>
<field name="folder_id" ref="documents_quality_check_folder" />
</record>

<record id="documents_quality_alert_facet" model="documents.facet">
<field name="name">Documents</field>
<field name="sequence">5</field>
<field name="folder_id" ref="documents_quality_alert_folder" />
</record>

</odoo>
26 changes: 26 additions & 0 deletions documents_quality/data/documents_folder.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<odoo noupdate="1">

<record id="documents_quality_folder" model="documents.folder">
<field name="name">Quality</field>
<field name="sequence">20</field>
</record>

<record id="documents_quality_point_folder" model="documents.folder">
<field name="name">Control Points</field>
<field name="sequence">20</field>
<field name="parent_folder_id" ref="documents_quality_folder" />
</record>

<record id="documents_quality_check_folder" model="documents.folder">
<field name="name">Checks</field>
<field name="sequence">25</field>
<field name="parent_folder_id" ref="documents_quality_folder" />
</record>

<record id="documents_quality_alert_folder" model="documents.folder">
<field name="name">Alerts</field>
<field name="sequence">30</field>
<field name="parent_folder_id" ref="documents_quality_folder" />
</record>

</odoo>
21 changes: 21 additions & 0 deletions documents_quality/data/documents_tag.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<odoo noupdate="1">

<record id="documents_tag_point_new" model="documents.tag">
<field name="name">New</field>
<field name="facet_id" ref="documents_quality_point_facet" />
<field name="sequence">10</field>
</record>

<record id="documents_tag_check_new" model="documents.tag">
<field name="name">New</field>
<field name="facet_id" ref="documents_quality_check_facet" />
<field name="sequence">10</field>
</record>

<record id="documents_tag_alert_new" model="documents.tag">
<field name="name">New</field>
<field name="facet_id" ref="documents_quality_alert_facet" />
<field name="sequence">10</field>
</record>

</odoo>
9 changes: 9 additions & 0 deletions documents_quality/data/res_company.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<odoo noupdate="1">

<record id="base.main_company" model="res.company">
<field name="quality_point_folder" ref="documents_quality_point_folder" />
<field name="quality_check_folder" ref="documents_quality_check_folder" />
<field name="quality_alert_folder" ref="documents_quality_alert_folder" />
</record>

</odoo>
9 changes: 9 additions & 0 deletions documents_quality/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (C) 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from . import (
quality_point,
quality_check,
quality_alert,
res_config_settings,
res_company,
)
23 changes: 23 additions & 0 deletions documents_quality/models/quality_alert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (C) 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import models


class QualityAlert(models.Model):
_name = "quality.alert"
_inherit = ["quality.alert", "documents.mixin"]

def _get_document_tags(self):
company = self.company_id or self.env.company
return company.quality_alert_tags

def _get_document_folder(self):
company = self.company_id or self.env.company
return company.quality_alert_folder

def _check_create_documents(self):
company = self.company_id or self.env.company
return (
company.documents_quality_alert_settings
and super()._check_create_documents()
)
23 changes: 23 additions & 0 deletions documents_quality/models/quality_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (C) 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import models


class QualityCheck(models.Model):
_name = "quality.check"
_inherit = ["quality.check", "documents.mixin"]

def _get_document_tags(self):
company = self.company_id or self.env.company
return company.quality_check_tags

def _get_document_folder(self):
company = self.company_id or self.env.company
return company.quality_check_folder

def _check_create_documents(self):
company = self.company_id or self.env.company
return (
company.documents_quality_check_settings
and super()._check_create_documents()
)
23 changes: 23 additions & 0 deletions documents_quality/models/quality_point.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (C) 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import models


class QualityPoint(models.Model):
_name = "quality.point"
_inherit = ["quality.point", "documents.mixin"]

def _get_document_tags(self):
company = self.company_id or self.env.company
return company.quality_point_tags

def _get_document_folder(self):
company = self.company_id or self.env.company
return company.quality_point_folder

def _check_create_documents(self):
company = self.company_id or self.env.company
return (
company.documents_quality_point_settings
and super()._check_create_documents()
)
47 changes: 47 additions & 0 deletions documents_quality/models/res_company.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright (C) 2021 Open Source Integrators
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import fields, models


class ResCompany(models.Model):
_inherit = "res.company"

def _domain_company(self):
company = self.env.company or self.env.user.company_id.id
return ["|", ("company_id", "=", False), ("company_id", "=", company)]

# Quality Control Points
documents_quality_point_settings = fields.Boolean()
quality_point_folder = fields.Many2one(
"documents.folder",
string="Quality Control Points Workspace",
domain=_domain_company,
default=lambda self: self.env.ref(
"documents_quality_point_folder", raise_if_not_found=False
),
)
quality_point_tags = fields.Many2many("documents.tag", "quality_point_tags_table")

# Quality Checks
documents_quality_check_settings = fields.Boolean()
quality_check_folder = fields.Many2one(
"documents.folder",
string="Quality Checks Workspace",
domain=_domain_company,
default=lambda self: self.env.ref(
"documents_quality_check_folder", raise_if_not_found=False
),
)
quality_check_tags = fields.Many2many("documents.tag", "quality_check_tags_table")

# Quality Alerts
documents_quality_alert_settings = fields.Boolean()
quality_alert_folder = fields.Many2one(
"documents.folder",
string="Quality Alerts Workspace",
domain=_domain_company,
default=lambda self: self.env.ref(
"documents_quality_alert_folder", raise_if_not_found=False
),
)
quality_alert_tags = fields.Many2many("documents.tag", "quality_alert_tags_table")
Loading

0 comments on commit c1e57cc

Please sign in to comment.