diff --git a/quality_control_oca/README.rst b/quality_control_oca/README.rst index c742b61f38..734d95bdd8 100644 --- a/quality_control_oca/README.rst +++ b/quality_control_oca/README.rst @@ -7,7 +7,7 @@ Quality Control OCA !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:6fb9b191b38582ebba5b4717a2666ce0afc2e2fde98cade2b2cba4010a1c7111 + !! source digest: sha256:9416315bac2077c0ab38d72f229416d9fb0412fd00b8f74e72953166aaa7ad9b !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -109,6 +109,7 @@ Contributors * `Trey Kilobytes de Soluciones SL `__: * Vicent Cubells +* David Alonso Other credits ~~~~~~~~~~~~~ diff --git a/quality_control_oca/__manifest__.py b/quality_control_oca/__manifest__.py index 43ee7f26fd..940d617b3e 100644 --- a/quality_control_oca/__manifest__.py +++ b/quality_control_oca/__manifest__.py @@ -3,6 +3,7 @@ # Copyright 2014 Oihane Crucelaegui - AvanzOSC # Copyright 2017-2020 ForgeFlow S.L. # Copyright 2017 Simone Rubino - Agile Business Group +# Copyright 2023 Solvos Consultoría Informática, S.L. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { @@ -25,6 +26,7 @@ "views/qc_test_view.xml", "views/qc_trigger_view.xml", "views/product_template_view.xml", + "views/product_product_view.xml", "views/product_category_view.xml", ], "demo": ["demo/quality_control_demo.xml"], diff --git a/quality_control_oca/models/product_product.py b/quality_control_oca/models/product_product.py index 41d23c0c6e..e14d915533 100644 --- a/quality_control_oca/models/product_product.py +++ b/quality_control_oca/models/product_product.py @@ -3,9 +3,9 @@ # Copyright 2014 Oihane Crucelaegui - AvanzOSC # Copyright 2017 ForgeFlow S.L. # Copyright 2017 Simone Rubino - Agile Business Group +# Copyright 2023 Solvos Consultoría Informática, S.L. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -import ast from odoo import fields, models @@ -54,26 +54,3 @@ def _compute_count_inspections(self): product.done_inspections = ( product.passed_inspections + product.failed_inspections ) - - def button_qc_inspection_per_product(self): - return self._action_qc_inspection_per_product() - - def _action_qc_inspection_per_product(self): - product_ids = self.ids - action = self.env["ir.actions.act_window"]._for_xml_id( - "quality_control_oca.action_qc_inspection" - ) - domain = [("product_id", "in", product_ids)] - qc_type = self.env.context.get("qc_type", "all") - if qc_type == "done": - domain.append(("state", "not in", ["draft", "waiting"])) - elif qc_type == "passed": - domain.append(("state", "=", "success")) - elif qc_type == "failed": - domain.append(("state", "=", "failed")) - action["domain"] = domain - if len(product_ids) == 1: - context = ast.literal_eval(action.get("context")) - context["default_object_id"] = "product.product,%s" % product_ids[0] - action["context"] = context - return action diff --git a/quality_control_oca/static/description/index.html b/quality_control_oca/static/description/index.html index 6491dcdc66..8cc79ca1fb 100644 --- a/quality_control_oca/static/description/index.html +++ b/quality_control_oca/static/description/index.html @@ -367,7 +367,7 @@

Quality Control OCA

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:6fb9b191b38582ebba5b4717a2666ce0afc2e2fde98cade2b2cba4010a1c7111 +!! source digest: sha256:9416315bac2077c0ab38d72f229416d9fb0412fd00b8f74e72953166aaa7ad9b !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/manufacture Translate me on Weblate Try me on Runboat

This module provides a generic infrastructure for quality tests. The idea is @@ -459,6 +459,7 @@

