mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[MIG] quality_control_mrp: Migration to 11.0
This commit is contained in:
committed by
Ignacio José Alés López
parent
8966c3414b
commit
7f7a05a635
@@ -14,13 +14,13 @@ MRP extension for quality control
|
||||
: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_mrp
|
||||
:target: https://github.com/OCA/manufacture/tree/11.0/quality_control_mrp
|
||||
: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_mrp
|
||||
:target: https://translation.odoo-community.org/projects/manufacture-10-0/manufacture-11-0-quality_control_mrp
|
||||
: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
|
||||
:target: https://runbot.odoo-community.org/runbot/129/11.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
@@ -62,6 +62,7 @@ Contributors
|
||||
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
|
||||
* Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
|
||||
* Simone Rubino <simone.rubino@agilebg.com>
|
||||
* Ignacio Ales <ignacio.ales@guadaltech.es>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
@@ -76,6 +77,6 @@ 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.
|
||||
|
||||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/10.0/quality_control_mrp>`_ project on GitHub.
|
||||
This module is part of the `OCA/manufacture <https://github.com/OCA/manufacture/tree/11.0/quality_control_mrp>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import models
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2014 Oihane Crucelaegui - AvanzOSC
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
"name": "MRP extension for quality control",
|
||||
"version": "10.0.1.0.0",
|
||||
"version": "11.0.1.0.0",
|
||||
"category": "Quality control",
|
||||
"license": "AGPL-3",
|
||||
"author": "OdooMRP team, "
|
||||
@@ -13,7 +12,7 @@
|
||||
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
|
||||
"Agile Business Group, "
|
||||
"Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/manufacture/tree/10.0/"
|
||||
"website": "https://github.com/OCA/manufacture/tree/11.0/"
|
||||
"quality_control_mrp",
|
||||
"depends": [
|
||||
"quality_control",
|
||||
|
||||
13
quality_control_mrp/migrations/10.0.1.0.0/pre-migration.py
Normal file
13
quality_control_mrp/migrations/10.0.1.0.0/pre-migration.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from openupgradelib import openupgrade
|
||||
|
||||
field_renames = [
|
||||
("mrp.production", "mrp_production", "qc_inspections",
|
||||
"qc_inspections_ids"),
|
||||
("qc.inspection", "qc_inspection", "production", "production_id"),
|
||||
("qc.inspection.line", "qc_inspection_line", "production", "production_id")
|
||||
]
|
||||
|
||||
|
||||
@openupgrade.migrate(use_env=True)
|
||||
def migrate(env, version):
|
||||
openupgrade.rename_fields(env, field_renames)
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import qc_inspection
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# 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).
|
||||
@@ -12,16 +11,15 @@ class MrpProduction(models.Model):
|
||||
_inherit = 'mrp.production'
|
||||
|
||||
@api.multi
|
||||
@api.depends('qc_inspections')
|
||||
def _count_inspections(self):
|
||||
@api.depends('qc_inspections_ids')
|
||||
def _compute_count_inspections(self):
|
||||
for production in self:
|
||||
production.created_inspections = len(production.qc_inspections)
|
||||
production.created_inspections = len(production.qc_inspections_ids)
|
||||
|
||||
qc_inspections = fields.One2many(
|
||||
comodel_name='qc.inspection', inverse_name='production', copy=False,
|
||||
qc_inspections_ids = fields.One2many(
|
||||
comodel_name='qc.inspection', inverse_name='production_id', copy=False,
|
||||
string='Inspections', help="Inspections related to this production.")
|
||||
created_inspections = fields.Integer(
|
||||
compute="_count_inspections", string="Created inspections")
|
||||
created_inspections = fields.Integer(compute="_compute_count_inspections")
|
||||
|
||||
@api.multi
|
||||
def post_inventory(self):
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# 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).
|
||||
@@ -13,36 +12,40 @@ class QcInspection(models.Model):
|
||||
def _prepare_inspection_header(self, object_ref, trigger_line):
|
||||
res = super(QcInspection, self)._prepare_inspection_header(
|
||||
object_ref, trigger_line)
|
||||
# Fill qty when coming from pack operations
|
||||
# Fill qty when coming from stock move
|
||||
if object_ref and object_ref._name == 'mrp.production':
|
||||
res['qty'] = object_ref.product_qty
|
||||
return res
|
||||
|
||||
@api.depends('object_id')
|
||||
def get_production(self):
|
||||
def _compute_get_production(self):
|
||||
for inspection in self:
|
||||
if inspection.object_id:
|
||||
if inspection.object_id._name == 'stock.move':
|
||||
inspection.production = inspection.object_id.production_id
|
||||
inspection.production_id = \
|
||||
inspection.object_id.production_id
|
||||
elif inspection.object_id._name == 'mrp.production':
|
||||
inspection.production = inspection.object_id
|
||||
inspection.production_id = inspection.object_id
|
||||
|
||||
@api.multi
|
||||
@api.depends('object_id')
|
||||
def _get_product(self):
|
||||
def _compute_product_id(self):
|
||||
"""Overriden for getting the product from a manufacturing order."""
|
||||
for inspection in self:
|
||||
super(QcInspection, inspection)._get_product()
|
||||
super(QcInspection, inspection)._compute_product_id()
|
||||
if inspection.object_id and\
|
||||
inspection.object_id._name == 'mrp.production':
|
||||
inspection.product = inspection.object_id.product_id
|
||||
inspection.product_id = inspection.object_id.product_id
|
||||
return
|
||||
|
||||
production = fields.Many2one(
|
||||
comodel_name="mrp.production", compute="get_production", store=True)
|
||||
production_id = fields.Many2one(
|
||||
comodel_name="mrp.production",
|
||||
compute="_compute_get_production", store=True)
|
||||
|
||||
|
||||
class QcInspectionLine(models.Model):
|
||||
_inherit = 'qc.inspection.line'
|
||||
|
||||
production = fields.Many2one(
|
||||
comodel_name="mrp.production", related="inspection_id.production",
|
||||
production_id = fields.Many2one(
|
||||
comodel_name="mrp.production", related="inspection_id.production_id",
|
||||
store=True, string="Production order")
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
|
||||
* Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
|
||||
* Simone Rubino <simone.rubino@agilebg.com>
|
||||
* Ignacio José Alés López <ignacio.ales@guadaltech.es>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import test_quality_control_mrp
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2015 Oihane Crucelaegui - AvanzOSC
|
||||
# Copyright 2018 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
@@ -142,5 +141,5 @@ class TestQualityControlMrp(TransactionCase):
|
||||
'object_id': '%s,%d' % (self.production1._name,
|
||||
self.production1.id),
|
||||
})
|
||||
self.assertEquals(self.inspection1.production,
|
||||
self.production1)
|
||||
self.assertEqual(self.inspection1.production_id,
|
||||
self.production1)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<field name="name">Quality inspections from production order</field>
|
||||
<field name="res_model">qc.inspection</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('production', '=', active_id)]</field>
|
||||
<field name="domain">[('production_id', '=', active_id)]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="mrp_production_qc_view">
|
||||
@@ -28,4 +28,4 @@
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
</odoo>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<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 name="product_id" position="after">
|
||||
<field name="production_id" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
@@ -22,8 +22,8 @@
|
||||
<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 name="product_id" position="after">
|
||||
<field name="production_id" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
@@ -35,13 +35,13 @@
|
||||
<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 name="product_id" position="after">
|
||||
<field name="production_id" />
|
||||
</field>
|
||||
<group expand="0" position="inside">
|
||||
<filter string="Production"
|
||||
domain="[]"
|
||||
context="{'group_by': 'production'}" />
|
||||
context="{'group_by': 'production_id'}" />
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
@@ -53,8 +53,8 @@
|
||||
<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 name="product_id" position="after">
|
||||
<field name="production_id" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
@@ -66,13 +66,13 @@
|
||||
<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 name="product_id" position="after">
|
||||
<field name="production_id" />
|
||||
</field>
|
||||
<group expand="0" position="inside">
|
||||
<filter string="Production order"
|
||||
domain="[]"
|
||||
context="{'group_by': 'production'}" />
|
||||
context="{'group_by': 'production_id'}" />
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user