← Back to team overview

avanzosc team mailing list archive

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

 

Review: Needs Fixing code review

Un par de cosas más.

Un saludo.

Diff comments:

> === modified file 'nayar_impagados/__init__.py'
> --- nayar_impagados/__init__.py	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/__init__.py	2014-07-04 07:56:20 +0000
> @@ -19,8 +19,5 @@
>  #
>  ##############################################################################
>  
> -import account_bank_statement
> -import account_invoice
> -import account_move_line
> -import partner
> -import wizard
> +from . import models
> +from . import wizard
> 
> === modified file 'nayar_impagados/__openerp__.py'
> --- nayar_impagados/__openerp__.py	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/__openerp__.py	2014-07-04 07:56:20 +0000
> @@ -19,13 +19,14 @@
>  #
>  ##############################################################################
>  
> -
>  {
>      "name": "Tratamiento de facturas impagadas",
>      "version": "1.0",
>      "author": "Javier Sancho",
>      "category": "Enterprise Specific Modules",
> -    "description": "Importación de ficheros con norma 58 y gestión de facturas impagadas.",
> +    "description": """
> +    Importación de ficheros con norma 58 y gestión de facturas impagadas.
> +    """,
>      "website": "http://jsancho.org/";,
>      "license": "AGPL-3",
>      "depends": [
> @@ -33,19 +34,15 @@
>          "account",
>          "dos_partner_additional_info",
>          "l10n_es_bank_statement",
> -        ],
> -    "init_xml": [],
> -    "demo_xml": [],
> -    "update_xml": [
> +    ],
> +    "data": [
>          "wizard/import_c58_file_view.xml",
>          "wizard/make_return_costs_invoices_view.xml",
>          "wizard/reconcile_unpaid_account_moves_view.xml",
>          "wizard/unpaid_followup_print_view.xml",
> -        "reconcile_data.xml",
> -        "partner_view.xml",
> -        ],
> +        "data/reconcile_data.xml",
> +        "views/partner_view.xml",
> +    ],
>      "installable": True,
>      "active": False,
>  }
> -
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> 
> === added directory 'nayar_impagados/data'
> === renamed file 'nayar_impagados/reconcile_data.xml' => 'nayar_impagados/data/reconcile_data.xml'
> --- nayar_impagados/reconcile_data.xml	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/data/reconcile_data.xml	2014-07-04 07:56:20 +0000
> @@ -1,22 +1,27 @@
>  <?xml version="1.0" encoding="utf-8"?>
>  <openerp>
> -  <data noupdate="1">
> -    <record id="unpaid_account_id" model="ir.property">
> -      <field name="name">unpaid_account_id</field>
> -      <field name="fields_id" search="[('model', '=', 'l10n.es.reconcile.unpaid.account.moves.wizard'), ('name', '=', 'account_id')]"/>
> -      <field name="value" model="account.account" search="[('code', '=', '43150000')]"/>
> -    </record>
> -
> -    <record id="unpaid_journal_id" model="ir.property">
> -      <field name="name">unpaid_journal_id</field>
> -      <field name="fields_id" search="[('model', '=', 'account.move.line.reconcile.writeoff'), ('name', '=', 'journal_id')]"/>
> -      <field name="value" model="account.journal" search="[('code', '=', 'GRAL')]"/>
> -    </record>
> -
> -    <record id="unpaid_writeoff_account_id" model="ir.property">
> -      <field name="name">unpaid_writeoff_account_id</field>
> -      <field name="fields_id" search="[('model', '=', 'account.move.line.reconcile.writeoff'), ('name', '=', 'writeoff_acc_id')]"/>
> -      <field name="value" model="account.account" search="[('code', '=', '43120000')]"/>
> -    </record>
> -  </data>
> +    <data noupdate="1">
> +        <record id="unpaid_account_id" model="ir.property">
> +            <field name="name">unpaid_account_id</field>
> +            <field name="fields_id"
> +                search="[('model', '=', 'l10n.es.reconcile.unpaid.account.moves.wizard'), ('name', '=', 'account_id')]" />
> +            <field name="value" model="account.account"
> +                search="[('code', 'like', '4315%00')]" />
> +        </record>
> +
> +        <record id="unpaid_journal_id" model="ir.property">
> +            <field name="name">unpaid_journal_id</field>
> +            <field name="fields_id"
> +                search="[('model', '=', 'account.move.line.reconcile.writeoff'), ('name', '=', 'journal_id')]" />
> +            <field name="value" model="account.journal" search="[('code', '=', 'GRAL')]" />
> +        </record>
> +
> +        <record id="unpaid_writeoff_account_id" model="ir.property">
> +            <field name="name">unpaid_writeoff_account_id</field>
> +            <field name="fields_id"
> +                search="[('model', '=', 'account.move.line.reconcile.writeoff'), ('name', '=', 'writeoff_acc_id')]" />
> +            <field name="value" model="account.account"
> +                search="[('code', 'like', '4312%00')]" />
> +        </record>
> +    </data>
>  </openerp>
> 
> === added directory 'nayar_impagados/models'
> === added file 'nayar_impagados/models/__init__.py'
> --- nayar_impagados/models/__init__.py	1970-01-01 00:00:00 +0000
> +++ nayar_impagados/models/__init__.py	2014-07-04 07:56:20 +0000
> @@ -0,0 +1,25 @@
> +# -*- coding: utf-8 -*-
> +##############################################################################
> +#
> +#    OpenERP, Open Source Management Solution
> +#    Copyright (C) 2013 Javier Sancho (<http://jsancho.org/>)
> +#
> +#    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 account_bank_statement
> +from . import account_invoice
> +from . import account_move_line
> +from . import partner
> 
> === renamed file 'nayar_impagados/account_bank_statement.py' => 'nayar_impagados/models/account_bank_statement.py'
> --- nayar_impagados/account_bank_statement.py	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/models/account_bank_statement.py	2014-07-04 07:56:20 +0000
> @@ -24,9 +24,9 @@
>  """
>  
>  import base64
> -from osv import osv, fields
> +from openerp.osv import orm, fields
>  import time
> -from tools.translate import _
> +from openerp.tools.translate import _
>  
>  
>  UNPAID_TYPE = (
> @@ -42,16 +42,16 @@
>      )
>  
>  
> -class account_bank_statement(osv.osv):
> +class AccountBankStatement(orm.Model):
>      _inherit = 'account.bank.statement'
>  
>      def import_c58_file(self, cr, uid, ids, file_contents, context=None):
>          """
>          Imports a C58 file into the current bank statement.
>          """
> -        partner_obj = self.pool.get('res.partner')
> -        statement_line_obj = self.pool.get('account.bank.statement.line')
> -        invoice_obj = self.pool.get('account.invoice')
> +        partner_obj = self.pool['res.partner']
> +        statement_line_obj = self.pool['account.bank.statement.line']
> +        invoice_obj = self.pool['account.invoice']
>  
>          st_data = self._load_c58_file(cr, uid, file_contents, context)
>          if type(ids) is list:
> @@ -63,9 +63,14 @@
>          for st_group in st_data:
>              for st_line in st_group['lines']:
>                  invoice_number = st_line['concept'].strip().split(" ")[1]
> -                invoice_id = invoice_obj.search(cr, uid, [('number', '=', invoice_number)])
> -                partner_id = partner_obj.search(cr, uid, [('ref', '=', st_line['partner_ref'].lstrip("0"))])[0]
> -                account_id = partner_obj.read(cr, uid, partner_id, ['property_account_receivable'])['property_account_receivable'][0]
> +                invoice_id = invoice_obj.search(
> +                    cr, uid, [('number', '=', invoice_number)])
> +                partner_id = partner_obj.search(
> +                    cr, uid, [('ref', '=', st_line['partner_ref'].lstrip("0"))],
> +                    context=context)[0]
> +                account_id = partner_obj.read(
> +                    cr, uid, partner_id, ['property_account_receivable'],
> +                    context=context)['property_account_receivable'][0]
>                  total_amount += st_line['amount']
>                  values = {
>                      'statement_id': statement_id,
> @@ -80,24 +85,27 @@
>                      'ref': dict(UNPAID_TYPE)[st_line['type']],
>                      }
>                  # Statement line
> -                line_id = statement_line_obj.create(cr, uid, values, context=context)
> +                statement_line_obj.create(cr, uid, values, context=context)
>  
>          # Update statement
>          statement = self.browse(cr, uid, statement_id)
>          data = {
>              'date': st_data[-1]['date'],
>              'balance_end_real': statement.balance_start - total_amount,
> -            }
> -        data.update(self.onchange_date(cr, uid, statement_id, st_data[-1]['date'])['value'])
> +        }
> +        data.update(self.onchange_date(cr, uid, statement_id,
> +                                       st_data[-1]['date'])['value'])
>          self.write(cr, uid, [statement_id], data)
>  
>          # Attach the C58 file to the current statement
> -        res = self._attach_file_to_statement(cr, uid, file_contents, statement_id, _('Unpaid Bank Statement'), _('unpaid-bank-statement.txt'))
> -
> +        self._attach_file_to_statement(
> +            cr, uid, file_contents, statement_id, _('Unpaid Bank Statement'),
> +            _('unpaid-bank-statement.txt'))
>  
>      def _load_c58_file(self, cr, uid, file_contents, context=None):
>          """
> -        Reads a c58 file and returns a list of dictionaries containing the file data:
> +        Reads a c58 file and returns a list of dictionaries containing the
> +        file data:
>              _amount
>              _num_records
>              amount
> @@ -117,25 +125,20 @@
>          if context is None:
>              context = {}
>  
> -        #
>          # st_data will contain the data read from the file, plus the internal
>          # counters used for checking.
> -        #
>          st_data = []
>  
> -        #
>          # Read C58 file
> -        #
>          decoded_file_contents = base64.decodestring(file_contents)
>          try:
>              unicode(decoded_file_contents, 'utf8')
>          except:
>              # Maybe is ISO-8859-1
> -            decoded_file_contents = unicode(decoded_file_contents, 'iso-8859-1').encode('utf-8')
> +            decoded_file_contents = unicode(decoded_file_contents,
> +                                            'iso-8859-1').encode('utf-8')
>  
> -        #
>          # Process file lines
> -        #
>          for line in decoded_file_contents.split("\n"):
>              if len(line) == 0:
>                  continue
> @@ -149,40 +152,38 @@
>                  self._process_record_5895(cr, uid, st_data, line, context)
>              elif line[0:4] == '5995':  # Registro total general
>                  self._process_record_5995(cr, uid, st_data, line, context)
> -            elif ord(line[0]) == 26:  # CTRL-Z (^Z), is often used as an end-of-file marker in DOS
> +            # CTRL-Z (^Z), is often used as an end-of-file marker in DOS
> +            elif ord(line[0]) == 26:
>                  pass
>              else:
> -                raise osv.except_osv(_('Error in C58 file'), _('Record type %s is not valid.') % line[0:2])
> +                raise orm.except_orm(
> +                    _('Error in C58 file'),
> +                    _('Record type %s is not valid.') % line[0:2])
>  
>          return st_data
>  
> -
> -    def _process_record_5195(self, cr, uid, st_data, line, context):
> +    def _process_record_5195(self, cr, uid, st_data, line, context=None):
>          """
>          5195 - Registro de cabecera del presentador
>          """
> -        #
>          # Add a new group to the statement groups
> -        #
>          st_group = {}
>          st_data.append(st_group)
>  
> -        #
>          # Set the group values
> -        #
>          st_group.update({
> -                'date': time.strftime('%Y-%m-%d', time.strptime(line[16:22], '%d%m%y')),
> -                'entity': line[88:92],
> -                'office': line[92:96],
> -                '_amount': 0,
> -                '_num_records': 1,
> -                'lines': [],
> -                })
> +            'date': time.strftime('%Y-%m-%d', time.strptime(line[16:22],
> +                                                            '%d%m%y')),
> +            'entity': line[88:92],
> +            'office': line[92:96],
> +            '_amount': 0,
> +            '_num_records': 1,
> +            'lines': [],
> +        })
>  
>          return st_group
>  
> -
> -    def _process_record_5395(self, cr, uid, st_data, line, context):
> +    def _process_record_5395(self, cr, uid, st_data, line, context=None):
>          """
>          5395 - Registro de cabecera del ordenante
>          """
> @@ -191,41 +192,35 @@
>  
>          return None
>  
> -
> -    def _process_record_5695(self, cr, uid, st_data, line, context):
> +    def _process_record_5695(self, cr, uid, st_data, line, context=None):
>          """
>          5695 - Registro individual
>          """
> -        #
>          # Add a new line to the statement lines
> -        #
>          st_line = {}
>          st_data[-1]['lines'].append(st_line)
>  
> -        #
>          # Set the line values
> -        #
>          st_line.update({
> -                'partner_ref': line[16:28],
> -                'partner_name': line[28:68].strip(),
> -                'bank_account': line[68:88],
> -                'amount': float(line[88:98])/100,
> -                'concept': line[114:154],
> -                'type': line[154],
> -                'due_date': time.strftime('%Y-%m-%d', time.strptime(line[155:161], '%d%m%y')),
> -                })
> +            'partner_ref': line[16:28],
> +            'partner_name': line[28:68].strip(),
> +            'bank_account': line[68:88],
> +            'amount': float(line[88:98]) / 100,
> +            'concept': line[114:154],
> +            'type': line[154],
> +            'due_date': time.strftime('%Y-%m-%d',
> +                                      time.strptime(line[155:161],
> +                                                    '%d%m%y')),
> +        })
>  
> -        #
>          # Update the (last) group totals
> -        #
>          st_group = st_data[-1]
>          st_group['_num_records'] += 1
>          st_group['_amount'] += st_line['amount']
>  
>          return st_line
>  
> -
> -    def _process_record_5895(self, cr, uid, st_data, line, context):
> +    def _process_record_5895(self, cr, uid, st_data, line, context=None):
>          """
>          5895 - Registro total del ordenante
>          """
> @@ -234,8 +229,7 @@
>  
>          return None
>  
> -
> -    def _process_record_5995(self, cr, uid, st_data, line, context):
> +    def _process_record_5995(self, cr, uid, st_data, line, context=None):
>          """
>          5995 - Registro total general
>          """
> @@ -245,42 +239,59 @@
>          # Update the group
>          st_group['_num_records'] += 1
>          st_group.update({
> -                '_amount': round(st_group['_amount'], 2),
> -                'amount': float(line[88:98])/100,
> -                'num_records': int(line[114:124]),
> -                })
> +            '_amount': round(st_group['_amount'], 2),
> +            'amount': float(line[88:98]) / 100,
> +            'num_records': int(line[114:124]),
> +        })
>  
> -        #
>          # Checks
> -        #
>          if st_group['num_records'] != st_group['_num_records']:
> -            raise osv.except_osv(_('Error in C58 file'), _('Number of records does not agree with the defined in the last record.'))
> +            raise orm.except_orm(
> +                _('Error in C58 file'),
> +                _('Number of records does not agree with the defined in the '
> +                  'last record'))
>          if st_group['amount'] != st_group['_amount']:
> -            raise osv.except_osv(_('Error in C58 file'), _('Amount does not agree with the defined in the last record.'))
> +            raise orm.except_orm(
> +                _('Error in C58 file'),
> +                _('Amount does not agree with the defined in the last record'))
>  
>          return st_group
>  
> -
> -    def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, st_line_number, context=None):
> -        move_id = super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line_id, company_currency_id, st_line_number, context=context)
> -        line_ids = self.pool.get('account.move').read(cr, uid, move_id, ['line_id'])['line_id']
> -        st_line = self.pool.get('account.bank.statement.line').browse(cr, uid, st_line_id)
> -        self.pool.get('account.move.line').write(cr, uid, line_ids, {'ref': st_line.ref, 'date_maturity': st_line.due_date})
> +    def create_move_from_st_line(self, cr, uid, st_line_id,
> +                                 company_currency_id, st_line_number,
> +                                 context=None):
> +        move_id = super(AccountBankStatement,
> +                        self).create_move_from_st_line(
> +            cr, uid, st_line_id, company_currency_id, st_line_number,
> +            context=context)
> +        line_ids = self.pool['account.move'].read(
> +            cr, uid, move_id, ['line_id'])['line_id']
> +        st_line = self.pool['account.bank.statement.line'].browse(
> +            cr, uid, st_line_id, context=context)
> +        self.pool['account.move.line'].write(
> +            cr, uid, line_ids, {'ref': st_line.ref,
> +                                'date_maturity': st_line.due_date},
> +            context=context)
>          return move_id
>  
> -
>      def unpaid_followup_print(self, cr, uid, ids, context=None):
>          if context is None:
>              context = {}
>  
> -        line_obj = self.pool.get('account.bank.statement.line')
> -        line_ids = line_obj.search(cr, uid, [('statement_id', 'in', ids)])
> -        lines = line_obj.browse(cr, uid, line_ids)
> +        line_obj = self.pool['account.bank.statement.line']
> +        line_ids = line_obj.search(cr, uid, [('statement_id', 'in', ids)],
> +                                   context=context)
> +        lines = line_obj.browse(cr, uid, line_ids, context=context)
>          context['partner_ids'] = list(set([l.partner_id.id for l in lines]))
>  
> -        mod_obj = self.pool.get('ir.model.data')
> -        model_data_ids = mod_obj.search(cr, uid, [('model', '=', 'ir.ui.view'), ('name', '=', 'view_account_followup_print')], context=context)
> -        resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
> +        mod_obj = self.pool['ir.model.data']
> +        model_data_ids = mod_obj.search(
> +            cr, uid, [('model', '=', 'ir.ui.view'),
> +                      ('name', '=', 'view_account_followup_print')],
> +            context=context)
> +        resource_id = mod_obj.read(
> +            cr, uid, model_data_ids, fields=['res_id'],
> +            context=context)[0]['res_id']
>          return {
>              'name': _('Send followups'),
>              'view_type': 'form',
> @@ -290,19 +301,13 @@
>              'views': [(resource_id, 'form')],
>              'type': 'ir.actions.act_window',
>              'target': 'new',
> -            }
> -
> -account_bank_statement()
> -
> -
> -class account_bank_statement_line(osv.osv):
> +        }
> +
> +
> +class AccountBankStatementLine(orm.Model):
>      _inherit = 'account.bank.statement.line'
>  
>      _columns = {
>          'invoice_id': fields.many2one('account.invoice', 'Invoice'),
>          'due_date': fields.date('Due Date'),
> -        }
> -
> -account_bank_statement_line()
> -
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> +    }
> 
> === renamed file 'nayar_impagados/account_invoice.py' => 'nayar_impagados/models/account_invoice.py'
> --- nayar_impagados/account_invoice.py	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/models/account_invoice.py	2014-07-04 07:56:20 +0000
> @@ -19,13 +19,13 @@
>  #
>  ##############################################################################
>  
> -from osv import osv, fields
> -
> -class account_invoice(osv.osv):
> +from openerp.osv import orm, fields
> +
> +
> +class AccountInvoice(orm.Model):
>      _inherit = 'account.invoice'
>  
>      _columns = {
> -        'bank_statement_line_id': fields.many2one('account.bank.statement.line', 'Bank Statement Line'),
> -        }
> -
> -account_invoice()
> +        'bank_statement_line_id': fields.many2one('account.bank.statement.line',
> +                                                  'Bank Statement Line'),
> +    }
> 
> === renamed file 'nayar_impagados/account_move_line.py' => 'nayar_impagados/models/account_move_line.py'
> --- nayar_impagados/account_move_line.py	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/models/account_move_line.py	2014-07-04 07:56:20 +0000
> @@ -19,16 +19,17 @@
>  #
>  ##############################################################################
>  
> -from osv import osv
> -from tools.translate import _
> -
> -class account_move_line(osv.osv):
> +from openerp.osv import orm
> +from openerp.tools.translate import _
> +
> +
> +class AccountMoveLine(orm.Model):
>      _inherit = 'account.move.line'
>  
>      def get_writeoff(self, cr, uid, ids, context=None):
> -        cr.execute("SELECT SUM(debit - credit) " \
> -                       "FROM account_move_line " \
> -                       "WHERE id IN %s",
> +        cr.execute("SELECT SUM(debit - credit) "
> +                   "  FROM account_move_line "
> +                   " WHERE id IN %s",
>                     (tuple(ids),))
>          return cr.fetchall()[0][0]
>  
> @@ -37,7 +38,9 @@
>              context = {}
>  
>          if not ids:
> -            raise osv.except_osv("Error", "There are not unpaid account move lines to reconcile")
> +            raise orm.except_orm(
> +                _("Error"),
> +                _("There are not unpaid account move lines to reconcile"))
>  
>          c = context.copy()
>          c['active_ids'] = list(ids)
> @@ -46,53 +49,71 @@
>  
>          if self.get_writeoff(cr, uid, ids):
>              # Reconcile With Write-Off
> -            writeoff_obj = self.pool.get('account.move.line.reconcile.writeoff')
> -            property_obj = self.pool.get('ir.property')
> -            journal_id = property_obj.get(cr, uid, 'journal_id', writeoff_obj._name)
> -            writeoff_acc_id = property_obj.get(cr, uid, 'writeoff_acc_id', writeoff_obj._name)
> -            writeoff_id = writeoff_obj.create(cr, uid, {'journal_id': journal_id and journal_id.id or False,
> -                                                        'writeoff_acc_id': writeoff_acc_id and writeoff_acc_id.id or False,
> -                                                        'date_p': self.read(cr, uid, ids[0])['date'],
> -                                                        'comment': _('Unpaid Write-Off')})
> +            writeoff_obj = self.pool['account.move.line.reconcile.writeoff']
> +            property_obj = self.pool['ir.property']
> +
> +            journal_id = property_obj.get(cr, uid, 'journal_id',
> +                                          writeoff_obj._name)
> +            writeoff_acc_id = property_obj.get(
> +                cr, uid, 'writeoff_acc_id', writeoff_obj._name)
> +            writeoff_id = writeoff_obj.create(
> +                cr, uid, {'journal_id': journal_id and journal_id.id or False,
> +                          'writeoff_acc_id': (writeoff_acc_id and
> +                                              writeoff_acc_id.id or False),
> +                          'date_p': self.read(cr, uid, ids[0])['date'],
> +                          'comment': _('Unpaid Write-Off')})
>              writeoff_obj.trans_rec_reconcile(cr, uid, [writeoff_id], context=c)
>          else:
>              # Reconcile Full
> -            reconcile_obj = self.pool.get('account.move.line.reconcile')
> -            reconcile_obj.trans_rec_reconcile_full(cr, uid, list(ids), context=c)
> +            reconcile_obj = self.pool['account.move.line.reconcile']
> +            reconcile_obj.trans_rec_reconcile_full(cr, uid, list(ids),
> +                                                   context=c)
>  
>          # Reconcile invoice
> -        bank_line_obj = self.pool.get('account.bank.statement.line')
> -        reconcile_obj = self.pool.get('account.move.line.reconcile')
> -        invoice_obj = self.pool.get('account.invoice')
> -        for line in self.browse(cr, uid, ids):
> +        bank_line_obj = self.pool['account.bank.statement.line']
> +        reconcile_obj = self.pool['account.move.line.reconcile']
> +        invoice_obj = self.pool['account.invoice']
> +        for line in self.browse(cr, uid, ids, context=c):
>              if not line.partner_id:
>                  continue
>  
>              # Search tween move line at partner account
> -            partner_line_id = self.search(cr, uid, [('move_id', '=', line.move_id.id),
> -                                                    ('id', '!=', line.id)])[0]
> -            partner_line = self.browse(cr, uid, partner_line_id)
> +            partner_line_id = self.search(cr, uid,
> +                                          [('move_id', '=', line.move_id.id),
> +                                           ('id', '!=', line.id)],
> +                                          context=c)[0]
> +            partner_line = self.browse(cr, uid, partner_line_id, context=c)
>  
>              # Search bank statement line and obtain invoice and reconcile object
> -            bank_line_id = bank_line_obj.search(cr, uid, [('move_ids', '=', partner_line.move_id.id)])[0]
> +            bank_line_id = bank_line_obj.search(
> +                cr, uid, [('move_ids', '=', partner_line.move_id.id)],
> +                context=c)[0]
>              bank_line = bank_line_obj.browse(cr, uid, bank_line_id)
> -            reconcile_id = self.search(cr, uid, [('move_id', '=', bank_line.invoice_id.move_id.id),
> -                                                 '|', ('reconcile_id', '!=', False),
> -                                                      ('reconcile_partial_id', '!=', False)])[0]
> -            reconcile = self.browse(cr, uid, reconcile_id)
> -            reconcile = reconcile.reconcile_id or reconcile.reconcile_partial_id
> -            reconcile_line_ids = [l.id for l in reconcile.line_id + reconcile.line_partial_ids]
> +            reconcile_id = self.search(
> +                cr, uid, [('move_id', '=', bank_line.invoice_id.move_id.id),
> +                          '|', ('reconcile_id', '!=', False),
> +                          ('reconcile_partial_id', '!=', False)],
> +                context=c)[0]
> +            reconcile = self.browse(cr, uid, reconcile_id, context=c)
> +            reconcile = (reconcile.reconcile_id or
> +                         reconcile.reconcile_partial_id)
> +            reconcile_line_ids = [l.id for l in (reconcile.line_id +
> +                                                 reconcile.line_partial_ids)]
>  
>              # Unreconcile move lines
>              self._remove_move_reconcile(cr, uid, reconcile_line_ids)
>  
>              # Search return costs invoice
> -            return_costs_invoice_id = invoice_obj.search(cr, uid, [('bank_statement_line_id', '=', bank_line_id)])
> +            return_costs_invoice_id = invoice_obj.search(
> +                cr, uid, [('bank_statement_line_id', '=', bank_line_id)],
> +                context=c)
>              if return_costs_invoice_id:
> -                return_costs_move_line_ids = self.search(cr, uid, [('invoice', '=', return_costs_invoice_id[0]),
> -                                                                   ('account_id', '=', partner_line.account_id.id),
> -                                                                   ('reconcile_id', '=', False),
> -                                                                   ('reconcile_partial_id', '=', False)])
> +                return_costs_move_line_ids = self.search(
> +                    cr, uid, [('invoice', '=', return_costs_invoice_id[0]),
> +                              ('account_id', '=', partner_line.account_id.id),
> +                              ('reconcile_id', '=', False),
> +                              ('reconcile_partial_id', '=', False)],
> +                    context=c)
>                  if return_costs_move_line_ids:
>                      reconcile_line_ids += return_costs_move_line_ids
>  
> @@ -103,6 +124,5 @@
>              c['active_ids'] = reconcile_line_ids
>              c['active_id'] = reconcile_line_ids[0]
>              c['active_model'] = 'account.move.line'
> -            reconcile_obj.trans_rec_reconcile_partial_reconcile(cr, uid, reconcile_id, context=c)
> -
> -account_move_line()
> +            reconcile_obj.trans_rec_reconcile_partial_reconcile(
> +                cr, uid, reconcile_id, context=c)
> 
> === renamed file 'nayar_impagados/partner.py' => 'nayar_impagados/models/partner.py'
> --- nayar_impagados/partner.py	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/models/partner.py	2014-07-04 07:56:20 +0000
> @@ -19,17 +19,17 @@
>  #
>  ##############################################################################
>  
> -from osv import osv, fields
> -
> -class res_partner(osv.osv):
> +from openerp.osv import orm, fields
> +
> +
> +class ResPartner(orm.Model):
>      _inherit = 'res.partner'
>  
>      _columns = {
> -        'receive_followups_for_customers': fields.boolean('Receive followups for customers'),
> -        }
> +        'receive_followups_for_customers': fields.boolean(
> +            'Receive followups for customers'),
> +    }
>  
>      _default = {
>          'receive_followups_for_customers': False,
> -        }
> -
> -res_partner()
> +    }
> 
> === added directory 'nayar_impagados/views'
> === renamed file 'nayar_impagados/account_bank_statement_view.xml' => 'nayar_impagados/views/account_bank_statement_view.xml'
> --- nayar_impagados/account_bank_statement_view.xml	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/views/account_bank_statement_view.xml	2014-07-04 07:56:20 +0000
> @@ -1,16 +1,18 @@
>  <?xml version="1.0" encoding="utf-8"?>
>  <openerp>
> -  <data>
> -    <record id="view_bank_statement_form" model="ir.ui.view">
> -      <field name="name">account.bank.statement.form</field>
> -      <field name="model">account.bank.statement</field>
> -      <field name="inherit_id" ref="account.view_bank_statement_form" />
> -      <field name="type">form</field>
> -      <field name="arch" type="xml">
> -	<button name="button_confirm_bank" position="before">
> -	  <button name="%(action_make_return_costs_invoices_wizard)d" string="Return Costs Invoices" type="action" icon="gtk-ok"/>
> -	</button>
> -      </field>
> -    </record>
> -  </data>
> +    <data>
> +        <record id="view_bank_statement_form" model="ir.ui.view">
> +            <field name="name">account.bank.statement.form</field>
> +            <field name="model">account.bank.statement</field>
> +            <field name="inherit_id" ref="account.view_bank_statement_form" />
> +            <field name="arch" type="xml">
> +                <button name="button_confirm_bank" position="before">
> +                    <button
> +                        name="%(action_make_return_costs_invoices_wizard)d"
> +                        string="Return Costs Invoices" type="action"
> +                        icon="gtk-ok" />
> +                </button>
> +            </field>
> +        </record>
> +    </data>
>  </openerp>
> 
> === renamed file 'nayar_impagados/partner_view.xml' => 'nayar_impagados/views/partner_view.xml'
> --- nayar_impagados/partner_view.xml	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/views/partner_view.xml	2014-07-04 07:56:20 +0000
> @@ -1,15 +1,17 @@
>  <?xml version="1.0" encoding="utf-8"?>
>  <openerp>
> -  <data>
> -    <record id="view_partner_additional_info_form" model="ir.ui.view">
> -      <field name="name">res.partner.additional.info.form</field>
> -      <field name="model">res.partner</field>
> -      <field name="inherit_id" ref="dos_partner_additional_info.view_partner_additional_info_form"/>
> -      <field name="arch" type="xml">
> -	<field name="tipo_cliente" position="after">
> -	  <field name="receive_followups_for_customers" colspan="4"/>
> -	</field>
> -      </field>
> -    </record>
> -  </data>
> +    <data>
> +        <record id="view_partner_additional_info_form" model="ir.ui.view">
> +            <field name="name">res.partner.additional.info.form</field>
> +            <field name="model">res.partner</field>
> +            <field name="inherit_id"
> +                ref="dos_partner_additional_info.view_partner_additional_info_form" />
> +            <field name="arch" type="xml">
> +                <field name="tipo_cliente" position="after">
> +                    <field name="receive_followups_for_customers"
> +                        colspan="4" />
> +                </field>
> +            </field>
> +        </record>
> +    </data>
>  </openerp>
> 
> === modified file 'nayar_impagados/wizard/import_c58_file.py'
> --- nayar_impagados/wizard/import_c58_file.py	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/wizard/import_c58_file.py	2014-07-04 07:56:20 +0000
> @@ -19,19 +19,16 @@
>  #
>  ##############################################################################
>  
> -from osv import osv
> -
> -class import_c58_wizard(osv.osv_memory):
> +from openerp.osv import orm
> +
> +
> +class ImportC58Wizard(orm.TransientModel):
>      _name = "l10n.es.bank.statement.unpaid.import.c58.wizard"
>      _inherit = "l10n.es.bank.statement.import.c43.wizard"
>  
>      def import_action(self, cr, uid, ids, context=None):
> -        st_obj = self.pool.get('account.bank.statement')
> +        st_obj = self.pool['account.bank.statement']
>          file_contents = self.browse(cr, uid, ids)[0].file
> -        st_obj.import_c58_file(cr, uid, context['active_id'], file_contents, context=context)
> +        st_obj.import_c58_file(cr, uid, context['active_id'], file_contents,
> +                               context=context)
>          return {'type': 'ir.actions.act_window_close'}
> -
> -
> -import_c58_wizard()
> -
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> 
> === modified file 'nayar_impagados/wizard/import_c58_file_view.xml'
> --- nayar_impagados/wizard/import_c58_file_view.xml	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/wizard/import_c58_file_view.xml	2014-07-04 07:56:20 +0000
> @@ -1,47 +1,54 @@
>  <?xml version="1.0" encoding="utf-8"?>
>  <openerp>
> -  <data>
> -
> -    <!-- Import C58 file wizard -->
> -    <record model="ir.ui.view" id="c58_file_import_wizard">
> -      <field name="name">l10n.es.bank.statement.unpaid.c58.import.form</field>
> -      <field name="model">l10n.es.bank.statement.unpaid.import.c58.wizard</field>
> -      <field name="type">form</field>
> -      <field name="arch" type="xml">
> -	<form string="Bank statements import according to norm C58">
> -	  <group colspan="4">
> -	    <label string="Bank Statements File:"/>
> -	    <newline/>
> -	    <field name="file_name" nolabel="1"/>
> -	    <field name="file" filename="file_name" nolabel="1"/>
> -	  </group>
> -	  <group colspan="4" col="1">
> -	    <separator string="Automatic reconciliation options"/>
> -	    <field name="reco_reference_and_amount"/>
> -	    <field name="reco_vat_and_amount"/>
> -	    <field name="reco_amount"/>
> -	    <field name="reco_payment_order"/>
> -	    <field name="reco_rules"/>
> -	    <field name="reco_max_days"/>
> -	  </group>
> -	  <button icon="gtk-cancel" special="cancel" string="Cancel" type="object"/>
> -	  <button icon="gtk-ok" name="import_action" string="Import" type="object"/>
> -	</form>
> -      </field>
> -    </record>
> -
> -    <record id="action_c58_file_import_wizard" model="ir.actions.act_window">
> -      <field name="name">Import C58 Files Wizard</field>
> -      <field name="type">ir.actions.act_window</field>
> -      <field name="res_model">l10n.es.bank.statement.unpaid.import.c58.wizard</field>
> -      <field name="view_type">form</field>
> -      <field name="view_mode">form</field>
> -      <field name="target">new</field>
> -    </record>
> -
> -    <act_window id="action_c58_file_import_wizard"
> -                key2="client_action_multi" name="Import Unpaid Bank Statement"
> -                res_model="l10n.es.bank.statement.unpaid.import.c58.wizard" src_model="account.bank.statement"
> -                view_mode="form" target="new" view_type="form" groups="account.group_account_manager"/>
> -  </data>
> +    <data>
> +
> +        <!-- Import C58 file wizard -->
> +        <record model="ir.ui.view" id="c58_file_import_wizard">
> +            <field name="name">l10n.es.bank.statement.unpaid.c58.import.form
> +            </field>
> +            <field name="model">l10n.es.bank.statement.unpaid.import.c58.wizard
> +            </field>
> +            <field name="arch" type="xml">
> +                <form string="Bank statements import according to norm C58">

