diff --git a/quality_control_mrp/README.rst b/quality_control_mrp/README.rst index 8ebfd491f..297ba3160 100644 --- a/quality_control_mrp/README.rst +++ b/quality_control_mrp/README.rst @@ -1,3 +1,8 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +================================= MRP extension for quality control ================================= @@ -6,7 +11,42 @@ production order is finished. It also adds the shortcuts related to these inspections on production orders. + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/129/8.0 + + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `here `_. + + +Credits +======= + Contributors ------------ - * Pedro M. Baeza +* Oihane Crucelaegui + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +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. + +To contribute to this module, please visit http://odoo-community.org. diff --git a/quality_control_mrp/__openerp__.py b/quality_control_mrp/__openerp__.py index bb9b6d7f7..c88440fbe 100644 --- a/quality_control_mrp/__openerp__.py +++ b/quality_control_mrp/__openerp__.py @@ -1,40 +1,26 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Copyright (c) -# 2014 Serv. Tec. Avanzados - Pedro M. Baeza (http://www.serviciosbaeza.com) -# 2014 AvanzOsc (http://www.avanzosc.es) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published -# by the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# -*- coding: utf-8 -*- +# (c) 2014 Serv. Tec. Avanzados - Pedro M. Baeza +# (c) 2014 Oihane Crucelaegui - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html { "name": "Quality control - MRP", - "version": "1.0", - "author": "OdooMRP team," - "AvanzOSC," - "Serv. Tecnol. Avanzados - Pedro M. Baeza", + "version": "8.0.1.0.0", + "category": "Quality control", + "license": "AGPL-3", + "author": "OdooMRP team, " + "AvanzOSC, " + "Serv. Tecnol. Avanzados - Pedro M. Baeza, " + "Odoo Community Association (OCA)", "website": "http://www.odoomrp.com", "contributors": [ - "Pedro M. Baeza ", + "Oihane Crucelaegui ", ], - "category": "Quality control", "depends": [ - 'quality_control', - 'quality_control_stock', - 'mrp', + "quality_control", + "quality_control_stock", + "mrp", ], "data": [ 'data/quality_control_mrp_data.xml', diff --git a/quality_control_mrp/i18n/quality_control_mrp.pot b/quality_control_mrp/i18n/quality_control_mrp.pot deleted file mode 100644 index d7bb4f7bd..000000000 --- a/quality_control_mrp/i18n/quality_control_mrp.pot +++ /dev/null @@ -1,44 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * quality_control_mrp -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 8.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-12-10 17:45+0000\n" -"PO-Revision-Date: 2014-12-10 17:45+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_mrp -#: help:mrp.production,qc_inspections:0 -msgid "Inspections related to this production." -msgstr "" - -#. module: quality_control_mrp -#: view:qc.inspection:quality_control_mrp.qc_inspection_search_view_production -#: field:qc.inspection,production:0 -msgid "Production" -msgstr "" - -#. module: quality_control_mrp -#: model:qc.trigger,name:quality_control_mrp.qc_trigger_mrp -msgid "Production done" -msgstr "" - -#. module: quality_control_mrp -#: view:qc.inspection.line:quality_control_mrp.qc_inspection_line_search_production_view -#: field:qc.inspection.line,production:0 -msgid "Production order" -msgstr "" - -#. module: quality_control_mrp -#: view:mrp.production:quality_control_mrp.mrp_production_qc_view -msgid "inspections" -msgstr "" - diff --git a/quality_control_mrp/models/mrp_production.py b/quality_control_mrp/models/mrp_production.py index bb50d1387..3455790f9 100644 --- a/quality_control_mrp/models/mrp_production.py +++ b/quality_control_mrp/models/mrp_production.py @@ -3,6 +3,8 @@ # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## from openerp import models, fields, api +from openerp.addons.quality_control.models.qc_trigger_line import\ + _filter_trigger_lines class MrpProduction(models.Model): @@ -42,6 +44,6 @@ class MrpProduction(models.Model): trigger_lines = trigger_lines.union( self.env[model].get_trigger_line_for_product( qc_trigger, move.product_id)) - for trigger_line in trigger_lines: + for trigger_line in _filter_trigger_lines(trigger_lines): inspection_model._make_inspection(move, trigger_line) return res diff --git a/quality_control_mrp/tests/__init__.py b/quality_control_mrp/tests/__init__.py new file mode 100644 index 000000000..bb13e6fe1 --- /dev/null +++ b/quality_control_mrp/tests/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# (c) 2015 Oihane Crucelaegui - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from . import test_quality_control_mrp diff --git a/quality_control_mrp/tests/test_quality_control_mrp.py b/quality_control_mrp/tests/test_quality_control_mrp.py new file mode 100644 index 000000000..7aefdabd9 --- /dev/null +++ b/quality_control_mrp/tests/test_quality_control_mrp.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# (c) 2015 Oihane Crucelaegui - AvanzOSC +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from openerp.tests.common import TransactionCase + + +class TestQualityControlMrp(TransactionCase): + + def setUp(self): + super(TestQualityControlMrp, self).setUp() + self.production_model = self.env['mrp.production'] + self.qc_trigger_model = self.env['qc.trigger'] + self.product = self.env.ref('product.product_product_4') + self.test = self.env.ref('quality_control.qc_test_1') + self.trigger = self.env.ref('quality_control_mrp.qc_trigger_mrp') + self.production1 = self.production_model.create({ + 'product_id': self.product.id, + 'product_uom': self.product.uom_id.id, + }) + self.production1.action_confirm() + self.production1.action_assign() + + def test_inspection_create_for_product(self): + self.product.qc_triggers = [( + 0, 0, { + 'trigger': self.trigger.id, + 'test': self.test.id, + } + )] + self.production1.action_produce( + self.production1.id, self.production1.product_qty, + 'consume_produce') + self.assertEqual(self.production1.created_inspections, 1, + 'Only one inspection must be created') + + def test_inspection_create_for_template(self): + self.product.product_tmpl_id.qc_triggers = [( + 0, 0, { + 'trigger': self.trigger.id, + 'test': self.test.id, + } + )] + self.production1.action_produce( + self.production1.id, self.production1.product_qty, + 'consume_produce') + self.assertEqual(self.production1.created_inspections, 1, + 'Only one inspection must be created') + + def test_inspection_create_for_category(self): + self.product.categ_id.qc_triggers = [( + 0, 0, { + 'trigger': self.trigger.id, + 'test': self.test.id, + } + )] + self.production1.action_produce( + self.production1.id, self.production1.product_qty, + 'consume_produce') + self.assertEqual(self.production1.created_inspections, 1, + 'Only one inspection must be created') + + def test_inspection_create_only_one(self): + self.product.qc_triggers = [( + 0, 0, { + 'trigger': self.trigger.id, + 'test': self.test.id, + } + )] + self.product.categ_id.qc_triggers = [( + 0, 0, { + 'trigger': self.trigger.id, + 'test': self.test.id, + } + )] + self.production1.action_produce( + self.production1.id, self.production1.product_qty, + 'consume_produce') + self.assertEqual(self.production1.created_inspections, 1, + 'Only one inspection must be created')