@ -0,0 +1,32 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2012-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Nikhil krishnan(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
from openerp import _ |
|||
from openerp.exceptions import Warning |
|||
try: |
|||
import statistics |
|||
except ImportError: |
|||
raise Warning(_("Warning " |
|||
"Please Install the statistics python package -- sudo pip install statistics --")) |
|||
import models |
@ -0,0 +1,51 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2012-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Nikhil krishnan(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
{ |
|||
'name': "Quality Control - Multiple Quantitative Values", |
|||
'version': "8.0.1.0.0", |
|||
'category': "Quality control", |
|||
'summary': 'Quality Control - Multiple Quantitative Values With Different Statistical Averaging Methods.', |
|||
'description': """ |
|||
Manage the Quality Control process with Multiple Quantitative Values |
|||
==================================================================== |
|||
This module allows you to give multiple quantitative values in the quality control lines as the result. |
|||
Also we can mention the calculation method in the line like Mean,Mode,Median,Largest and smallest. |
|||
the result(Quantitative value) will calculated automatically. |
|||
------------------------------------------------------------------------------------------------- |
|||
* Allows to manage Multiple Quantitative Values |
|||
* We can set the Number of tests and calculation method |
|||
* Different calculation methods - Mean,Mode,Median,Largest and smallest |
|||
""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'website': 'http://www.yourcompany.com', |
|||
'depends': ['product', 'quality_control'], |
|||
'data': ['views/qc_inspection_views.xml'], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'application': False, |
|||
# install sudo pip install statistics |
|||
} |
@ -0,0 +1,25 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2012-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Nikhil krishnan(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
import qc_inspection |
@ -0,0 +1,146 @@ |
|||
# -*- coding: utf-8 -*- |
|||
|
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2012-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Nikhil krishnan(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
|
|||
import statistics |
|||
from openerp import models, fields, api, exceptions, _ |
|||
from openerp.exceptions import Warning |
|||
|
|||
|
|||
class QcInspection(models.Model): |
|||
_inherit = 'qc.inspection' |
|||
|
|||
# Replace this function here. for Checking the test_number and test_results |
|||
@api.multi |
|||
def action_confirm(self): |
|||
for inspection in self: |
|||
for line in inspection.inspection_lines: |
|||
if line.question_type == 'qualitative': |
|||
if not line.qualitative_value: |
|||
raise exceptions.Warning( |
|||
_("You should provide an answer for all " |
|||
"qualitative questions.")) |
|||
else: |
|||
if not line.uom_id: |
|||
raise exceptions.Warning( |
|||
_("You should provide a unit of measure for" |
|||
"quantitative questions.")) |
|||
if line.test_number == len(line.test_results): |
|||
pass |
|||
elif line.test_number > len(line.test_results): |
|||
raise exceptions.Warning( |
|||
_("Warning \n" |
|||
"Question %s has no sufficient test results. we need %s results" % (line.name, |
|||
line.test_number))) |
|||
else: |
|||
raise exceptions.Warning( |
|||
_("Warning \n" "Question %s has excess of test results. Number of tests is %s. Please update " |
|||
"the test number or test results" % (line.name, line.test_number))) |
|||
|
|||
if inspection.success: |
|||
inspection.state = 'success' |
|||
else: |
|||
inspection.state = 'waiting' |
|||
|
|||
|
|||
class QcInspectionLine(models.Model): |
|||
_inherit = 'qc.inspection.line' |
|||
_description = 'Quality control inspection' |
|||
|
|||
@api.one |
|||
@api.depends('question_type', 'test_number', 'test_results', 'test_method') |
|||
def quantitative_value_check(self): |
|||
if self.question_type == 'qualitative': |
|||
# self.write({'test_number': 0}) |
|||
self.test_number = 0 |
|||
else: |
|||
lst = [] |
|||
for n in self.test_results: |
|||
lst.append(n.name) |
|||
if self.test_method == 'avg_mean': |
|||
if self.test_number == len(self.test_results): |
|||
self.quantitative_value = statistics.mean(lst) |
|||
else: |
|||
self.quantitative_value = 0 |
|||
elif self.test_method == 'avg_mode': |
|||
if self.test_number == len(self.test_results): |
|||
try: |
|||
self.quantitative_value = statistics.mode(lst) |
|||
except Exception, e: |
|||
raise Warning(_("Warning \n" |
|||
"no unique mode; found %s equally common values" % (self.test_number))) |
|||
else: |
|||
self.quantitative_value = 0 |
|||
elif self.test_method == 'avg_median': |
|||
if self.test_number == len(self.test_results): |
|||
self.quantitative_value = statistics.median(lst) |
|||
else: |
|||
self.quantitative_value = 0 |
|||
|
|||
elif self.test_method == 'max_method': |
|||
if self.test_number == len(self.test_results): |
|||
self.quantitative_value = max(lst) |
|||
else: |
|||
self.quantitative_value = 0 |
|||
else: |
|||
if self.test_number == len(self.test_results): |
|||
self.quantitative_value = min(lst) |
|||
else: |
|||
self.quantitative_value = 0 |
|||
|
|||
@api.one |
|||
@api.depends('question_type', 'test_number', 'test_results', 'uom_id', 'test_uom_id', 'max_value', |
|||
'min_value', 'quantitative_value', 'qualitative_value', |
|||
'possible_ql_values') |
|||
def quality_test_check(self): |
|||
if self.question_type == 'qualitative': |
|||
self.success = self.qualitative_value.ok |
|||
else: |
|||
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, |
|||
self.test_uom_id.id) |
|||
self.success = self.max_value >= amount >= self.min_value |
|||
|
|||
test_number = fields.Integer('Number of tests', default=2) |
|||
test_results = fields.Many2many('qc.test.results') |
|||
quantitative_value = fields.Float( |
|||
'Quantitative value', compute="quantitative_value_check", digits=(16, 5), |
|||
help="Value of the result for a quantitative question.") |
|||
test_method = fields.Selection([('avg_mean', 'Mean'), ('avg_mode', 'Mode'), |
|||
('avg_median', 'Median'), ('max_method', 'Largest'), |
|||
('min_method', 'Smallest')], 'Testing Method', default='avg_mean', |
|||
help='The testing Method are used to calculate the Quantitative value with ' |
|||
'varies calculation methods.\n1-Mean: Sum of Test results divided by Number ' |
|||
'of tests.\n2- Mode: Results that occurs most often within the set ' |
|||
'of Test results.\n3-Median: Median is the middle Result in a sequence ' |
|||
'of Test results.\n4- Largest: Largest result from the Test results\n' |
|||
'5-Smallest: Smallest result from the Test results)') |
|||
|
|||
|
|||
class QcTestResults(models.Model): |
|||
_name = 'qc.test.results' |
|||
|
|||
name = fields.Float(string='Values') |
After Width: | Height: | Size: 132 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 71 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 23 KiB |
@ -0,0 +1,119 @@ |
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12"> |
|||
<h2 class="oe_slogan">Quality Control - Multiple Quantitative Values</h2> |
|||
<h3 class="oe_slogan"> Manage the Quality Control process with Multiple Quantitative Values </h3> |
|||
<h4 class="oe_slogan"> Cybrosys Technologies , www.cybrosys.com</h4> |
|||
</div> |
|||
<div class="oe_row oe_spaced"> |
|||
<h4><p style="margin-left: 42px;">Major Features:</p></h4> |
|||
<ul> |
|||
<li style="list-style:none !important;"><span style="color:green;"> ★</span> Allows To Manage Multiple Quantitative Values.</li> |
|||
<li style="list-style:none !important;"><span style="color:green;"> ★</span> We Can Set The 'Number Of Tests' And Calculation Method.</li> |
|||
<li style="list-style:none !important;"><span style="color:green;"> ★</span> Different Calculation Methods - Mean,Mode,Median,Largest and Smallest.</li> |
|||
</ul> |
|||
</div> |
|||
<div class="oe_span12"> |
|||
<div class="oe_demo oe_picture oe_screenshot"> |
|||
<img src="1.png"> |
|||
</div> |
|||
</div> |
|||
<div class="oe_span12"> |
|||
<p class="oe_mt32"> |
|||
<p>This module allows you to give multiple quantitative values in the quality control lines as the result. |
|||
Also we can mention the calculation method in the line like Mean,Mode,Median,Largest and smallest. |
|||
the result(Quantitative value) will calculated automatically.</p> |
|||
</p> |
|||
|
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12"> |
|||
<div class="oe_demo oe_picture oe_screenshot"> |
|||
<img src="2.png"> |
|||
</div> |
|||
</div> |
|||
<div class="oe_span12"> |
|||
<p class="oe_mt32"> |
|||
<p>This module allows you to give multiple quantitative values in the quality control lines as the result. |
|||
Also we can mention the calculation method in the line like Mean,Mode,Median,Largest and smallest. |
|||
the result(Quantitative value) will calculated automatically.</p> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span12"> |
|||
<h4><p style="margin-left: 42px;">Calculation Methods:</p></h4> |
|||
<div class="oe_demo oe_picture oe_screenshot"> |
|||
<img src="3.png"> |
|||
</div> |
|||
</div> |
|||
<div class="oe_span12"> |
|||
<p class="oe_mt32"> |
|||
<ul> |
|||
<li style="list-style:none !important;"><span style="color:red;"> <i style="font-size: 20px;color: #d81212;" class="fa fa-long-arrow-right" aria-hidden="true"></i></span> Mean = Add all the test results/number of tests.</li> |
|||
<li style="list-style:none !important;"><span style="color:red;"> <i style="font-size: 20px;color: #d81212;" class="fa fa-long-arrow-right" aria-hidden="true"></i></span> Mode = Refers to the test results that occur most frequently.</li> |
|||
<li style="list-style:none !important;"><span style="color:red;"> <i style="font-size: 20px;color: #d81212;" class="fa fa-long-arrow-right" aria-hidden="true"></i></span> Median = The Median is the 'middle value' in the sorted test results.</li> |
|||
<li style="list-style:none !important; font-size: 12px;padding-left: 33px;">When the number of tests is odd, the median is the middle entry in the |
|||
sorted list. when the number of tests are even, the median is equal to the sum |
|||
of the two middle after sorting and divided by two.</li> |
|||
<li style="list-style:none !important;"><span style="color:red;"> <i style="font-size: 20px;color: #d81212;" class="fa fa-long-arrow-right" aria-hidden="true"></i></span> Largest = Largest value in the Test results.</li> |
|||
<li style="list-style:none !important;"><span style="color:red;"> <i style="font-size: 20px;color: #d81212;" class="fa fa-long-arrow-right" aria-hidden="true"></i></span> Smallest = smallest value in the Test results.</li> |
|||
</ul> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container oe_dark"> |
|||
<div class="oe_row oe_spaced"> |
|||
<div class="oe_span6"> |
|||
<div class="oe_demo oe_picture oe_screenshot"> |
|||
<img src="4.png"> |
|||
</div> |
|||
</div> |
|||
<div class="oe_span6"> |
|||
<p class="oe_mt32"> |
|||
<p>If you select the Mode Method in the line and No Test results are repeated. Then a warning will arise.</p> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
<section class="oe_container"> |
|||
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2> |
|||
<div class="oe_slogan" style="margin-top:10px !important;"> |
|||
<div> |
|||
<a class="btn btn-primary btn-lg mt8" |
|||
style="color: #FFFFFF !important;border-radius: 0;" href="http://www.cybrosys.com"><i |
|||
class="fa fa-envelope"></i> Email </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="http://www.cybrosys.com/contact/"><i |
|||
class="fa fa-phone"></i> Contact Us </a> <a |
|||
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;" |
|||
href="http://www.cybrosys.com/odoo-customization-and-installation/"><i |
|||
class="fa fa-check-square"></i> Request Customization </a> |
|||
</div> |
|||
<br> |
|||
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block"> |
|||
<div> |
|||
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td> |
|||
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td> |
|||
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td> |
|||
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td> |
|||
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td> |
|||
</div> |
|||
</div> |
|||
</section> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
@ -0,0 +1,22 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data> |
|||
<record model="ir.ui.view" id="qc_inspection_form_view_inherits"> |
|||
<field name="name">qc.inspection.form</field> |
|||
<field name="model">qc.inspection</field> |
|||
<field name="inherit_id" ref="quality_control.qc_inspection_form_view"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='inspection_lines']/tree/field[@name='question_type']" position="after"> |
|||
<field name="test_method" attrs="{'readonly': [('question_type', '=', 'qualitative')]}"/> |
|||
<field name="test_number" attrs="{'readonly': [('question_type', '=', 'qualitative')]}"/> |
|||
<field name="test_results" nolabel="1" widget="many2many_tags" |
|||
attrs="{'readonly': [('question_type', '=', 'qualitative')]}"/> |
|||
</xpath> |
|||
<xpath expr="//field[@name='inspection_lines']/tree/field[@name='quantitative_value']" position="replace"> |
|||
<field name="quantitative_value" |
|||
attrs="{'readonly': [('question_type', '=', 'qualitative')]}" /> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</data> |
|||
</openerp> |