[11.0][MIG] quality_control_issue

This commit is contained in:
Lois Rilo
2018-10-24 17:10:56 +02:00
committed by Jordi Ballester Alomar
parent 8d4e83b4c5
commit dc1720faf0
22 changed files with 233 additions and 103 deletions

View File

@@ -1,14 +1,35 @@
.. 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
=====================
Quality Control Issue
=====================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
:alt: Production/Stable
.. |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/11.0/quality_control_issue
:alt: OCA/manufacture
.. |badge4| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/129/11.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4|
This module extends the functionality of quality Control to allow you to
report and manage quality control issues.
**Table of contents**
.. contents::
:local:
Configuration
=============
@@ -53,58 +74,69 @@ To manage your Quality Control Problems, you have to:
Control > Dashboard* and click on *Problems* in any of your teams.
Issue Dispositions:
-------------------
~~~~~~~~~~~~~~~~~~~
You can perform the following actions in quality control issues 'in progress':
* Scrap: Click on *Scrap Products* button.
* Create RMA: Install `rma_quality_control_issue` and see instructions there.
.. 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
Known issues / Roadmap
======================
Todo:
-----
* Add more dispositions: repair, refurbish...
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.
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.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Images
------
Authors
~~~~~~~
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
* Eficent
Contributors
------------
~~~~~~~~~~~~
* Lois Rilo <lois.rilo@eficent.com>
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
Maintainer
----------
Other credits
~~~~~~~~~~~~~
The development of this module has been financially supported by:
* `Aleph Objects, Inc. <https://www.alephobjects.com/>`_
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. 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.
.. |maintainer-lreficent| image:: https://github.com/lreficent.png?size=40px
:target: https://github.com/lreficent
:alt: lreficent
Current `maintainer <https://odoo-community.org/page/maintainer-role>`_:
|maintainer-lreficent|
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/11.0/quality_control_issue>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -1,5 +1 @@
# -*- 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

View File

@@ -1,14 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# Copyright 2017 Aleph Objects, Inc. (https://www.alephobjects.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Quality Control Issue",
"summary": "Allow to manage and report Quality Control Issues.",
"version": "9.0.1.0.0",
"version": "11.0.1.0.0",
"development_status": "Production/Stable",
"category": "Quality Control",
"website": "https://odoo-community.org/",
"author": "Eficent , Odoo Community Association (OCA)",
"maintainers": ["lreficent"],
"license": "AGPL-3",
"application": False,
"installable": True,
@@ -16,7 +17,6 @@
"quality_control",
"quality_control_team",
"stock",
"stock_scrap",
],
"data": [
"security/ir.model.access.csv",
@@ -28,5 +28,7 @@
"views/qc_problem_group_view.xml",
"views/qc_team_dashboard_view.xml",
"views/stock_scrap_view.xml",
"views/qc_issue_stage.xml",
"views/qc_problem_stage.xml",
],
}

View File

@@ -1,7 +1,3 @@
# -*- 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 stock_scrap
from . import qc_stage
from . import qc_problem

View File

