[ADD] nan_prodlot_sample_library: new module that adds new workflow step to Production Lots to get a Sample Library (configuration in company and product)
This commit is contained in:
commit
6b3f7912bf
|
@ -0,0 +1,34 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2010-2012 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 Affero 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero 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.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import company
|
||||
import product
|
||||
import stock
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,61 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2010-2012 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 Affero 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero 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.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
"name" : "Production Lot Quality Control - Sample Library",
|
||||
"version" : "1.0",
|
||||
"author" : "NaN Projectes de Programari Lliure S.L.",
|
||||
"category" : "Generic Modules/Quality Control",
|
||||
"website": "http://www.nan-tic.com",
|
||||
"description": """
|
||||
Module developed for Trod y Avia, S.L.
|
||||
|
||||
This module adds the possibility to define that a Product requires that its
|
||||
Lots must to get a Sample Library to be Valid.
|
||||
""",
|
||||
"depends" : [
|
||||
'nan_prodlot_quality_control'
|
||||
],
|
||||
"init_xml" : [],
|
||||
"update_xml" : [
|
||||
'company_view.xml',
|
||||
'product_view.xml',
|
||||
'stock_view.xml',
|
||||
'prodlot_workflow.xml',
|
||||
'sample_library_sequence.xml',
|
||||
],
|
||||
"demo_xml" : [],
|
||||
"test": [
|
||||
#TODO
|
||||
],
|
||||
"active": False,
|
||||
"installable": True,
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,47 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2012 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 Affero 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero 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.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
|
||||
class res_company(osv.osv):
|
||||
'''
|
||||
Adds the field 'requires_sample_library' to configure the default behaviour
|
||||
of Company's products
|
||||
'''
|
||||
_inherit = 'res.company'
|
||||
|
||||
_columns = {
|
||||
'requires_sample_library': fields.boolean('Requires Sample Library',
|
||||
help="It defines the default value which will be used when a "
|
||||
"Product is created. Only the Product's field define the final "
|
||||
"behavior of its lots."),
|
||||
}
|
||||
res_company()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="company_prodlot_sample_library_form" model="ir.ui.view">
|
||||
<field name="name">res.company.prodlot.sample_library.form</field>
|
||||
<field name="model">res.company</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="nan_prodlot_quality_control.company_prodlot_qc_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="qc_template_trigger_ids" position="after">
|
||||
<field name="requires_sample_library"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,90 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * nan_prodlot_sample_library
|
||||
#
|
||||
# Guillem Barba <guillem@nan-tic.com>, 2012.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 6.0.2\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2012-02-27 12:02+0000\n"
|
||||
"PO-Revision-Date: 2012-02-27 13:06+0100\n"
|
||||
"Last-Translator: Guillem Barba <guillem@nan-tic.com>\n"
|
||||
"Language-Team: Catalan <>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
"Language: ca\n"
|
||||
"X-Generator: Lokalize 1.2\n"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: model:ir.model,name:nan_prodlot_sample_library.model_product_product
|
||||
msgid "Product"
|
||||
msgstr "Producte"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: help:res.company,requires_sample_library:0
|
||||
msgid ""
|
||||
"It defines the default value which will be used when a Product is created. "
|
||||
"Only the Product's field define the final behavior of its lots."
|
||||
msgstr ""
|
||||
"Defineix el comportament per defecte que es tindrà en compte al crear-se un "
|
||||
"nou producte. Només el camp al producte defineix el comportament final dels "
|
||||
"seus lots."
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: field:res.company,requires_sample_library:0
|
||||
#: field:stock.production.lot,requires_sample_library:0
|
||||
#: field:stock.production.lot,requires_sample_library_ro:0
|
||||
msgid "Requires Sample Library"
|
||||
msgstr "Requereix mostra"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: model:ir.model,name:nan_prodlot_sample_library.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr "Companyies"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: view:stock.production.lot:0
|
||||
msgid "Quality Control Triggers"
|
||||
msgstr "Disparadors de qualitat"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: constraint:res.company:0
|
||||
msgid "Error! You can not create recursive companies."
|
||||
msgstr "Error! No podeu crear companyies recursives."
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: model:ir.model,name:nan_prodlot_sample_library.model_stock_production_lot
|
||||
msgid "Production lot"
|
||||
msgstr "Lot de producció"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: view:stock.production.lot:0
|
||||
msgid "Get Sample"
|
||||
msgstr "Obté mostra"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: constraint:product.product:0
|
||||
msgid "Error: Invalid ean code"
|
||||
msgstr "Error: Codi EAN invàlid"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: field:stock.production.lot,sample_library_code:0
|
||||
msgid "Sample Library Code"
|
||||
msgstr "Codi mostra"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: sql_constraint:stock.production.lot:0
|
||||
msgid ""
|
||||
"The combination of serial number and internal reference must be unique !"
|
||||
msgstr ""
|
||||
"La combinació del número de serie i la referència interna ha de ser única!"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: view:stock.production.lot:0
|
||||
msgid "Waiting Sample"
|
||||
msgstr "Esperant mostra"
|
||||
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * nan_prodlot_sample_library
|
||||
#
|
||||
# Guillem Barba <guillem@nan-tic.com>, 2012.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 6.0.2\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2012-02-27 12:02+0000\n"
|
||||
"PO-Revision-Date: 2012-02-27 13:04+0100\n"
|
||||
"Last-Translator: Guillem Barba <guillem@nan-tic.com>\n"
|
||||
"Language-Team: Spanish <>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
"Language: es\n"
|
||||
"X-Generator: Lokalize 1.2\n"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: model:ir.model,name:nan_prodlot_sample_library.model_product_product
|
||||
msgid "Product"
|
||||
msgstr "Producto"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: help:res.company,requires_sample_library:0
|
||||
msgid ""
|
||||
"It defines the default value which will be used when a Product is created. "
|
||||
"Only the Product's field define the final behavior of its lots."
|
||||
msgstr ""
|
||||
"Define el valor por defecte que se usará en el producto al crearlo. Sólo el "
|
||||
"campo en el producto define el comportamineto final de los lotes."
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: field:res.company,requires_sample_library:0
|
||||
#: field:stock.production.lot,requires_sample_library:0
|
||||
#: field:stock.production.lot,requires_sample_library_ro:0
|
||||
msgid "Requires Sample Library"
|
||||
msgstr "Require muestra"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: model:ir.model,name:nan_prodlot_sample_library.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr "Compañías"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: view:stock.production.lot:0
|
||||
msgid "Quality Control Triggers"
|
||||
msgstr "Disparadores de control de calidad"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: constraint:res.company:0
|
||||
msgid "Error! You can not create recursive companies."
|
||||
msgstr "¡Error! No puede crear compañías recursivas."
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: model:ir.model,name:nan_prodlot_sample_library.model_stock_production_lot
|
||||
msgid "Production lot"
|
||||
msgstr "Lote producción"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: view:stock.production.lot:0
|
||||
msgid "Get Sample"
|
||||
msgstr "Obtener muestra"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: constraint:product.product:0
|
||||
msgid "Error: Invalid ean code"
|
||||
msgstr "Error: Código EAN erróneo"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: field:stock.production.lot,sample_library_code:0
|
||||
msgid "Sample Library Code"
|
||||
msgstr "Código muestra"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: sql_constraint:stock.production.lot:0
|
||||
msgid ""
|
||||
"The combination of serial number and internal reference must be unique !"
|
||||
msgstr ""
|
||||
"¡La combinación del número de serie y la referencia interna debe ser única!"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: view:stock.production.lot:0
|
||||
msgid "Waiting Sample"
|
||||
msgstr "Esperando muestra"
|
||||
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * nan_prodlot_sample_library
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 6.0.2\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2012-02-27 12:02+0000\n"
|
||||
"PO-Revision-Date: 2012-02-27 12:02+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: model:ir.model,name:nan_prodlot_sample_library.model_product_product
|
||||
msgid "Product"
|
||||
msgstr "Product"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: help:res.company,requires_sample_library:0
|
||||
msgid "It defines the default value which will be used when a Product is created. Only the Product's field define the final behavior of its lots."
|
||||
msgstr "It defines the default value which will be used when a Product is created. Only the Product's field define the final behavior of its lots."
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: field:res.company,requires_sample_library:0
|
||||
#: field:stock.production.lot,requires_sample_library:0
|
||||
#: field:stock.production.lot,requires_sample_library_ro:0
|
||||
msgid "Requires Sample Library"
|
||||
msgstr "Requires Sample Library"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: model:ir.model,name:nan_prodlot_sample_library.model_res_company
|
||||
msgid "Companies"
|
||||
msgstr "Companies"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: view:stock.production.lot:0
|
||||
msgid "Quality Control Triggers"
|
||||
msgstr "Quality Control Triggers"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: constraint:res.company:0
|
||||
msgid "Error! You can not create recursive companies."
|
||||
msgstr "Error! You can not create recursive companies."
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: model:ir.model,name:nan_prodlot_sample_library.model_stock_production_lot
|
||||
msgid "Production lot"
|
||||
msgstr "Production lot"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: view:stock.production.lot:0
|
||||
msgid "Get Sample"
|
||||
msgstr "Get Sample"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: constraint:product.product:0
|
||||
msgid "Error: Invalid ean code"
|
||||
msgstr "Error: Invalid ean code"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: field:stock.production.lot,sample_library_code:0
|
||||
msgid "Sample Library Code"
|
||||
msgstr "Sample Library Code"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: sql_constraint:stock.production.lot:0
|
||||
msgid "The combination of serial number and internal reference must be unique !"
|
||||
msgstr "The combination of serial number and internal reference must be unique !"
|
||||
|
||||
#. module: nan_prodlot_sample_library
|
||||
#: view:stock.production.lot:0
|
||||
msgid "Waiting Sample"
|
||||
msgstr "Waiting Sample"
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="act_pending_sample" model="workflow.activity">
|
||||
<field name="wkf_id" ref="nan_prodlot_quality_control.wkf_prodlot"/>
|
||||
<field name="name">pending_sample</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_wofkflow_pending_sample()</field>
|
||||
<field name="signal_send">subflow.pending_sample</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Transistion -->
|
||||
<!-- Draft Output Transitions -->
|
||||
<record id="nan_prodlot_quality_control.trans_draft_next_test" model="workflow.transition">
|
||||
<field name="act_from" ref="nan_prodlot_quality_control.act_draft"/>
|
||||
<field name="act_to" ref="nan_prodlot_quality_control.act_next_test"/>
|
||||
<field name="condition">not test_pending_sample()</field>
|
||||
<field name="signal">confirm</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_draft_pending_sample" model="workflow.transition">
|
||||
<field name="act_from" ref="nan_prodlot_quality_control.act_draft"/>
|
||||
<field name="act_to" ref="act_pending_sample"/>
|
||||
<field name="condition">test_pending_sample()</field>
|
||||
<field name="signal">confirm</field>
|
||||
</record>
|
||||
|
||||
<!-- Pending Sample Output Transitions -->
|
||||
<record id="trans_pending_sample_next_test" model="workflow.transition">
|
||||
<field name="act_from" ref="act_pending_sample"/>
|
||||
<field name="act_to" ref="nan_prodlot_quality_control.act_next_test"/>
|
||||
<field name="condition">not test_pending_sample()</field>
|
||||
<field name="signal">sample_get</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,86 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2010-2012 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 Affero 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero 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.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
|
||||
class product_product(osv.osv):
|
||||
"""
|
||||
Adds the new property field 'requires_sample_library' for Quality Control templates for Lots: generic and
|
||||
specific templates for input and produced lots. If they are empty, the lots
|
||||
won't require to pass test.
|
||||
The generic templates get it's default value from company.
|
||||
"""
|
||||
_inherit = 'product.product'
|
||||
|
||||
# product.product
|
||||
def _search_by_requires_sample_library(self, cr, uid, obj, name, args,
|
||||
context):
|
||||
property_proxy = self.pool.get('ir.property')
|
||||
|
||||
res = []
|
||||
for fieldname, operator, condition in args:
|
||||
opposite = False
|
||||
if operator in ('!=', '<>'):
|
||||
operator = '='
|
||||
opposite = True
|
||||
|
||||
prop_ids = property_proxy.search(cr, uid, [
|
||||
('name', '=', fieldname),
|
||||
('res_id', 'like', 'res.partner,%'),
|
||||
('value_integer', operator, condition),
|
||||
], context=context)
|
||||
|
||||
product_ids = []
|
||||
for property in property_proxy.browse(cr, uid, prop_ids, context):
|
||||
product_ids.append(property.res_id.id)
|
||||
|
||||
operator = 'in'
|
||||
if opposite:
|
||||
operator = 'not in'
|
||||
res.append(('id', operator, product_ids))
|
||||
return res
|
||||
|
||||
|
||||
_columns = {
|
||||
'requires_sample_library': fields.property('product.product',
|
||||
type='boolean', string="Requires Sample Library", method=True,
|
||||
view_load=True, fnct_search=_search_by_requires_sample_library),
|
||||
}
|
||||
|
||||
# product.product
|
||||
def _default_requires_sample_library(self, cr, uid, context):
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context)
|
||||
return user.company_id.requires_sample_library
|
||||
|
||||
_defaults = {
|
||||
'requires_sample_library': _default_requires_sample_library,
|
||||
}
|
||||
product_product()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- product.product -->
|
||||
<record id="product_prodlot_sample_library_form" model="ir.ui.view">
|
||||
<field name="name">product.prodlot.sample_library.form</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="nan_prodlot_quality_control.product_prodlot_qc_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="qc_template_trigger_ids" position="after">
|
||||
<field name="requires_sample_library"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<!-- stock.production.lot.sample_library Sequence -->
|
||||
<record id="seq_type_sample_library" model="ir.sequence.type">
|
||||
<field name="name">Production Lot Sample Library</field>
|
||||
<field name="code">stock.prodlot.sample_library</field>
|
||||
</record>
|
||||
<record id="seq_sample_library" model="ir.sequence">
|
||||
<field name="name">Production Lot Sample Library</field>
|
||||
<field name="code">stock.prodlot.sample_library</field>
|
||||
<field name="padding">8</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,144 @@
|
|||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2010-2012 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 Affero 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero 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.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
import netsvc
|
||||
|
||||
class stock_production_lot( osv.osv ):
|
||||
_inherit = 'stock.production.lot'
|
||||
|
||||
# stock.production.lot
|
||||
def get_available_states(self, cr, uid, context=None):
|
||||
"""
|
||||
Adds the new state 'pending_sample' before 'pending_test' state.
|
||||
"""
|
||||
states_list = super(stock_production_lot, self).get_available_states(cr,
|
||||
uid, context)
|
||||
pending_index = states_list.index(('pending_test', 'Waiting QC Test'))
|
||||
|
||||
states_list.insert(pending_index, ('pending_sample', "Pending Sample"))
|
||||
return states_list
|
||||
|
||||
|
||||
# stock.production.lot
|
||||
def _calc_sample_library_ro(self, cr, uid, ids, fieldname, args,
|
||||
context=None):
|
||||
res = {}
|
||||
for lot in self.browse(cr, uid, ids, context):
|
||||
res[lot.id] = lot.requires_sample_library
|
||||
return res
|
||||
|
||||
_columns = {
|
||||
'requires_sample_library': fields.boolean('Requires Sample Library',
|
||||
readonly=True, states={'draft': [('readonly',False)]}),
|
||||
# Read Only version of previous field. Better solutions are wellcome
|
||||
'requires_sample_library_ro': fields.function(_calc_sample_library_ro,
|
||||
method=True, type='boolean', string='Requires Sample Library',
|
||||
store = {
|
||||
'stock.production.lot': (
|
||||
lambda self, cr, uid, ids, c=None: ids,
|
||||
['requires_sample_library'], 10),
|
||||
}),
|
||||
|
||||
'sample_library_code': fields.char('Sample Library Code', size=64,
|
||||
readonly=True),
|
||||
}
|
||||
|
||||
def _default_requires_sample_library(self, cr, uid, context=None):
|
||||
if context and context.get('product_id'):
|
||||
product = self.pool.get('product.product').browse(cr, uid,
|
||||
context['product_id'], context)
|
||||
return product.requires_sample_library
|
||||
return False
|
||||
|
||||
_defaults = {
|
||||
'requires_sample_library': _default_requires_sample_library,
|
||||
}
|
||||
|
||||
|
||||
# stock.production.lot
|
||||
def onchange_product_id(self, cr, uid, ids, product_id, context):
|
||||
if not product_id:
|
||||
return {}
|
||||
|
||||
product = self.pool.get('product.product').browse(cr, uid, product_id,
|
||||
context)
|
||||
return {
|
||||
'value': {
|
||||
'requires_sample_library': product.requires_sample_library,
|
||||
}}
|
||||
|
||||
|
||||
# stock.production.lot
|
||||
def test_pending_sample(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Returns True if any of Lot's requires Sample Library
|
||||
@param ids: IDs of stock.production.lot instances
|
||||
"""
|
||||
for lot in self.browse(cr, uid, ids, context):
|
||||
if lot.requires_sample_library and not lot.sample_library_code:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
# stock.production.lot
|
||||
def action_wofkflow_pending_sample(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state': 'pending_sample'}, context)
|
||||
return True
|
||||
|
||||
|
||||
# stock.production.lot
|
||||
def action_sample_library(self, cr, uid, ids, context=None):
|
||||
sequence_proxy = self.pool.get('ir.sequence')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
|
||||
for prodlot in self.browse(cr, uid, ids, context):
|
||||
if not prodlot.requires_sample_library:
|
||||
continue
|
||||
|
||||
self.write(cr, uid, [prodlot.id], {
|
||||
'sample_library_code': sequence_proxy.get(cr, uid,
|
||||
'stock.prodlot.sample_library'),
|
||||
}, context)
|
||||
wf_service.trg_validate(uid, 'stock.production.lot', prodlot.id,
|
||||
'sample_get', cr)
|
||||
return True
|
||||
|
||||
|
||||
# stock.production.lot
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if 'requires_sample_library' not in vals:
|
||||
product = self.pool.get('product.product').browse(cr, uid,
|
||||
vals['product_id'], context)
|
||||
vals['requires_sample_library'] = product.requires_sample_library
|
||||
|
||||
return super(stock_production_lot, self).create(cr, uid, vals, context)
|
||||
stock_production_lot()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- stock.production.lot -->
|
||||
<record id="view_prodlot_sample_library_form" model="ir.ui.view">
|
||||
<field name="name">stock.production.lot.sample_library.form</field>
|
||||
<field name="model">stock.production.lot</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="nan_prodlot_quality_control.view_production_lot_qc_form" />
|
||||
<field name="arch" type="xml">
|
||||
<separator string="Quality Control Triggers" position="before">
|
||||
<newline/>
|
||||
<group col="4" colspan="2">
|
||||
<field name="requires_sample_library" groups="nan_quality_control.group_quality_control_manager"/>
|
||||
<field name="requires_sample_library_ro" groups="nan_quality_control.group_quality_control_user"/>
|
||||
</group>
|
||||
<field name="sample_library_code"/>
|
||||
</separator>
|
||||
|
||||
<button name="confirm" position="after">
|
||||
<button name="action_sample_library" type="object" states="pending_sample" string="Get Sample" icon="gtk-apply"/>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="search_product_lot_sample_library_filter" model="ir.ui.view">
|
||||
<field name="name">stock.production.lot.sample_library.filter</field>
|
||||
<field name="model">stock.production.lot</field>
|
||||
<field name="type">search</field>
|
||||
<field name="inherit_id" ref="nan_prodlot_quality_control.search_product_lot_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<filter name="inactive" position="after">
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-gtk-media-pause" name="pending_sample_library" string="Waiting Sample" domain="[('state', '=', 'pending_sample'), ('active', '=', False)]"/>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue