← Back to team overview

avanzosc team mailing list archive

Re: [Merge] lp:~oihanecruce/avanzosc/nayar_production_lot_discard into lp:~avanzosc-security-team/avanzosc/72horas

 

Comentarios inline

Diff comments:

> === modified file 'nayar_production_lot_discard/__init__.py'
> --- nayar_production_lot_discard/__init__.py	2014-06-11 10:23:47 +0000
> +++ nayar_production_lot_discard/__init__.py	2014-06-30 14:42:48 +0000
> @@ -20,7 +20,5 @@
>  #
>  ##############################################################################
>  
> -import lot
> -import wizard
> -
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> +from . import models
> +from . import wizard
> 
> === modified file 'nayar_production_lot_discard/__openerp__.py'
> --- nayar_production_lot_discard/__openerp__.py	2014-06-11 10:23:47 +0000
> +++ nayar_production_lot_discard/__openerp__.py	2014-06-30 14:42:48 +0000
> @@ -27,17 +27,14 @@
>      "author": "Nayar Systems",
>      "category": "Stock",
>      "description": "Discard production lots updating dates, etc.",
> -    "depends" : [
> +    "depends": [
>          "dos_production_lot_additional_info",
>          "dos_stock_warehouse_additional_info",
> -        ],
> -    "init_xml": [],
> -    "update_xml": [
> +    ],
> +    "data": [
>          "wizard/discard_lots_view.xml",
> -        ],
> +    ],
>      "website": 'http://www.72horas.net/',
>      "active": False,
>      "installable": True
>  }
> -
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> 
> === added directory 'nayar_production_lot_discard/models'
> === added file 'nayar_production_lot_discard/models/__init__.py'
> --- nayar_production_lot_discard/models/__init__.py	1970-01-01 00:00:00 +0000
> +++ nayar_production_lot_discard/models/__init__.py	2014-06-30 14:42:48 +0000
> @@ -0,0 +1,23 @@
> +# -*- coding: utf-8 -*-
> +##############################################################################
> +#
> +#    OpenERP, Open Source Management Solution
> +#    Copyright (C) 2014 Nayar Systems (<http://www.72horas.net/>)
> +#    @author: Javier Sancho <jsancho@xxxxxxxxxxx>
> +#
> +#    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 . import lot
> 
> === renamed file 'nayar_production_lot_discard/lot.py' => 'nayar_production_lot_discard/models/lot.py'
> --- nayar_production_lot_discard/lot.py	2014-06-11 10:23:47 +0000
> +++ nayar_production_lot_discard/models/lot.py	2014-06-30 14:42:48 +0000
> @@ -21,9 +21,10 @@
>  ##############################################################################
>  
>  from datetime import datetime
> -from osv import osv
> -
> -class stock_production_lot(osv.osv):
> +from openerp.osv import orm
> +
> +
> +class stock_production_lot(orm.Model):
>      _inherit = 'stock.production.lot'
>  
>      def discard(self, cr, uid, ids, context=None):
> @@ -31,12 +32,18 @@
>              ids = [ids]
>  
>          # Get location for discarded lots
> -        company_id = self.pool.get('res.users').read(cr, uid, uid, ['company_id'], context=context)['company_id'][0]
> -        warehouse_obj = self.pool.get('stock.warehouse')
> -        warehouse_id = warehouse_obj.search(cr, uid, [('company_id', '=', company_id)], context=context)[0]
> -        discard_location_id = warehouse_obj.read(cr, uid, warehouse_id, ['lot_broken_id'], context=context)['lot_broken_id'][0]
> +        user_obj = self.pool['res.users']
> +        company_id = user_obj.read(cr, uid, uid, ['company_id'],
> +                                   context=context)['company_id'][0]
> +        warehouse_obj = self.pool['stock.warehouse']
> +        warehouse_id = warehouse_obj.search(cr, uid,
> +                                            [('company_id', '=', company_id)],
> +                                            context=context)[0]
> +        discard_location_id = warehouse_obj.read(
> +            cr, uid, warehouse_id, ['lot_broken_id'],
> +            context=context)['lot_broken_id'][0]
>  
> -        move_obj = self.pool.get('stock.move')
> +        move_obj = self.pool['stock.move']
>          lots = self.browse(cr, uid, ids, context=context)
>          lot_ids_final = []
>          move_ids_final = []
> @@ -44,8 +51,11 @@
>  
>          for lot in lots:
>              # Get last location
> -            move_ids = move_obj.search(cr, uid, [('prodlot_id', '=', lot.id)], order='date desc', context=context)
> -            location_id = move_obj.read(cr, uid, move_ids[0], ['location_dest_id'], context=context)['location_dest_id'][0]
> +            move_ids = move_obj.search(cr, uid, [('prodlot_id', '=', lot.id)],
> +                                       order='date desc', context=context)
> +            location_id = move_obj.read(cr, uid, move_ids[0],
> +                                        ['location_dest_id'],
> +                                        context=context)['location_dest_id'][0]
>  
>              if location_id != discard_location_id:
>                  # Make stock move to discard location
> @@ -67,16 +77,18 @@
>                      'product_qty': 1,
>                      'product_uom': lot.product_id.uom_id.id,
>                      'prodlot_id': lot.id,
> -                    }
> +                }
>  
>          # Process stock moves
>          if move_ids_final:
> -            move_obj.do_partial(cr, uid, move_ids_final, partial_datas, context=context)
> +            move_obj.do_partial(cr, uid, move_ids_final, partial_datas,
> +                                context=context)
>  
>          # Set final date
>          if lot_ids_final:
>              final_date = datetime.today().strftime("%Y-%m-%d")
> -            self.write(cr, uid, lot_ids_final, {'fecha_baja': final_date}, context=context)
> +            self.write(cr, uid, lot_ids_final, {'fecha_baja': final_date},
> +                       context=context)
>  
>          return True
>  
> 
> === modified file 'nayar_production_lot_discard/wizard/__init__.py'
> --- nayar_production_lot_discard/wizard/__init__.py	2014-06-11 10:23:47 +0000
> +++ nayar_production_lot_discard/wizard/__init__.py	2014-06-30 14:42:48 +0000
> @@ -20,6 +20,4 @@
>  #
>  ##############################################################################
>  
> -import discard_lots
> -
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> +from . import discard_lots
> 
> === modified file 'nayar_production_lot_discard/wizard/discard_lots.py'
> --- nayar_production_lot_discard/wizard/discard_lots.py	2014-06-11 10:23:47 +0000
> +++ nayar_production_lot_discard/wizard/discard_lots.py	2014-06-30 14:42:48 +0000
> @@ -20,25 +20,26 @@
>  #
>  ##############################################################################
>  
> -from osv import osv, fields
> -
> -class stock_discard_lots(osv.osv_memory):
> +from openerp.osv import orm, fields
> +
> +
> +class StockDiscardLots(orm.TransientModel):
>      _name = 'stock.discard.lots'
>  
>      _columns = {
> -        'selected_lots': fields.many2many('stock.production.lot', 'selected_lots', 'wizard_id', 'lot_id', 'Selected Lots'),
> +        'selected_lots': fields.many2many('stock.production.lot',
> +                                          'selected_lots', 'wizard_id',
> +                                          'lot_id', 'Selected Lots'),
>          }
>  
>      _defaults = {
> -        'selected_lots': lambda self, cr, uid, context=None: context['active_ids'],
> -        }
> +        'selected_lots': lambda self, cr, uid, context=None:
> +        context['active_ids'],

