Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Arreglados errores de los tests. #27

Merged
merged 2 commits into from
Jul 22, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions l10n_es_account_invoice_sequence/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2011 NaN Projectes de Programari Lliure, S.L. All Rights Reserved.
# http://www.NaN-tic.com
# Copyright (c) 2013 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
#
# 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
# 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,
Expand All @@ -21,7 +16,4 @@
#
##############################################################################

import account_invoice
import account_journal

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
from . import models
28 changes: 13 additions & 15 deletions l10n_es_account_invoice_sequence/__openerp__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2011 NaN Projectes de Programari Lliure, S.L. All Rights Reserved.
# Copyright (c) 2011 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
# Copyright (c) 2013 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
#
# 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
# 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,
Expand All @@ -22,12 +22,12 @@
##############################################################################

{
"name" : "Secuencia para facturas separada de la secuencia de asientos",
"version" : "1.1",
"author" : "Localización española de OpenERP",
"website" : "https://github.com/OCA/l10n-spain",
"category" : "Accounting",
"license" : "AGPL-3",
"name": "Secuencia para facturas separada de la secuencia de asientos",
"version": "1.1",
"author": "Localización española de OpenERP",
"website": "https://github.com/OCA/l10n-spain",
"category": "Accounting",
"license": "AGPL-3",
"description": """
Este módulo separa los números de las facturas de los de los asientos. Para
ello, convierte el campo number de 'related' a campo de texto normal, y le
Expand All @@ -42,15 +42,13 @@
diarios de ventas, compras, abono de ventas y abono de compras utilizados
después de instalar este módulo.
""",
"depends" : [
"depends": [
'account',
],
"data" : [
'account_view.xml',
"data": [
'views/account_view.xml',
],
"demo" : [],
"demo": [],
"active": False,
"installable": True,
}

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
20 changes: 20 additions & 0 deletions l10n_es_account_invoice_sequence/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# 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_invoice
from . import account_journal
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2011 NaN Projectes de Programari Lliure, S.L. All Rights Reserved.
# Copyright (c) 2011 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
# Copyright (c) 2013 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
# Copyright (c) 2014 Domatix (http://www.domatix.com)
# Angel Moya <angel.moya@domatix.com>
#
# 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
# 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,
Expand All @@ -25,20 +25,21 @@
from openerp import models, fields, api, _
from openerp.exceptions import except_orm


class AccountInvoice(models.Model):
_inherit = 'account.invoice'

def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
default.update({'invoice_number' : False})
default.update({'number' : False})
default['invoice_number'] = False
default['number'] = False
return super(AccountInvoice, self).copy(cr, uid, id, default,
context=context)
context=context)
number = fields.Char('Invoice Number', size=32, readonly=True,
help="Unique number of the invoice, computed automatically "
"when the invoice is created.")
help="Unique number of the invoice, computed "
"automatically when the invoice is created.")

@api.multi
def action_number(self):
sequence_obj = self.pool['ir.sequence']
Expand All @@ -47,13 +48,13 @@ def action_number(self):
sequence = inv.journal_id.invoice_sequence_id
if not sequence:
raise except_orm(_('Error!'),
_('Journal %s has no sequence defined for invoices.')
%inv.journal_id.name)
_('Journal %s has no sequence defined for '
'invoices.') % inv.journal_id.name)
ctx = self.env.context.copy()
ctx['fiscalyear_id'] = period_obj.browse(self.env.cr, self.env.uid,
inv.period_id.id).fiscalyear_id.id
number = sequence_obj.next_by_id(self.env.cr, self.env.uid, sequence.id, ctx)
period = period_obj.browse(self.env.cr, self.env.uid,
inv.period_id.id)
ctx['fiscalyear_id'] = period.fiscalyear_id.id
number = sequence_obj.next_by_id(self.env.cr, self.env.uid,
sequence.id, ctx)
inv.write({'number': number})
return super(AccountInvoice, self).action_number()

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2011 NaN Projectes de Programari Lliure, S.L. All Rights Reserved.
# Copyright (c) 2011 NaN Projectes de Programari Lliure, S.L.
# http://www.NaN-tic.com
# Copyright (c) 2013 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
#
# 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
# 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,
Expand All @@ -22,15 +22,17 @@
##############################################################################
from openerp.osv import orm, fields


