Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions quality_control_team/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

====================
Quality Control Team
====================

This module extends the functionality of Quality Control app to support the
use of Quality control teams and to allow you to manage different team flows.

This module by itself does not provide any functionality to QC teams. It
provides the teams basic configuration and a dashboard to be used by other
modules.

Configuration
=============

To configure this module, you need to:

#. Go to *Quality Control > Configuration > Quality Control Teams*.

.. 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/9.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 smash it by providing detailed and welcomed feedback.

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.

Contributors
------------

* Lois Rilo <lois.rilo@eficent.com>

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 https://odoo-community.org.
5 changes: 5 additions & 0 deletions quality_control_team/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
24 changes: 24 additions & 0 deletions quality_control_team/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Quality Control Team",
"summary": "Adds quality control teams to handle different quality "
"control workflows",
"version": "9.0.1.0.0",
"category": "Quality Control",
"website": "https://odoo-community.org/",
"author": "Eficent, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": [
"quality_control",
],
"data": [
"security/ir.model.access.csv",
"views/qc_team_view.xml",
"views/qc_team_dashboard.xml",
"data/quality_control_team_data.xml",
],
}
14 changes: 14 additions & 0 deletions quality_control_team/data/quality_control_team_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<odoo>

<data noupdate="0">
<record model="qc.team" id="qc_team_main">
<field name="name">Main QC Team</field>
<field name="member_ids" eval="[(4, ref('base.user_root'))]"/>
</record>
</data>

</odoo>
7 changes: 7 additions & 0 deletions quality_control_team/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import qc_team
from . import res_partner
from . import res_user
61 changes: 61 additions & 0 deletions quality_control_team/models/qc_team.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import api, fields, models


class QualityControlTeam(models.Model):
_name = "qc.team"
_inherit = ['mail.thread', 'ir.needaction_mixin']
_description = "Quality Control Team"
_order = "name"

@api.model
def _get_default_qc_team_id(self, user_id=None):
if not user_id:
user_id = self.env.uid
qc_team_id = None
if 'default_qc_team_id' in self.env.context:
qc_team_id = self.env['qc.team'].browse(
self.env.context.get('default_qc_team_id'))
if not qc_team_id or not qc_team_id.exists():
company_id = self.sudo(user_id).company_id.id
qc_team_id = self.env['qc.team'].sudo().search([
'|',
('user_id', '=', user_id),
('member_ids', '=', user_id),
'|',
('company_id', '=', False),
('company_id', 'child_of', [company_id])
], limit=1)
if not qc_team_id:
default_team_id = self.env.ref(
'quality_control_team.qc_team_main', raise_if_not_found=False)
if default_team_id:
qc_team_id = default_team_id
return qc_team_id

name = fields.Char(
string='Quality Control Team', required=True)
active = fields.Boolean(default=True)
company_id = fields.Many2one(
comodel_name='res.company', string='Company',
default=lambda self: self.env['res.company']._company_default_get(
'qc.team'))
user_id = fields.Many2one(
comodel_name='res.users', string='Team Leader')
member_ids = fields.One2many(
comodel_name='res.users', inverse_name='qc_team_id',
string='Team Members')
reply_to = fields.Char(
string='Reply-To',
help="The email address put in the 'Reply-To' of all emails sent by "
"Odoo about cases in this QC team")
color = fields.Integer(string='Color Index', help="The color of the team")

@api.model
def create(self, values):
return super(
QualityControlTeam,
self.with_context(mail_create_nosubscribe=True)).create(values)
12 changes: 12 additions & 0 deletions quality_control_team/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import fields, models


class ResPartner(models.Model):
_inherit = 'res.partner'

qc_team_id = fields.Many2one(
comodel_name='qc.team', string='Quality Control Team')
12 changes: 12 additions & 0 deletions quality_control_team/models/res_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp import fields, models


class ResUsers(models.Model):
_inherit = 'res.users'

qc_team_id = fields.Many2one(
comodel_name='qc.team', string='Quality Control Team')
3 changes: 3 additions & 0 deletions quality_control_team/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_user_qc_team,qc.team.user,quality_control_team.model_qc_team,quality_control.group_quality_control_user,1,0,0,0
access_manager_qc_team,qc.team.manager,quality_control_team.model_qc_team,quality_control.group_quality_control_manager,1,1,1,1
Binary file added quality_control_team/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
95 changes: 95 additions & 0 deletions quality_control_team/static/description/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions quality_control_team/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import test_quality_control_team
36 changes: 36 additions & 0 deletions quality_control_team/tests/test_quality_control_team.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openerp.tests.common import TransactionCase


class TestQualityControlTeam(TransactionCase):

def setUp(self):
super(TestQualityControlTeam, self).setUp()
self.qc_team_obj = self.env['qc.team']
self.main_qc_team = self.env.ref('quality_control_team.qc_team_main')
self.other_company = self.env['res.company'].create({
'name': 'other company',
})
self.user_test = self.env['res.users'].create({
'name': 'Test User',
'login': 'testuser',
'company_id': self.other_company.id,
'company_ids': [(4, self.other_company.id)],
})

def test_default_qc_team(self):
"""Test that the QC team is defaulted correctly."""
team = self.qc_team_obj._get_default_qc_team_id(
user_id=self.user_test.id)
self.assertEqual(team, self.main_qc_team)
test_team = self.qc_team_obj.create({
'name': 'Test Team',
'user_id': self.user_test.id,
'company_id': self.other_company.id,
})
team = self.qc_team_obj._get_default_qc_team_id(
user_id=self.user_test.id)
self.assertEqual(team, test_team)
Loading