← Back to team overview

avanzosc team mailing list archive

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

 

Review: Needs Fixing code review

Comentarios inline

Diff comments:

> === modified file 'dos_partner_additional_info/__init__.py'
> --- dos_partner_additional_info/__init__.py	2014-06-11 10:23:47 +0000
> +++ dos_partner_additional_info/__init__.py	2014-06-16 16:02:52 +0000
> @@ -19,7 +19,4 @@
>  #
>  ##############################################################################
>  
> -
> -import partner
> -
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> +from . import models
> 
> === modified file 'dos_partner_additional_info/__openerp__.py'
> --- dos_partner_additional_info/__openerp__.py	2014-06-11 10:23:47 +0000
> +++ dos_partner_additional_info/__openerp__.py	2014-06-16 16:02:52 +0000
> @@ -21,20 +21,17 @@
>  
>  
>  {
> -    "name" : "DOS Partner Additional Info",
> -    "version" : "1.0",
> -    "author" : "DOS",
> -    "category" : "Base, Partner",
> -    "website" : "www.dos-sl.es",
> +    "name": "DOS Partner Additional Info",
> +    "version": "1.0",
> +    "author": "DOS",
> +    "category": "Base, Partner",
> +    "website": "www.dos-sl.es",
>      "description": "This module adds extra information to partners",
> -    "depends" : ['base', 'product'],
> -    "init_xml" : [],
> -    "update_xml" : [
> -					'security/ir.model.access.csv',
> -					'partner_view.xml',
> -					],
> +    "depends": ['base', 'product'],
> +    "data": [
> +        'security/ir.model.access.csv',
> +        'views/partner_view.xml',
> +    ],
>      "active": False,
>      "installable": True
>  }
> -
> -
> 
> === added directory 'dos_partner_additional_info/models'
> === added file 'dos_partner_additional_info/models/__init__.py'
> --- dos_partner_additional_info/models/__init__.py	1970-01-01 00:00:00 +0000
> +++ dos_partner_additional_info/models/__init__.py	2014-06-16 16:02:52 +0000
> @@ -0,0 +1,22 @@
> +# -*- encoding: utf-8 -*-
> +##############################################################################
> +#
> +#    OpenERP, Open Source Management Solution
> +#    Copyright (C) 2008-2014 AvanzOSC S.L. (Oihane) All Rights Reserved
> +#
> +#    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 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 partner
> 
> === renamed file 'dos_partner_additional_info/partner.py' => 'dos_partner_additional_info/models/partner.py'
> --- dos_partner_additional_info/partner.py	2014-06-11 10:23:47 +0000
> +++ dos_partner_additional_info/models/partner.py	2014-06-16 16:02:52 +0000
> @@ -16,81 +16,94 @@
>  #
>  #    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/>.
> -#impuesto a aplicar
> +#
>  ##############################################################################
>  
> -import math
> -from osv import fields,osv
> -import tools
> -import pooler
> -from tools.translate import _
> -
> -class res_partner(osv.osv):
> -
> -	_name = 'res.partner'
> -	_inherit = 'res.partner'
> -	
> -	_columns = {
> -		'dias_facturacion' : fields.integer('Días de Facturación'),
> -		'pre_pago': fields.boolean('Pre Pago'),
> -		'ciclo_cobro' : fields.integer('Ciclo de Cobro'),
> -		'tipo_ciclo_cobro' : fields.selection([('mes', 'Mes'), ('anyo', 'Año')], 'Tipo Ciclo de Cobro'),
> -		'tipo_cliente' : fields.selection([('particular', 'Particular'), ('ascensorista', 'Ascensorista'), ('administrador', 'Administrador')], 'Tipo de Cliente'),
> -		'tipo_envio_correo' : fields.selection([('ninguno', 'Ninguno'), ('electronico', 'Electrónico'), ('postal', 'Postal'), ('postal_electronico', 'Postal y Electrónico')], 'Tipo de Envío Correo'),
> -		'csv_correo': fields.boolean('Correo CSV'),
> -		#'particular': fields.boolean('Particular'),
> -		'special_invoicing': fields.boolean('Invoicing with sharing Shipping costs'),
> -		'sale_type' : fields.selection([('venta', 'Venta'), ('alquiler', 'Alquiler')], 'Default Sale Type'),
> -		'num_months_first_invoice' : fields.integer('Num. Months First Invoice', help="Number of months you will be billed to the customer in your first bill. A positive number indicates that billed X months from the date of payment. A negative number indicates that the bill at the end of the month for X months."),
> -		'info_invoice_ids': fields.one2many('res.partner.info.invoice', 'partner_id', 'Invoice information'),
> -		'tipo_albaran': fields.selection([('valorado', 'Valorado'), ('sin valorar', 'Sin valorar')], 'Tipo de albarán'),
> -	}
> -	
> -	_defaults = {
> -		'ref': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'res.partner'),
> -		'special_invoicing': False,
> -		'tipo_albaran': 'sin valorar',
> -	}
> -	
> -	def onchange_partner_type(self, cr, uid, ids, type):
> -
> -		val = {'num_months_first_invoice': 0, 
> -			   'dias_facturacion':0,
> -			   'ciclo_cobro':1,
> -			   'tipo_ciclo_cobro':'mes',
> -			   'pre_pago':True,
> -			   }
> -		
> -		if type == 'particular':
> -			val['num_months_first_invoice'] = 2
> -			val['special_invoicing'] = False
> -		elif  type == 'administrador':
> -			val['special_invoicing'] = False
> -		elif  type == 'ascensorista':
> -			val['num_months_first_invoice'] = -1
> -
> -		return {'value': val}
> -	
> -res_partner()
> -
> -class res_partner_info_invoice(osv.osv):
> -
> -	_name = 'res.partner.info.invoice'
> -	
> -	_columns = {
> -		'partner_id': fields.many2one('res.partner', 'Partner', select=True, required=True),
> -		'categ_id' : fields.many2one('product.category', 'Product Category', select=True, required=True),
> -		'receiver' : fields.selection([('cliente', 'Cliente'), ('ascensorista', 'Ascensorista')], 'Receiver', select=True, required=True),
> -	}
> -	
> -	_sql_constraints = [
> -		('categ_uniq', 'unique(partner_id, categ_id)', 'Product Category must be unique !'),
> -	]
> -
> -res_partner_info_invoice()
> -
> -
> -
> -
> -
> -
> +from openerp.osv import fields, orm
> +
> +
> +class ResPartner(orm.Model):
> +    _inherit = 'res.partner'
> +
> +    _columns = {
> +        'dias_facturacion': fields.integer('Días de Facturación'),
> +        'pre_pago': fields.boolean('Pre Pago'),
> +        'ciclo_cobro': fields.integer('Ciclo de Cobro'),
> +        'tipo_ciclo_cobro': fields.selection([('mes', 'Mes'),
> +                                              ('anyo', 'Año')],
> +                                             'Tipo Ciclo de Cobro'),
> +        'tipo_cliente': fields.selection([('particular', 'Particular'),
> +                                          ('ascensorista', 'Ascensorista'),
> +                                          ('administrador', 'Administrador')],
> +                                         'Tipo de Cliente'),
> +        'tipo_envio_correo':
> +        fields.selection([('ninguno', 'Ninguno'),

Indentación incorrecta, y va a dar error al compilar. Tiene que ir en la línea anterior.

> +                          ('electronico', 'Electrónico'),
> +                          ('postal', 'Postal'),
> +                          ('postal_electronico', 'Postal y Electrónico')],
> +                         'Tipo de Envío Correo'),
> +        'csv_correo': fields.boolean('Correo CSV'),
> +        'special_invoicing':
> +        fields.boolean('Invoicing with sharing Shipping costs'),
> +        'sale_type': fields.selection([('venta', 'Venta'),

Indentación incorrecta según PEP8. Debería ir un poco más indentado que la línea anterior.

> +                                       ('alquiler', 'Alquiler')],
> +                                      'Default Sale Type'),
> +        'num_months_first_invoice':
> +        fields.integer('Num. Months First Invoice',

Ídem indentación.

> +                       help="Number of months you will be billed to the "
> +                       "customer in your first bill. A positive number "
> +                       "indicates that billed X months from the date of "
> +                       "payment. A negative number indicates that the bill at "
> +                       "the end of the month for X months."),
> +        'info_invoice_ids': fields.one2many('res.partner.info.invoice',
> +                                            'partner_id',
> +                                            'Invoice information'),
> +        'tipo_albaran': fields.selection([('valorado', 'Valorado'),
> +                                          ('sin valorar', 'Sin valorar')],
> +                                         'Tipo de albarán'),
> +    }
> +
> +    _defaults = {
> +        'ref': lambda obj, cr, uid,
> +        context: obj.pool.get('ir.sequence').get(cr, uid, 'res.partner'),

Indentación incorrecta. Utiliza obj.pool[]

> +        'special_invoicing': False,
> +        'tipo_albaran': 'sin valorar',
> +    }
> +
> +    def onchange_partner_type(self, cr, uid, ids, type):
> +        val = {
> +            'num_months_first_invoice': 0,
> +            'dias_facturacion': 0,
> +            'ciclo_cobro': 1,
> +            'tipo_ciclo_cobro': 'mes',
> +            'pre_pago': True,
> +        }
> +
> +        if type == 'particular':
> +            val['num_months_first_invoice'] = 2
> +            val['special_invoicing'] = False
> +        elif type == 'administrador':
> +            val['special_invoicing'] = False
> +        elif type == 'ascensorista':
> +            val['num_months_first_invoice'] = -1
> +
> +        return {'value': val}
> +
> +
> +class ResPartnerInfoInvoice(orm.Model):
> +    _name = 'res.partner.info.invoice'
> +
> +    _columns = {
> +        'partner_id': fields.many2one('res.partner', 'Partner', select=True,
> +                                      required=True),
> +        'categ_id': fields.many2one('product.category', 'Product Category',
> +                                    select=True, required=True),
> +        'receiver': fields.selection([('cliente', 'Cliente'),
> +                                      ('ascensorista', 'Ascensorista')],
> +                                     'Receiver', select=True, required=True),
> +    }
> +
> +    _sql_constraints = [
> +        ('categ_uniq', 'unique(partner_id, categ_id)',
> +         'Product Category must be unique !'),
> +    ]
> 
> === added directory 'dos_partner_additional_info/views'
> === renamed file 'dos_partner_additional_info/partner_view.xml' => 'dos_partner_additional_info/views/partner_view.xml'

Elimina etiquetas type de las vistas.



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