← Back to team overview

avanzosc team mailing list archive

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

 

Review: Needs Fixing code review

Algunas cosas más que reparar.

Diff comments:

> === modified file 'dos_account_invoice_report/__init__.py'
> --- dos_account_invoice_report/__init__.py	2014-06-11 10:23:47 +0000
> +++ dos_account_invoice_report/__init__.py	2014-06-20 10:22:39 +0000
> @@ -1,5 +1,5 @@
>  ##############################################################################
> -#    
> +#
>  #    OpenERP, Open Source Management Solution
>  #    Copyright (C) 2004-2012 DOS (<http://www.dos-sl.es>).
>  #
> @@ -14,11 +14,10 @@
>  #    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/>.     
> +#    along with this program.  If not, see <http://www.gnu.org/licenses/>
>  #
>  ##############################################################################
>  
> -import report
> +from . import report
>  
>  # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> -
> 
> === modified file 'dos_account_invoice_report/__openerp__.py'
> --- dos_account_invoice_report/__openerp__.py	2014-06-11 10:23:47 +0000
> +++ dos_account_invoice_report/__openerp__.py	2014-06-20 10:22:39 +0000
> @@ -19,20 +19,18 @@
>  ##############################################################################
>  
>  {
> -	"name" : "DOS Account Invoice Report",
> -	"version" : "1.1",
> -	"author" : "DOS",
> -	"category" : "Enterprise Specific Modules",
> -	"description":"""Module to print account invoice with custom format.
> -	""",
> -	"depends" : ["account"],
> -	"init_xml" : [],
> -	"demo_xml" : [],
> -	"update_xml" : [
> -		'account_invoice_report.xml',
> -	],
> -	"website": 'http://www.dos-sl.es',
> -	"active": False,
> -	"installable": True,
> +    "name": "DOS Account Invoice Report",
> +    "version": "1.1",
> +    "author": "DOS",
> +    "category": "Enterprise Specific Modules",
> +    "description": """Module to print account invoice with custom format.
> +    """,
> +    "depends": ["account"],
> +    "demo": [],
> +    "data": [
> +        'report/account_invoice_report.xml',
> +    ],
> +    "website": 'http://www.dos-sl.es',
> +    "installable": True,
>  }
>  # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> 
> === removed file 'dos_account_invoice_report/account_invoice_report.xml'
> --- dos_account_invoice_report/account_invoice_report.xml	2014-06-11 10:23:47 +0000
> +++ dos_account_invoice_report/account_invoice_report.xml	1970-01-01 00:00:00 +0000
> @@ -1,50 +0,0 @@
> -<?xml version="1.0"?>
> -<openerp>
> -  <data>
> -    <report id="account_invoice_custom_report"
> -	    string="Invoice 72horas"
> -	    model="account.invoice"
> -	    name="account.invoice.custom"
> -	    rml="dos_account_invoice_report/report/account_invoice.rml"
> -	    attachment="(object.state in ('open','paid')) and ((object.number or '').replace('/','') + '.pdf')"
> -	    attachment_use="1"
> -	    header="False"
> -	    auto="False"
> -	    />
> -
> -    <report id="account_invoice_preprinted_report"
> -	    string="Invoice Preprinted 72horas"
> -	    model="account.invoice"
> -	    name="account.invoice.preprinted"
> -	    rml="dos_account_invoice_report/report/account_invoice.rml"
> -	    attachment="(object.state in ('open','paid')) and ((object.number or '').replace('/','') + '.pdf')"
> -	    attachment_use="1"
> -	    header="False"
> -	    auto="False"
> -	    />
> -
> -    <report id="account_invoice_nayar_report"
> -	    string="Invoice Nayar Systems"
> -	    model="account.invoice"
> -	    name="account.invoice.nayar"
> -	    rml="dos_account_invoice_report/report/account_invoice.rml"
> -	    attachment="(object.state in ('open','paid')) and ((object.number or '').replace('/','') + '.pdf')"
> -	    attachment_use="1"
> -	    header="False"
> -	    auto="False"
> -	    />
> -
> -    <record id="view_invoice_report_inherit_account" model="ir.ui.view">
> -      <field name="name">stock.invoice.report.form</field>
> -      <field name="type">form</field>
> -      <field name="model">account.invoice</field>
> -      <field name="inherit_id" ref="account.invoice_form"/>
> -      <field name="arch" type="xml">
> -	<xpath expr="/form/notebook/page[@string='Invoice']/group/group/button[@string='Print Invoice']" position="replace">
> -	  <button name="%(account_invoice_custom_report)d" string="Print Invoice" type="action" icon="gtk-print" states="open,paid,proforma,sale,proforma2"/>
> -	</xpath>
> -      </field>
> -    </record>
> -
> -  </data>
> -</openerp>
> 
> === modified file 'dos_account_invoice_report/report/__init__.py'
> --- dos_account_invoice_report/report/__init__.py	2014-06-11 10:23:47 +0000
> +++ dos_account_invoice_report/report/__init__.py	2014-06-20 10:22:39 +0000
> @@ -1,5 +1,5 @@
>  ##############################################################################
> -#    
> +#
>  #    OpenERP, Open Source Management Solution
>  #    Copyright (C) 2004-2012 DOS (<http://www.dos-sl.es>).
>  #
> @@ -14,11 +14,9 @@
>  #    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/>.     
> +#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
>  #
>  ##############################################################################
>  
> -import account_invoice
> -
> +from . import account_invoice
>  # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> -
> 
> === modified file 'dos_account_invoice_report/report/account_invoice.py'
> --- dos_account_invoice_report/report/account_invoice.py	2014-06-11 10:23:47 +0000
> +++ dos_account_invoice_report/report/account_invoice.py	2014-06-20 10:22:39 +0000
> @@ -22,15 +22,16 @@
>  import time
>  from datetime import datetime
>  from dateutil.relativedelta import relativedelta
> -from report import report_sxw
> -from osv import osv
> -from tools.bank import format_acc_number
> -from tools.translate import _
> -import pooler
> -
> -class account_invoice_custom(report_sxw.rml_parse):
> +from openerp.report import report_sxw
> +from openerp.osv import orm
> +from openerp.tools.bank import format_acc_number
> +from openerp.tools.translate import _
> +
> +
> +class AccountInvoiceCustom(report_sxw.rml_parse):
>      def __init__(self, cr, uid, name, context):
> -        super(account_invoice_custom, self).__init__(cr, uid, name, context=context)
> +        super(AccountInvoiceCustom,
> +              self).__init__(cr, uid, name, context=context)
>          self.localcontext.update({
>              'time': time,
>              'get_left_text': self.get_left_text,
> @@ -56,444 +57,422 @@
>              'get_lines_per_page': self.get_lines_per_page,
>          })
>          self.context = context
> -        user = self.pool.get('res.users').browse(cr, uid, uid)
> +        user = self.pool['res.users'].browse(cr, uid, uid, context=context)
>          self.company = user.company_id
> -        
> -    def get_invoice_date (self, invoice):
> +
> +    def get_invoice_date(self, invoice):
>          invoice_date = ""
> -        
>          if str(invoice.date_invoice) != '':
>              invoice_date = datetime.strptime(invoice.date_invoice, '%Y-%m-%d')
>              invoice_date = invoice_date.strftime('%d/%m/%Y')
> -            
>          return invoice_date
> -    
> +
>      def get_invoice_refund(self, invoice):
>          if invoice.type == "out_refund" or invoice.type == "in_refund":
>              number = '-'
>              str_date = '-'
> -            if len(invoice.origin_invoices_ids) > 0:
> -                number =len(invoice.origin_invoices_ids) > 0 and invoice.origin_invoices_ids[0].number or '-'
> +            if invoice.origin_invoices_ids:
> +                number = (invoice.origin_invoices_ids and
> +                          invoice.origin_invoices_ids[0].number or '-')
>                  if str(invoice.origin_invoices_ids[0].date_invoice) != '':
> -                    invoice_date = datetime.strptime(invoice.origin_invoices_ids[0].date_invoice, '%Y-%m-%d')
> -                    str_date = invoice_date.strftime('%d-%m-%Y')        
> -                
> +                    date_inv = invoice.origin_invoices_ids[0].date_invoice
> +                    invoice_date = datetime.strptime(date_inv, '%Y-%m-%d')
> +                    str_date = invoice_date.strftime('%d-%m-%Y')
>              return number + ' (' + str_date + ')'
>          else:
>              return None
> -        
> +
>      def get_left_text(self, invoice):
> -        
>          text = ""
> -        
>          company = invoice.company_id or self.company or None
> -        
>          if company and company.partner_id:
> -            
>              partner = company.partner_id
> -
>              # Nombre empresa
> -            #text += partner.name or ""
> +            # text += partner.name or ""
>              # CIF
> -            #text += partner.vat and (" - " + partner.vat) or ""
> +            # text += partner.vat and (" - " + partner.vat) or ""
>              # Tomo
> -            text += partner.es_tomo and ("" + _("RM Tomo") + " " + partner.es_tomo) or ""
> +            text += partner.es_tomo and ("" + _("RM Tomo") + " " +
> +                                         partner.es_tomo) or ""
>              # Libro
> -            text += partner.es_libro and (" " + _("Libro") + " " + partner.es_libro) or ""
> +            text += partner.es_libro and (" " + _("Libro") + " " +
> +                                          partner.es_libro) or ""
>              # Folio
> -            text += partner.es_folio and (" " + _("Folio") + " " + partner.es_folio) or ""    
> +            text += partner.es_folio and (" " + _("Folio") + " " +
> +                                          partner.es_folio) or ""
>              # Hoja
> -            text += partner.es_hoja and (" " + _("Hoja") + " " + partner.es_hoja) or ""    
> +            text += partner.es_hoja and (" " + _("Hoja") +
> +                                         " " + partner.es_hoja) or ""
>              # Inscripcion
> -            text += partner.es_registro_mercantil and (" " + _("Inscripción") + " " + partner.es_registro_mercantil) or ""    
> +            reg_merc = partner.es_registro_mercantil
> +            text += partner.es_registro_mercantil and (" " + _("Inscripción") +
> +                                                       " " + reg_merc) or ""
>              # Final
> -            text += "."        
> +            text += "."
>  
>          return text
>  
>      def get_partner_name(self, invoice):
> -                
>          text = ""
>          company = invoice.company_id or self.company or None
> -        
>          if company and company.partner_id:
> -            
>              partner = company.partner_id
> -
>              # Nombre empresa
>              text += partner.name or ""
>              # CIF
>              text += partner.vat and (" - " + partner.vat) or ""
>              return text
> -         
> -    
> -    def get_footer_text(self, invoice):
> -        
> +
> +    def get_footer_text(self, invoice, context=None):
>          text = ""
> -        
>          company = invoice.company_id or self.company or None
> -        
>          if company and company.partner_id:
> -            
> +            partner_obj = self.pool['res.partner']
>              partner = company.partner_id
> -            addr_ids = self.pool.get('res.partner').address_get(self.cr, self.uid, [partner.id], ['default'])
> -            addr_id = addr_ids['default']
> -            addr = self.pool.get('res.partner.address').browse(self.cr, self.uid, addr_id)
> -            
>              # Nombre empresa
> -            #text += partner and partner.name or ""
> +            # text += partner and partner.name or ""
>              # Calle empresa
> -            text += addr and addr.street and ("" + addr.street + ".") or ""
> +            text += partner.street and ("" + addr.street + ".") or ""
>              # Codigo Postal empresa
> -            text += addr and addr.zip and (" - " + addr.zip) or ""
> +            text += partner.zip and (" - " + addr.zip) or ""
>              # Ciudad
> -            text += addr and addr.city and (" " + addr.city) or ""
> +            text += partner.city and (" " + addr.city) or ""
>              # Telefono
> -            text += addr and addr.phone and (" - " + _("Tel.") + " " + addr.phone) or ""
> +            text += partner.phone and (" - " + _("Tel.") +
> +                                       " " + addr.phone) or ""
>              # Fax
> -            text += addr and addr.fax and (" - " + _("Fax.") + " " + addr.fax) or ""
> +            text += partner.fax and (" - " + _("Fax.") + " " +
> +                                     addr.fax) or ""
>              # Email
> -            text += addr and addr.email and (" - " + _("E-Mail") + " " + addr.email) or ""
> -            
> +            text += addr and addr.email and (" - " + _("E-Mail") +
> +                                             " " + addr.email) or ""
>          return text
> -         
> -    def get_company_address (self, invoice):
> -        
> +
> +    def get_company_address(self, invoice, context=None):
>          res = []
> -        
>          company = invoice.company_id or self.company or None
> -        
>          if company and company.partner_id:
> -            
>              partner = company.partner_id
> -            addr_ids = self.pool.get('res.partner').address_get(self.cr, self.uid, [partner.id], ['default'])
> -            addr_id = addr_ids['default']
> -            addr = self.pool.get('res.partner.address').browse(self.cr, self.uid, addr_id)
> -            
> -            res.append(partner and partner.name or "")
> -            res.append((addr and addr.street) or '')
> -            res.append((addr and addr.zip or '') + " - " + (addr and addr.city or ''))
> -            res.append((addr and addr.state_id and addr.state_id.name or '') + " (" + (addr and addr.country_id and addr.country_id.name or '') + ")")
> -            res.append(partner and partner.vat or '')
> -            
> +            res.append(partner.name or "")
> +            res.append((partner.street) or '')
> +            res.append((partner.zip or '') + " - " +
> +                       (partner.city or ''))
> +            res.append((partner.state_id and partner.state_id.name or '') +
> +                       " (" + (partner.country_id and
> +                               partner.country_id.name or '') + ")")
> +            res.append(partner.vat or '')
>          else:
> -            
> -            res.append(" ")
> -            res.append(" ")
> -            res.append(" ")
> -            res.append(" ")
> -            res.append(" ")
> -
> +            for i in range(5):
> +                res.append(" ")
>          return res
> -    
> -    def get_customer_address (self, invoice):
> -        
> +
> +    def get_customer_address(self, invoice, context=None):
>          res = []
> -        
>          partner = invoice.partner_id
> -        addr_ids = self.pool.get('res.partner').address_get(self.cr, self.uid, [partner.id], ['default'])
> +        partner_obj = self.pool['res.partner']
> +        addr_ids = partner_obj.address_get(self.cr, self.uid,
> +                                           [partner.id], ['default'])
>          addr_id = addr_ids['default']
> -        addr = self.pool.get('res.partner.address').browse(self.cr, self.uid, addr_id)
> -        
> +        addr = partner_obj.browse(self.cr, self.uid, addr_id, context=context)
>          res.append((addr and addr.street) or '')
> -        res.append((addr and addr.zip or '') + " - " + (addr and addr.city or ''))
> -        res.append((addr and addr.state_id and addr.state_id.name or '') + " (" + (addr and addr.country_id and addr.country_id.name or '') + ")")
> +        res.append((addr and addr.zip or '') + " - " +
> +                   (addr and addr.city or ''))
> +        res.append((addr and addr.state_id and addr.state_id.name or '') +
> +                   " (" + (addr and addr.country_id and
> +                           addr.country_id.name or '') + ")")
> +        return res
>  
> -        return res
> -    
> -    def get_elevator_address (self, invoice):
> -        
> +    def get_elevator_address(self, invoice, context=None):
>          res = []
> -        
>          if invoice.elevator_partner_id:
> -            
>              partner = invoice.elevator_partner_id
> -            addr_ids = self.pool.get('res.partner').address_get(self.cr, self.uid, [partner.id], ['default'])
> -            addr_id = addr_ids['default']
> -            addr = self.pool.get('res.partner.address').browse(self.cr, self.uid, addr_id)
> -            
> -            res.append(partner and partner.name or "")
> -            res.append((addr and addr.street) or '')
> -            res.append((addr and addr.zip or '') + " - " + (addr and addr.city or ''))
> -            res.append((addr and addr.state_id and addr.state_id.name or '') + " (" + (addr and addr.country_id and addr.country_id.name or '') + ")")
> -            res.append(partner and partner.vat or '')
> -        
> +            res.append(partner.name or "")
> +            res.append((partner.street) or '')
> +            res.append((partner.zip or '') + " - " +
> +                       (partner.city or ''))
> +            res.append((partner.state_id and partner.state_id.name or '') +
> +                       " (" + (partner.country_id and
> +                               partner.country_id.name or '') + ")")
> +            res.append(partner.vat or '')
>          elif invoice.partner_id:
> -            
>              partner = invoice.partner_id
>              addr = invoice.address_invoice_id
> -            
>              res.append(partner and partner.name or "")
>              res.append((addr and addr.street) or '')
> -            res.append((addr and addr.zip or '') + " - " + (addr and addr.city or ''))
> -            res.append((addr and addr.state_id and addr.state_id.name or '') + " (" + (addr and addr.country_id and addr.country_id.name or '') + ")")
> +            res.append((addr and addr.zip or '') + " - " +
> +                       (addr and addr.city or ''))
> +            res.append((addr and addr.state_id and addr.state_id.name or '') +
> +                       " (" + (addr and addr.country_id and
> +                               addr.country_id.name or '') + ")")
>              res.append(partner and partner.vat or '')
> -                     
>          else:
> -            
> -            res.append(" ")
> -            res.append(" ")
> -            res.append(" ")
> -            res.append(" ")
> -            res.append(" ")
> -        
> +            for i in range(5):
> +                res.append(" ")
>          return res
> -        
> -        
> +
>      def get_payment_type(self, invoice):
> -
>          return invoice.payment_type and invoice.payment_type.name.upper() or ''
> -    
> -        
> +
>      def get_payment_term(self, invoice):
> -        
>          if invoice.date_due:
>              date_due = datetime.strptime(invoice.date_due, '%Y-%m-%d')
>              str_date = date_due.strftime('%d/%m/%Y')
>          else:
>              date_invoice = datetime.strptime(invoice.date_invoice, '%Y-%m-%d')
> -            str_date = date_invoice.strftime('%d/%m/%Y')            
> -
> +            str_date = date_invoice.strftime('%d/%m/%Y')
>          return str_date
>  
> -
> -    def get_account_number(self, invoice):
> -    
> +    def get_account_number(self, invoice, context=None):
>          bank_text = ""
> -        
> -        if invoice.payment_type and invoice.payment_type.code in ('TRANSF', 'T/T', 'TRANSFERENCIA_CSB', 'CNF'):
> -            
> -            if invoice.type in ("in_invoice", "out_invoice"):
> -                
> -                # Cuenta bancaria de la empresa
> -                if self.company.partner_id:
> -                    partner_id = self.company.partner_id.id
> -                    
> -                    pool = pooler.get_pool(self.cr.dbname)
> -                    bank_obj = pool.get('res.partner.bank')
> -                    bank_ids = bank_obj.search(self.cr, self.uid, [('partner_id','=', partner_id)], limit=1, order='default_bank desc')
> -                    
> -                    for bank in bank_obj.browse(self.cr, self.uid, bank_ids):
> -                        bank_text = format_acc_number(bank.iban or bank.acc_number or "")
> -
> -            else: # ("out_refund", "in_refund")    
> -                
> -                # Cuenta bancaria del cliente
> -                if invoice.partner_bank_id:
> -                    bank_text = format_acc_number(invoice.partner_bank_id.iban or invoice.partner_bank_id.acc_number or "", masked=True)
> -                                
> -        elif invoice.payment_type and invoice.payment_type.code in ('RECIBO', 'RECIBO_CSB', 'pain.008.001.02'):
> -            if invoice.type in ("in_invoice", "out_invoice"):
> -                # Cuenta bancaria del cliente
> -                if invoice.partner_bank_id:
> -                    bank_text = format_acc_number(invoice.partner_bank_id.iban or invoice.partner_bank_id.acc_number or "", masked=True)
> -            else: # ("out_refund", "in_refund")    
> -                
> -                # Cuenta bancaria de la empresa
> -                if self.company.partner_id:
> -                    partner_id = self.company.partner_id.id
> -                    
> -                    pool = pooler.get_pool(self.cr.dbname)
> -                    bank_obj = pool.get('res.partner.bank')
> -                    bank_ids = bank_obj.search(self.cr, self.uid, [('partner_id','=', partner_id)], limit=1, order='default_bank desc')
> -                    
> -                    for bank in bank_obj.browse(self.cr, self.uid, bank_ids):
> -                        bank_text = format_acc_number(bank.iban or bank.acc_number or "")
> -
> +        pay_type('TRANSF', 'T/T', 'TRANSFERENCIA_CSB', 'CNF')

