mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[MIG] quality_control_stock: Migration to 10.0
This commit is contained in:
committed by
Enrique Martín
parent
ff5280897e
commit
4190a02e39
@@ -1,57 +1,85 @@
|
||||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||
=======================
|
||||
Quality control - Stock
|
||||
=======================
|
||||
|
||||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
:alt: Beta
|
||||
.. |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/10.0/quality_control_stock
|
||||
:alt: OCA/manufacture
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/manufacture-10-0/manufacture-10-0-quality_control_stock
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/129/10.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
===================================
|
||||
Stock extension for quality control
|
||||
===================================
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
This module defines triggers that creates inspections when stock moves are done.
|
||||
|
||||
It also adds some shortcuts on picking and lots to these inspections.
|
||||
|
||||
**Table of contents**
|
||||
|
||||
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
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
* Put trigger in all languages.
|
||||
|
||||
|
||||
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**>`_.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed
|
||||
`feedback <https://github.com/OCA/manufacture/issues/new?body=module:%20quality_control_stock%0Aversion:%2010.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* OdooMRP team
|
||||
* AvanzOSC
|
||||
* Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
* Agile Business Group
|
||||
|
||||
Contributors
|
||||
------------
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Pedro M. Baeza <pedro.baeza@serviciobaeza.com>
|
||||
* Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
|
||||
* Simone Rubino <simone.rubino@agilebg.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
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 http://odoo-community.org.
|
||||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/10.0/quality_control_stock>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2018 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import models
|
||||
from openerp import SUPERUSER_ID
|
||||
from odoo import api, SUPERUSER_ID
|
||||
|
||||
|
||||
def post_init_hook(cr, registry):
|
||||
# Create QC triggers
|
||||
picking_type_ids = registry['stock.picking.type'].search(
|
||||
cr, SUPERUSER_ID, [])
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
picking_type_ids = env['stock.picking.type'].sudo().search([])
|
||||
for picking_type_id in picking_type_ids:
|
||||
registry['stock.picking.type']._create_qc_trigger(
|
||||
cr, SUPERUSER_ID, picking_type_id)
|
||||
picking_type_id.sudo()._create_qc_trigger()
|
||||
|
||||
@@ -1,22 +1,21 @@
|
||||
# -*- 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
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2014 Oihane Crucelaegui - AvanzOSC
|
||||
# Copyright 2018 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "Quality control - Stock",
|
||||
"version": "8.0.1.0.1",
|
||||
"version": "10.0.1.0.2",
|
||||
"category": "Quality control",
|
||||
"license": "AGPL-3",
|
||||
"author": "OdooMRP team, "
|
||||
"AvanzOSC, "
|
||||
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
|
||||
"Agile Business Group, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"website": "http://www.odoomrp.com",
|
||||
"contributors": [
|
||||
"Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>",
|
||||
"Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>",
|
||||
],
|
||||
"website": "https://github.com/OCA/manufacture/tree/10.0/"
|
||||
"quality_control_stock",
|
||||
"depends": [
|
||||
"quality_control",
|
||||
"stock",
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
|
||||
<data>
|
||||
<!-- Copyright 2018 Simone Rubino - Agile Business Group
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
<record id="req_link_stock_move" model="res.request.link">
|
||||
<field name="name">Stock Move</field>
|
||||
<field name="object">stock.move</field>
|
||||
@@ -16,6 +16,4 @@
|
||||
<field name="name">Lot</field>
|
||||
<field name="object">stock.production.lot</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
@@ -14,50 +14,50 @@ msgstr ""
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: field:stock.picking,created_inspections:0
|
||||
#: field:stock.production.lot,created_inspections:0
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_stock_picking_created_inspections
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_stock_production_lot_created_inspections
|
||||
msgid "Created inspections"
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: field:stock.picking,done_inspections:0
|
||||
#: field:stock.production.lot,done_inspections:0
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_stock_picking_done_inspections
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_stock_production_lot_done_inspections
|
||||
msgid "Done inspections"
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: field:stock.picking,qc_inspections:0
|
||||
#: field:stock.production.lot,qc_inspections:0
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_stock_picking_qc_inspections
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_stock_production_lot_qc_inspections
|
||||
msgid "Inspections"
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: field:stock.picking,passed_inspections:0
|
||||
#: field:stock.production.lot,passed_inspections:0
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_stock_picking_passed_inspections
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_stock_production_lot_passed_inspections
|
||||
msgid "Inspections OK"
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: field:stock.picking,failed_inspections:0
|
||||
#: field:stock.production.lot,failed_inspections:0
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_stock_picking_failed_inspections
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_stock_production_lot_failed_inspections
|
||||
msgid "Inspections failed"
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: help:stock.production.lot,qc_inspections:0
|
||||
#: model:ir.model.fields,help:quality_control_stock.field_stock_production_lot_qc_inspections
|
||||
msgid "Inspections related to this lot."
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: help:stock.picking,qc_inspections:0
|
||||
#: model:ir.model.fields,help:quality_control_stock.field_stock_picking_qc_inspections
|
||||
msgid "Inspections related to this picking."
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: view:qc.inspection:quality_control_stock.qc_inspection_search_view_picking
|
||||
#: field:qc.inspection,lot:0
|
||||
#: view:qc.inspection.line:quality_control_stock.qc_inspection_line_search_stock_view
|
||||
#: field:qc.inspection.line,lot:0
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_qc_inspection_line_lot
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_qc_inspection_lot
|
||||
#: model:ir.ui.view,arch_db:quality_control_stock.qc_inspection_line_search_stock_view
|
||||
#: model:ir.ui.view,arch_db:quality_control_stock.qc_inspection_search_view_picking
|
||||
#: model:res.request.link,name:quality_control_stock.req_link_stock_production_lot
|
||||
msgid "Lot"
|
||||
msgstr ""
|
||||
@@ -68,30 +68,23 @@ msgid "Lot/Serial"
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: view:qc.inspection:quality_control_stock.qc_inspection_search_view_picking
|
||||
#: field:qc.inspection,picking:0
|
||||
#: view:qc.inspection.line:quality_control_stock.qc_inspection_line_search_stock_view
|
||||
#: field:qc.inspection.line,picking:0
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_qc_inspection_line_picking
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_qc_inspection_picking
|
||||
#: model:ir.ui.view,arch_db:quality_control_stock.qc_inspection_line_search_stock_view
|
||||
#: model:ir.ui.view,arch_db:quality_control_stock.qc_inspection_search_view_picking
|
||||
msgid "Picking"
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: model:ir.model,name:quality_control_stock.model_stock_picking
|
||||
#: model:res.request.link,name:quality_control_stock.req_link_stock_picking
|
||||
msgid "Picking List"
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: field:qc.trigger,picking_type:0
|
||||
#: model:ir.model.fields,field_description:quality_control_stock.field_qc_trigger_picking_type
|
||||
msgid "Picking type"
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: view:qc.inspection:quality_control_stock.qc_inspection_search_view_picking
|
||||
#: view:qc.inspection.line:quality_control_stock.qc_inspection_line_search_stock_view
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: model:ir.model,name:quality_control_stock.model_qc_inspection
|
||||
msgid "Quality control inspection"
|
||||
@@ -158,8 +151,13 @@ msgid "The picking type determines the picking view"
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: view:stock.picking:quality_control_stock.stock_picking_qc_view
|
||||
#: view:stock.production.lot:quality_control_stock.stock_lot_qc_view
|
||||
#: model:ir.model,name:quality_control_stock.model_stock_picking
|
||||
msgid "Transfer"
|
||||
msgstr ""
|
||||
|
||||
#. module: quality_control_stock
|
||||
#: model:ir.ui.view,arch_db:quality_control_stock.stock_lot_qc_view
|
||||
#: model:ir.ui.view,arch_db:quality_control_stock.stock_picking_qc_view
|
||||
msgid "inspections"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import qc_trigger
|
||||
from . import qc_inspection
|
||||
|
||||
@@ -1,41 +1,46 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2018 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import models, fields, api
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class QcInspection(models.Model):
|
||||
_inherit = 'qc.inspection'
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('object_id')
|
||||
def get_picking(self):
|
||||
self.picking = False
|
||||
if self.object_id:
|
||||
if self.object_id._name == 'stock.move':
|
||||
self.picking = self.object_id.picking_id
|
||||
elif self.object_id._name == 'stock.picking':
|
||||
self.picking = self.object_id
|
||||
elif self.object_id._name == 'stock.pack.operation':
|
||||
self.picking = self.object_id.picking_id
|
||||
def _compute_picking(self):
|
||||
for inspection in self:
|
||||
inspection.picking = False
|
||||
if inspection.object_id:
|
||||
if inspection.object_id._name == 'stock.move':
|
||||
inspection.picking = inspection.object_id.picking_id
|
||||
elif inspection.object_id._name == 'stock.picking':
|
||||
inspection.picking = inspection.object_id
|
||||
elif inspection.object_id._name == 'stock.pack.operation':
|
||||
inspection.picking = inspection.object_id.picking_id
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('object_id')
|
||||
def get_lot(self):
|
||||
self.lot = False
|
||||
if self.object_id:
|
||||
if self.object_id._name == 'stock.pack.operation':
|
||||
self.lot = self.object_id.lot_id
|
||||
elif self.object_id._name == 'stock.move':
|
||||
self.lot = self.object_id.lot_ids[:1]
|
||||
elif self.object_id._name == 'stock.production.lot':
|
||||
self.lot = self.object_id
|
||||
def _compute_lot(self):
|
||||
for inspection in self:
|
||||
inspection.lot = False
|
||||
if inspection.object_id:
|
||||
if inspection.object_id._name == 'stock.pack.operation':
|
||||
inspection.lot = \
|
||||
inspection.object_id.pack_lot_ids[:1].lot_id
|
||||
elif inspection.object_id._name == 'stock.move':
|
||||
inspection.lot = inspection.object_id.lot_ids[:1]
|
||||
elif inspection.object_id._name == 'stock.production.lot':
|
||||
inspection.lot = inspection.object_id
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('object_id')
|
||||
def _get_product(self):
|
||||
"""Overriden for getting the product from a stock move."""
|
||||
self.ensure_one()
|
||||
super(QcInspection, self)._get_product()
|
||||
if self.object_id:
|
||||
if self.object_id._name == 'stock.move':
|
||||
@@ -65,9 +70,10 @@ class QcInspection(models.Model):
|
||||
return res
|
||||
|
||||
picking = fields.Many2one(
|
||||
comodel_name="stock.picking", compute="get_picking", store=True)
|
||||
comodel_name="stock.picking", compute="_compute_picking", store=True)
|
||||
lot = fields.Many2one(
|
||||
comodel_name='stock.production.lot', compute="get_lot", store=True)
|
||||
comodel_name='stock.production.lot', compute="_compute_lot",
|
||||
store=True)
|
||||
|
||||
|
||||
class QcInspectionLine(models.Model):
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2018 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import models, fields
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class QcTrigger(models.Model):
|
||||
|
||||
@@ -1,37 +1,41 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2018 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import models, fields, api
|
||||
from openerp.addons.quality_control.models.qc_trigger_line import\
|
||||
from odoo import api, fields, models
|
||||
from odoo.addons.quality_control.models.qc_trigger_line import\
|
||||
_filter_trigger_lines
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('qc_inspections', 'qc_inspections.state')
|
||||
def _count_inspections(self):
|
||||
self.created_inspections = len(self.qc_inspections)
|
||||
self.passed_inspections = len([x for x in self.qc_inspections if
|
||||
x.state == 'success'])
|
||||
self.failed_inspections = len([x for x in self.qc_inspections if
|
||||
x.state == 'failed'])
|
||||
self.done_inspections = (self.passed_inspections +
|
||||
self.failed_inspections)
|
||||
def _compute_count_inspections(self):
|
||||
for picking in self:
|
||||
picking.created_inspections = len(picking.qc_inspections)
|
||||
picking.passed_inspections = \
|
||||
len([x for x in picking.qc_inspections
|
||||
if x.state == 'success'])
|
||||
picking.failed_inspections = \
|
||||
len([x for x in picking.qc_inspections
|
||||
if x.state == 'failed'])
|
||||
picking.done_inspections = \
|
||||
(picking.passed_inspections + picking.failed_inspections)
|
||||
|
||||
qc_inspections = fields.One2many(
|
||||
comodel_name='qc.inspection', inverse_name='picking', copy=False,
|
||||
string='Inspections', help="Inspections related to this picking.")
|
||||
created_inspections = fields.Integer(
|
||||
compute="_count_inspections", string="Created inspections")
|
||||
compute="_compute_count_inspections", string="Created inspections")
|
||||
done_inspections = fields.Integer(
|
||||
compute="_count_inspections", string="Done inspections")
|
||||
compute="_compute_count_inspections", string="Done inspections")
|
||||
passed_inspections = fields.Integer(
|
||||
compute="_count_inspections", string="Inspections OK")
|
||||
compute="_compute_count_inspections", string="Inspections OK")
|
||||
failed_inspections = fields.Integer(
|
||||
compute="_count_inspections", string="Inspections failed")
|
||||
compute="_compute_count_inspections", string="Inspections failed")
|
||||
|
||||
@api.multi
|
||||
def do_transfer(self):
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2018 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import models, api
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class StockPickingType(models.Model):
|
||||
@@ -10,8 +11,9 @@ class StockPickingType(models.Model):
|
||||
|
||||
@api.multi
|
||||
def _create_qc_trigger(self):
|
||||
self.ensure_one()
|
||||
qc_trigger = {
|
||||
'name': self.complete_name,
|
||||
'name': self.name,
|
||||
'company_id': self.warehouse_id.company_id.id,
|
||||
'picking_type': self.id,
|
||||
'partner_selectable': True,
|
||||
@@ -31,5 +33,5 @@ class StockPickingType(models.Model):
|
||||
qc_trigger_model = self.env['qc.trigger'].sudo()
|
||||
qc_trigger = qc_trigger_model.search(
|
||||
[('picking_type', '=', self.id)])
|
||||
qc_trigger.name = self.complete_name
|
||||
qc_trigger.name = self.name
|
||||
return res
|
||||
|
||||
@@ -1,32 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2018 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import models, fields, api
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockProductionLot(models.Model):
|
||||
_inherit = 'stock.production.lot'
|
||||
|
||||
@api.one
|
||||
@api.multi
|
||||
@api.depends('qc_inspections', 'qc_inspections.state')
|
||||
def _count_inspections(self):
|
||||
self.created_inspections = len(self.qc_inspections)
|
||||
self.passed_inspections = len([x for x in self.qc_inspections if
|
||||
x.state == 'success'])
|
||||
self.failed_inspections = len([x for x in self.qc_inspections if
|
||||
x.state == 'failed'])
|
||||
self.done_inspections = (self.passed_inspections +
|
||||
self.failed_inspections)
|
||||
def _compute_count_inspections(self):
|
||||
for lot in self:
|
||||
lot.created_inspections = len(lot.qc_inspections)
|
||||
lot.passed_inspections = \
|
||||
len([x for x in lot.qc_inspections if x.state == 'success'])
|
||||
lot.failed_inspections = \
|
||||
len([x for x in lot.qc_inspections if x.state == 'failed'])
|
||||
lot.done_inspections = \
|
||||
(lot.passed_inspections + lot.failed_inspections)
|
||||
|
||||
qc_inspections = fields.One2many(
|
||||
comodel_name='qc.inspection', inverse_name='lot', copy=False,
|
||||
string='Inspections', help="Inspections related to this lot.")
|
||||
created_inspections = fields.Integer(
|
||||
compute="_count_inspections", string="Created inspections")
|
||||
compute="_compute_count_inspections", string="Created inspections")
|
||||
done_inspections = fields.Integer(
|
||||
compute="_count_inspections", string="Done inspections")
|
||||
compute="_compute_count_inspections", string="Done inspections")
|
||||
passed_inspections = fields.Integer(
|
||||
compute="_count_inspections", string="Inspections OK")
|
||||
compute="_compute_count_inspections", string="Inspections OK")
|
||||
failed_inspections = fields.Integer(
|
||||
compute="_count_inspections", string="Inspections failed")
|
||||
compute="_compute_count_inspections", string="Inspections failed")
|
||||
|
||||
3
quality_control_stock_oca/readme/CONTRIBUTORS.rst
Normal file
3
quality_control_stock_oca/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,3 @@
|
||||
* Pedro M. Baeza <pedro.baeza@serviciobaeza.com>
|
||||
* Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
|
||||
* Simone Rubino <simone.rubino@agilebg.com>
|
||||
3
quality_control_stock_oca/readme/DESCRIPTION.rst
Normal file
3
quality_control_stock_oca/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1,3 @@
|
||||
This module defines triggers that creates inspections when stock moves are done.
|
||||
|
||||
It also adds some shortcuts on picking and lots to these inspections.
|
||||
1
quality_control_stock_oca/readme/ROADMAP.rst
Normal file
1
quality_control_stock_oca/readme/ROADMAP.rst
Normal file
@@ -0,0 +1 @@
|
||||
* Put trigger in all languages.
|
||||
432
quality_control_stock_oca/static/description/index.html
Normal file
432
quality_control_stock_oca/static/description/index.html
Normal file
@@ -0,0 +1,432 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.14: http://docutils.sourceforge.net/" />
|
||||
<title>Quality control - Stock</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th {
|
||||
border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first {
|
||||
/* Override more specific margin styles with "! important". */
|
||||
margin-top: 0 ! important }
|
||||
|
||||
.last, .with-subtitle {
|
||||
margin-bottom: 0 ! important }
|
||||
|
||||
.hidden {
|
||||
display: none }
|
||||
|
||||
.subscript {
|
||||
vertical-align: sub;
|
||||
font-size: smaller }
|
||||
|
||||
.superscript {
|
||||
vertical-align: super;
|
||||
font-size: smaller }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
blockquote.epigraph {
|
||||
margin: 2em 5em ; }
|
||||
|
||||
dl.docutils dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||
dl.docutils dt {
|
||||
font-weight: bold }
|
||||
*/
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title, .code .error {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
clear: both;
|
||||
font-size: smaller }
|
||||
|
||||
div.line-block {
|
||||
display: block ;
|
||||
margin-top: 1em ;
|
||||
margin-bottom: 1em }
|
||||
|
||||
div.line-block div.line-block {
|
||||
margin-top: 0 ;
|
||||
margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
|
||||
div.sidebar {
|
||||
margin: 0 0 0.5em 1em ;
|
||||
border: medium outset ;
|
||||
padding: 1em ;
|
||||
background-color: #ffffee ;
|
||||
width: 40% ;
|
||||
float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric {
|
||||
font-family: sans-serif ;
|
||||
font-size: medium }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr.docutils {
|
||||
width: 75% }
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
||||
clear: left ;
|
||||
float: left ;
|
||||
margin-right: 1em }
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
||||
clear: right ;
|
||||
float: right ;
|
||||
margin-left: 1em }
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table.align-center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left }
|
||||
|
||||
.align-center {
|
||||
clear: both ;
|
||||
text-align: center }
|
||||
|
||||
.align-right {
|
||||
text-align: right }
|
||||
|
||||
/* reset inner alignment in figures */
|
||||
div.align-right {
|
||||
text-align: inherit }
|
||||
|
||||
/* div.align-center * { */
|
||||
/* text-align: left } */
|
||||
|
||||
.align-top {
|
||||
vertical-align: top }
|
||||
|
||||
.align-middle {
|
||||
vertical-align: middle }
|
||||
|
||||
.align-bottom {
|
||||
vertical-align: bottom }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.attribution {
|
||||
text-align: right ;
|
||||
margin-left: 50% }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.rubric {
|
||||
font-weight: bold ;
|
||||
font-size: larger ;
|
||||
color: maroon ;
|
||||
text-align: center }
|
||||
|
||||
p.sidebar-title {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold ;
|
||||
font-size: larger }
|
||||
|
||||
p.sidebar-subtitle {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font: inherit }
|
||||
|
||||
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: grey; } /* line numbers */
|
||||
pre.code, code { background-color: #eeeeee }
|
||||
pre.code .comment, code .comment { color: #5C6576 }
|
||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
||||
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
||||
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
||||
pre.code .inserted, code .inserted { background-color: #A3D289}
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option {
|
||||
white-space: nowrap }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.docutils {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid 1px black;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap ;
|
||||
padding-left: 0 }
|
||||
|
||||
/* "booktabs" style (no vertical lines) */
|
||||
table.docutils.booktabs {
|
||||
border: 0px;
|
||||
border-top: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.docutils.booktabs * {
|
||||
border: 0px;
|
||||
}
|
||||
table.docutils.booktabs th {
|
||||
border-bottom: thin solid;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||
font-size: 100% }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="quality-control-stock">
|
||||
<h1 class="title">Quality control - Stock</h1>
|
||||
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/manufacture/tree/10.0/quality_control_stock"><img alt="OCA/manufacture" src="https://img.shields.io/badge/github-OCA%2Fmanufacture-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/manufacture-10-0/manufacture-10-0-quality_control_stock"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/129/10.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module defines triggers that creates inspections when stock moves are done.</p>
|
||||
<p>It also adds some shortcuts on picking and lots to these inspections.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#known-issues-roadmap" id="id1">Known issues / Roadmap</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id6">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="known-issues-roadmap">
|
||||
<h1><a class="toc-backref" href="#id1">Known issues / Roadmap</a></h1>
|
||||
<ul class="simple">
|
||||
<li>Put trigger in all languages.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/manufacture/issues">GitHub Issues</a>.
|
||||
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
|
||||
<a class="reference external" href="https://github.com/OCA/manufacture/issues/new?body=module:%20quality_control_stock%0Aversion:%2010.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>OdooMRP team</li>
|
||||
<li>AvanzOSC</li>
|
||||
<li>Serv. Tecnol. Avanzados - Pedro M. Baeza</li>
|
||||
<li>Agile Business Group</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Pedro M. Baeza <<a class="reference external" href="mailto:pedro.baeza@serviciobaeza.com">pedro.baeza@serviciobaeza.com</a>></li>
|
||||
<li>Oihane Crucelaegui <<a class="reference external" href="mailto:oihanecrucelaegi@avanzosc.es">oihanecrucelaegi@avanzosc.es</a>></li>
|
||||
<li>Simone Rubino <<a class="reference external" href="mailto:simone.rubino@agilebg.com">simone.rubino@agilebg.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||
<p>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.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/manufacture/tree/10.0/quality_control_stock">OCA/manufacture</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2015 Oihane Crucelaegui - AvanzOSC
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import test_quality_control_stock
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2015 Oihane Crucelaegui - AvanzOSC
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
# Copyright 2015 Oihane Crucelaegui - AvanzOSC
|
||||
# Copyright 2018 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp.tests.common import TransactionCase
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestQualityControl(TransactionCase):
|
||||
@@ -18,7 +19,9 @@ class TestQualityControl(TransactionCase):
|
||||
self.partner2 = self.env.ref('base.res_partner_4')
|
||||
self.test = self.env.ref('quality_control.qc_test_1')
|
||||
self.picking_type = self.env.ref('stock.picking_type_out')
|
||||
self.sequence = self.env.ref('stock.seq_type_picking_out')
|
||||
self.location_dest = self.env.ref('stock.stock_location_customers')
|
||||
self.sequence = self.env['ir.sequence'] \
|
||||
.search([('prefix', 'like', '/OUT/')], limit=1)
|
||||
inspection_lines = (
|
||||
self.inspection_model._prepare_inspection_lines(self.test))
|
||||
self.inspection1 = self.inspection_model.create({
|
||||
@@ -37,19 +40,27 @@ class TestQualityControl(TransactionCase):
|
||||
'product_uom': self.product.uom_id.id,
|
||||
'product_uom_qty': 2.0,
|
||||
'location_id': self.picking_type.default_location_src_id.id,
|
||||
'location_dest_id': self.picking_type.default_location_dest_id.id,
|
||||
'location_dest_id': self.location_dest.id,
|
||||
}
|
||||
self.picking1 = self.picking_model.create({
|
||||
self.picking1 = self.picking_model \
|
||||
.with_context(default_picking_type_id=self.picking_type.id) \
|
||||
.create({
|
||||
'partner_id': self.partner1.id,
|
||||
'picking_type_id': self.picking_type.id,
|
||||
'move_lines': [(0, 0, move_vals)],
|
||||
'location_dest_id': self.location_dest.id
|
||||
})
|
||||
self.picking1.action_confirm()
|
||||
self.picking1.force_assign()
|
||||
self.picking1.do_prepare_partial()
|
||||
for line in self.picking1.pack_operation_ids.filtered(
|
||||
lambda r: r.product_id == self.product):
|
||||
line.write({'lot_id': self.lot.id})
|
||||
line.write({
|
||||
'pack_lot_ids': [(0, 0, {
|
||||
'lot_id': self.lot.id,
|
||||
'qty': 2.0
|
||||
})]
|
||||
})
|
||||
|
||||
def test_inspection_create_for_product(self):
|
||||
self.product.qc_triggers = [(
|
||||
@@ -200,24 +211,24 @@ class TestQualityControl(TransactionCase):
|
||||
def test_picking_type(self):
|
||||
picking_type = self.picking_type_model.create({
|
||||
'name': 'Test Picking Type',
|
||||
'sequence_id': self.sequence.id,
|
||||
'code': 'outgoing',
|
||||
'sequence_id': self.sequence.id
|
||||
})
|
||||
trigger = self.qc_trigger_model.search(
|
||||
[('picking_type', '=', picking_type.id)])
|
||||
self.assertEqual(len(trigger), 1,
|
||||
'One trigger must have been created.')
|
||||
self.assertEqual(trigger.name, picking_type.complete_name,
|
||||
self.assertEqual(trigger.name, picking_type.name,
|
||||
'Trigger name must match picking type name.')
|
||||
picking_type.write({
|
||||
'name': 'Test Name Change',
|
||||
})
|
||||
self.assertEqual(trigger.name, picking_type.complete_name,
|
||||
self.assertEqual(trigger.name, picking_type.name,
|
||||
'Trigger name must match picking type name.')
|
||||
|
||||
def test_qc_inspection_picking(self):
|
||||
self.inspection1.write({
|
||||
'object_id': '%s,%d' % (self.picking1._model,
|
||||
'object_id': '%s,%d' % (self.picking1._name,
|
||||
self.picking1.id),
|
||||
})
|
||||
self.assertEquals(self.inspection1.picking,
|
||||
@@ -225,7 +236,7 @@ class TestQualityControl(TransactionCase):
|
||||
|
||||
def test_qc_inspection_stock_move(self):
|
||||
self.inspection1.write({
|
||||
'object_id': '%s,%d' % (self.picking1.move_lines[:1]._model,
|
||||
'object_id': '%s,%d' % (self.picking1.move_lines[:1]._name,
|
||||
self.picking1.move_lines[:1].id),
|
||||
})
|
||||
self.inspection1.onchange_object_id()
|
||||
@@ -240,7 +251,7 @@ class TestQualityControl(TransactionCase):
|
||||
|
||||
def test_qc_inspection_lot(self):
|
||||
self.inspection1.write({
|
||||
'object_id': '%s,%d' % (self.lot._model,
|
||||
'object_id': '%s,%d' % (self.lot._name,
|
||||
self.lot.id),
|
||||
})
|
||||
self.inspection1.onchange_object_id()
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Copyright 2018 Simone Rubino - Agile Business Group
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="qc_inspection_form_view_picking">
|
||||
<field name="name">qc.inspection.form.view.picking</field>
|
||||
<field name="model">qc.inspection</field>
|
||||
<field name="inherit_id" ref="quality_control.qc_inspection_form_view" />
|
||||
<field name="inherit_id" ref="quality_control.qc_inspection_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product" position="after">
|
||||
<field name="picking" />
|
||||
<field name="lot" groups="stock.group_production_lot" />
|
||||
<field name="picking"/>
|
||||
<field name="lot" groups="stock.group_production_lot"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
@@ -17,11 +17,11 @@
|
||||
<record model="ir.ui.view" id="qc_inspection_tree_view_picking">
|
||||
<field name="name">qc.inspection.tree.view.picking</field>
|
||||
<field name="model">qc.inspection</field>
|
||||
<field name="inherit_id" ref="quality_control.qc_inspection_tree_view" />
|
||||
<field name="inherit_id" ref="quality_control.qc_inspection_tree_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product" position="after">
|
||||
<field name="picking" />
|
||||
<field name="lot" groups="stock.group_production_lot" />
|
||||
<field name="picking"/>
|
||||
<field name="lot" groups="stock.group_production_lot"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
@@ -29,21 +29,21 @@
|
||||
<record model="ir.ui.view" id="qc_inspection_search_view_picking">
|
||||
<field name="name">qc.inspection.search.view.picking</field>
|
||||
<field name="model">qc.inspection</field>
|
||||
<field name="inherit_id" ref="quality_control.qc_inspection_search_view" />
|
||||
<field name="inherit_id" ref="quality_control.qc_inspection_search_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product" position="after">
|
||||
<field name="picking" />
|
||||
<field name="lot" groups="stock.group_production_lot" />
|
||||
<field name="picking"/>
|
||||
<field name="lot" groups="stock.group_production_lot"/>
|
||||
</field>
|
||||
<filter string="Product" position="after">
|
||||
<group expand="0" position="inside">
|
||||
<filter string="Picking"
|
||||
domain="[]"
|
||||
context="{'group_by': 'picking'}" />
|
||||
context="{'group_by': 'picking'}"/>
|
||||
<filter string="Lot"
|
||||
domain="[]"
|
||||
groups="stock.group_production_lot"
|
||||
context="{'group_by': 'lot'}" />
|
||||
</filter>
|
||||
context="{'group_by': 'lot'}"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
<field name="inherit_id" ref="quality_control.qc_inspection_line_tree_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product" position="after">
|
||||
<field name="picking" />
|
||||
<field name="lot" />
|
||||
<field name="picking"/>
|
||||
<field name="lot"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
@@ -62,22 +62,20 @@
|
||||
<record model="ir.ui.view" id="qc_inspection_line_search_stock_view">
|
||||
<field name="name">qc.inspection.line.search.stock</field>
|
||||
<field name="model">qc.inspection.line</field>
|
||||
<field name="inherit_id" ref="quality_control.qc_inspection_line_search_view" />
|
||||
<field name="inherit_id" ref="quality_control.qc_inspection_line_search_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="product" position="after">
|
||||
<field name="picking" />
|
||||
<field name="lot" />
|
||||
<field name="picking"/>
|
||||
<field name="lot"/>
|
||||
</field>
|
||||
<filter string="Product" position="after">
|
||||
<group expand="0" position="inside">
|
||||
<filter string="Picking"
|
||||
domain="[]"
|
||||
context="{'group_by': 'picking'}" />
|
||||
context="{'group_by': 'picking'}"/>
|
||||
<filter string="Lot"
|
||||
domain="[]"
|
||||
context="{'group_by': 'lot'}" />
|
||||
</filter>
|
||||
context="{'group_by': 'lot'}"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Copyright 2018 Simone Rubino - Agile Business Group
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
<record id="action_qc_inspection_per_picking" model="ir.actions.act_window">
|
||||
<field name="name">Quality inspections from picking</field>
|
||||
<field name="res_model">qc.inspection</field>
|
||||
@@ -37,7 +37,7 @@
|
||||
<field name="groups_id"
|
||||
eval="[(4, ref('quality_control.group_quality_control_user'))]" />
|
||||
<field name="arch" type="xml">
|
||||
<div class="oe_right oe_button_box" position="inside">
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_inline oe_stat_button"
|
||||
type="action"
|
||||
name="%(action_qc_inspection_per_picking)d"
|
||||
@@ -67,6 +67,4 @@
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Copyright 2018 Simone Rubino - Agile Business Group
|
||||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
<record id="action_qc_inspection_per_lot" model="ir.actions.act_window">
|
||||
<field name="name">Quality inspections from lot</field>
|
||||
<field name="res_model">qc.inspection</field>
|
||||
@@ -37,7 +37,7 @@
|
||||
<field name="groups_id"
|
||||
eval="[(4, ref('quality_control.group_quality_control_user'))]" />
|
||||
<field name="arch" type="xml">
|
||||
<div class="oe_button_box oe_right" position="inside">
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_inline oe_stat_button"
|
||||
type="action"
|
||||
name="%(action_qc_inspection_per_lot)d"
|
||||
@@ -67,6 +67,4 @@
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user