PEP8 me dice: continuation line over-indented for hanging indent

> +    }
>  
>      def discard_lots(self, cr, uid, ids, context=None):
>          data = self.browse(cr, uid, ids, context=context)[0]
>          lot_ids = [lot.id for lot in data.selected_lots]
> -        self.pool.get('stock.production.lot').discard(cr, uid, lot_ids, context=context)
> +        self.pool['stock.production.lot'].discard(cr, uid, lot_ids,
> +                                                  context=context)
>          return {'type': 'ir.actions.act_window_close'}
> -
> -stock_discard_lots()
> -
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> 
> === modified file 'nayar_production_lot_discard/wizard/discard_lots_view.xml'
> --- nayar_production_lot_discard/wizard/discard_lots_view.xml	2014-06-11 10:23:47 +0000
> +++ nayar_production_lot_discard/wizard/discard_lots_view.xml	2014-06-30 14:42:48 +0000
> @@ -1,48 +1,45 @@
>  <?xml version="1.0" encoding="utf-8"?>
> -<!--
> -  Copyright (C) 2014 Nayar Systems (http://www.72horas.net/)
> -  @author: Javier Sancho <jsancho@xxxxxxxxxxx>
> -  The license is in the file __openerp__.py
> +<!-- 
> +    Copyright (C) 2014 Nayar Systems (http://www.72horas.net/)
> +    @author: Javier Sancho <jsancho@xxxxxxxxxxx>
> +    The license is in the file __openerp__.py
>  -->
>  <openerp>
> -  <data>
> -    <record model="ir.ui.view" id="stock_discard_lots_wizard">
> -      <field name="name">stock.discard.lots.wizard</field>
> -      <field name="model">stock.discard.lots</field>
> -      <field name="type">form</field>
> -      <field name="arch" type="xml">
> -	<form string="Discard Production Lots">
> -	  <field name="selected_lots" nolabel="1" colspan="4">
> -	    <tree string="Selected Lots">
> -	      <field name="name"/>
> -	      <field name="ref"/>
> -	      <field name="product_id"/>
> -	    </tree>
> -	  </field>
> -	  <button icon="gtk-cancel" special="cancel" string="Cancel"/>
> -	  <button icon="gtk-ok" name="discard_lots" string="Discard" type="object"/>
> -	</form>
> -      </field>
> -    </record>
> -
> -    <record id="action_stock_discard_lots_wizard" model="ir.actions.act_window">
> -      <field name="name">Discard Lots</field>
> -      <field name="type">ir.actions.act_window</field>
> -      <field name="res_model">stock.discard.lots</field>
> -      <field name="view_type">form</field>
> -      <field name="view_mode">form</field>
> -      <field name="target">new</field>
> -    </record>
> -
> -    <act_window
> -	id="action_stock_discard_lots_wizard"
> -	name="Discard Lots"
> -	res_model="stock.discard.lots"
> -	src_model="stock.production.lot"
> -	view_mode="form"
> -	target="new"
> -	view_type="form"
> -	groups="stock.group_stock_manager"/>
> -
> -  </data>
> +    <data>
> +        <record model="ir.ui.view" id="stock_discard_lots_wizard">
> +            <field name="name">stock.discard.lots.wizard</field>
> +            <field name="model">stock.discard.lots</field>
> +            <field name="arch" type="xml">
> +                <form string="Discard Production Lots">
> +                    <field name="selected_lots" nolabel="1"
> +                        colspan="4">
> +                        <tree string="Selected Lots">
> +                            <field name="name" />
> +                            <field name="ref" />
> +                            <field name="product_id" />
> +                        </tree>
> +                    </field>
> +                    <button icon="gtk-cancel" special="cancel"
> +                        string="Cancel" />
> +                    <button icon="gtk-ok" name="discard_lots"
> +                        string="Discard" type="object" />
> +                </form>
> +            </field>
> +        </record>
> +
> +        <record id="action_stock_discard_lots_wizard" model="ir.actions.act_window">
> +            <field name="name">Discard Lots</field>
> +            <field name="type">ir.actions.act_window</field>
> +            <field name="res_model">stock.discard.lots</field>
> +            <field name="view_type">form</field>
> +            <field name="view_mode">form</field>
> +            <field name="target">new</field>
> +        </record>
> +
> +        <act_window id="action_stock_discard_lots_wizard"
> +            name="Discard Lots" res_model="stock.discard.lots"
> +            src_model="stock.production.lot" view_mode="form" target="new"
> +            view_type="form" groups="stock.group_stock_manager" />
> +
> +    </data>
>  </openerp>
> 


-- 
https://code.launchpad.net/~oihanecruce/avanzosc/nayar_production_lot_discard/+merge/225023
Your team Avanzosc_security is subscribed to branch lp:~avanzosc-security-team/avanzosc/72horas.