@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# Copyright 2017 Aleph Objects, Inc. (https://www.alephobjects.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import api, fields, models, _
from openerp.exceptions import UserError
import openerp.addons.decimal_precision as dp
from odoo import api, fields, models, SUPERUSER_ID, _
from odoo.exceptions import UserError
import odoo.addons.decimal_precision as dp
class QualityControlIssue(models.Model):
@@ -35,33 +34,29 @@ class QualityControlIssue(models.Model):
user_id=self.env.uid)
return self.issue_stage_find([], team, [('fold', '=', False)])
def _get_default_location_id(self):
company_user = self.env.user.company_id
warehouse = self.env['stock.warehouse'].search([
('company_id', '=', company_user.id)], limit=1)
if warehouse:
return warehouse.lot_stock_id.id
return None
@api.multi
def _read_group_stage_ids(self, domain, read_group_order=None,
access_rights_uid=None):
access_rights_uid = access_rights_uid or self._uid
stage_obj = self.env['qc.issue.stage']
def _read_group_stage_ids(self, stages, domain, order=None):
search_domain = []
qc_team_id = self.env.context.get('default_qc_team_id') or False
if qc_team_id:
search_domain += ['|', ('id', 'in', self.ids)]
search_domain += ['|', ('id', 'in', stages.ids)]
search_domain += ['|', ('qc_team_id', '=', qc_team_id)]
search_domain += [('qc_team_id', '=', False)]
else:
search_domain += ['|', ('id', 'in', self.ids)]
search_domain += ['|', ('id', 'in', stages.ids)]
search_domain += [('qc_team_id', '=', False)]
# perform search
stage_ids = stage_obj._search(search_domain,
access_rights_uid=access_rights_uid)
result = [stage.name_get()[0] for stage in
stage_obj.browse(stage_ids)]
# restore order of the search
result.sort(
lambda x, y: cmp(stage_ids.index(x[0]), stage_ids.index(y[0])))
fold = {}
for stage in stage_obj.browse(stage_ids):
fold[stage.id] = stage.fold or False
return result, fold
stage_ids = stages._search(
search_domain, order=order, access_rights_uid=SUPERUSER_ID)
return stages.browse(stage_ids)
name = fields.Char(readonly=True)
state = fields.Selection(
@@ -77,7 +72,7 @@ class QualityControlIssue(models.Model):
product_qty = fields.Float(
string="Product Quantity", required=True, default=1.0,
readonly=True, states={"new": [("readonly", False)]},
digits_compute=dp.get_precision("Product Unit of Measure"))
digits=dp.get_precision("Product Unit of Measure"))
product_uom = fields.Many2one(
comodel_name="product.uom", string="Product Unit of Measure",
default=_get_uom, required=True, readonly=True,
@@ -87,6 +82,7 @@ class QualityControlIssue(models.Model):
readonly=True, states={"new": [("readonly", False)]},)
location_id = fields.Many2one(
comodel_name="stock.location", string="Location",
default=_get_default_location_id,
readonly=True, states={"new": [("readonly", False)]},)
inspector_id = fields.Many2one(
comodel_name="res.users", string="Inspector",
@@ -108,9 +104,11 @@ class QualityControlIssue(models.Model):
stage_id = fields.Many2one(
comodel_name="qc.issue.stage", string='Stage',
track_visibility='onchange',
select=True, default=_get_default_stage_id,
index=True, default=_get_default_stage_id,
group_expand='_read_group_stage_ids',
domain="['|', ('qc_team_id', '=', False), "
"('qc_team_id', '=', qc_team_id)]")
"('qc_team_id', '=', qc_team_id)]",
)
qc_team_id = fields.Many2one(
comodel_name='qc.team', string='QC Team',
default=lambda self: self.env[
@@ -219,7 +217,7 @@ class QualityControlIssue(models.Model):
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.scrap',
'view_id': self.env.ref('stock_scrap.stock_scrap_form_view2').id,
'view_id': self.env.ref('stock.stock_scrap_form_view2').id,
'type': 'ir.actions.act_window',
'context': {
'default_qc_issue_id': self.id,
@@ -234,7 +232,7 @@ class QualityControlIssue(models.Model):
@api.multi
def action_view_stock_scrap(self):
action = self.env.ref('stock_scrap.action_stock_scrap')
action = self.env.ref('stock.action_stock_scrap')
result = action.read()[0]
lines = self.stock_scrap_ids
# choose the view_mode accordingly
@@ -242,7 +240,7 @@ class QualityControlIssue(models.Model):
result['domain'] = "[('id', 'in', " + \
str(lines.ids) + ")]"
elif len(lines) == 1:
res = self.env.ref('stock_scrap.stock_scrap_form_view', False)
res = self.env.ref('stock.stock_scrap_form_view', False)
result['views'] = [(res and res.id or False, 'form')]
result['res_id'] = lines.id
return result

View File

@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# Copyright 2017 Aleph Objects, Inc. (https://www.alephobjects.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import api, fields, models
from odoo import api, fields, models
AVAILABLE_PRIORITIES = [
('0', 'Normal'),

View File

@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# Copyright 2017 Aleph Objects, Inc. (https://www.alephobjects.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import api, fields, models
from odoo import api, fields, models, SUPERUSER_ID
AVAILABLE_PRIORITIES = [
('0', 'Normal'),
@@ -25,32 +24,20 @@ class QcProblem(models.Model):
return self.stage_find([], team, [('fold', '=', False)])
@api.multi
def _read_group_stage_ids(self, domain, read_group_order=None,
access_rights_uid=None):
access_rights_uid = access_rights_uid or self._uid
stage_obj = self.env['qc.stage']
def _read_group_stage_ids(self, stages, domain, order=None):
search_domain = []
qc_team_id = self.env.context.get('default_qc_team_id') or False
if qc_team_id:
search_domain += ['|', ('id', 'in', self.ids)]
search_domain += ['|', ('id', 'in', stages.ids)]
search_domain += ['|', ('qc_team_id', '=', qc_team_id)]
search_domain += [('qc_team_id', '=', False)]
else:
search_domain += ['|', ('id', 'in', self.ids)]
search_domain += ['|', ('id', 'in', stages.ids)]
search_domain += [('qc_team_id', '=', False)]
# perform search
stage_ids = stage_obj._search(search_domain,
access_rights_uid=access_rights_uid)
result = [stage.name_get()[0] for stage in
stage_obj.browse(stage_ids)]
# restore order of the search
result.sort(
lambda x, y: cmp(stage_ids.index(x[0]), stage_ids.index(y[0])))
fold = {}
for stage in stage_obj.browse(stage_ids):
fold[stage.id] = stage.fold or False
return result, fold
stage_ids = stages._search(
search_domain, order=order, access_rights_uid=SUPERUSER_ID)
return stages.browse(stage_ids)
@api.one
@api.depends('issue_ids')
@@ -71,10 +58,13 @@ class QcProblem(models.Model):
priority = fields.Selection(
selection=AVAILABLE_PRIORITIES, string='Rating', index=True)
stage_id = fields.Many2one(
comodel_name="qc.stage", string='Stage', track_visibility='onchange',
select=True, default=_get_default_stage_id,
comodel_name="qc.stage", string='Stage',
track_visibility='onchange',
index=True, default=_get_default_stage_id,
group_expand='_read_group_stage_ids',
domain="['|', ('qc_team_id', '=', False), "
"('qc_team_id', '=', qc_team_id)]")
"('qc_team_id', '=', qc_team_id)]",
)
qc_team_id = fields.Many2one(
comodel_name='qc.team', string='QC Team',
default=lambda self: self.env[

View File

@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# Copyright 2017 Aleph Objects, Inc. (https://www.alephobjects.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import fields, models
from odoo import fields, models
class QcProblemGroup(models.Model):

View File

@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# Copyright 2017 Aleph Objects, Inc. (https://www.alephobjects.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import api, fields, models
from odoo import api, fields, models
AVAILABLE_PRIORITIES = [
('0', 'Normal'),

View File

@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
# Copyright 2017 Aleph Objects, Inc. (https://www.alephobjects.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import fields, models
from odoo import fields, models
class QualityControlIssueStage(models.Model):

View File

@@ -0,0 +1,23 @@
To configure this module in order to take advantage of the kanban views you
need to create the stages for *issues* and *problems*. To **create** stages in
any kanban view click on *Add New Column*. Then you can **reorder** the stages
just dragging them.
In created stages you can **configure** them clicking on the gear button that
appears at the right of the stage name and clicking on *Edit*. Note the
following behaviors:
* You can set a *Quality Control Team*.
- Stages with no team set will be shared by all teams.
- Stages with a team associated will be only available for that specific
team.
* In Issue Stages you can also relate a *QC State* to the stage.
- When you move to a different stage an issue with *QC state* defined the
state of the issue will also change according to it.
- The other way around, if you change the state, the system will look for
an appropriate stage and if existing the issue will be move to that stage.
- If you change the *QC team* of an issue, the system will get the default
stage for that team and apply it to the issue.

View File

@@ -0,0 +1,2 @@
* Lois Rilo <lois.rilo@eficent.com>
* Jordi Ballester Alomar <jordi.ballester@eficent.com>

View File

@@ -0,0 +1,3 @@
The development of this module has been financially supported by:
* `Aleph Objects, Inc. <https://www.alephobjects.com/>`_

View File

@@ -0,0 +1,2 @@
This module extends the functionality of quality Control to allow you to
report and manage quality control issues.

View File

@@ -0,0 +1 @@
* Add more dispositions: repair, refurbish...

View File

@@ -0,0 +1,20 @@
To use Quality Control Issues, you need to:
#. Go to *Quality Control > Issues > QC Issues* or to *Quality Control >
Dashboard* and click on *Issues* in any of your teams.
#. Click on create to report an issue.
#. Select the product and quantity for the issue. Optionally you can specify
a location and relate the issue to some *Problem*.
To manage your Quality Control Problems, you have to:
#. Go to *Quality Control > Problem Tracking > Problems* or to *Quality
Control > Dashboard* and click on *Problems* in any of your teams.
Issue Dispositions:
~~~~~~~~~~~~~~~~~~~
You can perform the following actions in quality control issues 'in progress':
* Scrap: Click on *Scrap Products* button.
* Create RMA: Install `rma_quality_control_issue` and see instructions there.

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="qc_issue_stage_tree" model="ir.ui.view">
<field name="name">qc.issue.stage.tree</field>
<field name="model">qc.issue.stage</field>
<field name="arch" type="xml">
<tree>
<field name="sequence" widget="handle" groups="base.group_no_one"/>
<field name="name"/>
<field name="fold"/>
<field name="state"/>
</tree>
</field>
</record>
<record id="qc_issue_stage_config_action" model="ir.actions.act_window">
<field name="name">Quality Control Issue Stages</field>
<field name="res_model">qc.issue.stage</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Issue Stages"
id="qc_issue_stage_config_menu"
groups="base.group_system"
parent="quality_control.menu_qc_config"
action="qc_issue_stage_config_action"
sequence="20"/>
</odoo>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="qc_stage_tree" model="ir.ui.view">
<field name="name">qc.stage.tree</field>
<field name="model">qc.stage</field>
<field name="arch" type="xml">
<tree>
<field name="sequence" widget="handle" groups="base.group_no_one"/>
<field name="name"/>
<field name="fold"/>
</tree>
</field>
</record>
<record id="qc_problem_stage_config_action" model="ir.actions.act_window">
<field name="name">Quality Control Problem Stages</field>
<field name="res_model">qc.stage</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Problem Stages"
id="qc_stage_config_menu"
groups="base.group_system"
parent="quality_control.menu_qc_config"
action="qc_problem_stage_config_action"
sequence="30"/>
</odoo>

View File

@@ -81,8 +81,10 @@
<div>
<strong><field name="name"/></strong>
</div>
<field name="problem_group_id"/><br></br>
<field name="issue_count"/> issues
<group name="info">
<field name="problem_group_id"/><br></br>
<field name="issue_count"/> issues
</group>
<div class="o_kanban_footer">
<field name="priority" widget="priority" groups="base.group_user"/>
</div>

View File

@@ -39,12 +39,12 @@
<field name="inherit_id" ref="quality_control_team.qc_team_view_kanban"/>
<field name="arch" type="xml">
<xpath expr="//div[contains(@class, 'o_kanban_primary_left')]" position="inside">
<xpath expr="//div[@name='card_left']" position="inside">
<button class="btn btn-primary" type="action"
name="%(team_qc_issue_act)d">Issues
</button>
</xpath>
<xpath expr="//div[contains(@class, 'o_kanban_primary_right')]" position="inside">
<xpath expr="//div[@name='card_right']" position="inside">
<button class="btn btn-primary" type="action"
name="%(team_qc_problem_act)d">Problems
</button>

View File

@@ -7,7 +7,7 @@
<record id="stock_scrap_form_view" model="ir.ui.view">
<field name="name">stock.scrap.form - quality_control_issue</field>
<field name="model">stock.scrap</field>
<field name="inherit_id" ref="stock_scrap.stock_scrap_form_view"/>
<field name="inherit_id" ref="stock.stock_scrap_form_view"/>
<field name="arch" type="xml">
<field name="owner_id" position="after">
<field name="qc_issue_id" attrs="{'invisible': [('qc_issue_id', '=', False)]}"/>
@@ -18,7 +18,7 @@
<record id="stock_scrap_form_view2" model="ir.ui.view">
<field name="name">stock.scrap.form2 - quality_control_issue</field>
<field name="model">stock.scrap</field>
<field name="inherit_id" ref="stock_scrap.stock_scrap_form_view2"/>
<field name="inherit_id" ref="stock.stock_scrap_form_view2"/>
<field name="arch" type="xml">
<field name="owner_id" position="after">
<field name="qc_issue_id" attrs="{'invisible': [('qc_issue_id', '=', False)]}"/>

View File

@@ -25,8 +25,8 @@
</div>
<div class="container o_kanban_card_content o_visible">
<div class="row">
<div class="col-xs-6 o_kanban_primary_left" name="to_replace_in_qc_issue"/>
<div class="col-xs-6 o_kanban_primary_right"/>
<div class="col-xs-6 o_kanban_primary_left" name="card_left"/>
<div class="col-xs-6 o_kanban_primary_right" name="card_right"/>
</div>
</div>