version="7.0"

> +                    <group colspan="4">
> +                        <label string="Bank Statements File:" />
> +                        <newline />
> +                        <field name="file_name" nolabel="1" />
> +                        <field name="file" filename="file_name"
> +                            nolabel="1" />
> +                    </group>
> +                    <group colspan="4" col="1">
> +                        <separator string="Automatic reconciliation options" />
> +                        <field name="reco_reference_and_amount" />
> +                        <field name="reco_vat_and_amount" />
> +                        <field name="reco_amount" />
> +                        <field name="reco_payment_order" />
> +                        <field name="reco_rules" />
> +                        <field name="reco_max_days" />
> +                    </group>
> +                    <footer>
> +                        <button icon="gtk-ok" name="import_action"
> +                            string="Import" type="object" />

Poner un 'o' entre medias

> +                        <button class="oe_link" icon="gtk-cancel" special="cancel"
> +                            string="Cancel" type="object" />
> +                    </footer>
> +                </form>
> +            </field>
> +        </record>
> +
> +        <record id="action_c58_file_import_wizard" model="ir.actions.act_window">
> +            <field name="name">Import C58 Files Wizard</field>
> +            <field name="type">ir.actions.act_window</field>
> +            <field name="res_model">l10n.es.bank.statement.unpaid.import.c58.wizard
> +            </field>
> +            <field name="view_type">form</field>
> +            <field name="view_mode">form</field>
> +            <field name="target">new</field>
> +        </record>
> +
> +        <act_window id="action_c58_file_import_wizard" key2="client_action_multi"
> +            name="Import Unpaid Bank Statement" res_model="l10n.es.bank.statement.unpaid.import.c58.wizard"
> +            src_model="account.bank.statement" view_mode="form" target="new"
> +            view_type="form" groups="account.group_account_manager" />
> +    </data>
>  </openerp>
> 
> === modified file 'nayar_impagados/wizard/make_return_costs_invoices.py'
> --- nayar_impagados/wizard/make_return_costs_invoices.py	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/wizard/make_return_costs_invoices.py	2014-07-04 07:56:20 +0000
> @@ -19,35 +19,44 @@
>  #
>  ##############################################################################
>  
> -from osv import osv, fields
> -from tools.translate import _
> -
> -class make_return_costs_invoices_wizard(osv.osv_memory):
> +from openerp.osv import orm, fields
> +from openerp.tools.translate import _
> +
> +
> +class MakeReturnCostsInvoicesWizard(orm.TransientModel):
>      _name = 'l10n.es.bank.statement.return.costs.invoices.wizard'
>  
>      def _get_unpaid_lines(self, cr, uid, context=None):
> -        line_obj = self.pool.get('account.bank.statement.line')
> -        line_ids = line_obj.search(cr, uid, [('statement_id', '=', context['active_id']), ('amount', '<', 0)])
> +        line_obj = self.pool['account.bank.statement.line']
> +        line_ids = line_obj.search(
> +            cr, uid, [('statement_id', '=', context['active_id']),
> +                      ('amount', '<', 0)], context=context)
>          return line_ids
>  
>      _columns = {
> -        'unpaid_lines': fields.many2many('account.bank.statement.line', 'unpaid_lines', 'wizard_id', 'line_id', 'Unpaid Lines'),
> +        'unpaid_lines': fields.many2many('account.bank.statement.line',
> +                                         'unpaid_lines', 'wizard_id',
> +                                         'line_id', 'Unpaid Lines'),
>          'return_costs': fields.float('Return Costs Percentage'),
> -        }
> +    }
>  
>      _defaults = {
>          'unpaid_lines': _get_unpaid_lines,
>          'return_costs': 6.0,
> -        }
> +    }
>  
>      def make_invoices(self, cr, uid, ids, context=None):
> -        data = self.browse(cr, uid, ids)[0]
> -        line_obj = self.pool.get('account.bank.statement.line')
> -        invoice_obj = self.pool.get('account.invoice')
> -        invoice_line_obj = self.pool.get('account.invoice.line')
> -
> -        costs_product_id = self.pool.get('product.product').search(cr, uid, [('default_code', '=', 'GDEVBNK')], context=context)[0]
> -        tax_id = self.pool.get('account.tax').search(cr, uid, [('name', 'like', 'IVA 0% Exp')], context=context)[0]
> +        data = self.browse(cr, uid, ids, context=context)[0]
> +
> +        invoice_obj = self.pool['account.invoice']
> +        invoice_line_obj = self.pool['account.invoice.line']
> +        product_obj = self.pool['product.product']
> +        tax_obj = self.pool['account.tax']
> +
> +        costs_product_id = product_obj.search(
> +            cr, uid, [('default_code', '=', 'GDEVBNK')], context=context)[0]
> +        tax_id = tax_obj.search(cr, uid, [('name', 'like', 'IVA 0% Exp')],
> +                                context=context)[0]
>  
>          for line in data.unpaid_lines:
>              if line.invoice_id:
> @@ -58,26 +67,32 @@
>                      'name': _("Return Costs Inv. %s") % line.invoice_id.number,
>                      'origin': line.statement_id.name,
>                      'bank_statement_line_id': line.id,
> -                    }
> -                new_invoice.update(invoice_obj.onchange_partner_id(cr, uid, [], new_invoice['type'], new_invoice['partner_id'])['value'])
> +                }
> +                new_invoice.update(
> +                    invoice_obj.onchange_partner_id(
> +                        cr, uid, [], new_invoice['type'],
> +                        new_invoice['partner_id'])['value'])
>                  new_invoice['contract_id'] = line.invoice_id.contract_id.id
> -                new_invoice.update(invoice_obj.onchange_contract_id(cr, uid, [], new_invoice['contract_id'])['value'])
> -                new_invoice.update({'payment_term': 2,})
> -                invoice_id = invoice_obj.create(cr, uid, new_invoice)
> +                new_invoice.update(
> +                    invoice_obj.onchange_contract_id(
> +                        cr, uid, [], new_invoice['contract_id'])['value'])
> +                new_invoice.update({'payment_term': 2})
> +                invoice_id = invoice_obj.create(cr, uid, new_invoice,
> +                                                context=context)
>  
>                  new_line = {
>                      'invoice_id': invoice_id,
>                      'product_id': costs_product_id,
>                      'quantity': 1,
> -                    }
> -                new_line.update(invoice_line_obj.product_id_change(cr, uid, [], new_line['product_id'], False, partner_id=new_invoice['partner_id'])['value'])
> -                new_line['price_unit'] = round(line.amount * data.return_costs / 100, 2) * -1
> -                new_line['invoice_line_tax_id'] = [(6, 0, [tax_id])]  # IVA Exento
> -                invoice_line_obj.create(cr, uid, new_line)
> +                }
> +                new_line.update(
> +                    invoice_line_obj.product_id_change(
> +                        cr, uid, [], new_line['product_id'], False,
> +                        partner_id=new_invoice['partner_id'])['value'])
> +                new_line['price_unit'] = round(line.amount *
> +                                               data.return_costs / 100, 2) * -1
> +                # IVA Exento
> +                new_line['invoice_line_tax_id'] = [(6, 0, [tax_id])]
> +                invoice_line_obj.create(cr, uid, new_line, context=context)
>  
>          return {'type': 'ir.actions.act_window_close'}
> -
> -
> -make_return_costs_invoices_wizard()
> -
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> 
> === modified file 'nayar_impagados/wizard/make_return_costs_invoices_view.xml'
> --- nayar_impagados/wizard/make_return_costs_invoices_view.xml	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/wizard/make_return_costs_invoices_view.xml	2014-07-04 07:56:20 +0000
> @@ -1,47 +1,53 @@
>  <?xml version="1.0" encoding="utf-8"?>
>  <openerp>
> -  <data>
> -    <record model="ir.ui.view" id="bank_statement_return_costs_invoices_wizard">
> -      <field name="name">l10n.es.bank.statement.return.costs.invoices.form</field>
> -      <field name="model">l10n.es.bank.statement.return.costs.invoices.wizard</field>
> -      <field name="type">form</field>
> -      <field name="arch" type="xml">
> -	<form string="Return Costs Invoices">
> -	  <field name="unpaid_lines" nolabel="1" colspan="4">
> -	    <tree string="Statement Lines">
> -	      <field name="name"/>
> -	      <field name="ref"/>
> -	      <field name="partner_id"/>
> -	      <field name="amount"/>
> -	    </tree>
> -	  </field>
> -	  <group colspan="4" col="4">
> -	    <separator string="Bank Conditions" colspan="4" col="4"/>
> -	    <field name="return_costs"/>
> -	    <separator colspan="4" col="4"/>
> -	  </group>
> -	  <button icon="gtk-cancel" special="cancel" string="Cancel"/>
> -	  <button icon="gtk-ok" name="make_invoices" string="Make invoices" type="object"/>
> -	</form>
> -      </field>
> -    </record>
> -
> -    <record id="action_make_return_costs_invoices_wizard" model="ir.actions.act_window">
> -      <field name="name">Return Costs Invoices</field>
> -      <field name="type">ir.actions.act_window</field>
> -      <field name="res_model">l10n.es.bank.statement.return.costs.invoices.wizard</field>
> -      <field name="view_type">form</field>
> -      <field name="view_mode">form</field>
> -      <field name="target">new</field>
> -    </record>
> -
> -    <act_window id="action_make_return_costs_invoices_wizard"
> -		name="Return Costs Invoices"
> -		res_model="l10n.es.bank.statement.return.costs.invoices.wizard"
> -		src_model="account.bank.statement"
> -		view_mode="form"
> -		target="new"
> -		view_type="form"
> -		groups="account.group_account_manager" />
> -  </data>
> +    <data>
> +        <record model="ir.ui.view"
> +            id="bank_statement_return_costs_invoices_wizard">
> +            <field name="name">l10n.es.bank.statement.return.costs.invoices.form
> +            </field>
> +            <field name="model">l10n.es.bank.statement.return.costs.invoices.wizard
> +            </field>
> +            <field name="arch" type="xml">
> +                <form string="Return Costs Invoices">
> +                    <field name="unpaid_lines" nolabel="1"
> +                        colspan="4">
> +                        <tree string="Statement Lines">
> +                            <field name="name" />
> +                            <field name="ref" />
> +                            <field name="partner_id" />
> +                            <field name="amount" />
> +                        </tree>
> +                    </field>
> +                    <group colspan="4" col="4">
> +                        <separator string="Bank Conditions"
> +                            colspan="4" col="4" />
> +                        <field name="return_costs" />
> +                        <separator colspan="4" col="4" />
> +                    </group>
> +                    <footer>
> +                        <button icon="gtk-ok" name="make_invoices"
> +                            string="Make invoices" type="object" />
> +                        <button class="oe_link" icon="gtk-cancel"
> +                            special="cancel" string="Cancel" />
> +                    </footer>
> +                </form>
> +            </field>
> +        </record>
> +
> +        <record id="action_make_return_costs_invoices_wizard"
> +            model="ir.actions.act_window">
> +            <field name="name">Return Costs Invoices</field>
> +            <field name="type">ir.actions.act_window</field>
> +            <field name="res_model">l10n.es.bank.statement.return.costs.invoices.wizard
> +            </field>
> +            <field name="view_type">form</field>
> +            <field name="view_mode">form</field>
> +            <field name="target">new</field>
> +        </record>
> +
> +        <act_window id="action_make_return_costs_invoices_wizard"
> +            name="Return Costs Invoices" res_model="l10n.es.bank.statement.return.costs.invoices.wizard"
> +            src_model="account.bank.statement" view_mode="form" target="new"
> +            view_type="form" groups="account.group_account_manager" />
> +    </data>
>  </openerp>
> 
> === modified file 'nayar_impagados/wizard/reconcile_unpaid_account_moves.py'
> --- nayar_impagados/wizard/reconcile_unpaid_account_moves.py	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/wizard/reconcile_unpaid_account_moves.py	2014-07-04 07:56:20 +0000
> @@ -19,14 +19,18 @@
>  #
>  ##############################################################################
>  
> -from osv import osv, fields
> -
> -class reconcile_unpaid_account_moves_wizard(osv.osv_memory):
> +from openerp.osv import orm, fields
> +from openerp.tools.translate import _
> +
> +
> +class ReconcileUnpaidAccountMovesWizard(orm.TransientModel):
>      _name = 'l10n.es.reconcile.unpaid.account.moves.wizard'
>  
>      def _get_account_id(self, cr, uid, context=None):
> -        property_obj = self.pool.get('ir.property')
> -        account_id = property_obj.get(cr, uid, "account_id", "l10n.es.reconcile.unpaid.account.moves.wizard")
> +        property_obj = self.pool['ir.property']
> +        account_id = property_obj.get(
> +            cr, uid, "account_id",
> +            "l10n.es.reconcile.unpaid.account.moves.wizard")
>          if account_id:
>              return [account_id.id]
>          else:
> @@ -40,21 +44,26 @@
>          return line_ids
>  
>      _columns = {
> -        'unpaid_account_lines': fields.many2many('account.move.line', 'unpaid_account_lines', 'wizard_id', 'line_id', 'Unpaid Account Lines'),
> +        'unpaid_account_lines': fields.many2many('account.move.line',
> +                                                 'unpaid_account_lines',
> +                                                 'wizard_id', 'line_id',
> +                                                 'Unpaid Account Lines'),
>          'account_id': fields.many2one('account.account', 'Unpaid Account'),
> -        }
> +    }
>  
>      _defaults = {
>          'unpaid_account_lines': _get_unpaid_lines,
> -        }
> +    }
>  
>      def reconcile_unpaid_moves(self, cr, uid, ids, context=None):
> -        data = self.browse(cr, uid, ids)[0]
> +        data = self.browse(cr, uid, ids, context=context)[0]
>  
>          if not data.unpaid_account_lines:
> -            raise osv.except_osv("Error", "There are not unpaid account move lines to reconcile")
> +            raise orm.except_orm(
> +                _("Error"),
> +                _("There are not unpaid account move lines to reconcile"))
>  
> -        line_obj = self.pool.get('account.move.line')
> +        line_obj = self.pool['account.move.line']
>          groups = {}
>          for line in data.unpaid_account_lines:
>              if line.date in groups:
> @@ -70,7 +79,3 @@
>                  'view_type': 'form',
>                  'view_mode': 'form',
>                  'target': 'new'}
> -
> -reconcile_unpaid_account_moves_wizard()
> -
> -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
> 
> === modified file 'nayar_impagados/wizard/reconcile_unpaid_account_moves_view.xml'
> --- nayar_impagados/wizard/reconcile_unpaid_account_moves_view.xml	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/wizard/reconcile_unpaid_account_moves_view.xml	2014-07-04 07:56:20 +0000
> @@ -1,40 +1,50 @@
>  <?xml version="1.0" encoding="utf-8"?>
>  <openerp>
> -  <data>
> -    <record model="ir.ui.view" id="reconcile_unpaid_account_moves_wizard">
> -      <field name="name">l10n.es.reconcile.unpaid.account.moves.form</field>
> -      <field name="model">l10n.es.reconcile.unpaid.account.moves.wizard</field>
> -      <field name="type">form</field>
> -      <field name="arch" type="xml">
> -	<form string="Reconcile Unpaid Account Moves">
> -	  <field name="unpaid_account_lines" nolabel="1" colspan="4">
> -	    <tree string="Unpaid Lines">
> -	      <field name="date" />
> -	      <field name="period_id" />
> -	      <field name="move_id" />
> -	      <field name="name" />
> -	      <field name="partner_id" />
> -	      <field name="debit" sum="Debit" />
> -	      <field name="credit" sum="Credit" />
> -	      <field name="ref" />
> -	    </tree>
> -	  </field>
> -	  <button icon="gtk-cancel" special="cancel" string="Cancel" />
> -	  <button icon="gtk-ok" name="reconcile_unpaid_moves" string="Reconcile" type="object" />
> -	</form>
> -      </field>
> -    </record>
> -
> -    <record id="action_reconcile_unpaid_account_moves_wizard" model="ir.actions.act_window">
> -      <field name="name">Reconcile Unpaid Account Moves</field>
> -      <field name="type">ir.actions.act_window</field>
> -      <field name="res_model">l10n.es.reconcile.unpaid.account.moves.wizard</field>
> -      <field name="view_type">form</field>
> -      <field name="view_mode">form</field>
> -      <field name="target">new</field>
> -    </record>
> -
> -    <menuitem name="Reconcile Unpaid Account Moves" id="menu_reconcile_unpaid_account_moves" parent="account.menu_finance_bank_and_cash" action="action_reconcile_unpaid_account_moves_wizard" sequence="20"/>
> -
> -  </data>
> +    <data>
> +        <record model="ir.ui.view" id="reconcile_unpaid_account_moves_wizard">
> +            <field name="name">l10n.es.reconcile.unpaid.account.moves.form
> +            </field>
> +            <field name="model">l10n.es.reconcile.unpaid.account.moves.wizard
> +            </field>
> +            <field name="arch" type="xml">
> +                <form string="Reconcile Unpaid Account Moves">
> +                    <field name="unpaid_account_lines" nolabel="1"
> +                        colspan="4">
> +                        <tree string="Unpaid Lines">
> +                            <field name="date" />
> +                            <field name="period_id" />
> +                            <field name="move_id" />
> +                            <field name="name" />
> +                            <field name="partner_id" />
> +                            <field name="debit" sum="Debit" />
> +                            <field name="credit" sum="Credit" />
> +                            <field name="ref" />
> +                        </tree>
> +                    </field>
> +                    <footer>
> +                        <button icon="gtk-ok" name="reconcile_unpaid_moves"
> +                            string="Reconcile" type="object" />
> +                        <button class="oe_link" icon="gtk-cancel"
> +                            special="cancel" string="Cancel" />
> +                    </footer>
> +                </form>
> +            </field>
> +        </record>
> +
> +        <record id="action_reconcile_unpaid_account_moves_wizard"
> +            model="ir.actions.act_window">
> +            <field name="name">Reconcile Unpaid Account Moves</field>
> +            <field name="type">ir.actions.act_window</field>
> +            <field name="res_model">l10n.es.reconcile.unpaid.account.moves.wizard
> +            </field>
> +            <field name="view_type">form</field>
> +            <field name="view_mode">form</field>
> +            <field name="target">new</field>
> +        </record>
> +
> +        <menuitem name="Reconcile Unpaid Account Moves" id="menu_reconcile_unpaid_account_moves"
> +            parent="account.menu_finance_bank_and_cash" action="action_reconcile_unpaid_account_moves_wizard"
> +            sequence="20" />
> +
> +    </data>
>  </openerp>
> 
> === modified file 'nayar_impagados/wizard/unpaid_followup_print_view.xml'
> --- nayar_impagados/wizard/unpaid_followup_print_view.xml	2014-06-11 10:23:47 +0000
> +++ nayar_impagados/wizard/unpaid_followup_print_view.xml	2014-07-04 07:56:20 +0000
> @@ -1,20 +1,22 @@
>  <?xml version="1.0" encoding="utf-8"?>
>  <openerp>
> -  <data>
> -    <record id="action_unpaid_followup_print" model="ir.actions.server">
> -      <field name="name">Send followups</field>
> -      <field name="type">ir.actions.server</field>
> -      <field name="model_id" ref="model_account_bank_statement"/>
> -      <field name="state">code</field>
> -      <field name="code">action = obj.unpaid_followup_print(context=context)</field>
> -    </record>
> +    <data>
> +        <record id="action_unpaid_followup_print" model="ir.actions.server">
> +            <field name="name">Send followups</field>
> +            <field name="type">ir.actions.server</field>
> +            <field name="model_id" ref="model_account_bank_statement" />
> +            <field name="state">code</field>
> +            <field name="code">action =
> +                obj.unpaid_followup_print(context=context)</field>
> +        </record>
>  
> -    <record id="ir_unpaid_followup_print" model="ir.values">
> -      <field name="name">Send followups</field>
> -      <field name="model">account.bank.statement</field>
> -      <field name="key2">client_action_multi</field>
> -      <field name="value" eval="'ir.actions.server,%d'%action_unpaid_followup_print"/>
> -      <field name="object">True</field>
> -    </record>
> -  </data>
> +        <record id="ir_unpaid_followup_print" model="ir.values">
> +            <field name="name">Send followups</field>
> +            <field name="model">account.bank.statement</field>
> +            <field name="key2">client_action_multi</field>
> +            <field name="value"
> +                eval="'ir.actions.server,%d'%action_unpaid_followup_print" />
> +            <field name="object">True</field>
> +        </record>
> +    </data>
>  </openerp>
> 


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


References