Skip to content

Commit

Permalink
[16.0][ADD] quality_control_attachment_oca: This module allows you to…
Browse files Browse the repository at this point in the history
… add attachments to quality control inspections

[16.0][IMP] quality_control_attachment_oca: Add module in setup

[16.0][ADD] quality_control_attachment_oca: This module allows you to add attachments to quality control inspections

[16.0][IMP] quality_control_attachment_oca: Add tests
  • Loading branch information
edescalona committed Feb 6, 2025
1 parent 3271ae2 commit 1dbc6ee
Show file tree
Hide file tree
Showing 26 changed files with 1,136 additions and 0 deletions.
125 changes: 125 additions & 0 deletions quality_control_attachment_oca/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
==============================
Quality Control Attachment OCA
==============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a6f480007b752e1c4d7cdf4fbca90ca60c4725597d282ef1d9595a1c64b4ee44
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github
:target: https://github.com/OCA/manufacture/tree/16.0/quality_control_attachment_oca
:alt: OCA/manufacture
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/manufacture-16-0/manufacture-16-0-quality_control_attachment_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/manufacture&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows you to add attachments to quality control inspections.

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

This module implements additional featured for the `Quality Control OCA <https://github.com/OCA/manufacture/tree/16.0/quality_control_oca>`_ module.

It covers the following scenarios:

* Allows you to add documents (images, files, etc.) to inspections for better verification of quality control.

Usage
=====

Add documents to inspections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Go to *Quality Control > Inspections > Inspections*.
#. Add a new inspection.
#. Add a new test, using the smart button *Set test*.

.. image:: https://raw.githubusercontent.com/quality_control_attachment_oca/static/src/img/add_test.png
:height: 100
:width: 200
:alt: Add test

#. Once the test is selected, a new tab will be enabled in which you can add attachments

.. image:: https://raw.githubusercontent.com/quality_control_attachment_oca/static/src/img/enable_attachment.png
:height: 100
:width: 200
:alt: Enable attachment

#. Start adding documents.

Add required documents to inspections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Go to *Quality Control > Tests > Tests*.
#. Add a new test.
#. Check the *Require attachment* field.

.. image:: https://raw.githubusercontent.com/quality_control_attachment_oca/static/src/img/enable_required_attachment.png
:height: 100
:width: 200
:alt: Enable attachment

#. When performing the steps of *Add documents to inspections* it would be mandatory to add at least one attachment.

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

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

* Binhexteam

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

* `Binhex Cloud <https://www.binhex.cloud/>`_:

* Edilio Escalona Almira

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.

This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/16.0/quality_control_attachment_oca>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions quality_control_attachment_oca/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from . import wizard
from . import models
18 changes: 18 additions & 0 deletions quality_control_attachment_oca/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2025 Edilio Escalona Almira - Binhexteam
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Quality Control Attachment OCA",
"version": "16.0.1.0.0",
"category": "Quality Control",
"license": "AGPL-3",
"summary": "This module allows you to add attachments to quality control inspections.",
"author": "Binhexteam, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/manufacture",
"depends": ["quality_control_oca"],
"data": [
"""views/qc_inspection_views.xml""",
"""views/qc_test_views.xml""",
],
"installable": True,
}
71 changes: 71 additions & 0 deletions quality_control_attachment_oca/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * quality_control_attachment_oca
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-02-05 16:35+0000\n"
"PO-Revision-Date: 2025-02-05 16:35+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: quality_control_attachment_oca
#: model:ir.model,name:quality_control_attachment_oca.model_ir_attachment
msgid "Attachment"
msgstr "Archivo adjunto"

#. module: quality_control_attachment_oca
#: model:ir.model.fields,field_description:quality_control_attachment_oca.field_qc_inspection__attachment_ids
#: model_terms:ir.ui.view,arch_db:quality_control_attachment_oca.qc_inspection_form_view
msgid "Attachments"
msgstr "Adjuntos"

#. module: quality_control_attachment_oca
#. odoo-python
#: code:addons/quality_control_attachment_oca/models/qc_test.py:0
#: model:ir.model.fields,help:quality_control_attachment_oca.field_qc_inspection__is_required_attachment
#: model:ir.model.fields,help:quality_control_attachment_oca.field_qc_test__is_required_attachment
#, python-format
msgid ""
"Defines whether at least one attachment should be added to the inspection"
msgstr ""
"Define si se debe agregar al menos un archivo adjunto a la inspección."

#. module: quality_control_attachment_oca
#: model_terms:ir.ui.view,arch_db:quality_control_attachment_oca.qc_inspection_form_view
msgid "File"
msgstr "Archivo"

