quality_control: required changes

This commit is contained in:
oihane
2015-10-26 16:56:43 +01:00
committed by lreficent
parent 4b08e4c0cd
commit a30a2d7823
4 changed files with 20 additions and 19 deletions

View File

@@ -64,16 +64,16 @@ class QcInspection(models.Model):
('waiting', 'Waiting supervisor approval'), ('waiting', 'Waiting supervisor approval'),
('success', 'Quality success'), ('success', 'Quality success'),
('failed', 'Quality failed'), ('failed', 'Quality failed'),
('canceled', 'Cancelled')], ('canceled', 'Canceled')],
string='State', readonly=True, default='draft') string='State', readonly=True, default='draft')
success = fields.Boolean( success = fields.Boolean(
compute="_success", string='Success', compute="_success", string='Success',
help='This field will be marked if all tests have been succeeded.', help='This field will be marked if all tests have succeeded.',
store=True) store=True)
auto_generated = fields.Boolean( auto_generated = fields.Boolean(
string='Auto-generated', readonly=True, copy=False, string='Auto-generated', readonly=True, copy=False,
help='If an inspection is auto-generated, it can be cancelled nor ' help='If an inspection is auto-generated, it can be canceled nor '
'removed') 'removed.')
company_id = fields.Many2one( company_id = fields.Many2one(
comodel_name='res.company', string='Company', readonly=True, comodel_name='res.company', string='Company', readonly=True,
states={'draft': [('readonly', False)]}, states={'draft': [('readonly', False)]},
@@ -94,11 +94,11 @@ class QcInspection(models.Model):
for inspection in self: for inspection in self:
if inspection.auto_generated: if inspection.auto_generated:
raise exceptions.Warning( raise exceptions.Warning(
_("You cannot remove an auto-generated inspection")) _("You cannot remove an auto-generated inspection."))
if inspection.state != 'draft': if inspection.state != 'draft':
raise exceptions.Warning( raise exceptions.Warning(
_("You cannot remove an inspection that it's not in draft " _("You cannot remove an inspection that is not in draft "
"state")) "state."))
return super(QcInspection, self).unlink() return super(QcInspection, self).unlink()
@api.multi @api.multi
@@ -110,7 +110,7 @@ class QcInspection(models.Model):
for inspection in self: for inspection in self:
if not inspection.test: if not inspection.test:
raise exceptions.Warning( raise exceptions.Warning(
_("You must set the test to perform first.")) _("You must first set the test to perform."))
self.write({'state': 'ready'}) self.write({'state': 'ready'})
@api.multi @api.multi
@@ -266,21 +266,21 @@ class QcInspectionLine(models.Model):
comodel_name='qc.test.question.value', string='Answers') comodel_name='qc.test.question.value', string='Answers')
quantitative_value = fields.Float( quantitative_value = fields.Float(
'Quantitative value', digits=(16, 5), 'Quantitative value', digits=(16, 5),
help="Value of the result if it's a quantitative question.") help="Value of the result for a quantitative question.")
qualitative_value = fields.Many2one( qualitative_value = fields.Many2one(
comodel_name='qc.test.question.value', string='Qualitative value', comodel_name='qc.test.question.value', string='Qualitative value',
help="Value of the result if it's a qualitative question.", help="Value of the result for a qualitative question.",
domain="[('id', 'in', possible_ql_values[0][2])]") domain="[('id', 'in', possible_ql_values[0][2])]")
notes = fields.Text(string='Notes') notes = fields.Text(string='Notes')
min_value = fields.Float( min_value = fields.Float(
string='Min', digits=(16, 5), readonly=True, string='Min', digits=(16, 5), readonly=True,
help="Minimum valid value if it's a quantitative question.") help="Minimum valid value for a quantitative question.")
max_value = fields.Float( max_value = fields.Float(
string='Max', digits=(16, 5), readonly=True, string='Max', digits=(16, 5), readonly=True,
help="Maximum valid value if it's a quantitative question.") help="Maximum valid value for a quantitative question.")
test_uom_id = fields.Many2one( test_uom_id = fields.Many2one(
comodel_name='product.uom', string='Test UoM', readonly=True, comodel_name='product.uom', string='Test UoM', readonly=True,
help="UoM for minimum and maximum values if it's a quantitative " help="UoM for minimum and maximum values for a quantitative "
"question.") "question.")
test_uom_category = fields.Many2one( test_uom_category = fields.Many2one(
comodel_name="product.uom.categ", related="test_uom_id.category_id", comodel_name="product.uom.categ", related="test_uom_id.category_id",
@@ -288,7 +288,7 @@ class QcInspectionLine(models.Model):
uom_id = fields.Many2one( uom_id = fields.Many2one(
comodel_name='product.uom', string='UoM', comodel_name='product.uom', string='UoM',
domain="[('category_id', '=', test_uom_category)]", domain="[('category_id', '=', test_uom_category)]",
help="UoM of the inspection value if it's a quantitative question.") help="UoM of the inspection value for a quantitative question.")
question_type = fields.Selection( question_type = fields.Selection(
[('qualitative', 'Qualitative'), [('qualitative', 'Qualitative'),
('quantitative', 'Quantitative')], ('quantitative', 'Quantitative')],

View File

@@ -6,7 +6,8 @@ from openerp import models, fields, api, exceptions, _
class QcTest(models.Model): class QcTest(models.Model):
"""A test is a group of questions to with the values that make them valid. """
A test is a group of questions along with the values that make them valid.
""" """
_name = 'qc.test' _name = 'qc.test'
_description = 'Quality control test' _description = 'Quality control test'
@@ -53,7 +54,7 @@ class QcTestQuestion(models.Model):
if value.ok: if value.ok:
return return
raise exceptions.Warning( raise exceptions.Warning(
_("There isn't any value with OK marked. You have to mark at " _("There isn't no value marked as OK. You have to mark at "
"least one.")) "least one."))
@api.one @api.one
@@ -84,7 +85,7 @@ class QcTestQuestion(models.Model):
class QcTestQuestionValue(models.Model): class QcTestQuestionValue(models.Model):
_name = 'qc.test.question.value' _name = 'qc.test.question.value'
_description = 'Possible values of qualitative questions.' _description = 'Possible values for qualitative questions.'
test_line = fields.Many2one( test_line = fields.Many2one(
comodel_name="qc.test.question", string="Test question") comodel_name="qc.test.question", string="Test question")

View File

@@ -27,7 +27,7 @@ class QcTriggerLine(models.AbstractModel):
partners = fields.Many2many( partners = fields.Many2many(
comodel_name='res.partner', string='Partners', comodel_name='res.partner', string='Partners',
help='If filled, the test will only be created when the action is done' help='If filled, the test will only be created when the action is done'
' for one of the specified partners. If empty, the test will be always' ' for one of the specified partners. If empty, the test will always be'
' created.', domain="[('parent_id', '=', False)]") ' created.', domain="[('parent_id', '=', False)]")
def get_trigger_line_for_product(self, trigger, product, partner=False): def get_trigger_line_for_product(self, trigger, product, partner=False):

View File

@@ -6,7 +6,7 @@ from openerp import models, fields, api
class QcInspectionSetTest(models.TransientModel): class QcInspectionSetTest(models.TransientModel):
"""This wizard is responsible for setting the test for a given """This wizard is used to preset the test for a given
inspection. This will not only fill in the 'test' field, but will inspection. This will not only fill in the 'test' field, but will
also fill in all lines of the inspection with the corresponding lines of also fill in all lines of the inspection with the corresponding lines of
the template. the template.