avanzosc team mailing list archive
-
avanzosc team
-
Mailing list archive
-
Message #00492
Re: [Merge] lp:~oihanecruce/avanzosc/dos_stock_picking_additional_info into lp:~avanzosc-security-team/avanzosc/72horas
Review: Needs Fixing code review
Algunas cosillas entre líneas.
Diff comments:
> === modified file 'dos_stock_picking_additional_info/__init__.py'
> --- dos_stock_picking_additional_info/__init__.py 2014-06-11 10:23:47 +0000
> +++ dos_stock_picking_additional_info/__init__.py 2014-06-23 09:07:02 +0000
> @@ -18,7 +18,4 @@
> #
> ##############################################################################
>
> -import stock
> -
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> -
> +from . import models
>
> === modified file 'dos_stock_picking_additional_info/__openerp__.py'
> --- dos_stock_picking_additional_info/__openerp__.py 2014-06-11 10:23:47 +0000
> +++ dos_stock_picking_additional_info/__openerp__.py 2014-06-23 09:07:02 +0000
> @@ -1,7 +1,7 @@
> # -*- encoding: utf-8 -*-
> ##############################################################################
> -#
> -# OpenERP, Open Source Management Solution
> +#
> +# OpenERP, Open Source Management Solution
> # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
> # $Id$
> #
> @@ -19,18 +19,18 @@
> # along with this program. If not, see <http://www.gnu.org/licenses/>.
> #
> ##############################################################################
> +
> {
> - "name" : "DOS Stock Picking Additional Info",
> - "version" : "1.0",
> - "author" : "DOS",
> - "category" : "Stock, Delivery",
> - "description":"""Module to allow adds extra information to stock pickings.""",
> - "depends" : ["stock", "delivery"],
> - "init_xml" : [],
> - "demo_xml" : [],
> - "update_xml" : ['stock_view.xml'],
> - "website": 'http://www.dos-sl.es',
> - "active": False,
> - "installable": True
> + "name": "DOS Stock Picking Additional Info",
> + "version": "1.0",
> + "author": "DOS",
> + "category": "Stock, Delivery",
> + "description": """
> + Module to allow adds extra information to stock pickings.
> + """,
> + "depends": ["stock", "delivery"],
> + "data": ['stock_view.xml'],
> + "website": 'http://www.dos-sl.es',
> + "active": False,
> + "installable": True
> }
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
>
> === added directory 'dos_stock_picking_additional_info/models'
> === added file 'dos_stock_picking_additional_info/models/__init__.py'
> --- dos_stock_picking_additional_info/models/__init__.py 1970-01-01 00:00:00 +0000
> +++ dos_stock_picking_additional_info/models/__init__.py 2014-06-23 09:07:02 +0000
> @@ -0,0 +1,21 @@
> +# -*- coding: utf-8 -*-
> +##############################################################################
> +#
> +# Copyright (C) 2011 Diseño Operativo de Software. All Rights Reserved
> +#
> +# 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 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 General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +#
> +##############################################################################
> +
> +from . import stock
>
> === renamed file 'dos_stock_picking_additional_info/stock.py' => 'dos_stock_picking_additional_info/models/stock.py'
> --- dos_stock_picking_additional_info/stock.py 2014-06-11 10:23:47 +0000
> +++ dos_stock_picking_additional_info/models/stock.py 2014-06-23 09:07:02 +0000
> @@ -20,45 +20,47 @@
> #
> ##############################################################################
>
> -from osv import fields, osv
> -import decimal_precision as dp
> -import time
> -
> -class stock_picking(osv.osv):
> -
> - _inherit ="stock.picking"
> -
> - _columns = {
> - 'transport_ship_code': fields.char('Transport Ship Code', size=64),
> - }
> -
> - def next_transport_ship_code(self, cr, uid, ids, context=None):
> - if context is None:
> - context = {}
> -
> - sequence_code = 'stock.transport.ship.code'
> - sequence_name = 'Transport Ship Code'
> -
> - # Verificamos que exista secuencia definida, si no es asi la creamos.
> - sequence_ids = self.pool.get('ir.sequence.type').search(cr, uid, [('code', '=', sequence_code)])
> - if not sequence_ids:
> - self.pool.get('ir.sequence.type').create(cr, uid, {'code': sequence_code,
> - 'name': sequence_name,
> - })
> -
> - self.pool.get('ir.sequence').create(cr, uid, {'code': sequence_code,
> - 'name': sequence_name,
> - 'number_next': 1,
> - 'padding': 8,
> - 'number_increment': 1,
> - 'active': True,
> - })
> -
> - # Asignamos siguiente secuencia
> - for id in ids:
> - transport_ship_code = self.pool.get('ir.sequence').get(cr, uid, sequence_code)
> - self.write(cr, uid, id, {'transport_ship_code': transport_ship_code})
> -
> - return True
> -
> -stock_picking()
> +from openerp.osv import fields, orm
> +
> +
> +class stock_picking(orm.Model):
Pon StockPicking como nombre de clase.
> +
> + _inherit = "stock.picking"
> +
> + _columns = {
> + 'transport_ship_code': fields.char('Transport Ship Code', size=64),
> + }
> +
> + def next_transport_ship_code(self, cr, uid, ids, context=None):
> + if context is None:
No hace falta.
> + context = {}
> +
> + sequence_code = 'stock.transport.ship.code'
> + sequence_name = 'Transport Ship Code'
> +
> + seq_type_obj = self.pool['ir.sequence.type']
> + seq_obj = self.pool['ir.sequence']
> +
> + # Verificamos que exista secuencia definida, si no es asi la creamos.
> + sequence_ids = seq_type_obj.search(cr, uid,
> + [('code', '=', sequence_code)])
propagar context
> + if not sequence_ids:
> + seq_type_obj.create(cr, uid, {'code': sequence_code,
> + 'name': sequence_name,
> + })
propagar context
> +
> + seq_obj.create(cr, uid, {'code': sequence_code,
> + 'name': sequence_name,
> + 'number_next': 1,
> + 'padding': 8,
> + 'number_increment': 1,
> + 'active': True,
> + })
propagar context
> +
> + # Asignamos siguiente secuencia
> + for id in ids:
> + transport_ship_code = seq_obj.get(cr, uid, sequence_code)
> + self.write(cr, uid, id,
> + {'transport_ship_code': transport_ship_code})
propagar context
> +
> + return True
>
> === added directory 'dos_stock_picking_additional_info/views'
> === renamed file 'dos_stock_picking_additional_info/stock_view.xml' => 'dos_stock_picking_additional_info/views/stock_view.xml'
> --- dos_stock_picking_additional_info/stock_view.xml 2014-06-11 10:23:47 +0000
> +++ dos_stock_picking_additional_info/views/stock_view.xml 2014-06-23 09:07:02 +0000
> @@ -4,13 +4,14 @@
> <record id="view_picking_out_form_additional_info" model="ir.ui.view">
> <field name="name">stock.picking.out.form.additional_info</field>
> <field name="model">stock.picking</field>
> - <field name="inherit_id" ref="delivery.view_picking_withcarrier_out_form"/>
> - <field name="type">form</field>
> + <field name="inherit_id"
> + ref="delivery.view_picking_withcarrier_out_form" />
> <field name="priority">1</field>
> <field name="arch" type="xml">
> <field name="carrier_tracking_ref" position="after">
> <field name="transport_ship_code" />
> - <button name="next_transport_ship_code" string="Next Ship Code" type="object" icon="gtk-execute" />
> + <button name="next_transport_ship_code"
> + string="Next Ship Code" type="object" icon="gtk-execute" />
> </field>
> </field>
> </record>
>
--
https://code.launchpad.net/~oihanecruce/avanzosc/dos_stock_picking_additional_info/+merge/224078
Your team Avanzosc_security is subscribed to branch lp:~avanzosc-security-team/avanzosc/72horas.
References