pay_type = (...)

> +        if invoice.payment_type and invoice.payment_type.code in pay_type:
> +            if invoice.type in ("in_invoice", "out_invoice"):
> +                # Cuenta bancaria de la empresa
> +                if self.company.partner_id:
> +                    partner_id = self.company.partner_id.id
> +                    bank_obj = self.pool['res.partner.bank']
> +                    bank_ids = bank_obj.search(self.cr, self.uid,
> +                                               [('partner_id', '=',
> +                                                 partner_id)],
> +                                               limit=1,
> +                                               order='default_bank desc',
> +                                               context=context)
> +                    for bank in bank_obj.browse(self.cr, self.uid, bank_ids,
> +                                                context=context):
> +                        bank_text = format_acc_number(bank.iban or
> +                                                      bank.acc_number or "")
> +            else:  # ("out_refund", "in_refund")
> +                # Cuenta bancaria del cliente
> +                if invoice.partner_bank_id:
> +                    acc_number = invoice.partner_bank_id.acc_number
> +                    bank_text = format_acc_number(invoice.partner_bank_id.iban
> +                                                  or acc_number or "",
> +                                                  masked=True)
> +        elif (invoice.payment_type and invoice.payment_type.code in
> +                ('RECIBO', 'RECIBO_CSB', 'pain.008.001.02')):
> +            if invoice.type in ("in_invoice", "out_invoice"):
> +                # Cuenta bancaria del cliente
> +                if invoice.partner_bank_id:
> +                    acc_number = invoice.partner_bank_id.acc_number
> +                    bank_text = format_acc_number(invoice.partner_bank_id.iban
> +                                                  or acc_number or "",
> +                                                  masked=True)
> +            else:  # ("out_refund", "in_refund")
> +                # Cuenta bancaria de la empresa
> +                if self.company.partner_id:
> +                    partner_id = self.company.partner_id.id
> +                    bank_obj = self.pool['res.partner.bank']
> +                    bank_ids = bank_obj.search(self.cr, self.uid,
> +                                               [('partner_id', '=',
> +                                                 partner_id)], limit=1,
> +                                               order='default_bank desc',
> +                                               context=context)
> +                    for bank in bank_obj.browse(self.cr, self.uid, bank_ids,
> +                                                context=context):
> +                        bank_text = format_acc_number(bank.iban or
> +                                                      bank.acc_number or "")
>          return bank_text
>  
> -                        
>      def get_invoice_lines(self, invoice):
> -        product_obj = self.pool.get('product.product')
> -        
> +        product_obj = self.pool['product.product']
>          res = []
> -        
>          contracts = {}
>          links = {}
>          shippings = {}
>          others = {}
> -
>          max_lines_first, max_lines = self.get_lines_per_page()
> -        
>          sign = 1.0
>          if invoice.type == "out_refund" or invoice.type == "in_refund":
>              sign = -1.0
> -        
>          count = 0
> -
>          for l in invoice.invoice_line:
>              # Lineas de teléfono
> -            if l.contract_id and l.product_id and product_obj._is_sim(l.product_id.categ_id):
> +            if (l.contract_id and l.product_id and
> +                    product_obj._is_sim(l.product_id.categ_id)):
>                  if l.contract_id.id in contracts:
> -                    contracts[l.contract_id.id]['uds'] = contracts[l.contract_id.id]['uds'] + int(l.quantity or 0)
> -                    contracts[l.contract_id.id]['price'] = contracts[l.contract_id.id]['price'] + (l.price_subtotal or 0)
> +                    contracts[l.contract_id.id]['uds'] += int(l.quantity or 0)
> +                    contracts[l.contract_id.id]['price'] += (l.price_subtotal
> +                                                             or 0)
>                  else:
> -                    contracts[l.contract_id.id] = {'uds': int(l.quantity or 0), 
> -                                                   'price': l.price_subtotal or 0,
> -                                                   'ref': l.contract_id.ref or "", 
> -                                                   'type': l.contract_id and l.contract_id.contract_type_id and l.contract_id.contract_type_id.name or " - "}
> -
> +                    uds = int(l.quantity or 0)
> +                    price = l.price_subtotal or 0
> +                    ref = l.contract_id.ref or ""
> +                    type = (l.contract_id and l.contract_id.contract_type_id
> +                            and l.contract_id.contract_type_id.name or " - ")
> +                    contracts[l.contract_id.id] = {'uds': uds,
> +                                                   'price': price,
> +                                                   'ref': ref,
> +                                                   'type': type,
> +                                                   }
>              # Gastos de envío
> -            elif l.product_id and product_obj._is_shipping_cost(l.product_id.categ_id):
> -                if l.product_id.id in shippings and shippings[l.product_id.id]['price'] == (l.price_unit or 0) and shippings[l.product_id.id]['dto'] == (l.discount or 0):
> -                    shippings[l.product_id.id]['uds'] = shippings[l.product_id.id]['uds'] + int(l.quantity or 0)
> -                    shippings[l.product_id.id]['import'] = shippings[l.product_id.id]['import'] + (l.price_subtotal or 0)                
> +            elif (l.product_id and
> +                    product_obj._is_shipping_cost(l.product_id.categ_id)):
> +                if (l.product_id.id in shippings and
> +                        shippings[l.product_id.id]['price'] == (l.price_unit
> +                                                                or 0)
> +                        and shippings[l.product_id.id]['dto'] == (l.discount
> +                                                                  or 0)):
> +                    shippings[l.product_id.id]['uds'] += int(l.quantity or 0)
> +                    shippings[l.product_id.id]['import'] += (l.price_subtotal
> +                                                             or 0)
>                  else:
> -                    shippings[l.product_id.id] = {'concept': l.product_id and l.product_id.name or " ",
> -                                                  'uds': int(l.quantity or 0), 
> +                    shippings[l.product_id.id] = {'concept': (l.product_id and
> +                                                              l.product_id.name
> +                                                              or " "),
> +                                                  'uds': int(l.quantity or 0),
>                                                    'price': l.price_unit or 0,
> -                                                  'dto': l.discount or 0, 
> -                                                  'import': l.price_subtotal or 0}    
> -
> +                                                  'dto': l.discount or 0,
> +                                                  'import': (l.price_subtotal
> +                                                             or 0)}
>              # Enlaces, repuestos u otros tipos de producto
>              elif l.product_id:
> -                if (l.product_id.id,l.price_unit,l.discount) in links:
> -                    links[(l.product_id.id,l.price_unit,l.discount)]['uds'] = links[(l.product_id.id,l.price_unit,l.discount)]['uds'] + int(l.quantity or 0)
> -                    links[(l.product_id.id,l.price_unit,l.discount)]['import'] = links[(l.product_id.id,l.price_unit,l.discount)]['import'] + (l.price_subtotal or 0)
> +                if (l.product_id.id, l.price_unit, l.discount) in links:
> +                    links[(l.product_id.id, l.price_unit,
> +                           l.discount)]['uds'] += int(l.quantity or 0)
> +                    links[(l.product_id.id, l.price_unit,
> +                           l.discount)]['import'] += (l.price_subtotal or 0)
>                  else:
> -                    links[(l.product_id.id,l.price_unit,l.discount)] = {
> -                        'uds': int(l.quantity or 0), 
> +                    links[(l.product_id.id, l.price_unit, l.discount)] = {
> +                        'uds': int(l.quantity or 0),
>                          'price': l.price_unit or 0,
> -                        'dto': l.discount or 0, 
> +                        'dto': l.discount or 0,
>                          'import': l.price_subtotal or 0,
>                          'concept': l.product_id and l.product_id.name or " ",
>                          }
> -
>              # Resto de líneas (texto libre)
>              else:
>                  others[l.id] = {'concept': l.name or " ",
> -                                'uds': int(l.quantity or 0), 
> +                                'uds': int(l.quantity or 0),
>                                  'price': l.price_unit or 0,
> -                                'dto': l.discount or 0, 
> -                                'import': l.price_subtotal or 0}    
> -                    
> -                
> +                                'dto': l.discount or 0,
> +                                'import': l.price_subtotal or 0}
>          # Diccionario final
>          # -------------------------------------------
> -
> -        # Lineas de teléfono    
> +        # Lineas de teléfono
>          for contract_id in contracts:
>              line = {}
> -            
> -            uds = contracts[contract_id]['uds'] > 1 and str(contracts[contract_id]['uds']) + _(" Líneas Móvil") or str(contracts[contract_id]['uds']) + _(" Línea Móvil")
> -            
> -            concept = _("Contrato ") + contracts[contract_id]['ref'] + " - " + uds + " (" + contracts[contract_id]['type'] + ")"
> -            
> +            uds = (contracts[contract_id]['uds'] > 1 and
> +                   str(contracts[contract_id]['uds']) + _(" Líneas Móvil") or
> +                   str(contracts[contract_id]['uds']) + _(" Línea Móvil"))
> +            concept = (_("Contrato ") + contracts[contract_id]['ref'] + " - " +
> +                       uds + " (" + contracts[contract_id]['type'] + ")")
>              line["concept"] = concept
>              line["uds"] = 1
>              line["price"] = contracts[contract_id]['price'] * sign or 0
>              line["dto"] = 0
> -            line["import"] = contracts[contract_id]['price']  * sign or 0
> -            line["header"] = (count == 0) or (count == max_lines_first) or ((count%max_lines == max_lines_first) and 1 or 0)
> -            line["pagebreak"] = (count == max_lines_first) or ((count%max_lines == max_lines_first) and 1 or 0)
> -            
> +            line["import"] = contracts[contract_id]['price'] * sign or 0
> +            line["header"] = ((count == 0) or (count == max_lines_first) or
> +                              ((count % max_lines == max_lines_first)
> +                               and 1 or 0))
> +            line["pagebreak"] = ((count == max_lines_first) or
> +                                 ((count % max_lines == max_lines_first)
> +                                  and 1 or 0))
>              res.append(line)
> -            
>              count += 1
> -            
> -        # Enlaces    
> +        # Enlaces
>          for link_id in links:
>              line = {}
> -            
>              line["concept"] = links[link_id]['concept']
>              line["uds"] = links[link_id]['uds']
>              line["price"] = links[link_id]['price'] * sign or 0
>              line["dto"] = links[link_id]['dto']
>              line["import"] = links[link_id]['import'] * sign or 0
> -            line["header"] = (count == 0) or (count == max_lines_first) or ((count%max_lines == max_lines_first) and 1 or 0)
> -            line["pagebreak"] = (count == max_lines_first) or ((count%max_lines == max_lines_first) and 1 or 0)
> -
> +            line["header"] = ((count == 0) or (count == max_lines_first) or
> +                              ((count % max_lines == max_lines_first)
> +                               and 1 or 0))
> +            line["pagebreak"] = ((count == max_lines_first) or
> +                                 ((count % max_lines == max_lines_first)
> +                                  and 1 or 0))
>              res.append(line)
> -            
>              count += 1
> -            
>          # Gastos de envío
>          for shipping_id in shippings:
>              line = {}
> -            
>              line["concept"] = shippings[shipping_id]['concept']
>              line["uds"] = shippings[shipping_id]['uds']
>              line["price"] = shippings[shipping_id]['price'] * sign or 0
>              line["dto"] = shippings[shipping_id]['dto']
>              line["import"] = shippings[shipping_id]['import'] * sign or 0
> -            line["header"] = (count == 0) or (count == max_lines_first) or ((count%max_lines == max_lines_first) and 1 or 0)
> -            line["pagebreak"] = (count == max_lines_first) or ((count%max_lines == max_lines_first) and 1 or 0)
> -
> +            line["header"] = ((count == 0) or (count == max_lines_first) or
> +                              ((count % max_lines == max_lines_first)
> +                               and 1 or 0))
> +            line["pagebreak"] = ((count == max_lines_first) or
> +                                 ((count % max_lines == max_lines_first)
> +                                  and 1 or 0))
>              res.append(line)
> -            
> -            count += 1            
> -
> +            count += 1
>          # Resto
>          for other_id in others:
>              line = {}
> -            
>              line["concept"] = others[other_id]['concept']
>              line["uds"] = others[other_id]['uds']
>              line["price"] = others[other_id]['price'] * sign or 0
>              line["dto"] = others[other_id]['dto']
>              line["import"] = others[other_id]['import'] * sign or 0
> -            line["header"] = (count == 0) or (count == max_lines_first) or ((count%max_lines == max_lines_first) and 1 or 0)
> -            line["pagebreak"] = (count == max_lines_first) or ((count%max_lines == max_lines_first) and 1 or 0)
> -
> +            line["header"] = ((count == 0) or (count == max_lines_first) or
> +                              ((count % max_lines == max_lines_first)
> +                               and 1 or 0))
> +            line["pagebreak"] = ((count == max_lines_first) or
> +                                 ((count % max_lines == max_lines_first)
> +                                  and 1 or 0))
>              res.append(line)
> -            
> -            count += 1            
> -
> +            count += 1
>          return res
> -    
> -    def get_phone_lines (self, invoice):
> -        
> -        product_obj = self.pool.get('product.product')
> -        
> +
> +    def get_phone_lines(self, invoice):
> +        product_obj = self.pool['product.product']
>          res = []
> -        
>          sign = 1.0
>          if invoice.type == "out_refund" or invoice.type == "in_refund":
>              sign = -1.0
> -        
>          count = 0
>          max_lines = 36
> -        
>          # Teléfonos
>          for l in invoice.invoice_line:
> -            if l.contract_annexe_id and l.product_id and product_obj._is_sim(l.product_id.categ_id):
> +            if (l.contract_annexe_id and l.product_id and
> +                    product_obj._is_sim(l.product_id.categ_id)):
>                  line = {}
> -                
>                  link_model = ""
>                  str_annexe_date = ""
>                  str_start_date = ""
>                  str_end_date = ""
>                  num_cabins = l.num_cabins or 0
>                  price_month = 0
> -                
> -                # El campo modelo de enlace, se rellena únicamente cuando el contrato es de tipo integral
> -                if l.contract_id and l.contract_id.contract_type_id and l.contract_id.contract_type_id.ref == 'Integral':
> -                    link = l.contract_annexe_id.production_lot_2_id and l.contract_annexe_id.production_lot_2_id.product_id.name or ''
> +                # El campo modelo de enlace, se rellena únicamente
> +                # cuando el contrato es de tipo integral
> +                if (l.contract_id and l.contract_id.contract_type_id and
> +                        l.contract_id.contract_type_id.ref == 'Integral'):
> +                    lot_2_id = l.contract_annexe_id.production_lot_2_id
> +                    link = (lot_2_id and lot_2_id.product_id.name or '')
>                      link_model = link.replace('Enlace ', '')
> -                    link_model = len(link_model) > 10 and link_model[0:10] or link_model
> -                
> +                    link_model = (len(link_model) > 10 and link_model[0:10] or
> +                                  link_model)
>                  if str(l.contract_annexe_id.annexe_date) != '':
> -                    annexe_date = datetime.strptime(l.contract_annexe_id.annexe_date, '%Y-%m-%d')
> +                    str_annexe_date = l.contract_annexe_id.annexe_date
> +                    annexe_date = datetime.strptime(str_annexe_date,
> +                                                    '%Y-%m-%d')
>                      str_annexe_date = annexe_date.strftime('%d/%m/%Y')
> -                
>                  if str(l.start_date) != '':
>                      start_date = datetime.strptime(l.start_date, '%Y-%m-%d')
>                      str_start_date = start_date.strftime('%d/%m/%Y')
> -                    
>                  if str(l.end_date) != '':
>                      end_date = datetime.strptime(l.end_date, '%Y-%m-%d')
>                      str_end_date = end_date.strftime('%d/%m/%Y')
> -                
> -                price_cabins = num_cabins > 1 and ((num_cabins - 1) * (l.contract_annexe_id.extra_cabin_price or 0)) or 0
> -                price_month = (l.contract_annexe_id.fixed_price or 0) + price_cabins
> -                price_month = price_month - (price_month * (l.contract_annexe_id.differential_price or 0) / 100.0)
> -                
> +                price_cabins = (num_cabins > 1
> +                                and ((num_cabins - 1)
> +                                     * (l.contract_annexe_id.extra_cabin_price
> +                                        or 0)) or 0)
> +                price_month = ((l.contract_annexe_id.fixed_price or 0) +
> +                               price_cabins)
> +                price_month = (price_month -
> +                               (price_month *
> +                                (l.contract_annexe_id.differential_price or 0)
> +                                / 100.0))
>                  ref = l.contract_annexe_id.customer_ref or l.customer_ref or ''
>                  ref = len(ref) > 12 and ref[:11] + '...' or ref
> -                
> -                
> -                
> -                line['phone'] = l.contract_annexe_id.production_lot_id and l.contract_annexe_id.production_lot_id.telefono or ''
> +                phone = (l.contract_annexe_id.production_lot_id and
> +                         l.contract_annexe_id.production_lot_id.telefono or '')
> +                line['phone'] = phone
>                  line["link"] = link_model
>                  line["start_contract"] = str_annexe_date
>                  line["num_cabins"] = num_cabins
> @@ -502,185 +481,155 @@
>                  line["months"] = l.months or 0
>                  line["price_month"] = price_month * sign or 0
>                  line["ref"] = ref
> -                line["total"] = l.price_subtotal * sign or 0  #(l.months or 0) * price_month
> -                
> +                line["total"] = l.price_subtotal * sign or 0
> +                # (l.months or 0) * price_month
>                  res.append(line)
> -
>          # Ordenamos array por telefono
> -        res = sorted(res, key=lambda k: k['phone']) 
> -        
> +        res = sorted(res, key=lambda k: k['phone'])
>          # Añadimos cabeceras
>          result = []
> -        
>          for line in res:
> -            line["header"] = (count%max_lines == 0) and 1 or 0
> +            line["header"] = (count % max_lines == 0) and 1 or 0
>              line["count"] = count
>              result.append(line)
> -            count += 1            
> -        
> +            count += 1
>          return result
> -    
> -    
> -    def get_phone_lines_totals (self, invoice):
> -        
> -        product_obj = self.pool.get('product.product')
> -        
> +
> +    def get_phone_lines_totals(self, invoice):
> +        product_obj = self.pool['product.product']
>          totals = {}
> -        
>          sign = 1.0
>          if invoice.type == "out_refund" or invoice.type == "in_refund":
>              sign = -1.0
> -            
>          phone = link = num_cabins = months = total = 0
> -        
>          # Teléfonos
>          for l in invoice.invoice_line:
> -            if l.contract_annexe_id and l.product_id and product_obj._is_sim(l.product_id.categ_id):
> +            if (l.contract_annexe_id and l.product_id and
> +                    product_obj._is_sim(l.product_id.categ_id)):
>                  phone += 1
>                  # Solo sumamos enlaces que pertenzca a un contrato Integral
> -                link += l.contract_id and l.contract_id.contract_type_id and (l.contract_id.contract_type_id.ref == 'Integral') and l.contract_annexe_id.production_lot_2_id and 1 or 0
> +                link += (l.contract_id and l.contract_id.contract_type_id and
> +                         (l.contract_id.contract_type_id.ref == 'Integral') and
> +                         l.contract_annexe_id.production_lot_2_id and 1 or 0)
>                  num_cabins += l.num_cabins or 0
>                  months += l.months or 0
>                  total += l.price_subtotal or 0
> -                
>          totals['phone'] = phone
>          totals["link"] = link
>          totals["num_cabins"] = num_cabins
>          totals["months"] = months
>          totals["total"] = total * sign or 0
> -        
>          return [totals]
> -    
> -    
> +
>      def get_picking_info_line(self, line):
> -        
>          if line and line.stock_move_id and line.stock_move_id.picking_id:
> -
>              picking = line.stock_move_id.picking_id
> -            
>              picking_date = datetime.strptime(picking.date[0:10], '%Y-%m-%d')
>              str_picking_date = picking_date.strftime('%d/%m/%Y')
> -            picking_info = _("Albarán") + " " + picking.name + " (" + str_picking_date + ")"
> +            picking_info = "%s %s (%s)" % (_("Albarán"), picking.name,
> +                                           str_picking_date)
>              return picking_info
>          else:
>              return ""
> -        
> +
>      def get_picking_info(self, invoice):
> -        
> -        sql = "SELECT p.name, p.date "
> -        sql += "FROM picking_invoice_rel r "
> -        sql += "INNER JOIN stock_picking p ON p.id = r.picking_id "
> -        sql += "INNER JOIN account_invoice i ON i.id = r.invoice_id "
> -        sql += "WHERE r.invoice_id=" + str(invoice.id)+ " and p.date <= i.date_invoice "
> -        sql += "ORDER BY p.date desc "
> -        
> +        sql = ("SELECT p.name, p.date "
> +               "FROM picking_invoice_rel r "
> +               "INNER JOIN stock_picking p ON p.id = r.picking_id "
> +               "INNER JOIN account_invoice i ON i.id = r.invoice_id "
> +               "WHERE r.invoice_id=" + str(invoice.id) + " and "
> +               "p.date <= i.date_invoice "
> +               "ORDER BY p.date desc ")
>          self.cr.execute(sql)
>          results = self.cr.fetchall()
> -        
>          if results and len(results) > 0:
>              for p in results:
>                  picking_date = datetime.strptime(p[1][0:10], '%Y-%m-%d')
>                  str_picking_date = picking_date.strftime('%d/%m/%Y')
> -                picking_info = _("Albarán") + " " + p[0] + " (" + str_picking_date + ")"
> +                picking_info = (_("Albarán") + " " +
> +                                p[0] + " (" + str_picking_date + ")")

