avanzosc team mailing list archive
-
avanzosc team
-
Mailing list archive
-
Message #00455
[Merge] lp:~dani-ds/avanzosc/dos_production_lot_additional_info into lp:~avanzosc-security-team/avanzosc/72horas
Daniel Campos (Avanzosc) has proposed merging lp:~dani-ds/avanzosc/dos_production_lot_additional_info into lp:~avanzosc-security-team/avanzosc/72horas.
Requested reviews:
Avanzosc_security (avanzosc-security-team)
For more details, see:
https://code.launchpad.net/~dani-ds/avanzosc/dos_production_lot_additional_info/+merge/223379
dos_production_lot_additional_info: Refactorizado v8
--
https://code.launchpad.net/~dani-ds/avanzosc/dos_production_lot_additional_info/+merge/223379
Your team Avanzosc_security is requested to review the proposed merge of lp:~dani-ds/avanzosc/dos_production_lot_additional_info into lp:~avanzosc-security-team/avanzosc/72horas.
=== modified file 'dos_production_lot_additional_info/__openerp__.py'
--- dos_production_lot_additional_info/__openerp__.py 2014-06-11 10:23:47 +0000
+++ dos_production_lot_additional_info/__openerp__.py 2014-06-17 10:14:38 +0000
@@ -21,17 +21,14 @@
{
- "name" : "DOS Stock Production Lot",
- "version" : "1.0",
- "author" : "DOS",
- "category" : "Base, Product, Stock",
- "website" : "www.dos-sl.es",
+ "name": "DOS Stock Production Lot",
+ "version": "1.0",
+ "author": "DOS",
+ "category": "Base, Product, Stock",
+ "website": "www.dos-sl.es",
"description": "This module adds extra information to production lots",
- "depends" : ['base_tools', 'product', 'stock'],
- "init_xml" : [],
- "update_xml" : ['stock_production_lot_view.xml'],
+ "depends": ['base_tools', 'product', 'stock'],
+ 'data': ['view/stock_production_lot_view.xml'],
"active": False,
"installable": True
}
-
-
=== added directory 'dos_production_lot_additional_info/models'
=== added file 'dos_production_lot_additional_info/models/stock_production_lot.py'
--- dos_production_lot_additional_info/models/stock_production_lot.py 1970-01-01 00:00:00 +0000
+++ dos_production_lot_additional_info/models/stock_production_lot.py 2014-06-17 10:14:38 +0000
@@ -0,0 +1,90 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import fields, orm
+# import tools
+# import pooler
+import re
+# from openerp.tools.translate import _
+
+
+class StockProductionLot(orm.Model):
+ _inherit = 'stock.production.lot'
+
+ def name_search(self, cr, user, name='', args=None, operator='ilike',
+ context=None, limit=100):
+ if not args:
+ args = []
+ if name:
+ ids = self.search(cr, user, ['|', ('name', operator, name),
+ ('ref', operator, name)] +
+ args, limit=limit, context=context)
+ if not len(ids):
+ ids = self.search(cr, user, [('telefono', '=', name)] + args,
+ limit=limit, context=context)
+ if not len(ids):
+ ptrn = re.compile('(\[(.*?)\])')
+ res = ptrn.search(name)
+ if res:
+ ids = self.search(cr, user, [('name', '=', res.group(2))] +
+ args, limit=limit, context=context)
+ else:
+ ids = self.search(cr, user, args, limit=limit, context=context)
+ return self.name_get(cr, user, ids, context=context)
+
+ _columns = {
+ 'icc': fields.char('ICC', size=64),
+ 'telefono': fields.char('Teléfono', size=20),
+ 'pin': fields.char('Número PIN', size=4),
+ 'puk': fields.char('Número PUK', size=8),
+ 'fecha_alta': fields.date('Fecha Alta'),
+ 'operador': fields.char('Operador', size=64),
+ 'descripcion': fields.char('Descripción', size=128),
+ 'ref_cliente': fields.char('Ref. Cliente', size=64),
+ 'albaran_entrada': fields.char('Albarán Entrada', size=64),
+ 'imei': fields.char('IMEI', size=15),
+ 'n_serie': fields.char('Núm. Serie', size=64),
+ 'tipo_enlace': fields.char('Tipo Enlace', size=64),
+ 'fecha_compra': fields.date('Fecha Compra'),
+ 'precio': fields.float('Precio'),
+ 'precio_subvencionado': fields.float('Precio Subvencionado'),
+ 'propietario': fields.char('Propietario', size=64),
+ 'activo': fields.boolean('Activo'),
+ 'fecha_activacion': fields.date('Fecha Activación'),
+ 'fecha_baja': fields.date('Fecha Baja'),
+ 'observaciones': fields.text('Observaciones'),
+ }
+
+ def create(self, cr, user, vals, context=None):
+ if 'product_id' in vals and vals['product_id']:
+ product_obj = self.pool['product.product']
+ product = product_obj.browse(cr, user, vals['product_id'])
+ categ_id = product.categ_id
+ if product_obj._is_sim(categ_id) or product_obj._is_pack(categ_id):
+ vals['ref'] = ('telefono' in vals) and vals['telefono'] or None
+ return super(StockProductionLot, self).create(cr, user, vals,
+ context=context)
+
+ def write(self, cr, uid, ids, vals, context=None):
+ if not ('ref' in vals) and 'telefono' in vals:
+ vals['ref'] = vals['telefono']
+ return super(StockProductionLot, self).write(cr, uid, ids, vals,
+ context=context)
=== added directory 'dos_production_lot_additional_info/views'
=== added file 'dos_production_lot_additional_info/views/stock_production_lot_view.xml'
--- dos_production_lot_additional_info/views/stock_production_lot_view.xml 1970-01-01 00:00:00 +0000
+++ dos_production_lot_additional_info/views/stock_production_lot_view.xml 2014-06-17 10:14:38 +0000
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+
+ <!-- Stock Production Lot Inherit Form View -->
+ <record model="ir.ui.view" id="view_stock_prod_lot_additional_info_form">
+ <field name="name">stock.production.lot.additional.info.form</field>
+ <field name="model">stock.production.lot</field>
+ <field name="inherit_id" ref="stock.view_production_lot_form"/>
+ <field name="priority">1</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <page string="Stock Moves" position="after">
+ <page string="Información Adicional">
+ <group colspan="4" col="4">
+ <separator string="Descripción" colspan="4" col="4" />
+ <field name="descripcion" nolabel="1" colspan="4"/>
+ </group>
+ <group colspan="2" col="4">
+ <separator string="Información Tarjeta SIM" colspan="4" col="4" />
+ <field name="icc" string="ICC" colspan="3"/>
+ <field name="telefono" string="Teléfono" colspan="3"/>
+ <field name="pin" string="Número PIN" colspan="3"/>
+ <field name="puk" string="Número PUK" colspan="3"/>
+ <field name="operador" string="Operador" colspan="3"/>
+ </group>
+ <group colspan="2" col="2">
+ <separator string="Información Enlace" colspan="2" col="2" />
+ <field name="imei" string="IMEI"/>
+ <field name="n_serie" string="Núm. Serie"/>
+ <field name="tipo_enlace" string="Tipo Enlace"/>
+ <field name="propietario" string="Propietario"/>
+ <field name="precio" string="Precio"/>
+ <field name="precio_subvencionado" string="Precio Subvencionado"/>
+ </group>
+ <group colspan="4" col="4">
+ <separator string="Información Extra" colspan="4" col="4" />
+ <field name="ref_cliente" string="Ref. Cliente"/>
+ <field name="albaran_entrada" string="Albarán Entrada"/>
+ <field name="fecha_compra" string="Fecha Compra"/>
+ <field name="fecha_alta" string="Fecha Alta"/>
+ <field name="fecha_activacion" string="Fecha Activación" />
+ <field name="fecha_baja" string="Fecha Baja" />
+ </group>
+ <group colspan="4" col="4">
+ <separator string="Observaciones" colspan="4" col="4" />
+ <field name="observaciones" nolabel="1" colspan="4"/>
+ </group>
+ </page>
+ </page>
+ </field>
+ </record>
+
+
+ </data>
+</openerp>
Follow ups