openobject-italia-core-devs team mailing list archive
-
openobject-italia-core-devs team
-
Mailing list archive
-
Message #01212
lp:~icsergio/openobject-italia/adding_account_vat_period_end_statement into lp:openobject-italia/7.0
Sergio Corato has proposed merging lp:~icsergio/openobject-italia/adding_account_vat_period_end_statement into lp:openobject-italia/7.0.
Requested reviews:
OpenERP Italia core devs (openobject-italia-core-devs)
For more details, see:
https://code.launchpad.net/~icsergio/openobject-italia/adding_account_vat_period_end_statement/+merge/153660
--
https://code.launchpad.net/~icsergio/openobject-italia/adding_account_vat_period_end_statement/+merge/153660
Your team OpenERP Italia core devs is requested to review the proposed merge of lp:~icsergio/openobject-italia/adding_account_vat_period_end_statement into lp:openobject-italia/7.0.
=== added directory 'account_vat_period_end_statement'
=== added file 'account_vat_period_end_statement/AUTHORS.txt'
--- account_vat_period_end_statement/AUTHORS.txt 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/AUTHORS.txt 2013-03-16 13:20:28 +0000
@@ -0,0 +1,3 @@
+Lorenzo Battistini <lorenzo.battistini@xxxxxxxxxxxx>
+Marco Marchiori <marcomarkiori@xxxxxxxxx>
+Sergio Corato <sergiocorato@xxxxxxxxx>
=== added file 'account_vat_period_end_statement/__init__.py'
--- account_vat_period_end_statement/__init__.py 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/__init__.py 2013-03-16 13:20:28 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2012 Domsense s.r.l. (<http://www.domsense.com>).
+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.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 (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/>.
+#
+##############################################################################
+import account
+import report
+import wizard
=== added file 'account_vat_period_end_statement/__openerp__.py'
--- account_vat_period_end_statement/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/__openerp__.py 2013-03-16 13:20:28 +0000
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2012 Domsense s.r.l. (<http://www.domsense.com>).
+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.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 (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/>.
+#
+##############################################################################
+
+
+{
+ "name": "Period End VAT Statement",
+ "version": "0.3",
+ 'category': 'Generic Modules/Accounting',
+ "depends": ["account_voucher", "report_webkit"],
+ "author": "Agile Business Group",
+ "description": """
+
+This module helps to register the VAT statement of period end.
+
+In order to load correct amount from tax code, the tax code has to be associated to account involved in statement, through tax code form.
+
+The 'VAT statement' object allows to specify every amount and relative account used by the statement.
+By default, amounts of debit and credit taxes are automatically loaded from tax codes of selected periods.
+Previous debit or credit is loaded from previous VAT statement, according to its payments status.
+Confirming the statement, the 'account.move' is created. If you select a payment term, the due date(s) will be set.
+
+The 'tax authority' tab contains information about payment(s). You can see statement's result ('authority VAT amount') and residual amount to pay ('Balance').
+The statement can be paid like every other debit: by voucher or 'move.line' reconciliation.
+
+It is advisable the use of account_due_list module.
+
+Specification: http://wiki.openerp-italia.org/doku.php/moduli/vat_period_end_statement
+
+""",
+ 'website': 'http://www.agilebg.com',
+ 'init_xml': [],
+ 'update_xml': [
+ 'wizard/add_period.xml',
+ 'wizard/remove_period.xml',
+ 'account_view.xml',
+ 'statement_workflow.xml',
+ 'security/ir.model.access.csv',
+ 'reports.xml',
+ ],
+ 'demo_xml': [],
+ 'installable': True,
+ 'active': False,
+}
=== added file 'account_vat_period_end_statement/account.py'
--- account_vat_period_end_statement/account.py 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/account.py 2013-03-16 13:20:28 +0000
@@ -0,0 +1,573 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2012 Domsense s.r.l. (<http://www.domsense.com>).
+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.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 (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 osv import fields, osv
+from tools.translate import _
+import math
+import decimal_precision as dp
+import netsvc
+from datetime import datetime
+from dateutil.relativedelta import relativedelta
+
+class account_vat_period_end_statement(osv.osv):
+
+ def _compute_authority_vat_amount(self, cr, uid, ids, field_name, arg, context):
+ res={}
+ for i in ids:
+ statement = self.browse(cr, uid, i)
+ debit_vat_amount = 0.0
+ credit_vat_amount = 0.0
+ generic_vat_amount = 0.0
+ for debit_line in statement.debit_vat_account_line_ids:
+ debit_vat_amount += debit_line.amount
+ for credit_line in statement.credit_vat_account_line_ids:
+ credit_vat_amount += credit_line.amount
+ for generic_line in statement.generic_vat_account_line_ids:
+ generic_vat_amount += generic_line.amount
+ authority_amount = (debit_vat_amount - credit_vat_amount - generic_vat_amount
+ - statement.previous_credit_vat_amount + statement.previous_debit_vat_amount)
+ res[i] = authority_amount
+ return res
+
+ def _compute_payable_vat_amount(self, cr, uid, ids, field_name, arg, context):
+ res={}
+ for i in ids:
+ statement = self.browse(cr, uid, i)
+ debit_vat_amount = 0.0
+ for debit_line in statement.debit_vat_account_line_ids:
+ debit_vat_amount += debit_line.amount
+ res[i] = debit_vat_amount
+ return res
+
+ def _compute_deductible_vat_amount(self, cr, uid, ids, field_name, arg, context):
+ res={}
+ for i in ids:
+ statement = self.browse(cr, uid, i)
+ credit_vat_amount = 0.0
+ for credit_line in statement.credit_vat_account_line_ids:
+ credit_vat_amount += credit_line.amount
+ res[i] = credit_vat_amount
+ return res
+
+ # Workflow stuff
+ #################
+
+ def _reconciled(self, cr, uid, ids, name, args, context=None):
+ res = {}
+ for id in ids:
+ res[id] = self.test_paid(cr, uid, [id])
+ return res
+
+ def move_line_id_payment_gets(self, cr, uid, ids, *args):
+ res = {}
+ if not ids: return res
+ cr.execute('SELECT statement.id, l.id '\
+ 'FROM account_move_line l '\
+ 'LEFT JOIN account_vat_period_end_statement statement ON (statement.move_id=l.move_id) '\
+ 'WHERE statement.id IN %s '\
+ 'AND l.account_id=statement.authority_vat_account_id',
+ (tuple(ids),))
+ for r in cr.fetchall():
+ res.setdefault(r[0], [])
+ res[r[0]].append( r[1] )
+ return res
+
+ # return the ids of the move lines which has the same account than the statement
+ # whose id is in ids
+ def move_line_id_payment_get(self, cr, uid, ids, *args):
+ if not ids: return []
+ result = self.move_line_id_payment_gets(cr, uid, ids, *args)
+ return result.get(ids[0], [])
+
+ def test_paid(self, cr, uid, ids, *args):
+ res = self.move_line_id_payment_get(cr, uid, ids)
+ if not res:
+ return False
+ ok = True
+ for id in res:
+ cr.execute('select reconcile_id from account_move_line where id=%s', (id,))
+ ok = ok and bool(cr.fetchone()[0])
+ return ok
+
+ def _get_statement_from_line(self, cr, uid, ids, context=None):
+ move = {}
+ for line in self.pool.get('account.move.line').browse(cr, uid, ids, context=context):
+ if line.reconcile_partial_id:
+ for line2 in line.reconcile_partial_id.line_partial_ids:
+ move[line2.move_id.id] = True
+ if line.reconcile_id:
+ for line2 in line.reconcile_id.line_id:
+ move[line2.move_id.id] = True
+ statement_ids = []
+ if move:
+ statement_ids = self.pool.get('account.vat.period.end.statement').search(
+ cr, uid, [('move_id','in',move.keys())], context=context)
+ return statement_ids
+
+ def _get_statement_from_move(self, cr, uid, ids, context=None):
+ move = {}
+ statement_ids = []
+ for move in self.pool.get('account.move').browse(cr, uid, ids, context=context):
+ found_ids = self.pool.get('account.vat.period.end.statement').search(
+ cr, uid, [('move_id','=',move.id)], context=context)
+ for found_id in found_ids:
+ if found_id not in statement_ids:
+ statement_ids.append(found_id)
+ return statement_ids
+
+ def _get_statement_from_reconcile(self, cr, uid, ids, context=None):
+ move = {}
+ for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids, context=context):
+ for line in r.line_partial_ids:
+ move[line.move_id.id] = True
+ for line in r.line_id:
+ move[line.move_id.id] = True
+
+ statement_ids = []
+ if move:
+ statement_ids = self.pool.get('account.vat.period.end.statement').search(
+ cr, uid, [('move_id','in',move.keys())], context=context)
+ return statement_ids
+
+ def _get_credit_line(self, cr, uid, ids, context=None):
+ result = {}
+ for line in self.pool.get('statement.credit.account.line').browse(cr, uid, ids, context=context):
+ result[line.statement_id.id] = True
+ return result.keys()
+
+ def _get_debit_line(self, cr, uid, ids, context=None):
+ result = {}
+ for line in self.pool.get('statement.debit.account.line').browse(cr, uid, ids, context=context):
+ result[line.statement_id.id] = True
+ return result.keys()
+
+ def _get_generic_line(self, cr, uid, ids, context=None):
+ result = {}
+ for line in self.pool.get('statement.generic.account.line').browse(cr, uid, ids, context=context):
+ result[line.statement_id.id] = True
+ return result.keys()
+
+ def _amount_residual(self, cr, uid, ids, name, args, context=None):
+ result = {}
+ for statement in self.browse(cr, uid, ids, context=context):
+ result[statement.id] = 0.0
+ if statement.move_id:
+ for m in statement.move_id.line_id:
+ if m.account_id.type in ('receivable','payable'):
+ result[statement.id] += m.amount_residual_currency
+ return result
+
+ def _compute_lines(self, cr, uid, ids, name, args, context=None):
+ result = {}
+ for statement in self.browse(cr, uid, ids, context=context):
+ src = []
+ lines = []
+ if statement.move_id:
+ for m in statement.move_id.line_id:
+ temp_lines = []
+ if m.reconcile_id:
+ temp_lines = map(lambda x: x.id, m.reconcile_id.line_id)
+ elif m.reconcile_partial_id:
+ temp_lines = map(lambda x: x.id, m.reconcile_partial_id.line_partial_ids)
+ lines += [x for x in temp_lines if x not in lines]
+ src.append(m.id)
+
+ lines = filter(lambda x: x not in src, lines)
+ result[statement.id] = lines
+ return result
+
+ _name = "account.vat.period.end.statement"
+ _rec_name = 'date'
+ _columns = {
+ 'debit_vat_account_line_ids': fields.one2many('statement.debit.account.line', 'statement_id', 'Debit VAT', help='The accounts containing the debit VAT amount to write-off', required=True, states={'confirmed': [('readonly', True)], 'paid': [('readonly', True)], 'draft': [('readonly', False)]}),
+
+ 'credit_vat_account_line_ids': fields.one2many('statement.credit.account.line', 'statement_id', 'Credit VAT', help='The accounts containing the credit VAT amount to write-off', required=True, states={'confirmed': [('readonly', True)], 'paid': [('readonly', True)], 'draft': [('readonly', False)]}),
+
+ 'previous_credit_vat_account_id': fields.many2one('account.account', 'Previous Credits VAT', help='Credit VAT from previous periods', states={'confirmed': [('readonly', True)], 'paid': [('readonly', True)], 'draft': [('readonly', False)]}),
+ 'previous_credit_vat_amount': fields.float('Previous Credits VAT Amount', states={'confirmed': [('readonly', True)], 'paid': [('readonly', True)], 'draft': [('readonly', False)]},
+ digits_compute=dp.get_precision('Account')),
+
+ 'previous_debit_vat_account_id': fields.many2one('account.account', 'Previous Debits VAT', help='Debit VAT from previous periods', states={'confirmed': [('readonly', True)], 'paid': [('readonly', True)], 'draft': [('readonly', False)]}),
+ 'previous_debit_vat_amount': fields.float('Previous Debits VAT Amount', states={'confirmed': [('readonly', True)], 'paid': [('readonly', True)], 'draft': [('readonly', False)]},
+ digits_compute=dp.get_precision('Account')),
+
+ 'generic_vat_account_line_ids': fields.one2many('statement.generic.account.line', 'statement_id', 'Other VAT Credits / Debits or Tax Compensations', states={'confirmed': [('readonly', True)], 'paid': [('readonly', True)], 'draft': [('readonly', False)]}),
+
+ 'authority_partner_id': fields.many2one('res.partner', 'Tax Authority Partner', states={'confirmed': [('readonly', True)], 'paid': [('readonly', True)], 'draft': [('readonly', False)]}),
+ 'authority_vat_account_id': fields.many2one('account.account', 'Tax Authority VAT Account', required=True, states={'confirmed': [('readonly', True)], 'paid': [('readonly', True)], 'draft': [('readonly', False)]}),
+ 'authority_vat_amount': fields.function(_compute_authority_vat_amount, method=True, string='Authority VAT Amount'),
+ 'payable_vat_amount': fields.function(_compute_payable_vat_amount, method=True, string='Payable VAT Amount'),
+ 'deductible_vat_amount': fields.function(_compute_deductible_vat_amount, method=True, string='Deductible VAT Amount'),
+
+ 'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'confirmed': [('readonly', True)], 'paid': [('readonly', True)], 'draft': [('readonly', False)]}),
+ 'date': fields.date('Date', required=True, states={'confirmed': [('readonly', True)], 'paid': [('readonly', True)], 'draft': [('readonly', False)]}),
+ 'move_id': fields.many2one('account.move', 'VAT statement move', readonly=True),
+ #'voucher_id': fields.many2one('account.voucher', 'VAT payment', readonly=True),
+
+ 'state': fields.selection([
+ ('draft', 'Draft'),
+ ('confirmed', 'Confirmed'),
+ ('paid', 'Paid'),
+ ], 'State', readonly=True),
+
+ 'payment_term_id': fields.many2one('account.payment.term', 'Payment Term',
+ states={'confirmed': [('readonly', True)], 'paid': [('readonly', True)],
+ 'draft': [('readonly', False)]}),
+
+ 'reconciled': fields.function(_reconciled, string='Paid/Reconciled', type='boolean',
+ store={
+ 'account.vat.period.end.statement': (lambda self, cr, uid, ids, c={}: ids, None, 50),
+ 'account.move.line': (_get_statement_from_line, None, 50),
+ 'account.move.reconcile': (_get_statement_from_reconcile, None, 50),
+ }, help="It indicates that the statement has been paid and the journal entry of the statement has been reconciled with one or several journal entries of payment."),
+ 'residual': fields.function(_amount_residual, digits_compute=dp.get_precision('Account'), string='Balance',
+ store={
+ 'account.vat.period.end.statement': (lambda self, cr, uid, ids, c={}: ids,
+ ['debit_vat_account_line_ids', 'credit_vat_account_line_ids',
+ 'generic_vat_account_line_ids', 'move_id', 'state'], 50),
+ 'statement.credit.account.line': (_get_credit_line, ['amount','statement_id'], 50),
+ 'statement.debit.account.line': (_get_debit_line, ['amount','statement_id'], 50),
+ 'statement.generic.account.line': (_get_generic_line, ['amount','statement_id'], 50),
+ 'account.move': (_get_statement_from_move, None, 50),
+ 'account.move.line': (_get_statement_from_line, None, 50),
+ 'account.move.reconcile': (_get_statement_from_reconcile, None, 50),
+ },
+ help="Remaining amount due."),
+ 'payment_ids': fields.function(_compute_lines, relation='account.move.line', type="many2many", string='Payments'),
+ 'period_ids': fields.one2many('account.period','vat_statement_id','Periods'),
+ }
+
+ _defaults = {
+ 'date': fields.date.context_today,
+ }
+
+ def _get_tax_code_amount(self, cr, uid, tax_code_id, period_id, context):
+ if not context:
+ context={}
+ context['period_id'] = period_id
+ return self.pool.get('account.tax.code').browse(cr, uid, tax_code_id, context)._sum_period(
+ None, None, context)[tax_code_id]
+
+ def unlink(self, cr, uid, ids, context=None):
+ if isinstance(ids, (long,int)):
+ ids = [ids]
+ for statement in self.browse(cr, uid, ids, context):
+ if statement.state == 'confirmed' or statement.state == 'paid':
+ raise osv.except_osv(_('Error!'), _('You cannot delete a confirmed or paid statement'))
+ res = super(account_vat_period_end_statement, self).unlink(cr, uid, ids, context)
+ return res
+
+ def statement_draft(self, cr, uid, ids, context=None):
+ for statement in self.browse(cr, uid, ids, context):
+ if statement.move_id:
+ statement.move_id.unlink()
+ '''
+ if statement.voucher_id:
+ statement.voucher_id.unlink()
+ '''
+ self.write(cr, uid, ids , {'state': 'draft'})
+
+ def statement_paid(self, cr, uid, ids, context=None):
+ self.write(cr, uid, ids , {'state': 'paid'})
+
+ def create_move(self, cr, uid, ids, context=None):
+ move_obj = self.pool.get('account.move')
+ term_pool = self.pool.get('account.payment.term')
+ line_obj = self.pool.get('account.move.line')
+ period_obj = self.pool.get('account.period')
+ for statement in self.browse(cr, uid, ids, context):
+ period_ids = period_obj.find(cr, uid, dt=statement.date, context=context)
+ if len(period_ids) != 1:
+ raise osv.except_osv(_('Encoding error'), _('No period found or more than one period found for the given date.'))
+ move_data = {
+ 'name': _('VAT statement') + ' - ' + statement.date,
+ 'date': statement.date,
+ 'journal_id': statement.journal_id.id,
+ }
+ move_id = move_obj.create(cr, uid, move_data)
+ statement.write({'move_id': move_id})
+
+ for debit_line in statement.debit_vat_account_line_ids:
+ debit_vat_data = {
+ 'name': _('Debit VAT'),
+ 'account_id': debit_line.account_id.id,
+ 'move_id': move_id,
+ 'journal_id': statement.journal_id.id,
+ 'debit': 0.0,
+ 'credit': 0.0,
+ 'date': statement.date,
+ 'period_id': period_ids[0],
+ }
+ if debit_line.amount > 0:
+ debit_vat_data['debit'] = math.fabs(debit_line.amount)
+ else:
+ debit_vat_data['credit'] = math.fabs(debit_line.amount)
+ line_obj.create(cr, uid, debit_vat_data)
+
+ for credit_line in statement.credit_vat_account_line_ids:
+ credit_vat_data = {
+ 'name': _('Credit VAT'),
+ 'account_id': credit_line.account_id.id,
+ 'move_id': move_id,
+ 'journal_id': statement.journal_id.id,
+ 'debit': 0.0,
+ 'credit': 0.0,
+ 'date': statement.date,
+ 'period_id': period_ids[0],
+ }
+ if credit_line.amount < 0:
+ credit_vat_data['debit'] = math.fabs(credit_line.amount)
+ else:
+ credit_vat_data['credit'] = math.fabs(credit_line.amount)
+ line_obj.create(cr, uid, credit_vat_data)
+
+ if statement.previous_credit_vat_amount:
+ previous_credit_vat_data = {
+ 'name': _('Previous Credits VAT'),
+ 'account_id': statement.previous_credit_vat_account_id.id,
+ 'move_id': move_id,
+ 'journal_id': statement.journal_id.id,
+ 'debit': 0.0,
+ 'credit': 0.0,
+ 'date': statement.date,
+ 'period_id': period_ids[0],
+ }
+ if statement.previous_credit_vat_amount < 0:
+ previous_credit_vat_data['debit'] = math.fabs(statement.previous_credit_vat_amount)
+ else:
+ previous_credit_vat_data['credit'] = math.fabs(statement.previous_credit_vat_amount)
+ line_obj.create(cr, uid, previous_credit_vat_data)
+
+ if statement.previous_debit_vat_amount:
+ previous_debit_vat_data = {
+ 'name': _('Previous Debits VAT'),
+ 'account_id': statement.previous_debit_vat_account_id.id,
+ 'move_id': move_id,
+ 'journal_id': statement.journal_id.id,
+ 'debit': 0.0,
+ 'credit': 0.0,
+ 'date': statement.date,
+ 'period_id': period_ids[0],
+ }
+ if statement.previous_debit_vat_amount > 0:
+ previous_debit_vat_data['debit'] = math.fabs(statement.previous_debit_vat_amount)
+ else:
+ previous_debit_vat_data['credit'] = math.fabs(statement.previous_debit_vat_amount)
+ line_obj.create(cr, uid, previous_debit_vat_data)
+
+ for generic_line in statement.generic_vat_account_line_ids:
+ generic_vat_data = {
+ 'name': _('Other VAT Credits / Debits'),
+ 'account_id': generic_line.account_id.id,
+ 'move_id': move_id,
+ 'journal_id': statement.journal_id.id,
+ 'debit': 0.0,
+ 'credit': 0.0,
+ 'date': statement.date,
+ 'period_id': period_ids[0],
+ }
+ if generic_line.amount < 0:
+ generic_vat_data['debit'] = math.fabs(generic_line.amount)
+ else:
+ generic_vat_data['credit'] = math.fabs(generic_line.amount)
+ line_obj.create(cr, uid, generic_vat_data)
+
+ end_debit_vat_data = {
+ 'name': _('Tax Authority VAT'),
+ 'account_id': statement.authority_vat_account_id.id,
+ 'partner_id': statement.authority_partner_id.id,
+ 'move_id': move_id,
+ 'journal_id': statement.journal_id.id,
+ 'date': statement.date,
+ 'period_id': period_ids[0],
+ }
+ if statement.authority_vat_amount > 0:
+ end_debit_vat_data['debit'] = 0.0
+ end_debit_vat_data['credit'] = math.fabs(statement.authority_vat_amount)
+ if statement.payment_term_id:
+ due_list = term_pool.compute(
+ cr, uid, statement.payment_term_id.id, math.fabs(statement.authority_vat_amount),
+ date_ref=statement.date, context=context)
+ if len(due_list) == 0:
+ raise osv.except_osv(_('Error'),
+ _('The payment term %s does not have due dates')
+ % statement.payment_term_id.name)
+ for term in due_list:
+ current_line = end_debit_vat_data
+ current_line['credit'] = term[1]
+ current_line['date_maturity'] = term[0]
+ line_obj.create(cr, uid, current_line)
+ else:
+ line_obj.create(cr, uid, end_debit_vat_data)
+ elif statement.authority_vat_amount < 0:
+ end_debit_vat_data['debit'] = math.fabs(statement.authority_vat_amount)
+ end_debit_vat_data['credit'] = 0.0
+ line_obj.create(cr, uid, end_debit_vat_data)
+
+ self.write(cr, uid, statement.id , {'state': 'confirmed'})
+
+ return True
+
+ """
+ def open_chart_of_taxes(self, cr, uid, ids, context=None):
+ result = {}
+ if context is None:
+ context = {}
+ for statement in self.browse(cr, uid, ids, context):
+ mod_obj = self.pool.get('ir.model.data')
+ act_obj = self.pool.get('ir.actions.act_window')
+ period_obj = self.pool.get('account.period')
+ period_ids = period_obj.find(cr, uid, dt=statement.date, context=context)
+ if len(period_ids)> 1:
+ raise osv.except_osv(_('Error'), _('Too many periods for date %s') % str(statement.date))
+ period = period_obj.browse(cr, uid, period_ids[0], context)
+ result = mod_obj.get_object_reference(cr, uid, 'account', 'action_tax_code_tree')
+ id = result and result[1] or False
+ result = act_obj.read(cr, uid, [id], context=context)[0]
+
+ fiscalyear_id = period.fiscalyear_id.id
+ result['context'] = str({'period_id': period.id, \
+ 'fiscalyear_id': fiscalyear_id, \
+ 'state': 'posted'})
+
+ period_code = period.code
+ result['name'] += period_code and (':' + period_code) or ''
+ result['nodestroy'] = True
+ return result
+ """
+
+ def compute_amounts(self, cr, uid, ids, context=None):
+ debit_line_pool=self.pool.get('statement.debit.account.line')
+ credit_line_pool=self.pool.get('statement.credit.account.line')
+ for statement in self.browse(cr, uid, ids, context):
+ statement.write({'previous_debit_vat_amount': 0.0})
+ prev_statement_ids = self.search(cr, uid, [('date', '<', statement.date)], order='date')
+ if prev_statement_ids:
+ prev_statement = self.browse(cr, uid, prev_statement_ids[len(prev_statement_ids)-1], context)
+ if prev_statement.residual > 0 and prev_statement.authority_vat_amount > 0:
+ statement.write({'previous_debit_vat_amount': prev_statement.residual})
+ elif prev_statement.authority_vat_amount < 0:
+ statement.write({'previous_credit_vat_amount': - prev_statement.authority_vat_amount})
+
+ credit_line_ids = []
+ debit_line_ids = []
+ tax_code_pool = self.pool.get('account.tax.code')
+ debit_tax_code_ids = tax_code_pool.search(cr, uid, [
+ ('vat_statement_account_id', '!=', False),
+ ('vat_statement_type', '=', 'debit'),
+ ], context=context)
+ for debit_tax_code_id in debit_tax_code_ids:
+ debit_tax_code = tax_code_pool.browse(cr, uid, debit_tax_code_id, context)
+ total = 0.0
+ for period in statement.period_ids:
+ context['period_id'] = period.id
+ total += tax_code_pool.browse(cr, uid, debit_tax_code_id, context).sum_period
+ debit_line_ids.append({
+ 'account_id': debit_tax_code.vat_statement_account_id.id,
+ 'tax_code_id': debit_tax_code.id,
+ 'amount': total * debit_tax_code.vat_statement_sign,
+ })
+
+ credit_tax_code_ids = tax_code_pool.search(cr, uid, [
+ ('vat_statement_account_id', '!=', False),
+ ('vat_statement_type', '=', 'credit'),
+ ], context=context)
+ for credit_tax_code_id in credit_tax_code_ids:
+ credit_tax_code = tax_code_pool.browse(cr, uid, credit_tax_code_id, context)
+ total = 0.0
+ for period in statement.period_ids:
+ context['period_id'] = period.id
+ total += tax_code_pool.browse(cr, uid, credit_tax_code_id, context).sum_period
+ credit_line_ids.append({
+ 'account_id': credit_tax_code.vat_statement_account_id.id,
+ 'tax_code_id': credit_tax_code.id,
+ 'amount': total * credit_tax_code.vat_statement_sign,
+ })
+
+ for debit_line in statement.debit_vat_account_line_ids:
+ debit_line.unlink()
+ for credit_line in statement.credit_vat_account_line_ids:
+ credit_line.unlink()
+ for debit_vals in debit_line_ids:
+ debit_vals.update({'statement_id': statement.id})
+ debit_line_pool.create(cr, uid, debit_vals, context=context)
+ for credit_vals in credit_line_ids:
+ credit_vals.update({'statement_id': statement.id})
+ credit_line_pool.create(cr, uid, credit_vals, context=context)
+ return True
+
+ def on_change_partner_id(self, cr, uid, ids, partner_id, context=None):
+ partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context)
+ return {'value': {'authority_vat_account_id': partner.property_account_payable.id}}
+
+class statement_debit_account_line(osv.osv):
+ _name='statement.debit.account.line'
+ _columns = {
+ 'account_id': fields.many2one('account.account', 'Account', required=True),
+ 'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', required=True),
+ 'statement_id': fields.many2one('account.vat.period.end.statement', 'VAT statement'),
+ 'amount': fields.float('Amount', digits_compute= dp.get_precision('Account'), required=True),
+ }
+
+class statement_credit_account_line(osv.osv):
+ _name='statement.credit.account.line'
+ _columns = {
+ 'account_id': fields.many2one('account.account', 'Account', required=True),
+ 'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', required=True),
+ 'statement_id': fields.many2one('account.vat.period.end.statement', 'VAT statement'),
+ 'amount': fields.float('Amount', digits_compute= dp.get_precision('Account'), required=True),
+ }
+
+class statement_generic_account_line(osv.osv):
+ _name='statement.generic.account.line'
+ _columns = {
+ 'account_id': fields.many2one('account.account', 'Account', required=True),
+ 'statement_id': fields.many2one('account.vat.period.end.statement', 'VAT statement'),
+ 'amount': fields.float('Amount', digits_compute= dp.get_precision('Account'), required=True),
+ }
+
+ def on_change_vat_account_id(self, cr, uid, ids, vat_account_id=False, context=None):
+ res = {}
+ res['value'] = {}
+ if not vat_account_id:
+ return res
+ res['value']['amount'] = self.pool.get('account.account').browse(cr, uid, vat_account_id,
+ context).balance
+ return res
+
+class account_tax_code(osv.osv):
+ _inherit = "account.tax.code"
+ _columns = {
+ 'vat_statement_account_id': fields.many2one('account.account', "Account used for VAT statement"),
+ 'vat_statement_type': fields.selection([('credit','Credit'),('debit','Debit')], 'Type', help="This establish whether amount will be loaded as debit or credit"),
+ 'vat_statement_sign': fields.integer('Sign used in statement', help="If tax code period sum is usually negative, set '-1' here"),
+ }
+ _defaults = {
+ 'vat_statement_type': 'debit',
+ 'vat_statement_sign': 1,
+ }
+
+class account_period(osv.osv):
+ _inherit = "account.period"
+ _columns = {
+ 'vat_statement_id': fields.many2one('account.vat.period.end.statement', "VAT statement"),
+ }
=== added file 'account_vat_period_end_statement/account_view.xml'
--- account_vat_period_end_statement/account_view.xml 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/account_view.xml 2013-03-16 13:20:28 +0000
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+<!-- Statement -->
+
+ <record id="view_account_vat_period_end_statement" model="ir.ui.view">
+ <field name="name">account.vat.period.end.statement.form</field>
+ <field name="model">account.vat.period.end.statement</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Vat statement">
+ <field name="journal_id" widget="selection" select="1"/>
+ <group col="2" colspan="2">
+ <field name="date" select="1" />
+ <!-- TODO check if it's manageable
+ <button name="open_chart_of_taxes" string="View chart of taxes for selected period" type="object"/>
+ -->
+ </group>
+ <field name="move_id" select="1"/>
+ <field name="payment_term_id" select="1"/>
+ <notebook colspan="4">
+ <page string="Periods">
+ <button type='action' name="%(action_add_period)d" string="Add period" colspan="2" attrs="{'readonly': [('state', 'in', ('confirmed', 'paid'))]}"></button>
+ <button type='action' name="%(action_remove_period)d" string="Remove period" colspan="2" attrs="{'readonly': [('state', 'in', ('confirmed', 'paid'))]}"></button>
+ <field name="period_ids" colspan="4" nolabel="1" readonly="1"/>
+ </page>
+ <page string="Accounts">
+ <group colspan="4" col="3">
+ <group col="2" colspan="3">
+ <field name="debit_vat_account_line_ids" nolabel="1" >
+ <tree editable="bottom" string="Debit Account Lines">
+ <field name="tax_code_id" />
+ <field name="account_id" />
+ <field name="amount" />
+ </tree>
+ <form>
+ <field name="tax_code_id" />
+ <field name="account_id" />
+ <field name="amount" />
+ </form>
+ </field>
+ <field name="credit_vat_account_line_ids" nolabel="1">
+ <tree editable="bottom" string="Credit Account Lines">
+ <field name="tax_code_id" />
+ <field name="account_id" />
+ <field name="amount" />
+ </tree>
+ <form>
+ <field name="tax_code_id" />
+ <field name="account_id" />
+ <field name="amount" />
+ </form>
+ </field>
+ </group>
+ <separator colspan="3" string="Previous Credits VAT"/>
+ <field name="previous_credit_vat_account_id" attrs="{'required':[('previous_credit_vat_amount','!=',0)]}"/>
+ <field name="previous_credit_vat_amount" nolabel="1"/>
+ <separator colspan="3" string="Previous Debits VAT"/>
+ <field name="previous_debit_vat_account_id" attrs="{'required':[('previous_debit_vat_amount','!=',0)]}"/>
+ <field name="previous_debit_vat_amount" nolabel="1"/>
+ <separator colspan="3" string="Other VAT Credits / Debits or Tax Compensations (Positive amounts for credits, negative for debits)"/>
+ <field name="generic_vat_account_line_ids" colspan="3" nolabel="1">
+ <tree editable="bottom" string="Account Lines">
+ <field name="account_id" on_change="on_change_vat_account_id(account_id)"/>
+ <field name="amount" />
+ </tree>
+ <form >
+ <field name="account_id" />
+ <field name="amount" />
+ </form>
+ </field>
+ </group>
+ <button type="object" name="compute_amounts" string="Recompute amounts" states="draft"></button>
+ </page>
+ <page string="Tax Authority">
+ <field name="authority_partner_id" select="1" on_change="on_change_partner_id(authority_partner_id)"/>
+ <field name="authority_vat_amount" />
+ <field name="authority_vat_account_id" select="1" />
+ <field name="residual" />
+ <separator string="Payments" colspan="4"/>
+ <field name="payment_ids" nolabel="1" colspan="4"/>
+ </page>
+ </notebook>
+ <field name="state" select="1"/>
+ <field name="reconciled"/>
+ <button name="create_move" states="draft" string="Create Move" colspan="2"/>
+ <button name="set_draft" states="confirmed,paid" string="Set to draft" colspan="2"/>
+ </form>
+ </field>
+ </record>
+ <record id="view_account_vat_period_end_statement_tree" model="ir.ui.view">
+ <field name="name">account.vat.period.end.statement.tree</field>
+ <field name="model">account.vat.period.end.statement</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree string="Vat statement">
+ <field name="date" />
+ <field name="journal_id" />
+ <field name="authority_vat_amount" />
+ <field name="state" />
+ </tree>
+ </field>
+ </record>
+
+ <record id="action_account_vat_period_end_statement" model="ir.actions.act_window">
+ <field name="name">Vat statement</field>
+ <field name="res_model">account.vat.period.end.statement</field>
+ </record>
+
+ <menuitem id="menu_account_vat_period_end_statement" action="action_account_vat_period_end_statement"
+ name="VAT statements" parent="account.menu_account_end_year_treatments"/>
+
+<!-- tax code -->
+
+ <record id="view_tax_code_form" model="ir.ui.view">
+ <field name="name">account.tax.code.form</field>
+ <field name="model">account.tax.code</field>
+ <field name="inherit_id" ref="account.view_tax_code_form"></field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <separator string="Description" position="before">
+ <group colspan="2" col="2">
+ <separator string="VAT statement" colspan="4"/>
+ <field name="vat_statement_account_id"/>
+ <field name="vat_statement_type"/>
+ <field name="vat_statement_sign"/>
+ </group>
+ </separator>
+ </field>
+ </record>
+
+ </data>
+</openerp>
=== added directory 'account_vat_period_end_statement/i18n'
=== added file 'account_vat_period_end_statement/i18n/account_vat_period_end_statement.pot'
--- account_vat_period_end_statement/i18n/account_vat_period_end_statement.pot 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/i18n/account_vat_period_end_statement.pot 2013-03-16 13:20:28 +0000
@@ -0,0 +1,379 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * account_vat_period_end_statement
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.3\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2011-09-10 08:34+0000\n"
+"PO-Revision-Date: 2011-09-10 08:34+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,voucher_id:0
+msgid "VAT payment"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: selection:account.vat.period.end.statement,state:0
+msgid "Confirmed"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Credit Account Lines"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: model:ir.model,name:account_vat_period_end_statement.model_statement_generic_account_line
+msgid "statement.generic.account.line"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/account.py:225
+#, python-format
+msgid "Other VAT Credits / Debits"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: model:ir.model,name:account_vat_period_end_statement.model_account_tax_code
+msgid "Tax Code"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: model:ir.model,name:account_vat_period_end_statement.model_account_vat_period_end_statement
+msgid "account.vat.period.end.statement"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:18
+msgid "Payable VAT"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+#: field:account.vat.period.end.statement,previous_debit_vat_account_id:0
+#: code:addons/account_vat_period_end_statement/account.py:208
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:58
+#, python-format
+msgid "Previous Debits VAT"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Set to draft"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: help:account.vat.period.end.statement,previous_credit_vat_account_id:0
+msgid "Credit VAT from previous periods"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Tax Authority"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,state:0
+msgid "State"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: selection:account.vat.period.end.statement,state:0
+msgid "Draft"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Load chargeable VAT"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: selection:account.tax.code,vat_statement_type:0
+msgid "Debit"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/account.py:241
+#, python-format
+msgid "Tax Authority VAT"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: model:ir.ui.menu,name:account_vat_period_end_statement.menu_account_vat_period_end_statement
+msgid "VAT statements"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.tax.code,vat_statement_type:0
+msgid "Type"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,previous_debit_vat_amount:0
+msgid "Previous Debits VAT Amount"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,credit_vat_account_line_ids:0
+#: code:addons/account_vat_period_end_statement/account.py:174
+#, python-format
+msgid "Credit VAT"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Debit Account Lines"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,journal_id:0
+msgid "Journal"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,payable_vat_amount:0
+msgid "Payable VAT Amount"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: selection:account.vat.period.end.statement,state:0
+msgid "Paid"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.tax.code:0
+#: code:addons/account_vat_period_end_statement/account.py:147
+#: field:statement.credit.account.line,statement_id:0
+#: field:statement.debit.account.line,statement_id:0
+#: field:statement.generic.account.line,statement_id:0
+#, python-format
+msgid "VAT statement"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: model:ir.module.module,description:account_vat_period_end_statement.module_meta_information
+msgid "This module helps to register the VAT statement of period end. The 'VAT statement' object allows to specify every amount and relative account used by the statement.\n"
+"By default, the amounts of debit and credit taxes are automatically loaded from the tax codes of the selected period. Previous debit or credit is loaded from previous VAT statement.\n"
+"In order to load the correct amount from tax code, the tax code has to be associated to the account involved in the statement, through the tax code form.\n"
+"Confirming the statement, the account.move is created along with a draft payment voucher.\n"
+"\n"
+"Specification: http://wiki.openerp-italia.org/doku.php/moduli/vat_period_end_statement"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: model:ir.model,name:account_vat_period_end_statement.model_statement_credit_account_line
+msgid "statement.credit.account.line"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/account.py:119
+#: code:addons/account_vat_period_end_statement/account.py:142
+#, python-format
+msgid "Error!"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,move_id:0
+msgid "VAT statement move"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/account.py:119
+#, python-format
+msgid "You cannot delete a confirmed or paid statement"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:10
+#: model:ir.actions.report.xml,name:account_vat_period_end_statement.print_vat_period_end_statement
+msgid "VAT Statement Summary"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Account Lines"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:statement.credit.account.line,account_id:0
+#: field:statement.debit.account.line,account_id:0
+#: field:statement.generic.account.line,account_id:0
+msgid "Account"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,generic_vat_account_line_ids:0
+msgid "Other VAT Credits / Debits or Tax Compensations"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: help:account.tax.code,vat_statement_type:0
+msgid "This establish whether amount will be loaded as debit or credit"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+#: field:account.vat.period.end.statement,previous_credit_vat_account_id:0
+#: code:addons/account_vat_period_end_statement/account.py:191
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:54
+#, python-format
+msgid "Previous Credits VAT"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,authority_vat_account_id:0
+msgid "Tax Authority VAT Account"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: model:ir.module.module,shortdesc:account_vat_period_end_statement.module_meta_information
+msgid "Period End VAT Statement"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,previous_credit_vat_amount:0
+msgid "Previous Credits VAT Amount"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.tax.code,vat_statement_account_id:0
+msgid "Account used for VAT statement"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: model:ir.model,name:account_vat_period_end_statement.model_statement_debit_account_line
+msgid "statement.debit.account.line"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,deductible_vat_amount:0
+msgid "Deductible VAT Amount"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:15
+#: field:statement.credit.account.line,amount:0
+#: field:statement.debit.account.line,amount:0
+#: field:statement.generic.account.line,amount:0
+msgid "Amount"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: help:account.vat.period.end.statement,previous_debit_vat_account_id:0
+msgid "Debit VAT from previous periods"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/account.py:142
+#, python-format
+msgid "The current period has VAT statement yet"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,authority_partner_id:0
+msgid "Tax Authority Partner"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:72
+msgid "Amount to pay"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Load deductible VAT"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.tax.code:0
+msgid "Description"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "View chart of taxes for selected period"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: help:account.vat.period.end.statement,debit_vat_account_line_ids:0
+msgid "The accounts containing the debit VAT amount to write-off"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: constraint:account.tax.code:0
+msgid "Error ! You can not create recursive accounts."
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: selection:account.tax.code,vat_statement_type:0
+msgid "Credit"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+#: model:ir.actions.act_window,name:account_vat_period_end_statement.action_account_vat_period_end_statement
+msgid "Vat statement"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,debit_vat_account_line_ids:0
+#: code:addons/account_vat_period_end_statement/account.py:157
+#, python-format
+msgid "Debit VAT"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: model:ir.model,name:account_vat_period_end_statement.model_account_voucher
+msgid "Accounting Voucher"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,period_id:0
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:11
+msgid "Period"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "General"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,authority_vat_amount:0
+msgid "Authority VAT Amount"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Other VAT Credits / Debits or Tax Compensations (Positive amounts for credits, negative for debits)"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Create Move"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: help:account.vat.period.end.statement,credit_vat_account_line_ids:0
+msgid "The accounts containing the credit VAT amount to write-off"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:28
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:46
+msgid "Total"
+msgstr ""
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:36
+msgid "Deductible VAT"
+msgstr ""
+
=== added file 'account_vat_period_end_statement/i18n/it.po'
--- account_vat_period_end_statement/i18n/it.po 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/i18n/it.po 2013-03-16 13:20:28 +0000
@@ -0,0 +1,432 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * account_vat_period_end_statement
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2012-06-22 10:31+0000\n"
+"PO-Revision-Date: 2012-06-22 12:35+0100\n"
+"Last-Translator: Lorenzo Battistini <lorenzo.battistini@xxxxxxxxxxx>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/report/vat_period_end_statement.py:35
+#, python-format
+msgid "Too many occurences of tax code %s"
+msgstr "Troppe occorrenze del codice impotsa %s"
+
+#. module: account_vat_period_end_statement
+#: selection:account.vat.period.end.statement,state:0
+msgid "Confirmed"
+msgstr "Confermato"
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Credit Account Lines"
+msgstr "Righe conti di credito"
+
+#. module: account_vat_period_end_statement
+#: model:ir.model,name:account_vat_period_end_statement.model_statement_generic_account_line
+msgid "statement.generic.account.line"
+msgstr "statement.generic.account.line"
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/account.py:381
+#, python-format
+msgid "Other VAT Credits / Debits"
+msgstr "Altri Crediti / Debiti per IVA"
+
+#. module: account_vat_period_end_statement
+#: help:account.vat.period.end.statement,reconciled:0
+msgid "It indicates that the statement has been paid and the journal entry of the statement has been reconciled with one or several journal entries of payment."
+msgstr "It indicates that the statement has been paid and the journal entry of the statement has been reconciled with one or several journal entries of payment."
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:42
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:70
+#: model:ir.model,name:account_vat_period_end_statement.model_account_tax_code
+#: field:statement.credit.account.line,tax_code_id:0
+#: field:statement.debit.account.line,tax_code_id:0
+msgid "Tax Code"
+msgstr "Codice imposta"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,authority_partner_id:0
+msgid "Tax Authority Partner"
+msgstr "Partner Erario"
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+#: field:account.vat.period.end.statement,previous_debit_vat_account_id:0
+#: code:addons/account_vat_period_end_statement/account.py:364
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:134
+#, python-format
+msgid "Previous Debits VAT"
+msgstr "IVA debiti precedenti"
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/report/vat_period_end_statement.py:43
+#, python-format
+msgid "No base code found for tax code %s"
+msgstr "Nessun codice imponibile trovato per il codice imposta %s"
+
+#. module: account_vat_period_end_statement
+#: help:account.vat.period.end.statement,previous_credit_vat_account_id:0
+msgid "Credit VAT from previous periods"
+msgstr "IVA a credito da periodi precedenti"
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Tax Authority"
+msgstr "Erario"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,state:0
+msgid "State"
+msgstr "Stato"
+
+#. module: account_vat_period_end_statement
+#: selection:account.vat.period.end.statement,state:0
+msgid "Draft"
+msgstr "Bozza"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,reconciled:0
+msgid "Paid/Reconciled"
+msgstr "Pagato/Riconciliato"
+
+#. module: account_vat_period_end_statement
+#: selection:account.tax.code,vat_statement_type:0
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:99
+msgid "Debit"
+msgstr "Debito"
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/account.py:397
+#, python-format
+msgid "Tax Authority VAT"
+msgstr "IVA Erario"
+
+#. module: account_vat_period_end_statement
+#: help:account.vat.period.end.statement,residual:0
+msgid "Remaining amount due."
+msgstr "Importo dovuto rimanente"
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "General"
+msgstr "Generale"
+
+#. module: account_vat_period_end_statement
+#: field:account.tax.code,vat_statement_type:0
+msgid "Type"
+msgstr "Tipo"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,previous_debit_vat_amount:0
+msgid "Previous Debits VAT Amount"
+msgstr "Importo IVA debiti precedenti"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,credit_vat_account_line_ids:0
+#: code:addons/account_vat_period_end_statement/account.py:330
+#, python-format
+msgid "Credit VAT"
+msgstr "IVA a credito"
+
+#. module: account_vat_period_end_statement
+#: model:ir.ui.menu,name:account_vat_period_end_statement.menu_account_vat_period_end_statement
+msgid "VAT statements"
+msgstr "Liquidazioni IVA"
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Debit Account Lines"
+msgstr "Righe conti di debito"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,journal_id:0
+msgid "Journal"
+msgstr "Sezionale"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,payable_vat_amount:0
+msgid "Payable VAT Amount"
+msgstr "Importo IVA Esigibile"
+
+#. module: account_vat_period_end_statement
+#: selection:account.vat.period.end.statement,state:0
+msgid "Paid"
+msgstr "Pagato"
+
+#. module: account_vat_period_end_statement
+#: view:account.tax.code:0
+#: code:addons/account_vat_period_end_statement/account.py:303
+#: field:statement.credit.account.line,statement_id:0
+#: field:statement.debit.account.line,statement_id:0
+#: field:statement.generic.account.line,statement_id:0
+#, python-format
+msgid "VAT statement"
+msgstr "Liquidazione IVA"
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:39
+msgid "Sales"
+msgstr "Vendite"
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:43
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:71
+msgid "Base"
+msgstr "Imponibile"
+
+#. module: account_vat_period_end_statement
+#: model:ir.model,name:account_vat_period_end_statement.model_statement_credit_account_line
+msgid "statement.credit.account.line"
+msgstr "statement.credit.account.line"
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/account.py:273
+#: code:addons/account_vat_period_end_statement/account.py:298
+#, python-format
+msgid "Error!"
+msgstr "Errore!"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,move_id:0
+msgid "VAT statement move"
+msgstr "Movimento liquidazione IVA"
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/report/vat_period_end_statement.py:48
+#, python-format
+msgid "Not every tax linked to tax code %s is linked the same base code"
+msgstr "Non tutte le imposte collegate al codice imposta %s sono collegate allo stesso codice imponibile"
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:34
+#: model:ir.actions.report.xml,name:account_vat_period_end_statement.print_vat_period_end_statement
+msgid "VAT Statement Summary"
+msgstr "Prospetto liquidazione IVA"
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Account Lines"
+msgstr "Righe conti"
+
+#. module: account_vat_period_end_statement
+#: field:statement.credit.account.line,account_id:0
+#: field:statement.debit.account.line,account_id:0
+#: field:statement.generic.account.line,account_id:0
+msgid "Account"
+msgstr "Conto"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,generic_vat_account_line_ids:0
+msgid "Other VAT Credits / Debits or Tax Compensations"
+msgstr "Altri Crediti / Debiti per IVA o compensazioni di imposta"
+
+#. module: account_vat_period_end_statement
+#: help:account.tax.code,vat_statement_type:0
+msgid "This establish whether amount will be loaded as debit or credit"
+msgstr "Questo stabilisce se il saldo debba essere caricato come debito o come credito"
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+#: field:account.vat.period.end.statement,previous_credit_vat_account_id:0
+#: code:addons/account_vat_period_end_statement/account.py:347
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:129
+#, python-format
+msgid "Previous Credits VAT"
+msgstr "IVA crediti precedenti"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,authority_vat_account_id:0
+msgid "Tax Authority VAT Account"
+msgstr "Conto IVA Erario"
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/account.py:273
+#, python-format
+msgid "You cannot delete a confirmed or paid statement"
+msgstr "Non è possibile eliminare una liquidazione confermata o pagata"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,previous_credit_vat_amount:0
+msgid "Previous Credits VAT Amount"
+msgstr "Importo IVA crediti precedenti"
+
+#. module: account_vat_period_end_statement
+#: field:account.tax.code,vat_statement_account_id:0
+msgid "Account used for VAT statement"
+msgstr "Conto utilizzato per la liquidazione IVA"
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:95
+msgid "Summary"
+msgstr "Riepilogo"
+
+#. module: account_vat_period_end_statement
+#: model:ir.model,name:account_vat_period_end_statement.model_statement_debit_account_line
+msgid "statement.debit.account.line"
+msgstr "statement.debit.account.line"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,deductible_vat_amount:0
+msgid "Deductible VAT Amount"
+msgstr "Importo IVA Deducibile"
+
+#. module: account_vat_period_end_statement
+#: field:statement.credit.account.line,amount:0
+#: field:statement.debit.account.line,amount:0
+#: field:statement.generic.account.line,amount:0
+msgid "Amount"
+msgstr "Importo"
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/account.py:414
+#, python-format
+msgid "The payment term %s does not have due dates"
+msgstr "Il termine di pagamento %s non ha date di scadenza"
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+#: field:account.vat.period.end.statement,payment_ids:0
+msgid "Payments"
+msgstr "Pagamenti"
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/account.py:413
+#: code:addons/account_vat_period_end_statement/report/vat_period_end_statement.py:35
+#: code:addons/account_vat_period_end_statement/report/vat_period_end_statement.py:43
+#: code:addons/account_vat_period_end_statement/report/vat_period_end_statement.py:48
+#, python-format
+msgid "Error"
+msgstr "Errore"
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:146
+msgid "Amount to pay"
+msgstr "Totale da pagare"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,residual:0
+msgid "Balance"
+msgstr "Saldo"
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:44
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:72
+msgid "VAT"
+msgstr "IVA"
+
+#. module: account_vat_period_end_statement
+#: view:account.tax.code:0
+msgid "Description"
+msgstr "Descrizione"
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:67
+msgid "Purchases"
+msgstr "Acquisti"
+
+#. module: account_vat_period_end_statement
+#: help:account.vat.period.end.statement,debit_vat_account_line_ids:0
+msgid "The accounts containing the debit VAT amount to write-off"
+msgstr "I conti contenenti l'IVA a debito da stornare"
+
+#. module: account_vat_period_end_statement
+#: help:account.vat.period.end.statement,previous_debit_vat_account_id:0
+msgid "Debit VAT from previous periods"
+msgstr "IVA a debito da periodi precedenti"
+
+#. module: account_vat_period_end_statement
+#: model:ir.model,name:account_vat_period_end_statement.model_account_vat_period_end_statement
+msgid "account.vat.period.end.statement"
+msgstr "account.vat.period.end.statement"
+
+#. module: account_vat_period_end_statement
+#: selection:account.tax.code,vat_statement_type:0
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:100
+msgid "Credit"
+msgstr "Credito"
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+#: model:ir.actions.act_window,name:account_vat_period_end_statement.action_account_vat_period_end_statement
+msgid "Vat statement"
+msgstr "Liquidazione IVA"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,debit_vat_account_line_ids:0
+#: code:addons/account_vat_period_end_statement/account.py:313
+#, python-format
+msgid "Debit VAT"
+msgstr "IVA a debito"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,payment_term_id:0
+msgid "Payment Term"
+msgstr "Termine di pagamento"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,period_id:0
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:35
+msgid "Period"
+msgstr "Periodo"
+
+#. module: account_vat_period_end_statement
+#: constraint:account.tax.code:0
+msgid "Error ! You can not create recursive accounts."
+msgstr "Errore! Non puoi creare conti ricorsivi"
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "View chart of taxes for selected period"
+msgstr "Visualizza i conti imposta per il periodo selezionato"
+
+#. module: account_vat_period_end_statement
+#: field:account.vat.period.end.statement,authority_vat_amount:0
+msgid "Authority VAT Amount"
+msgstr "Importo IVA Erario"
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Other VAT Credits / Debits or Tax Compensations (Positive amounts for credits, negative for debits)"
+msgstr "Altri crediti / debiti per IVA o compensazioni di imposta (importi positivi per i crediti, negativi per i debiti)"
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Create Move"
+msgstr "Crea movimento"
+
+#. module: account_vat_period_end_statement
+#: help:account.vat.period.end.statement,credit_vat_account_line_ids:0
+msgid "The accounts containing the credit VAT amount to write-off"
+msgstr "I conti contenenti l'IVA a credito da stornare"
+
+#. module: account_vat_period_end_statement
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:59
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:87
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:111
+#: report:addons/account_vat_period_end_statement/report/vat_period_end_statement.mako:124
+msgid "Total"
+msgstr "Totale"
+
+#. module: account_vat_period_end_statement
+#: view:account.vat.period.end.statement:0
+msgid "Set to draft"
+msgstr "Imposta a bozza"
+
+#. module: account_vat_period_end_statement
+#: code:addons/account_vat_period_end_statement/account.py:298
+#, python-format
+msgid "The current period has VAT statement yet"
+msgstr "Il periodo selezionato ha già una dichiarazione IVA"
+
=== added directory 'account_vat_period_end_statement/report'
=== added file 'account_vat_period_end_statement/report/__init__.py'
--- account_vat_period_end_statement/report/__init__.py 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/report/__init__.py 2013-03-16 13:20:28 +0000
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011 Domsense s.r.l. (<http://www.domsense.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 (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/>.
+#
+##############################################################################
+import vat_period_end_statement
=== added file 'account_vat_period_end_statement/report/vat_period_end_statement.mako'
--- account_vat_period_end_statement/report/vat_period_end_statement.mako 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/report/vat_period_end_statement.mako 2013-03-16 13:20:28 +0000
@@ -0,0 +1,193 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+table.tax_codes {
+ border-width: 1px;
+ border-spacing: 2px;
+ border-style: outset;
+ border-color: gray;
+ border-collapse: collapse;
+ background-color: white;
+ margin-right:auto;
+ margin-left:auto;
+}
+table.tax_codes th {
+ border-width: 1px;
+ padding: 4px;
+ border-style: inset;
+ border-color: gray;
+ background-color: white;
+}
+table.tax_codes td {
+ border-width: 1px;
+ padding: 4px;
+ border-style: inset;
+ border-color: gray;
+ background-color: white;
+}
+tr {
+ page-break-inside: avoid;
+}
+ </style>
+</head>
+<body>
+<% setLang(company.partner_id.lang) %>
+% for statement in objects:
+<h1 style="text-align: center;">${_("VAT Statement Summary")} </h1>
+<h2 style="text-align: center;">${_("Date")}: ${formatLang(statement.date, date=True)|entity} </h2>
+
+<table width="100%" class="tax_codes">
+ <tr >
+ <th colspan="3">${ _('Sales') }</th>
+ </tr>
+ <tr >
+ <th >${ _('Tax Code') }</th>
+ <th >${ _('Base') }</th>
+ <th >${ _('VAT') }</th>
+ </tr>
+ <% debit_total_base = 0.0 %>
+ <% debit_total_vat = 0.0 %>
+ <% totals_by_tax_code = {} %>
+ %for period in statement.period_ids:
+ <tr >
+ <td style="text-align:left" colspan="3"><strong>${ _('Period') + ' ' + period.name}</strong></td>
+ </tr>
+ <% debit_amounts = tax_codes_amounts(period.id, [l.tax_code_id.id for l in statement.debit_vat_account_line_ids]) %>
+ %for tax_code in debit_amounts :
+ <% if tax_code not in totals_by_tax_code: totals_by_tax_code[tax_code]={'base':0.0,'vat':0.0} %>
+ <% totals_by_tax_code[tax_code]['base'] += debit_amounts[tax_code]['base'] %>
+ <% totals_by_tax_code[tax_code]['vat'] += debit_amounts[tax_code]['vat'] %>
+ <tr >
+ <td style="text-align:left">${ tax_code|entity }</td>
+ <td style="text-align:right">${ formatLang(debit_amounts[tax_code]['base'])|entity }</td>
+ <td style="text-align:right">${ formatLang(debit_amounts[tax_code]['vat'])|entity }</td>
+ <% debit_total_base += debit_amounts[tax_code]['base'] %>
+ <% debit_total_vat += debit_amounts[tax_code]['vat'] %>
+ </tr>
+ %endfor
+ %endfor
+ <tr >
+ <td style="text-align:left" colspan="3"><strong>${ _('Totals')}</strong></td>
+ </tr>
+ %for tax_code in totals_by_tax_code:
+ <tr >
+ <td style="text-align:left">${ tax_code|entity }</td>
+ <td style="text-align:right">${ formatLang(totals_by_tax_code[tax_code]['base'])|entity }</td>
+ <td style="text-align:right">${ formatLang(totals_by_tax_code[tax_code]['vat'])|entity }</td>
+ </tr>
+ %endfor
+ <tr >
+ <td style="text-align:left"></td>
+ <td style="text-align:right"><strong>${ formatLang(debit_total_base)|entity }</strong></td>
+ <td style="text-align:right"><strong>${ formatLang(debit_total_vat)|entity }</strong></td>
+ </tr>
+</table>
+<br/><br/>
+<table width="100%" class="tax_codes">
+ <tr >
+ <th colspan="3">${ _('Purchases') }</th>
+ </tr>
+ <tr >
+ <th >${ _('Tax Code') }</th>
+ <th >${ _('Base') }</th>
+ <th >${ _('VAT') }</th>
+ </tr>
+ <% credit_total_base = 0.0 %>
+ <% credit_total_vat = 0.0 %>
+ <% totals_by_tax_code = {} %>
+ %for period in statement.period_ids:
+ <tr >
+ <td style="text-align:left" colspan="3"><strong>${ _('Period') + ' ' + period.name}</strong></td>
+ </tr>
+ <% credit_amounts = tax_codes_amounts(period.id, [l.tax_code_id.id for l in statement.credit_vat_account_line_ids]) %>
+ %for tax_code in credit_amounts :
+ <% if tax_code not in totals_by_tax_code: totals_by_tax_code[tax_code]={'base':0.0,'vat':0.0} %>
+ <% totals_by_tax_code[tax_code]['base'] += credit_amounts[tax_code]['base'] %>
+ <% totals_by_tax_code[tax_code]['vat'] += credit_amounts[tax_code]['vat'] %>
+ <tr >
+ <td style="text-align:left">${ tax_code|entity }</td>
+ <td style="text-align:right">${ formatLang(credit_amounts[tax_code]['base'])|entity }</td>
+ <td style="text-align:right">${ formatLang(credit_amounts[tax_code]['vat'])|entity }</td>
+ <% credit_total_base += credit_amounts[tax_code]['base'] %>
+ <% credit_total_vat += credit_amounts[tax_code]['vat'] %>
+ </tr>
+ %endfor
+ %endfor
+ <tr >
+ <td style="text-align:left" colspan="3"><strong>${ _('Totals')}</strong></td>
+ </tr>
+ %for tax_code in totals_by_tax_code:
+ <tr >
+ <td style="text-align:left">${ tax_code|entity }</td>
+ <td style="text-align:right">${ formatLang(totals_by_tax_code[tax_code]['base'])|entity }</td>
+ <td style="text-align:right">${ formatLang(totals_by_tax_code[tax_code]['vat'])|entity }</td>
+ </tr>
+ %endfor
+ <tr >
+ <td style="text-align:left"></td>
+ <td style="text-align:right"><strong>${ formatLang(credit_total_base)|entity }</strong></td>
+ <td style="text-align:right"><strong>${ formatLang(credit_total_vat)|entity }</strong></td>
+ </tr>
+</table>
+<br/><br/>
+<table class="tax_codes" width="100%" >
+ <tr >
+ <th colspan="3">${_("Summary")}</th>
+ </tr>
+ <tr>
+ <th></th>
+ <th> ${ _('Debit') }</th>
+ <th> ${ _('Credit') }</th>
+ </tr>
+ %for debit_line in statement.debit_vat_account_line_ids :
+ <tr >
+ <td>${ debit_line.account_id.name|entity }</td>
+ <td>${ formatLang(debit_line.amount)|entity }</td>
+ <td></td>
+ </tr>
+ %endfor
+ <!--
+ <tr >
+ <td>${_("Total")}</td>
+ <td>${ statement.payable_vat_amount|entity }</td>
+ </tr>
+ -->
+ %for credit_line in statement.credit_vat_account_line_ids :
+ <tr >
+ <td>${ credit_line.account_id.name|entity }</td>
+ <td></td>
+ <td>${ formatLang(credit_line.amount)|entity }</td>
+ </tr>
+ %endfor
+ <!--
+ <tr >
+ <td>${_("Total")}</td>
+ <td>${ statement.deductible_vat_amount|entity }</td>
+ </tr>
+ -->
+ <tr >
+ <td>${_("Previous Credits VAT")}</td>
+ <td></td>
+ <td>${ formatLang(statement.previous_credit_vat_amount)|entity }</td>
+ </tr>
+ <tr >
+ <td>${_("Previous Debits VAT")}</td>
+ <td>${ formatLang(statement.previous_debit_vat_amount)|entity }</td>
+ <td></td>
+ </tr>
+ %for generic_line in statement.generic_vat_account_line_ids :
+ <tr >
+ <td>${ generic_line.account_id.name|entity }</td>
+ <td>${ generic_line.amount < 0 and formatLang(generic_line.amount) or ''|entity }</td>
+ <td>${ generic_line.amount > 0 and formatLang(generic_line.amount) or ''|entity }</td>
+ </tr>
+ %endfor
+ <tr >
+ <td><strong>${_("Amount to pay")}</strong></td>
+ <td colspan="2" style="text-align:center"><strong>${ formatLang(statement.authority_vat_amount)|entity }</strong></td>
+ </tr>
+</table>
+%endfor
+</body>
+</html>
=== added file 'account_vat_period_end_statement/report/vat_period_end_statement.py'
--- account_vat_period_end_statement/report/vat_period_end_statement.py 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/report/vat_period_end_statement.py 2013-03-16 13:20:28 +0000
@@ -0,0 +1,94 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2012 Domsense s.r.l. (<http://www.domsense.com>).
+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.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 (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/>.
+#
+##############################################################################
+
+import time
+from report import report_sxw
+from tools.translate import _
+
+class print_vat_period_end_statement(report_sxw.rml_parse):
+ _name = 'parser.vat.period.end.statement'
+
+ def _build_codes_dict(self, tax_code, res={}, context=None):
+ if context is None:
+ context = {}
+ tax_pool = self.pool.get('account.tax')
+ if tax_code.sum_period:
+ if res.get(tax_code.name, False):
+ raise osv.except_osv(_('Error'), _('Too many occurences of tax code %s') % tax_code.name)
+ # search for taxes linked to that code
+ tax_ids = tax_pool.search(self.cr, self.uid, [('tax_code_id', '=', tax_code.id)], context=context)
+ if tax_ids:
+ tax = tax_pool.browse(self.cr, self.uid, tax_ids[0], context=context)
+ # search for the related base code
+ base_code = tax.base_code_id or tax.parent_id and tax.parent_id.base_code_id or False
+ if not base_code:
+ raise osv.except_osv(_('Error'), _('No base code found for tax code %s') % tax_code.name)
+ # check if every tax is linked to the same tax code and base code
+ for tax in tax_pool.browse(self.cr, self.uid, tax_ids, context=context):
+ test_base_code = tax.base_code_id or tax.parent_id and tax.parent_id.base_code_id or False
+ if test_base_code.id != base_code.id:
+ raise osv.except_osv(_('Error'), _('Not every tax linked to tax code %s is linked the same base code') % tax_code.name)
+ res[tax_code.name] = {
+ 'vat': tax_code.sum_period,
+ 'base': base_code.sum_period,
+ }
+ for child_code in tax_code.child_ids:
+ res = self._build_codes_dict(child_code, res=res, context=context)
+ return res
+
+ def _get_tax_codes_amounts(self, period_id, tax_code_ids=[], context=None):
+ if context is None:
+ context = {}
+ res = {}
+ code_pool = self.pool.get('account.tax.code')
+ context['period_id'] = period_id
+ for tax_code in code_pool.browse(self.cr, self.uid, tax_code_ids, context=context):
+ res = self._build_codes_dict(tax_code, res=res, context=context)
+ return res
+
+ def find_period(self, date,context=None):
+ if context is None:
+ context = {}
+ period_pool = self.pool.get('account.period')
+ period_ids = period_pool.find(self.cr, self.uid, dt=date, context=context)
+ if len(period_ids)> 1:
+ raise osv.except_osv(_('Error'), _('Too many periods for date %s') % str(date))
+ return period_ids[0]
+
+ def __init__(self, cr, uid, name, context=None):
+ if context is None:
+ context = {}
+ super(print_vat_period_end_statement, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update( {
+ 'time': time,
+ 'tax_codes_amounts': self._get_tax_codes_amounts,
+ 'find_period': self.find_period,
+ })
+ self.context = context
+
+report_sxw.report_sxw('report.account.print.vat.period.end.statement',
+ 'account.vat.period.end.statement',
+ 'addons/account_vat_period_end_statement/report/vat_period_end_statement.mako',
+ parser=print_vat_period_end_statement)
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_vat_period_end_statement/reports.xml'
--- account_vat_period_end_statement/reports.xml 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/reports.xml 2013-03-16 13:20:28 +0000
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+
+ <report
+ auto="False"
+ id="print_vat_period_end_statement"
+ model="account.vat.period.end.statement"
+ name="account.print.vat.period.end.statement"
+ file="account_vat_period_end_statement/report/vat_period_end_statement.mako"
+ string="VAT Statement Summary"
+ report_type="webkit" />
+
+ </data>
+</openerp>
+
=== added directory 'account_vat_period_end_statement/security'
=== added file 'account_vat_period_end_statement/security/ir.model.access.csv'
--- account_vat_period_end_statement/security/ir.model.access.csv 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/security/ir.model.access.csv 2013-03-16 13:20:28 +0000
@@ -0,0 +1,9 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_account_vat_period_end_statement_accountant","access_account_vat_period_end_statement_accountant","model_account_vat_period_end_statement","account.group_account_user","1","1","1","1"
+"access_account_vat_period_end_statement_manager","access_account_vat_period_end_statement_manager","model_account_vat_period_end_statement","account.group_account_manager","1","1","1","1"
+"access_statement_debit_account_line_accountant","access_statement_debit_account_line_accountant","model_statement_debit_account_line","account.group_account_user","1","1","1","1"
+"access_statement_debit_account_line_manager","access_statement_debit_account_line_manager","model_statement_debit_account_line","account.group_account_manager","1","1","1","1"
+"access_statement_credit_account_line_accountant","access_statement_credit_account_line_accountant","model_statement_credit_account_line","account.group_account_user","1","1","1","1"
+"access_statement_credit_account_line_manager","access_statement_credit_account_line_manager","model_statement_credit_account_line","account.group_account_manager","1","1","1","1"
+"access_statement_generic_account_line_accountant","access_statement_generic_account_line_accountant","model_statement_generic_account_line","account.group_account_user","1","1","1","1"
+"access_statement_generic_account_line_manager","access_statement_generic_account_line_manager","model_statement_generic_account_line","account.group_account_manager","1","1","1","1"
=== added file 'account_vat_period_end_statement/statement_workflow.xml'
--- account_vat_period_end_statement/statement_workflow.xml 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/statement_workflow.xml 2013-03-16 13:20:28 +0000
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+ <record model="workflow" id="wkf_vat_period_end_statement">
+ <field name="name">workflow.vat.period.end.statement</field>
+ <field name="osv">account.vat.period.end.statement</field>
+ <field name="on_create">True</field>
+ </record>
+
+ <record model="workflow.activity" id="act_draft">
+ <field name="wkf_id" ref="wkf_vat_period_end_statement" />
+ <field name="flow_start">True</field>
+ <field name="name">draft</field>
+ <field name="kind">function</field>
+ <field name="action">statement_draft()</field>
+ </record>
+
+ <record model="workflow.activity" id="act_move_created">
+ <field name="wkf_id" ref="wkf_vat_period_end_statement" />
+ <field name="name">created</field>
+ <field name="kind">function</field>
+ <field name="action">create_move()</field>
+ </record>
+
+ <record model="workflow.activity" id="act_statement_paid">
+ <field name="wkf_id" ref="wkf_vat_period_end_statement" />
+ <field name="name">paid</field>
+ <field name="kind">function</field>
+ <field name="action">statement_paid()</field>
+<!-- <field name="flow_stop">True</field> -->
+ </record>
+
+ <record model="workflow.transition" id="t1">
+ <field name="act_from" ref="act_draft" />
+ <field name="act_to" ref="act_move_created" />
+ <field name="signal">create_move</field>
+ </record>
+
+ <record model="workflow.transition" id="t2">
+ <field name="act_to" ref="act_draft" />
+ <field name="act_from" ref="act_move_created" />
+ <field name="signal">set_draft</field>
+ </record>
+
+ <record id="t3" model="workflow.transition">
+ <field name="act_to" ref="act_statement_paid" />
+ <field name="act_from" ref="act_move_created" />
+ <field name="trigger_model">account.move.line</field>
+ <field name="trigger_expr_id">move_line_id_payment_get()</field>
+ <field name="condition">test_paid()</field>
+ </record>
+
+ <record model="workflow.transition" id="t4">
+ <field name="act_to" ref="act_draft" />
+ <field name="act_from" ref="act_statement_paid" />
+ <field name="signal">set_draft</field>
+ </record>
+
+ </data>
+</openerp>
=== added directory 'account_vat_period_end_statement/test'
=== added file 'account_vat_period_end_statement/test/account_tax.xml'
--- account_vat_period_end_statement/test/account_tax.xml 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/test/account_tax.xml 2013-03-16 13:20:28 +0000
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data noupdate="1">
+
+ <!-- Tax codes -->
+
+ <record id="account_tax_code_21" model="account.tax.code">
+ <field name="name">21 %</field>
+ <field name="vat_statement_type">debit</field>
+ <field name="vat_statement_account_id">account.ova</field>
+ </record>
+ <record id="account_tax_code_21_imp" model="account.tax.code">
+ <field name="name">21 % IMP</field>
+ </record>
+
+ <record id="account_tax_code_21_credit" model="account.tax.code">
+ <field name="name">21 % (credit)</field>
+ <field name="vat_statement_type">credit</field>
+ <field name="vat_statement_account_id">account.iva</field>
+ </record>
+ <record id="account_tax_code_21_imp_credit" model="account.tax.code">
+ <field name="name">21 % IMP</field>
+ </record>
+
+ <!-- taxes -->
+
+ <record id="account_tax_21" model="account.tax">
+ <field name="name">21 %</field>
+ <field name="amount">0.21</field>
+ <field name="tax_code_id" ref="account_tax_code_21"></field>
+ <field name="base_code_id" ref="account_tax_code_21_imp"></field>
+ </record>
+
+ <record id="account_tax_21_credit" model="account.tax">
+ <field name="name">21 % (credit)</field>
+ <field name="amount">0.21</field>
+ <field name="tax_code_id" ref="account_tax_code_21_credit"></field>
+ <field name="base_code_id" ref="account_tax_code_21_imp_credit"></field>
+ </record>
+
+ <!-- account -->
+
+ <record id="vat_authority" model="account.account">
+ <field name="code">VAT AUTH</field>
+ <field name="name">VAT Authority</field>
+ <field ref="cli" name="parent_id"/>
+ <field name="type">payable</field>
+ <field eval="True" name="reconcile"/>
+ <field name="user_type" ref="data_account_type_payable"/>
+ </record>
+
+ <!--
+ Payment term
+ -->
+ <record id="account_payment_term" model="account.payment.term">
+ <field name="name">16 Days End of Month</field>
+ <field name="note">16 Days End of Month</field>
+ </record>
+ <record id="account_payment_term_line" model="account.payment.term.line">
+ <field name="name">16 Days End of Month</field>
+ <field name="value">balance</field>
+ <field eval="16" name="days"/>
+ <field eval="-1" name="days2"/>
+ <field eval="account_payment_term" name="payment_id"/>
+ </record>
+
+ </data>
+</openerp>
=== added file 'account_vat_period_end_statement/test/tax_computation.yml'
--- account_vat_period_end_statement/test/tax_computation.yml 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/test/tax_computation.yml 2013-03-16 13:20:28 +0000
@@ -0,0 +1,69 @@
+-
+ I create a new customer invoice
+-
+ !record {model: account.invoice, id: account_invoice_customer_0}:
+ account_id: account.a_recv
+ address_contact_id: base.res_partner_address_zen
+ address_invoice_id: base.res_partner_address_zen
+ company_id: base.main_company
+ currency_id: base.EUR
+ date_invoice: !eval time.strftime('%Y-%m-%d')
+ type: out_invoice
+ invoice_line:
+ - account_id: account.a_sale
+ name: '100'
+ price_unit: 100
+ quantity: 1.0
+ invoice_line_tax_id:
+ - account_tax_21
+ journal_id: account.sales_journal
+ partner_id: base.res_partner_3
+
+-
+ I confirm and open the invoice
+-
+ !workflow {model: account.invoice, ref: account_invoice_customer_0, action: invoice_open}
+-
+ I create a new supplier invoice
+-
+ !record {model: account.invoice, id: account_invoice_supplier_0}:
+ account_id: account.a_pay
+ address_contact_id: base.res_partner_address_7
+ address_invoice_id: base.res_partner_address_7
+ company_id: base.main_company
+ currency_id: base.EUR
+ date_invoice: !eval time.strftime('%Y-%m-%d')
+ type: in_invoice
+ invoice_line:
+ - account_id: account.a_expense
+ name: '50'
+ price_unit: 50
+ quantity: 1.0
+ invoice_line_tax_id:
+ - account_tax_21_credit
+ journal_id: account.expenses_journal
+ partner_id: base.res_partner_4
+
+-
+ I confirm and open the invoice
+-
+ !workflow {model: account.invoice, ref: account_invoice_supplier_0, action: invoice_open}
+
+-
+ I create the vat statement
+-
+ !python {model: account.vat.period.end.statement}: |
+ period_id = self.pool.get('account.period').find(cr, uid, dt=time.strftime('%Y-%m-%d'))
+ on_change_res = self.on_change_period_id(cr, uid, [], period_id)
+
+ !record {model: account.vat.period.end.statement, id: account_vat_statement_0}:
+ period_id: period_id
+ journal_id: account.miscellaneous_journal
+ debit_vat_account_line_ids: on_change_res['value']['debit_vat_account_line_ids']
+ credit_vat_account_line_ids: on_change_res['value']['credit_vat_account_line_ids']
+ authority_vat_account_id: vat_authority
+ payment_term_id: account_payment_term
+-
+ I confirm and open the statement
+-
+ !workflow {model: account.vat.period.end.statement, ref: account_vat_statement_0, action: create_move}
=== added directory 'account_vat_period_end_statement/wizard'
=== added file 'account_vat_period_end_statement/wizard/__init__.py'
--- account_vat_period_end_statement/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/wizard/__init__.py 2013-03-16 13:20:28 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2012 Domsense s.r.l. (<http://www.domsense.com>).
+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.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 (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/>.
+#
+##############################################################################
+import add_period
+import remove_period
=== added file 'account_vat_period_end_statement/wizard/add_period.py'
--- account_vat_period_end_statement/wizard/add_period.py 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/wizard/add_period.py 2013-03-16 13:20:28 +0000
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2012 Domsense s.r.l. (<http://www.domsense.com>).
+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.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 (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 osv import fields, osv
+from tools.translate import _
+
+class add_period(osv.osv_memory):
+
+ _name = 'add.period.to.vat.statement'
+
+ _columns = {
+ 'period_id': fields.many2one('account.period','Period', required=True),
+ }
+
+ def add_period(self, cr, uid, ids, context=None):
+ if 'active_id' not in context:
+ raise osv.except_osv(_('Error'), _('Current statement not found'))
+ statement_pool=self.pool.get('account.vat.period.end.statement')
+ wizard = self.browse(cr, uid, ids, context)[0]
+ if wizard.period_id.vat_statement_id:
+ raise osv.except_osv(_('Error'), _('Period %s is associated to statement %s yet') % (wizard.period_id.name, wizard.period_id.vat_statement_id.date))
+ wizard.period_id.write({'vat_statement_id': context['active_id']})
+ statement_pool.compute_amounts(cr, uid, [context['active_id']], context=context)
+ return {
+ 'type': 'ir.actions.act_window_close',
+ }
+
+
=== added file 'account_vat_period_end_statement/wizard/add_period.xml'
--- account_vat_period_end_statement/wizard/add_period.xml 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/wizard/add_period.xml 2013-03-16 13:20:28 +0000
@@ -0,0 +1,27 @@
+<?xml version="1.0" ?>
+<openerp>
+ <data>
+ <record id="add_period" model="ir.ui.view">
+ <field name="name">add_period</field>
+ <field name="model">add.period.to.vat.statement</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Add period">
+ <field name="period_id"></field>
+ <group col="2" colspan="4">
+ <button icon="gtk-cancel" special="cancel" string="Cancel"/>
+ <button icon="gtk-ok" name="add_period" string="Add" type="object"/>
+ </group>
+ </form>
+ </field>
+ </record>
+ <record id="action_add_period" model="ir.actions.act_window">
+ <field name="name">Add period</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">add.period.to.vat.statement</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+ </record>
+ </data>
+</openerp>
=== added file 'account_vat_period_end_statement/wizard/remove_period.py'
--- account_vat_period_end_statement/wizard/remove_period.py 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/wizard/remove_period.py 2013-03-16 13:20:28 +0000
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2012 Domsense s.r.l. (<http://www.domsense.com>).
+# Copyright (C) 2012 Agile Business Group sagl (<http://www.agilebg.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 (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 osv import fields, osv
+from tools.translate import _
+
+class remove_period(osv.osv_memory):
+
+ def _get_period_ids(self, cr, uid, context=None):
+ statement_obj = self.pool.get('account.vat.period.end.statement')
+ res = []
+ if context.has_key('active_id'):
+ statement = statement_obj.browse(cr, uid, context['active_id'], context)
+ for period in statement.period_ids:
+ res.append((period.id, period.name))
+ return res
+
+ _name = 'remove.period.from.vat.statement'
+
+ _columns = {
+ 'period_id': fields.selection(_get_period_ids, 'Period', required=True),
+ }
+
+ def remove_period(self, cr, uid, ids, context=None):
+ if 'active_id' not in context:
+ raise osv.except_osv(_('Error'), _('Current statement not found'))
+ self.pool.get('account.period').write(cr, uid, [int(self.browse(cr, uid, ids, context)[0].period_id)], {'vat_statement_id': False}, context=context)
+ self.pool.get('account.vat.period.end.statement').compute_amounts(cr, uid, [context['active_id']], context=context)
+ return {
+ 'type': 'ir.actions.act_window_close',
+ }
+
+
=== added file 'account_vat_period_end_statement/wizard/remove_period.xml'
--- account_vat_period_end_statement/wizard/remove_period.xml 1970-01-01 00:00:00 +0000
+++ account_vat_period_end_statement/wizard/remove_period.xml 2013-03-16 13:20:28 +0000
@@ -0,0 +1,27 @@
+<?xml version="1.0" ?>
+<openerp>
+ <data>
+ <record id="remove_period" model="ir.ui.view">
+ <field name="name">remove_period</field>
+ <field name="model">remove.period.from.vat.statement</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Remove period">
+ <field name="period_id"></field>
+ <group col="2" colspan="4">
+ <button icon="gtk-cancel" special="cancel" string="Cancel"/>
+ <button icon="gtk-ok" name="remove_period" string="Remove" type="object"/>
+ </group>
+ </form>
+ </field>
+ </record>
+ <record id="action_remove_period" model="ir.actions.act_window">
+ <field name="name">Remove period</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">remove.period.from.vat.statement</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+ </record>
+ </data>
+</openerp>
Follow ups