Skip to content

Commit

Permalink
Merge branch '7.0' of github.com:OCA/l10n-spain into 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobaeza committed Nov 18, 2014
2 parents 031f1b5 + 67c9a9a commit ff8ea48
Show file tree
Hide file tree
Showing 19 changed files with 72 additions and 81 deletions.
10 changes: 5 additions & 5 deletions account_balance_reporting/account_balance_reporting_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,17 @@ def action_recover(self, cr, uid, ids, context=None):
self.write(cr, uid, ids, {'state': 'draft', 'calc_date': None},
context=context)
wf_service = netsvc.LocalService("workflow")
for id in ids:
wf_service.trg_create(uid, 'account.balance.reporting', id, cr)
for rec_id in ids:
wf_service.trg_create(uid, 'account.balance.reporting', rec_id, cr)
return True

def calculate_action(self, cr, uid, ids, context=None):
"""Calculate the selected balance report data."""
for id in ids:
for rec_id in ids:
# Send the calculate signal to the balance report to trigger
# action_calculate.
wf_service = netsvc.LocalService('workflow')
wf_service.trg_validate(uid, 'account.balance.reporting', id,
wf_service.trg_validate(uid, 'account.balance.reporting', rec_id,
'calculate', cr)
return 'close'

Expand Down Expand Up @@ -410,7 +410,7 @@ def _get_account_balance(self, cr, uid, ids, code, balance_mode=0,
# We iterate over the accounts listed in "code", so code can be
# a string like "430+431+432-438"; accounts split by "+" will be added,
# accounts split by "-" will be substracted.
for acc_code in re.findall('(-?\w*\(?[0-9a-zA-Z_]*\)?)', code):
for acc_code in re.findall(r'(-?\w*\(?[0-9a-zA-Z_]*\)?)', code):
# Check if the code is valid (findall might return empty strings)
acc_code = acc_code.strip()
if acc_code:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ class account_balance_reporting_template(orm.Model):
'balance_mode': '0',
}

def copy(self, cr, uid, id, default=None, context=None):
def copy(self, cr, uid, rec_id, default=None, context=None):
"""Redefine the copy method to perform it correctly as the line
structure is a graph.
"""
line_obj = self.pool['account.balance.reporting.template.line']
# Read the current item data:
template = self.browse(cr, uid, id, context=context)
template = self.browse(cr, uid, rec_id, context=context)
# Create the template
new_id = self.create(
cr, uid, {
Expand Down
18 changes: 6 additions & 12 deletions l10n_es_account/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,17 @@ def _get_chart_template(self, cr, uid, ids, field_name, arg, context=None):
until parent_id is null (this is the root account) then
select the chart template which have 'account_root_id'
pointing to the root account."""

chart_obj = self.pool.get('account.chart.template')
if context is None:
context = {}
chart_obj = self.pool['account.chart.template']
res = {}
accounts = self.browse(cr, uid, ids)
for account in accounts:
id = account.id
rec_id = account.id
while account.parent_id:
account = self.browse(cr, uid, account.parent_id.id)
search_params = [('account_root_id', '=', account.id)]
template_ids = chart_obj.search(cr, uid, search_params,
context=context)
res[id] = template_ids and template_ids[0] or False

res[rec_id] = template_ids and template_ids[0] or False
return res

def _get_account_from_chart(self, cr, uid, ids, context=None):
Expand Down Expand Up @@ -140,19 +136,17 @@ def _get_chart_template(self, cr, uid, ids, field_name, arg, context=None):
until parent_id is null (this is the root tax code) then
select the chart template which have 'tax_code_root_id'
pointing to the root tax code."""
chart_obj = self.pool.get('account.chart.template')
if context is None:
context = {}
chart_obj = self.pool['account.chart.template']
res = {}
taxcodes = self.browse(cr, uid, ids)
for taxcode in taxcodes:
id = taxcode.id
rec_id = taxcode.id
while taxcode.parent_id:
taxcode = self.browse(cr, uid, taxcode.parent_id.id)
search_params = [('tax_code_root_id', '=', taxcode.id)]
template_ids = chart_obj.search(cr, uid, search_params,
context=context)
res[id] = template_ids and template_ids[0] or False
res[rec_id] = template_ids and template_ids[0] or False
return res

def _get_taxcode_from_chart(self, cr, uid, ids, context=None):
Expand Down
4 changes: 2 additions & 2 deletions l10n_es_account_invoice_sequence/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ def _number(self, cr, uid, ids, name, args, context=None):
result[invoice.id] = invoice.invoice_number
return result

def copy(self, cr, uid, id, default=None, context=None):
def copy(self, cr, uid, rec_id, default=None, context=None):
if not default:
default = {}
default.update({'invoice_number': False})
return super(AccountInvoice, self).copy(cr, uid, id, default,
return super(AccountInvoice, self).copy(cr, uid, rec_id, default,
context=context)

_columns = {
Expand Down
6 changes: 3 additions & 3 deletions l10n_es_aeat/wizard/export_to_boe.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def action_get_file(self, cr, uid, ids, context=None):
contents += self._get_formatted_other_records(cr, uid, report,
context=context)
# Generate the file and save as attachment
file = base64.encodestring(contents)
res = base64.encodestring(contents)
file_name = _("%s_report_%s.txt") % (
report.number, time.strftime(_(DEFAULT_SERVER_DATE_FORMAT)))
# Delete old files
Expand All @@ -163,13 +163,13 @@ def action_get_file(self, cr, uid, ids, context=None):
if attachment_ids:
attachment_obj.unlink(cr, uid, attachment_ids, context=context)
attachment_obj.create(cr, uid, {"name": file_name,
"datas": file,
"datas": res,
"datas_fname": file_name,
"res_model": report._model._name,
"res_id": report.id,
}, context=context)
self.write(cr, uid, ids,
{'state': 'get', 'data': file, 'name': file_name},
{'state': 'get', 'data': res, 'name': file_name},
context=context)
# Force view to be the parent one
data_obj = self.pool['ir.model.data']
Expand Down
6 changes: 3 additions & 3 deletions l10n_es_aeat_mod303/mod303.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ def _get_period(self, cr, uid, ids, context=None):

def _get_report_lines(self, cr, uid, ids, context=None):
if isinstance(ids, list):
id = ids[0]
rec_id = ids[0]
else:
id = ids
rec_id = ids
dict_code_values = {}
for i in range(1, 51):
dict_code_values["[%.2d]" % i] = 0
mod303 = self.browse(cr, uid, id, context=context)
mod303 = self.browse(cr, uid, rec_id, context=context)
generated_report = tax_report(cr, uid, "account.vat.declaration")
generated_report.period_ids = self._get_period(cr, uid, [mod303.id],
context=context)
Expand Down
16 changes: 7 additions & 9 deletions l10n_es_aeat_mod303/wizard/export_mod303_to_boe.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,13 @@ def _get_formatted_other_records(self, cr, uid, report, context=None):
raise orm.except_orm(
_('Warning'), _("CCC de devolución no válida \n%s") % ccc)
res += self._formatString(ccc, 20) # no hay devolución
"""
## ingreso (7)
859 1 Num Ingreso (7) - Forma de pago
860 17 N Ingreso (7) - Importe [I]
877 4 An Ingreso (7) - Código cuenta cliente - Entidad
881 4 An Ingreso (7) - Código cuenta cliente - Oficina
885 2 An Ingreso (7) - Código cuenta cliente - DC
887 10 An Ingreso (7) - Código cuenta cliente - Nº cuenta
"""
# ingreso (7)
# 859 1 Num Ingreso (7) - Forma de pago
# 860 17 N Ingreso (7) - Importe [I]
# 877 4 An Ingreso (7) - Código cuenta cliente - Entidad
# 881 4 An Ingreso (7) - Código cuenta cliente - Oficina
# 885 2 An Ingreso (7) - Código cuenta cliente - DC
# 887 10 An Ingreso (7) - Código cuenta cliente - Nº cuenta
# NO SE USA ??? Forma de Pago - "0" No consta, "1" Efectivo,
# "2" Adeudo en cuenta, "3" Domiciliación
res += self._formatString("0", 1)
Expand Down
10 changes: 5 additions & 5 deletions l10n_es_aeat_mod340/mod340.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def _name_get(self, cr, uid, ids, field_name, arg, context=None):
def _get_number_records(self, cr, uid, ids, field_name, args,
context=None):
result = {}
for id in ids:
result[id] = {}.fromkeys(
for rec_id in ids:
result[rec_id] = {}.fromkeys(
['number_records', 'total_taxable', 'total_sharetax', 'total'],
0.0)
for model in self.browse(cr, uid, ids, context=context):
Expand Down Expand Up @@ -121,12 +121,12 @@ def _get_number_records(self, cr, uid, ids, field_name, args,
'declaration_number': '340',
}

def set_done(self, cr, uid, id, *args):
def set_done(self, cr, uid, rec_id, *args):
self.write(cr, uid, id, {'calculation_date': time.strftime('%Y-%m-%d'),
'state': 'done'})
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'l10n.es.aeat.mod340.report', id, 'done',
cr)
wf_service.trg_validate(uid, 'l10n.es.aeat.mod340.report', rec_id,
'done', cr)
return True

def action_confirm(self, cr, uid, ids, context=None):
Expand Down
14 changes: 7 additions & 7 deletions l10n_es_aeat_mod349/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ def _assign_invoice_operation_keys(self, cr, uid, ids=None,
self.write(cr, uid, invoice.id, {'operation_key': op_key},
context=context)

def _get_operation_key(self, fp, type):
def _get_operation_key(self, fp, invoice_type):
if not fp.intracommunity_operations:
return False
else:
# TODO: Ver cómo discernir si son prestación de servicios
if type == 'out_invoice' or type == 'out_refund':
if invoice_type in ('out_invoice', 'out_refund'):
# Establecer a entrega si es de venta
return 'E'
else:
Expand Down Expand Up @@ -108,12 +108,12 @@ def _get_invoices_by_type(self, cr, uid, partner_id, operation_key,
"""
assert period_selection, 'There is no period selected'
# Set type of invoice
type = ['in_invoice', 'out_invoice', 'in_refund', 'out_refund']
invoice_type = ['in_invoice', 'out_invoice', 'in_refund', 'out_refund']
fy_obj = self.pool['account.fiscalyear']
fy = fy_obj.browse(cr, uid, fiscalyear_id, context=context)
domain = [('partner_id', '=', partner_id),
('state', 'in', ['open', 'paid']),
('type', 'in', type),
('type', 'in', invoice_type),
('operation_key', '=', operation_key)]
# Invoices by fiscalyear (Annual)
if period_selection == '0A':
Expand Down Expand Up @@ -193,13 +193,13 @@ def clean_refund_invoices(self, cr, uid, ids, partner_id,
return invoice_ids, refund_ids

def on_change_fiscal_position(self, cr, uid, ids, fiscal_position,
type, context=None):
invoice_type, context=None):
"""Suggest an operation key when fiscal position changes."""
res = {'operation_key': 'Nothing'}
if fiscal_position and type:
if fiscal_position and invoice_type:
fp_obj = self.pool['account.fiscal.position']
fp = fp_obj.browse(cr, uid, fiscal_position, context=context)
res['operation_key'] = self._get_operation_key(fp, type)
res['operation_key'] = self._get_operation_key(fp, invoice_type)
return {'value': res}

def create(self, cr, uid, vals, context=None):
Expand Down
4 changes: 2 additions & 2 deletions l10n_es_aeat_mod349/mod349.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
]

# TODO: Quitarlo de aquí y pasarlo a l10n_es_aeat con sustituciones
NAME_RESTRICTIVE_REGEXP = re.compile(u"^[a-zA-Z0-9\sáÁéÉíÍóÓúÚñÑçÇäÄëËïÏüÜöÖ"
u"àÀèÈìÌòÒùÙâÂêÊîÎôÔûÛ\.,-_&'´\:;:/]*$",
NAME_RESTRICTIVE_REGEXP = re.compile(r"^[a-zA-Z0-9\sáÁéÉíÍóÓúÚñÑçÇäÄëËïÏüÜöÖ"
r"àÀèÈìÌòÒùÙâÂêÊîÎôÔûÛ\.,-_&'´\\:;:/]*$",
re.UNICODE | re.X)


Expand Down
8 changes: 4 additions & 4 deletions l10n_es_fiscal_year_closing/wizard/wizard_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class CancelFyc(orm.TransientModel):
readonly=True),
}

def default_get(self, cr, uid, fields, context=None):
def default_get(self, cr, uid, field_list, context=None):
"""This function gets default values
@param self: The object pointer
@param cr: the current row, from the database cursor,
Expand All @@ -52,7 +52,7 @@ def default_get(self, cr, uid, fields, context=None):
@return : default values of fields.
"""
context = context or {}
res = super(CancelFyc, self).default_get(cr, uid, fields,
res = super(CancelFyc, self).default_get(cr, uid, field_list,
context=context)
if context.get('active_id'):
fyc_obj = self.pool['account.fiscalyear.closing']
Expand Down Expand Up @@ -142,7 +142,7 @@ class ExecuteFyc(orm.TransientModel):
readonly=True),
}

def default_get(self, cr, uid, fields, context=None):
def default_get(self, cr, uid, field_list, context=None):
"""This function gets default values
@param self: The object pointer
@param cr: the current row, from the database cursor,
Expand All @@ -153,7 +153,7 @@ def default_get(self, cr, uid, fields, context=None):
@return : default values of fields.
"""
context = context or {}
res = super(ExecuteFyc, self).default_get(cr, uid, fields,
res = super(ExecuteFyc, self).default_get(cr, uid, field_list,
context=context)
if context.get('active_id'):
fyc_obj = self.pool['account.fiscalyear.closing']
Expand Down
1 change: 0 additions & 1 deletion l10n_es_partner/l10n_es_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ class ResBank(orm.Model):
'lname': fields.char('Long name', size=128),
'vat': fields.char('VAT code', size=32, help="Value Added Tax number"),
'website': fields.char('Website', size=64),
'code': fields.char('Code', size=64),
}


Expand Down
2 changes: 1 addition & 1 deletion l10n_es_payment_order/wizard/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

from openerp.osv import orm
from openerp.tools.translate import _
from log import Log
from .log import Log


class PaymentConverterSpain(orm.Model):
Expand Down
2 changes: 1 addition & 1 deletion l10n_es_payment_order/wizard/csb19.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from openerp.osv import orm
from datetime import datetime
from openerp.tools.translate import _
from log import Log
from .log import Log


class Csb19(orm.Model):
Expand Down
2 changes: 1 addition & 1 deletion l10n_es_payment_order/wizard/csb32.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from openerp.osv import orm
from datetime import datetime
from openerp.tools.translate import _
from log import Log
from .log import Log


class Csb32(orm.Model):
Expand Down
18 changes: 9 additions & 9 deletions l10n_es_payment_order/wizard/csb34.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from openerp.osv import orm
from datetime import datetime
from openerp.tools.translate import _
from log import Log
from .log import Log
import time


Expand Down Expand Up @@ -418,18 +418,18 @@ def create_file(self, cr, uid, order, lines, context):
self.order = order
payment_line_count = 0
record_count = 0
file = ''
file += self._cabecera_ordenante_34(cr, uid, context)
file += self._cabecera_nacionales_34(cr, uid, context)
res = ''
res += self._cabecera_ordenante_34(cr, uid, context)
res += self._cabecera_nacionales_34(cr, uid, context)
for recibo in lines:
text = self._detalle_nacionales_34(
cr, uid, recibo, order.mode.csb34_type, context)
file += text
res += text
record_count += len(text.split('\r\n'))-1
payment_line_count += 1
values = (payment_line_count, record_count + 2)
file += self._totales_nacionales_34(cr, uid, values, context)
record_count = len(file.split('\r\n'))
res += self._totales_nacionales_34(cr, uid, values, context)
record_count = len(res.split('\r\n'))
values = (payment_line_count, record_count)
file += self._total_general_34(cr, uid, values, context)
return file
res += self._total_general_34(cr, uid, values, context)
return res
12 changes: 6 additions & 6 deletions l10n_es_payment_order/wizard/csb3401.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from openerp.osv import orm
from datetime import datetime
from openerp.tools.translate import _
from log import Log
from .log import Log


class Csb3401(orm.Model):
Expand Down Expand Up @@ -186,13 +186,13 @@ def create_file(self, cr, uid, order, lines, context):
self.order = order
self.payment_line_count = 0
self.record_count = 0
file = ''
file += self._cabecera_ordenante_34(cr, uid, context)
res = ''
res += self._cabecera_ordenante_34(cr, uid, context)
self.record_count += 4
for recibo in lines:
file += self._detalle_nacionales_34(cr, uid, recibo, context)
res += self._detalle_nacionales_34(cr, uid, recibo, context)
self.payment_line_count += 1
self.record_count += 2
self.record_count += 1
file += self._totales_nacionales_34(cr, uid, context)
return file
res += self._totales_nacionales_34(cr, uid, context)
return res
Loading

0 comments on commit ff8ea48

Please sign in to comment.