[MIG] quality_control_mrp: migrated from odoomrp/odoomrp-wip

[IMP] quality_control_mrp: required changes
* Limit access by groups in views
* Use api.model
This commit is contained in:
oihane
2015-10-26 12:31:55 +01:00
committed by Simone Rubino
parent cb7af3e6b8
commit 0f8f5ab661
11 changed files with 170 additions and 100 deletions

View File

@@ -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 <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 smashing it by providing a detailed and welcomed feedback `here <https://github.com/OCA/manufacture/issues/new?body=module:%20quality_control%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Credits
=======
Contributors
------------
* Pedro M. Baeza <pedro.baeza@serviciobaeza.com>
* Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
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.

View File

@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# (c) 2014 Serv. Tec. Avanzados - Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import models

View File

@@ -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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# -*- 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 <pedro.baeza@serviciosbaeza.com",
"Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>",
"Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>",
],
"category": "Quality control",
"depends": [
'quality_control',
'quality_control_stock',
'mrp',
"quality_control",
"quality_control_stock",
"mrp",
],
"data": [
'data/quality_control_mrp_data.xml',

View File

@@ -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 ""

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# (c) 2014 Serv. Tec. Avanzados - Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from . import qc_inspection
from . import mrp_production

View File

@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# (c) 2014 Serv. Tec. Avanzados - Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api
from openerp.addons.quality_control.models.qc_trigger_line import\
_filter_trigger_lines
class MrpProduction(models.Model):
@@ -19,14 +21,7 @@ class MrpProduction(models.Model):
created_inspections = fields.Integer(
compute="_count_inspections", string="Created inspections")
@api.v7
def action_produce(self, cr, uid, production_id, production_qty,
production_mode, wiz=False, context=None):
production = self.browse(cr, uid, production_id, context=context)
production.action_produce(
production_id, production_qty, production_mode, wiz=wiz)
@api.v8
@api.model
def action_produce(self, production_id, production_qty, production_mode,
wiz=False):
res = super(MrpProduction, self).action_produce(
@@ -42,6 +37,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

View File

@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
# (c) 2014 Serv. Tec. Avanzados - Pedro M. Baeza
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields, api

View File

@@ -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

View File

@@ -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')

View File

@@ -24,6 +24,8 @@
<field name="name">mrp.production.form.qc</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_buttons" />
<field name="groups_id"
eval="[(4, ref('quality_control.group_quality_control_user'))]" />
<field name="arch" type="xml">
<div name="buttons" position="inside">
<button class="oe_inline oe_stat_button"

View File

@@ -6,6 +6,8 @@
<field name="name">qc.inspection.form.view.production</field>
<field name="model">qc.inspection</field>
<field name="inherit_id" ref="quality_control.qc_inspection_form_view" />
<field name="groups_id"
eval="[(4, ref('mrp.group_mrp_user'))]" />
<field name="arch" type="xml">
<field name="product" position="after">
<field name="production" />
@@ -17,6 +19,8 @@
<field name="name">qc.inspection.tree.view.production</field>
<field name="model">qc.inspection</field>
<field name="inherit_id" ref="quality_control.qc_inspection_tree_view" />
<field name="groups_id"
eval="[(4, ref('mrp.group_mrp_user'))]" />
<field name="arch" type="xml">
<field name="product" position="after">
<field name="production" />
@@ -28,10 +32,11 @@
<field name="name">qc.inspection.search.view.production</field>
<field name="model">qc.inspection</field>
<field name="inherit_id" ref="quality_control.qc_inspection_search_view" />
<field name="groups_id"
eval="[(4, ref('mrp.group_mrp_user'))]" />
<field name="arch" type="xml">
<filter string="Product" position="after">
<filter string="Production"
domain="[]"
<filter string="Production" domain="[]"
context="{'group_by': 'production'}" />
</filter>
</field>
@@ -41,6 +46,8 @@
<field name="name">qc.inspection.line.tree.production</field>
<field name="model">qc.inspection.line</field>
<field name="inherit_id" ref="quality_control.qc_inspection_line_tree_view"/>
<field name="groups_id"
eval="[(4, ref('mrp.group_mrp_user'))]" />
<field name="arch" type="xml">
<field name="product" position="after">
<field name="production" />
@@ -52,13 +59,14 @@
<field name="name">qc.inspection.line.search.production</field>
<field name="model">qc.inspection.line</field>
<field name="inherit_id" ref="quality_control.qc_inspection_line_search_view" />
<field name="groups_id"
eval="[(4, ref('mrp.group_mrp_user'))]" />
<field name="arch" type="xml">
<field name="product" position="after">
<field name="production" />
</field>
<filter string="Product" position="after">
<filter string="Production order"
domain="[]"
<filter string="Production order" domain="[]"
context="{'group_by': 'production'}" />
</filter>
</field>