mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[MIG] quality_control: Migration to 10.0
This commit is contained in:
committed by
Pedro M. Baeza
parent
15a1ab163e
commit
069fd45f0d
@@ -1,9 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2010 NaN Projectes de Programari Lliure, S.L.
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2014 Oihane Crucelaegui - AvanzOSC
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import qc_trigger
|
||||
from . import qc_trigger_line
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2014 Oihane Crucelaegui - AvanzOSC
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
# Copyright 2017 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import fields, models
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ProductCategory(models.Model):
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2014 Oihane Crucelaegui - AvanzOSC
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
# Copyright 2017 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import fields, models
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2014 Oihane Crucelaegui - AvanzOSC
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
# Copyright 2017 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import fields, models
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2014 Oihane Crucelaegui - AvanzOSC
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
# Copyright 2017 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import api, exceptions, fields, models, _
|
||||
import openerp.addons.decimal_precision as dp
|
||||
from odoo import api, exceptions, fields, models, _
|
||||
from odoo.tools import formatLang
|
||||
import odoo.addons.decimal_precision as dp
|
||||
|
||||
|
||||
class QcInspection(models.Model):
|
||||
@@ -33,12 +35,12 @@ class QcInspection(models.Model):
|
||||
self.product = False
|
||||
|
||||
name = fields.Char(
|
||||
string='Inspection number', required=True, default='/', select=True,
|
||||
string='Inspection number', required=True, default='/',
|
||||
readonly=True, states={'draft': [('readonly', False)]}, copy=False)
|
||||
date = fields.Datetime(
|
||||
string='Date', required=True, readonly=True, copy=False,
|
||||
default=fields.Datetime.now,
|
||||
states={'draft': [('readonly', False)]}, select=True)
|
||||
states={'draft': [('readonly', False)]})
|
||||
object_id = fields.Reference(
|
||||
string='Reference', selection=_links_get, readonly=True,
|
||||
states={'draft': [('readonly', False)]}, ondelete="set null")
|
||||
@@ -47,7 +49,7 @@ class QcInspection(models.Model):
|
||||
help="Product associated with the inspection")
|
||||
qty = fields.Float(string="Quantity", default=1.0)
|
||||
test = fields.Many2one(
|
||||
comodel_name='qc.test', string='Test', readonly=True, select=True)
|
||||
comodel_name='qc.test', string='Test', readonly=True)
|
||||
inspection_lines = fields.One2many(
|
||||
comodel_name='qc.inspection.line', inverse_name='inspection_id',
|
||||
string='Inspection lines', readonly=True,
|
||||
@@ -71,7 +73,7 @@ class QcInspection(models.Model):
|
||||
store=True)
|
||||
auto_generated = fields.Boolean(
|
||||
string='Auto-generated', readonly=True, copy=False,
|
||||
help='If an inspection is auto-generated, it can be canceled nor '
|
||||
help='If an inspection is auto-generated, it can be canceled but not '
|
||||
'removed.')
|
||||
company_id = fields.Many2one(
|
||||
comodel_name='res.company', string='Company', readonly=True,
|
||||
@@ -235,8 +237,8 @@ class QcInspectionLine(models.Model):
|
||||
if self.uom_id.id == self.test_uom_id.id:
|
||||
amount = self.quantitative_value
|
||||
else:
|
||||
amount = self.env['product.uom']._compute_qty(
|
||||
self.uom_id.id, self.quantitative_value,
|
||||
amount = self.env['product.uom']._compute_quantity(
|
||||
self.quantitative_value,
|
||||
self.test_uom_id.id)
|
||||
self.success = self.max_value >= amount >= self.min_value
|
||||
|
||||
@@ -248,7 +250,9 @@ class QcInspectionLine(models.Model):
|
||||
self.valid_values = ", ".join([x.name for x in
|
||||
self.possible_ql_values if x.ok])
|
||||
else:
|
||||
self.valid_values = "%s-%s" % (self.min_value, self.max_value)
|
||||
self.valid_values = "%s ~ %s" % (
|
||||
formatLang(self.env, self.min_value),
|
||||
formatLang(self.env, self.max_value))
|
||||
if self.env.ref("product.group_uom") in self.env.user.groups_id:
|
||||
self.valid_values += " %s" % self.test_uom_id.name
|
||||
|
||||
|
||||
@@ -3,10 +3,11 @@
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2014 Oihane Crucelaegui - AvanzOSC
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
# Copyright 2017 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import api, exceptions, fields, models, _
|
||||
import openerp.addons.decimal_precision as dp
|
||||
from odoo import api, exceptions, fields, models, _
|
||||
import odoo.addons.decimal_precision as dp
|
||||
|
||||
|
||||
class QcTest(models.Model):
|
||||
@@ -21,9 +22,14 @@ class QcTest(models.Model):
|
||||
link_obj = self.env['res.request.link']
|
||||
return [(r.object, r.name) for r in link_obj.search([])]
|
||||
|
||||
@api.onchange('type')
|
||||
def onchange_type(self):
|
||||
if self.type == 'generic':
|
||||
self.object_id = False
|
||||
|
||||
active = fields.Boolean('Active', default=True)
|
||||
name = fields.Char(
|
||||
string='Name', required=True, translate=True, select=True)
|
||||
string='Name', required=True, translate=True)
|
||||
test_lines = fields.One2many(
|
||||
comodel_name='qc.test.question', inverse_name='test',
|
||||
string='Questions', copy=True)
|
||||
@@ -34,7 +40,7 @@ class QcTest(models.Model):
|
||||
type = fields.Selection(
|
||||
[('generic', 'Generic'),
|
||||
('related', 'Related')],
|
||||
string='Type', select=True, required=True, default='generic')
|
||||
string='Type', required=True, default='generic')
|
||||
category = fields.Many2one(
|
||||
comodel_name='qc.test.category', string='Category')
|
||||
company_id = fields.Many2one(
|
||||
@@ -55,8 +61,8 @@ class QcTestQuestion(models.Model):
|
||||
if (self.type == 'qualitative' and self.ql_values and
|
||||
not self.ql_values.filtered('ok')):
|
||||
raise exceptions.Warning(
|
||||
_("There isn't no value marked as OK. You have to mark at "
|
||||
"least one."))
|
||||
_("Question %s has no value marked as OK. "
|
||||
"You have to mark at least one.") % self.name_get()[0][1])
|
||||
|
||||
@api.one
|
||||
@api.constrains('min_value', 'max_value')
|
||||
@@ -69,7 +75,7 @@ class QcTestQuestion(models.Model):
|
||||
string='Sequence', required=True, default="10")
|
||||
test = fields.Many2one(comodel_name='qc.test', string='Test')
|
||||
name = fields.Char(
|
||||
string='Name', required=True, select=True, translate=True)
|
||||
string='Name', required=True, translate=True)
|
||||
type = fields.Selection(
|
||||
[('qualitative', 'Qualitative'),
|
||||
('quantitative', 'Quantitative')], string='Type', required=True)
|
||||
@@ -91,7 +97,7 @@ class QcTestQuestionValue(models.Model):
|
||||
test_line = fields.Many2one(
|
||||
comodel_name="qc.test.question", string="Test question")
|
||||
name = fields.Char(
|
||||
string='Name', required=True, select=True, translate=True)
|
||||
string='Name', required=True, translate=True)
|
||||
ok = fields.Boolean(
|
||||
string='Correct answer?',
|
||||
help="When this field is marked, the answer is considered correct.")
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2014 Oihane Crucelaegui - AvanzOSC
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
# Copyright 2017 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import api, exceptions, fields, models, _
|
||||
from odoo import api, exceptions, fields, models, _
|
||||
|
||||
|
||||
class QcTestTemplateCategory(models.Model):
|
||||
@@ -38,7 +39,7 @@ class QcTestTemplateCategory(models.Model):
|
||||
|
||||
name = fields.Char('Name', required=True, translate=True)
|
||||
parent_id = fields.Many2one(
|
||||
comodel_name='qc.test.category', string='Parent category', select=True)
|
||||
comodel_name='qc.test.category', string='Parent category')
|
||||
complete_name = fields.Char(
|
||||
compute="_get_complete_name", string='Full name')
|
||||
child_ids = fields.One2many(
|
||||
|
||||
@@ -3,16 +3,17 @@
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2014 Oihane Crucelaegui - AvanzOSC
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
# Copyright 2017 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import fields, models
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class QcTrigger(models.Model):
|
||||
_name = 'qc.trigger'
|
||||
_description = 'Quality control trigger'
|
||||
|
||||
name = fields.Char(string='Name', required=True, select=True,
|
||||
name = fields.Char(string='Name', required=True,
|
||||
translate=True)
|
||||
active = fields.Boolean(string='Active', default=True)
|
||||
company_id = fields.Many2one(
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
# Copyright 2014 Serv. Tec. Avanzados - Pedro M. Baeza
|
||||
# Copyright 2014 Oihane Crucelaegui - AvanzOSC
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
# Copyright 2017 Simone Rubino - Agile Business Group
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import fields, models
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
def _filter_trigger_lines(trigger_lines):
|
||||
|
||||
Reference in New Issue
Block a user