class account_journal(orm.Model):
_inherit = 'account.journal'

_columns = {
'invoice_sequence_id': fields.many2one('ir.sequence',
'Invoice sequence',
domain="[('company_id','=',company_id)]",
help="The sequence used for invoice numbers in this journal.",
ondelete='restrict'),
'invoice_sequence_id': fields.many2one(
'ir.sequence',
'Invoice sequence',
domain="[('company_id','=',company_id)]",
help="The sequence used for invoice numbers in this journal.",
ondelete='restrict'),
}

def _check_company(self, cr, uid, ids):
Expand All @@ -43,8 +45,6 @@ def _check_company(self, cr, uid, ids):

_constraints = [
(_check_company,
'Journal company and invoice sequence company do not match.',
['company_id','invoice_sequence_id'])
'Journal company and invoice sequence company do not match.',
['company_id', 'invoice_sequence_id'])
]

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4 changes: 2 additions & 2 deletions l10n_es_partner/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
"l10n_es_toponyms",
],
"data": [
"l10n_es_partner_view.xml",
"wizard/l10n_es_partner_wizard.xml"
"views/l10n_es_partner_view.xml",
"wizard/l10n_es_partner_wizard.xml",
],
"installable": True,
}
5 changes: 2 additions & 3 deletions l10n_es_partner_mercantil/models/partner_es.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2009 Spanish Localization Team
# $Id$
# Copyright (c) 2009-2014 Spanish Localization Team
#
# 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
Expand All @@ -19,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields, api, _
from openerp import models, fields


class ResPartner(models.Model):
Expand Down
30 changes: 15 additions & 15 deletions l10n_es_toponyms/wizard/l10n_es_toponyms_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2009 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
# Copyright (c) 2009 Zikzakmedia S.L. (http://zikzakmedia.com)
# Jordi Esteve <jesteve@zikzakmedia.com>
# Copyright (c) 2013 Serv. Tecnol. Avanzados (http://www.serviciosbaeza.com)
# Pedro Manuel Baeza <pedro.baeza@serviciosbaeza.com>
#
# 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
# 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,
Expand All @@ -25,32 +25,33 @@
import openerp.tools
from openerp.osv import fields, orm

class config_es_toponyms(orm.TransientModel):
_name='config.es.toponyms'

class ConfigEsToponyms(orm.TransientModel):
_name = 'config.es.toponyms'
_inherit = 'res.config.installer'

_columns = {
'name':fields.char('Name', size=64),
'name': fields.char('Name', size=64),
'state': fields.selection([('official', 'Official'),
('spanish', 'Spanish'),
('both', 'Both')], 'State names',
required=True),
'city_info': fields.selection([('yes', 'Yes'), ('no','No')],
'city_info': fields.selection([('yes', 'Yes'), ('no', 'No')],
'City information', required=True),
}

_defaults={
_defaults = {
'state': 'official',
'city_info': 'yes',
}

def create_states(self, cr, uid, state_type, context=None):
"""Import spanish states information through an XML file."""
file_name = 'l10n_es_toponyms_states_%s.xml' %state_type
file_name = 'l10n_es_toponyms_states_%s.xml' % state_type
try:
fp = openerp.tools.file_open(os.path.join('l10n_es_toponyms',
os.path.join('wizard', file_name)))
except IOError, e:
os.path.join('wizard', file_name)))
except IOError:
fp = None
if fp:
idref = {}
Expand All @@ -64,8 +65,8 @@ def create_zipcodes(self, cr, uid, context=None):
file_name = 'l10n_es_toponyms_zipcodes.xml'
try:
fp = openerp.tools.file_open(os.path.join('l10n_es_toponyms',
os.path.join('wizard', file_name)))
except IOError, e:
os.path.join('wizard', file_name)))
except IOError:
fp = None
if fp:
idref = {}
Expand All @@ -75,8 +76,7 @@ def create_zipcodes(self, cr, uid, context=None):
return False

def execute(self, cr, uid, ids, context=None):
if context is None: context = {}
super(config_es_toponyms, self).execute(cr, uid, ids, context=context)
super(ConfigEsToponyms, self).execute(cr, uid, ids, context=context)
res = self.read(cr, uid, ids)[0]
# Import spanish states (official, Spanish or both)
self.create_states(cr, uid, res['state'], context=context)
Expand Down