Skip to content

Commit

Permalink
Merge pull request #176 from agaldona/8.0-quality_control
Browse files Browse the repository at this point in the history
[IMP] quality_control: decimal precision configurable
  • Loading branch information
pedrobaeza committed Feb 10, 2017
2 parents c96ad0d + 3eb3284 commit 8d33b08
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion quality_control/__openerp__.py
Expand Up @@ -6,7 +6,7 @@

{
"name": "Quality control",
"version": "8.0.1.1.0",
"version": "8.0.1.2.0",
"category": "Quality control",
"license": "AGPL-3",
"author": "OdooMRP team, "
Expand Down
5 changes: 5 additions & 0 deletions quality_control/data/quality_control_data.xml
Expand Up @@ -8,6 +8,11 @@
<record id="qc_test_template_category_referenced" model="qc.test.category">
<field name="name">Referenced</field>
</record>

<record forcecreate="True" id="decimal_quality_control" model="decimal.precision">
<field name="name">Quality Control</field>
<field name="digits">5</field>
</record>
</data>

<data>
Expand Down
11 changes: 6 additions & 5 deletions quality_control/models/qc_inspection.py
Expand Up @@ -3,6 +3,7 @@
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields, api, exceptions, _
import openerp.addons.decimal_precision as dp


class QcInspection(models.Model):
Expand Down Expand Up @@ -260,19 +261,19 @@ def get_valid_values(self):
possible_ql_values = fields.Many2many(
comodel_name='qc.test.question.value', string='Answers')
quantitative_value = fields.Float(
'Quantitative value', digits=(16, 5),
'Quantitative value', digits=dp.get_precision('Quality Control'),
help="Value of the result for a quantitative question.")
qualitative_value = fields.Many2one(
comodel_name='qc.test.question.value', string='Qualitative value',
help="Value of the result for a qualitative question.",
domain="[('id', 'in', possible_ql_values[0][2])]")
notes = fields.Text(string='Notes')
min_value = fields.Float(
string='Min', digits=(16, 5), readonly=True,
help="Minimum valid value for a quantitative question.")
string='Min', digits=dp.get_precision('Quality Control'),
readonly=True, help="Minimum valid value for a quantitative question.")
max_value = fields.Float(
string='Max', digits=(16, 5), readonly=True,
help="Maximum valid value for a quantitative question.")
string='Max', digits=dp.get_precision('Quality Control'),
readonly=True, help="Maximum valid value for a quantitative question.")
test_uom_id = fields.Many2one(
comodel_name='product.uom', string='Test UoM', readonly=True,
help="UoM for minimum and maximum values for a quantitative "
Expand Down
7 changes: 5 additions & 2 deletions quality_control/models/qc_test.py
Expand Up @@ -3,6 +3,7 @@
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from openerp import models, fields, api, exceptions, _
import openerp.addons.decimal_precision as dp


class QcTest(models.Model):
Expand Down Expand Up @@ -73,8 +74,10 @@ def _check_valid_range(self):
comodel_name='qc.test.question.value', inverse_name="test_line",
string='Qualitative values', copy=True)
notes = fields.Text(string='Notes')
min_value = fields.Float(string='Min', digits=(16, 5))
max_value = fields.Float(string='Max', digits=(15, 5))
min_value = fields.Float(string='Min',
digits=dp.get_precision('Quality Control'))
max_value = fields.Float(string='Max',
digits=dp.get_precision('Quality Control'),)
uom_id = fields.Many2one(comodel_name='product.uom', string='Uom')


Expand Down

0 comments on commit 8d33b08

Please sign in to comment.