#. module: quality_control_attachment_oca
#: model:ir.model.fields,field_description:quality_control_attachment_oca.field_ir_attachment__qc_inspection_id
msgid "Qc Inspection"
msgstr "Qc Inspección"

#. module: quality_control_attachment_oca
#: model:ir.model,name:quality_control_attachment_oca.model_qc_inspection
msgid "Quality control inspection"
msgstr "Inspección del control de calidad"

#. module: quality_control_attachment_oca
#: model:ir.model,name:quality_control_attachment_oca.model_qc_test
msgid "Quality control test"
msgstr "Test del control de calidad"

#. module: quality_control_attachment_oca
#: model:ir.model.fields,field_description:quality_control_attachment_oca.field_qc_inspection__is_required_attachment
#: model:ir.model.fields,field_description:quality_control_attachment_oca.field_qc_test__is_required_attachment
msgid "Required attachment"
msgstr "Requiere archivo adjunto."

#. module: quality_control_attachment_oca
#. odoo-python
#: code:addons/quality_control_attachment_oca/models/qc_inspection.py:0
#, python-format
msgid "You must add at least one attachment."
msgstr "Debes agregar al menos un archivo adjunto."
4 changes: 4 additions & 0 deletions quality_control_attachment_oca/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import ir_attachment
from . import qc_inspection
from . import qc_test
10 changes: 10 additions & 0 deletions quality_control_attachment_oca/models/ir_attachment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2025 Edilio Escalona Almira - Binhexteam
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class IrAttachment(models.Model):
_inherit = "ir.attachment"

qc_inspection_id = fields.Many2one("qc.inspection", ondelete="cascade")
34 changes: 34 additions & 0 deletions quality_control_attachment_oca/models/qc_inspection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2025 Edilio Escalona Almira - Binhexteam
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError


class QcInspection(models.Model):
_inherit = "qc.inspection"

attachment_ids = fields.One2many(
"ir.attachment", "qc_inspection_id", string="Attachments"
)
is_required_attachment = fields.Boolean(related="test.is_required_attachment")

def _check_is_required_attachment(self):
context = dict(self.env.context)
if not context.get("qc_inspection_set_test", False):
for rec in self:
if rec.is_required_attachment:
if not rec.attachment_ids:
raise ValidationError(
_("You must add at least one attachment.")
)

@api.model_create_multi
def create(self, vals_list):
res = super().create(vals_list)
self._check_is_required_attachment()
return res

def write(self, vals):
res = super().write(vals)
self._check_is_required_attachment()
return res
14 changes: 14 additions & 0 deletions quality_control_attachment_oca/models/qc_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2025 Edilio Escalona Almira - Binhexteam
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class QcTest(models.Model):
_inherit = "qc.test"

is_required_attachment = fields.Boolean(
string="Required attachment",
default=False,
help="Defines whether at least one attachment should be added to the inspection",
)
5 changes: 5 additions & 0 deletions quality_control_attachment_oca/readme/CONTEXT.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module implements additional featured for the `Quality Control OCA <https://github.com/OCA/manufacture/tree/16.0/quality_control_oca>`_ module.

It covers the following scenarios:

* Allows you to add documents (images, files, etc.) to inspections for better verification of quality control.
3 changes: 3 additions & 0 deletions quality_control_attachment_oca/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Binhex Cloud <https://www.binhex.cloud/>`_:

* Edilio Escalona Almira
1 change: 1 addition & 0 deletions quality_control_attachment_oca/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module allows you to add attachments to quality control inspections.
34 changes: 34 additions & 0 deletions quality_control_attachment_oca/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Add documents to inspections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Go to *Quality Control > Inspections > Inspections*.
#. Add a new inspection.
#. Add a new test, using the smart button *Set test*.

.. image:: /quality_control_attachment_oca/static/src/img/add_test.png
:height: 100
:width: 200
:alt: Add test

#. Once the test is selected, a new tab will be enabled in which you can add attachments

.. image:: /quality_control_attachment_oca/static/src/img/enable_attachment.png
:height: 100
:width: 200
:alt: Enable attachment

#. Start adding documents.

Add required documents to inspections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Go to *Quality Control > Tests > Tests*.
#. Add a new test.
#. Check the *Require attachment* field.

.. image:: /quality_control_attachment_oca/static/src/img/enable_required_attachment.png
:height: 100
:width: 200
:alt: Enable attachment

#. When performing the steps of *Add documents to inspections* it would be mandatory to add at least one attachment.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1dbc6ee

Please sign in to comment.