Poner también con cadenas de sustitución ("%s (..."

>                  return picking_info
>          else:
>              return ""
> -        
> -        
> -    def get_rest_lines (self, invoice):
> -        
> -        product_obj = self.pool.get('product.product')
> +
> +    def get_rest_lines(self, invoice):
> +        product_obj = self.pool['product.product']
>          space = "     "
> -        
>          res = []
> -        
>          sign = 1.0
>          if invoice.type == "out_refund" or invoice.type == "in_refund":
>              sign = -1.0
> -        
>          count = 0
>          max_lines = 35
> -        
>          # Enlaces y gastos de envio
> -        sql = "SELECT l.id "
> -        sql += "FROM account_invoice_line l "
> -        sql += "INNER JOIN stock_move m ON l.stock_move_id=m.id "
> -        sql += "INNER JOIN stock_picking a ON m.picking_id=a.id "
> -        sql += "INNER JOIN product_product p ON l.product_id=p.id "
> -        sql += "INNER JOIN product_template t ON p.product_tmpl_id=t.id "
> -        sql += "WHERE l.invoice_id = " + str(invoice.id) + " AND t.categ_id != 2 "
> -        sql += "ORDER BY a.date, a.name, t.categ_id, l.product_id "
> -        
> +        sql = (("SELECT l.id "
> +                "FROM account_invoice_line l "
> +                "INNER JOIN stock_move m ON l.stock_move_id=m.id "
> +                "INNER JOIN stock_picking a ON m.picking_id=a.id "
> +                "INNER JOIN product_product p ON l.product_id=p.id "
> +                "INNER JOIN product_template t ON p.product_tmpl_id=t.id "
> +                "WHERE l.invoice_id = %s AND t.categ_id != 2 "
> +                "ORDER BY a.date, a.name, t.categ_id, l.product_id ")
> +               % str(invoice.id))
>          self.cr.execute(sql)
>          results = self.cr.fetchall()
>          lines_ids = [x[0] for x in results]
> -        
>          ant_picking_info = ""
> -        
> -        for l in self.pool.get('account.invoice.line').browse(self.cr, self.uid, lines_ids, context=None):
> -        
> +        inv_obj = self.pool['account.invoice.line']
> +        for l in inv_obj.browse(self.cr, self.uid, lines_ids, context=context):
>              picking_info = self.get_picking_info_line(l)
> -            
>              # Linea de albarán
>              if picking_info != ant_picking_info:
>                  line = {}
> -                
>                  line["concept"] = picking_info
>                  line["uds"] = 0
>                  line["price"] = 0
>                  line["dto"] = 0
>                  line["import"] = 0
> -                line["header"] = (count%max_lines == 0) and 1 or 0
> +                line["header"] = (count % max_lines == 0) and 1 or 0
>                  line["picking"] = 1
>                  line["count"] = count
> -                
>                  res.append(line)
> -                
>                  ant_picking_info = picking_info
>                  count += 1
> -                
>              # Lineas de enlaces o gastos de envio
>              line = {}
> -            
>              concept = l.product_id and l.product_id.name or " "
> -            
> -            if l.product_id and product_obj._is_link(l.product_id.categ_id) and l.contract_annexe_id.production_lot_2_id:
> -                ref = l.contract_annexe_id.customer_ref or l.customer_ref or '-'
> -                concept += " IMEI: " + (l.contract_annexe_id.production_lot_2_id.imei or '-') + ', REF.: ' + ref
> -                concept = len(concept) > 62 and concept[0:61] + '...' or concept
> -                
> +            if (l.product_id and product_obj._is_link(l.product_id.categ_id)
> +                    and l.contract_annexe_id.production_lot_2_id):
> +                ref = (l.contract_annexe_id.customer_ref or
> +                       l.customer_ref or '-')
> +                concept += (" IMEI: " +

Poner con cadena de sustitución para mejorar legibilidad

> +                            (l.contract_annexe_id.production_lot_2_id.imei
> +                             or '-') + ', REF.: ' + ref)
> +                concept = (len(concept) > 62 and concept[0:61] +
> +                           '...' or concept)
>              line["concept"] = space + concept
>              line["uds"] = int(l.quantity or 0)
>              line["price"] = l.price_unit * sign or 0
>              line["dto"] = l.discount or 0
>              line["import"] = l.price_subtotal * sign or 0
> -            line["header"] = (count%max_lines == 0) and 1 or 0
> +            line["header"] = (count % max_lines == 0) and 1 or 0
>              line["count"] = count
>              line["picking"] = 0
> -                
>              res.append(line)
> -            
>              count += 1
> +        return res
>  
> -        return res
> -    
> -    def get_rest_lines_total (self, invoice):
> -        
> -        product_obj = self.pool.get('product.product')
> +    def get_rest_lines_total(self, invoice):
> +        product_obj = self.pool['product.product']
>          total = 0
> -        
>          sign = 1.0
>          if invoice.type == "out_refund" or invoice.type == "in_refund":
>              sign = -1.0
> -        
>          for l in invoice.invoice_line:
> -            if l.stock_move_id and l.stock_move_id.picking_id and l.product_id and not product_obj._is_sim(l.product_id.categ_id):
> +            if (l.stock_move_id and l.stock_move_id.picking_id and l.product_id
> +                    and not product_obj._is_sim(l.product_id.categ_id)):
>                  total += l.price_subtotal or 0
> -
>          return total * sign or 0
>  
>      def get_company_logo(self, company):
> -        return company.logo        
> +        return company.logo
>  
>      def company_address_visible(self):
>          return False
> @@ -692,7 +641,7 @@
>          return (26, 44)
>  
>  
> -class account_invoice_preprinted(account_invoice_custom):
> +class AccountInvoicePreprinted(AccountInvoiceCustom):
>      def get_company_logo(self, company):
>          return None
>  
> @@ -703,7 +652,8 @@
>          return (22, 40)
>  
>  
> -class account_invoice_nayar(account_invoice_custom):
> +class AccountInvoiceNayar(AccountInvoiceCustom):
> +
>      def get_company_logo(self, company):
>          return None
>  
> @@ -712,11 +662,9 @@
>  
>      def get_invoice_lines(self, invoice):
>          max_lines_first, max_lines = self.get_lines_per_page()
> -        
>          sign = 1.0
>          if invoice.type == "out_refund" or invoice.type == "in_refund":
>              sign = -1.0
> -        
>          res = []
>          count = 0
>          for l in invoice.invoice_line:
> @@ -726,21 +674,26 @@
>                  'price': (l.price_unit or 0) * sign,
>                  'dto': l.discount or 0,
>                  'import': (l.price_subtotal or 0) * sign,
> -                'header': (count == 0) or (count == max_lines_first) or ((count%max_lines == max_lines_first) and 1 or 0),
> -                'pagebreak': (count == max_lines_first) or ((count%max_lines == max_lines_first) and 1 or 0),
> +                'header': ((count == 0) or (count == max_lines_first) or
> +                           ((count % max_lines == max_lines_first)
> +                            and 1 or 0)),
> +                'pagebreak': ((count == max_lines_first) or
> +                              ((count % max_lines == max_lines_first)
> +                               and 1 or 0)),
>                  }
> -
>              res.append(line)
> -            
>              count += 1
> -
>          return res
> -    
> -        
> -report_sxw.report_sxw('report.account.invoice.custom', 'account.invoice', 'addons/dos_account_invoice_report/report/account_invoice.rml', parser=account_invoice_custom)
> -
> -report_sxw.report_sxw('report.account.invoice.preprinted', 'account.invoice', 'addons/dos_account_invoice_report/report/account_invoice.rml', parser=account_invoice_preprinted)
> -
> -report_sxw.report_sxw('report.account.invoice.nayar', 'account.invoice', 'addons/dos_account_invoice_report/report/account_invoice.rml', parser=account_invoice_nayar)
> -
> +
> +report_sxw.report_sxw('report.account.invoice.custom', 'account.invoice',
> +                      'addons/dos_account_invoice_report'
> +                      '/report/account_invoice.rml',
> +                      parser=AccountInvoiceCustom)
> +report_sxw.report_sxw('report.account.invoice.preprinted', 'account.invoice',
> +                      'addons/dos_account_invoice_report/'
> +                      'report/account_invoice.rml',
> +                      parser=AccountInvoicePreprinted)
> +report_sxw.report_sxw('report.account.invoice.nayar', 'account.invoice',
> +                      'addons/dos_account_invoice_report/'
> +                      'report/account_invoice.rml', parser=AccountInvoiceNayar)
>  # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> 
> === added file 'dos_account_invoice_report/report/account_invoice_report.xml'
> --- dos_account_invoice_report/report/account_invoice_report.xml	1970-01-01 00:00:00 +0000
> +++ dos_account_invoice_report/report/account_invoice_report.xml	2014-06-20 10:22:39 +0000
> @@ -0,0 +1,49 @@
> +<?xml version="1.0"?>
> +<openerp>
> +  <data>
> +    <report id="account_invoice_custom_report"
> +	    string="Invoice 72horas"
> +	    model="account.invoice"
> +	    name="account.invoice.custom"
> +	    rml="dos_account_invoice_report/report/account_invoice.rml"
> +	    attachment="(object.state in ('open','paid')) and ((object.number or '').replace('/','') + '.pdf')"
> +	    attachment_use="1"
> +	    header="False"
> +	    auto="False"
> +	    />
> +
> +    <report id="account_invoice_preprinted_report"
> +	    string="Invoice Preprinted 72horas"
> +	    model="account.invoice"
> +	    name="account.invoice.preprinted"
> +	    rml="dos_account_invoice_report/report/account_invoice.rml"
> +	    attachment="(object.state in ('open','paid')) and ((object.number or '').replace('/','') + '.pdf')"
> +	    attachment_use="1"
> +	    header="False"
> +	    auto="False"
> +	    />
> +
> +    <report id="account_invoice_nayar_report"
> +	    string="Invoice Nayar Systems"
> +	    model="account.invoice"
> +	    name="account.invoice.nayar"
> +	    rml="dos_account_invoice_report/report/account_invoice.rml"
> +	    attachment="(object.state in ('open','paid')) and ((object.number or '').replace('/','') + '.pdf')"
> +	    attachment_use="1"
> +	    header="False"
> +	    auto="False"
> +	    />
> +
> +    <record id="view_invoice_report_inherit_account" model="ir.ui.view">
> +      <field name="name">stock.invoice.report.form</field>
> +      <field name="model">account.invoice</field>
> +      <field name="inherit_id" ref="account.invoice_form"/>
> +      <field name="arch" type="xml">
> +		<button string="Print Invoice" position="attributes">
> +			<attribute name='states'>open,paid,proforma,sale,proforma2</attribute>
> +		</button>
> +      </field>
> +    </record>
> +
> +  </data>
> +</openerp>
> 


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