Contributors

  • Vicent Cubells
  • +
  • David Alonso <david.alonso@solvos.es>
  • diff --git a/quality_control_oca/tests/test_quality_control.py b/quality_control_oca/tests/test_quality_control.py index 276126d281..81074a2cca 100644 --- a/quality_control_oca/tests/test_quality_control.py +++ b/quality_control_oca/tests/test_quality_control.py @@ -3,6 +3,7 @@ # Copyright 2014 Oihane Crucelaegui - AvanzOSC # Copyright 2017 ForgeFlow S.L. # Copyright 2017 Simone Rubino - Agile Business Group +# Copyright 2023 Solvos Consultoría Informática, S.L. # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import exceptions @@ -204,15 +205,7 @@ def test_qc_inspection_product(self): ) self.assertEqual(self.inspection1.product_id, self.product) self.assertEqual(self.product.created_inspections, 1) - action_prod = self.product._action_qc_inspection_per_product() - self.assertEqual(action_prod["domain"][0][2][0], self.product.id) - self.assertEqual( - action_prod["context"]["default_object_id"], - "product.product,%s" % self.product.id, - ) self.assertEqual(self.product.product_tmpl_id.created_inspections, 1) - action_tmpl = self.product.product_tmpl_id.button_qc_inspection_per_product() - self.assertTrue(self.product.id in action_tmpl["domain"][0][2]) def test_qc_test_question_constraints(self): with self.assertRaises(exceptions.ValidationError): diff --git a/quality_control_oca/views/product_product_view.xml b/quality_control_oca/views/product_product_view.xml new file mode 100644 index 0000000000..38135b2b76 --- /dev/null +++ b/quality_control_oca/views/product_product_view.xml @@ -0,0 +1,66 @@ + + + + + product.product.form (in quality_control_oca) + product.product + + + +
    + + + + +
    +
    +
    +
    diff --git a/quality_control_oca/views/product_template_view.xml b/quality_control_oca/views/product_template_view.xml index 5a2ca2528c..91f9f00a6d 100644 --- a/quality_control_oca/views/product_template_view.xml +++ b/quality_control_oca/views/product_template_view.xml @@ -4,6 +4,7 @@ Copyright 2014 Oihane Crucelaegui - AvanzOSC Copyright 2017 ForgeFlow S.L. Copyright 2017 Simone Rubino - Agile Business Group + Copyright 2023 Solvos Consultoría Informática, S.L. License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> @@ -14,14 +15,41 @@ name="groups_id" eval="[(4, ref('quality_control_oca.group_quality_control_user'))]" /> + + + + + + + + + + + + + + + + + product.template.product.form (in quality_control_oca) + product.template + +
    - - - - - - - - - - - -
    diff --git a/quality_control_oca/views/qc_inspection_view.xml b/quality_control_oca/views/qc_inspection_view.xml index b02e6cfa3f..0a2268c339 100644 --- a/quality_control_oca/views/qc_inspection_view.xml +++ b/quality_control_oca/views/qc_inspection_view.xml @@ -4,6 +4,7 @@ Copyright 2014 Oihane Crucelaegui - AvanzOSC Copyright 2017 ForgeFlow S.L. Copyright 2017 Simone Rubino - Agile Business Group + Copyright 2023 Solvos Consultoría Informática, S.L. License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> @@ -141,7 +142,10 @@ - + @@ -223,6 +227,88 @@ qc.inspection tree,form + + All Inspections + qc.inspection + tree,form + [("product_id.product_tmpl_id", "=", active_id)] + + + Done Inspections + qc.inspection + tree,form + [ + ("product_id.product_tmpl_id", "=", active_id), + ("state", "not in", ["draft", "waiting"]), + ] + + + Passed Inspections + qc.inspection + tree,form + [ + ("product_id.product_tmpl_id", "=", active_id), + ("state", "=", "success"), + ] + + + Failed Inspections + qc.inspection + tree,form + [ + ("product_id.product_tmpl_id", "=", active_id), + ("state", "=", "failed"), + ] + + + All Inspections + qc.inspection + tree,form + [("product_id", "=", active_id)] + {"hide_product": True} + + + Done Inspections + qc.inspection + tree,form + [ + ("product_id", "=", active_id), + ("state", "not in", ["draft", "waiting"]), + ] + {"hide_product": True} + + + Passed Inspections + qc.inspection + tree,form + [ + ("product_id", "=", active_id), + ("state", "=", "success"), + ] + {"hide_product": True} + + + Failed Inspections + qc.inspection + tree,form + [ + ("product_id", "=", active_id), + ("state", "=", "failed"), + ] + {"hide_product": True} +