mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
quality_control: Total refactorization with new API, README files, and new concepts. * Triggers for product category * ACLs * Tolerances in questions * one2many copyable * Fix some views * Error on same tolerance * Colors on inspection lines * Unify inspection header data assignment in set_test method * key name in set_test * Change icon set
This commit is contained in:
@@ -1,31 +1,5 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2010 NaN Projectes de Programari Lliure, S.L.
|
||||
# All Rights Reserved.
|
||||
# http://www.NaN-tic.com
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# For copyright and license notices, see __openerp__.py file in root directory
|
||||
##############################################################################
|
||||
|
||||
from . import qc_test_wizard
|
||||
|
||||
@@ -1,70 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2010 NaN Projectes de Programari Lliure, S.L.
|
||||
# All Rights Reserved.
|
||||
# http://www.NaN-tic.com
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# For copyright and license notices, see __openerp__.py file in root directory
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import orm, fields
|
||||
from openerp import models, fields, api
|
||||
|
||||
|
||||
class QcTestWizard(orm.TransientModel):
|
||||
class QcInspectionSetTest(models.TransientModel):
|
||||
"""This wizard is responsible for setting the test for a given
|
||||
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
|
||||
the template.
|
||||
"""
|
||||
This wizard is responsible for setting the proof template for a given test.
|
||||
This will not only fill in the 'test_template_id' field, but will also fill
|
||||
in all lines of the test with the corresponding lines of the template.
|
||||
"""
|
||||
_name = 'qc.test.set.template.wizard'
|
||||
_name = 'qc.inspection.set.test'
|
||||
|
||||
def _default_test_template_id(self, cr, uid, context=None):
|
||||
test = self.pool['qc.test'].browse(
|
||||
cr, uid, context.get('active_id', False), context=context)
|
||||
cond = [('object_id', '=', test.object_id.id)]
|
||||
ids = self.pool['qc.test.template'].search(cr, uid, cond,
|
||||
context=context)
|
||||
return ids and ids[0] or False
|
||||
test = fields.Many2one(comodel_name='qc.test', string='Test')
|
||||
|
||||
_columns = {
|
||||
'test_template_id': fields.many2one('qc.test.template', 'Template'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'test_template_id': _default_test_template_id,
|
||||
}
|
||||
|
||||
def action_create_test(self, cr, uid, ids, context=None):
|
||||
wizard = self.browse(cr, uid, ids[0], context=context)
|
||||
self.pool['qc.test'].set_test_template(cr, uid, [context['active_id']],
|
||||
wizard.test_template_id.id,
|
||||
context=context)
|
||||
return {
|
||||
'type': 'ir.actions.act_window_close',
|
||||
}
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
return {
|
||||
'type': 'ir.actions.act_window_close',
|
||||
}
|
||||
@api.multi
|
||||
def action_create_test(self):
|
||||
inspection_obj = self.env['qc.inspection']
|
||||
inspection_obj.browse(self.env.context['active_id']).set_test(
|
||||
self.test)
|
||||
return True
|
||||
|
||||
@@ -1,31 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- qc.test.set.template.wizard -->
|
||||
<record id="view_qc_test_set_template_wizard_form" model="ir.ui.view">
|
||||
<field name="name">qc.test.set.template.wizard</field>
|
||||
<field name="model">qc.test.set.template.wizard</field>
|
||||
<record id="view_qc_test_set_test_form" model="ir.ui.view">
|
||||
<field name="name">qc.inspection.set.test.form</field>
|
||||
<field name="model">qc.inspection.set.test</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Test Template" version="7.0">
|
||||
<form string="Select test" version="7.0">
|
||||
<group>
|
||||
<field name="test_template_id" />
|
||||
<field name="test" />
|
||||
</group>
|
||||
<footer>
|
||||
<button name="action_create_test"
|
||||
string="Accept" type="object" class="oe_highlight"/>
|
||||
string="Accept"
|
||||
type="object"
|
||||
class="oe_highlight"/>
|
||||
or
|
||||
<button special="cancel" class="oe_link"
|
||||
string="Cancel" />
|
||||
<button special="cancel"
|
||||
class="oe_link"
|
||||
string="Cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_qc_test_set_template_wizard_form"
|
||||
model="ir.actions.act_window">
|
||||
<field name="name">Select Test Template</field>
|
||||
<record id="action_qc_inspection_set_test" model="ir.actions.act_window">
|
||||
<field name="name">Select test</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">qc.test.set.template.wizard</field>
|
||||
<field name="res_model">qc.inspection.set.test</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
|
||||
Reference in New Issue
Block a user