From 2924a02e94465a0658bfbc32b0c2fe454cd62e54 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Tue, 11 Nov 2014 16:01:01 +0100 Subject: [PATCH 01/11] Move account_tax_analysis from __unported__ to root --- .../account_tax_analysis => account_tax_analysis}/__init__.py | 0 .../account_tax_analysis => account_tax_analysis}/__openerp__.py | 0 .../account_tax_analysis.py | 0 .../account_tax_analysis_view.xml | 0 .../i18n/account_tax_analysis.pot | 0 .../account_tax_analysis => account_tax_analysis}/i18n/pt_BR.po | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename {__unported__/account_tax_analysis => account_tax_analysis}/__init__.py (100%) rename {__unported__/account_tax_analysis => account_tax_analysis}/__openerp__.py (100%) rename {__unported__/account_tax_analysis => account_tax_analysis}/account_tax_analysis.py (100%) rename {__unported__/account_tax_analysis => account_tax_analysis}/account_tax_analysis_view.xml (100%) rename {__unported__/account_tax_analysis => account_tax_analysis}/i18n/account_tax_analysis.pot (100%) rename {__unported__/account_tax_analysis => account_tax_analysis}/i18n/pt_BR.po (100%) diff --git a/__unported__/account_tax_analysis/__init__.py b/account_tax_analysis/__init__.py similarity index 100% rename from __unported__/account_tax_analysis/__init__.py rename to account_tax_analysis/__init__.py diff --git a/__unported__/account_tax_analysis/__openerp__.py b/account_tax_analysis/__openerp__.py similarity index 100% rename from __unported__/account_tax_analysis/__openerp__.py rename to account_tax_analysis/__openerp__.py diff --git a/__unported__/account_tax_analysis/account_tax_analysis.py b/account_tax_analysis/account_tax_analysis.py similarity index 100% rename from __unported__/account_tax_analysis/account_tax_analysis.py rename to account_tax_analysis/account_tax_analysis.py diff --git a/__unported__/account_tax_analysis/account_tax_analysis_view.xml b/account_tax_analysis/account_tax_analysis_view.xml similarity index 100% rename from __unported__/account_tax_analysis/account_tax_analysis_view.xml rename to account_tax_analysis/account_tax_analysis_view.xml diff --git a/__unported__/account_tax_analysis/i18n/account_tax_analysis.pot b/account_tax_analysis/i18n/account_tax_analysis.pot similarity index 100% rename from __unported__/account_tax_analysis/i18n/account_tax_analysis.pot rename to account_tax_analysis/i18n/account_tax_analysis.pot diff --git a/__unported__/account_tax_analysis/i18n/pt_BR.po b/account_tax_analysis/i18n/pt_BR.po similarity index 100% rename from __unported__/account_tax_analysis/i18n/pt_BR.po rename to account_tax_analysis/i18n/pt_BR.po From 05e58eec0216b0d058975bee9c13da577a6d148b Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Tue, 11 Nov 2014 16:02:25 +0100 Subject: [PATCH 02/11] Module installable --- account_tax_analysis/__openerp__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/account_tax_analysis/__openerp__.py b/account_tax_analysis/__openerp__.py index 5dfea9c03..78a4272f7 100644 --- a/account_tax_analysis/__openerp__.py +++ b/account_tax_analysis/__openerp__.py @@ -36,7 +36,6 @@ This way you will find easily differences you may see between the OpenERP tax report and what you see in your books.""", "website": "http://www.camptocamp.com", "data": ["account_tax_analysis_view.xml"], - 'installable': False, + 'installable': True, "active": False, } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 15e50961676b76abab37c4283d9b4ee214bebcd6 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Tue, 11 Nov 2014 16:02:59 +0100 Subject: [PATCH 03/11] Extract the module's description to README.rst --- account_tax_analysis/README.rst | 11 +++++++++++ account_tax_analysis/__openerp__.py | 12 ------------ 2 files changed, 11 insertions(+), 12 deletions(-) create mode 100644 account_tax_analysis/README.rst diff --git a/account_tax_analysis/README.rst b/account_tax_analysis/README.rst new file mode 100644 index 000000000..3e953de06 --- /dev/null +++ b/account_tax_analysis/README.rst @@ -0,0 +1,11 @@ +Tax analysis view +================= + +This add-on is a must if you want to be able to validate your VAT form. + +Thanks to a new menu 'Invoicing / Reporting / Generic Reporting / Taxes / Taxes Analysis' +you are able to group accounting entries by Taxes (VAT codes) +and/or financial accounts. + +This way you will find easily differences you may see between +the OpenERP tax report and what you see in your books. diff --git a/account_tax_analysis/__openerp__.py b/account_tax_analysis/__openerp__.py index 78a4272f7..4e2ba8dff 100644 --- a/account_tax_analysis/__openerp__.py +++ b/account_tax_analysis/__openerp__.py @@ -22,18 +22,6 @@ "depends": ["base", "account"], "author": "CamptoCamp SA", "category": 'Accounting & Finance', - "description": """ -Tax analysis view -================= - -This add-on is a must if you want to be able to validate your VAT form. - -Thanks to a new menu 'Accounting / Tax / Tax analysis' -you are able to group accounting entries by Taxes (VAT codes) -and/or financial accounts. - -This way you will find easily differences you may see between -the OpenERP tax report and what you see in your books.""", "website": "http://www.camptocamp.com", "data": ["account_tax_analysis_view.xml"], 'installable': True, From 90f99c2bd0674bf5b41279c5687f0e9f5d280038 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Tue, 11 Nov 2014 16:29:27 +0100 Subject: [PATCH 04/11] Migrate the model to the new API, also, it should be a TransientModel --- account_tax_analysis/account_tax_analysis.py | 59 +++++++++----------- 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/account_tax_analysis/account_tax_analysis.py b/account_tax_analysis/account_tax_analysis.py index a8a05b679..e7b62a83b 100644 --- a/account_tax_analysis/account_tax_analysis.py +++ b/account_tax_analysis/account_tax_analysis.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- ############################################################################## # -# Author Vincent Renaville. Copyright 2013 Camptocamp SA +# Author Vincent Renaville. Copyright 2013-2014 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -17,41 +17,36 @@ # along with this program. If not, see . # ############################################################################## -from osv import orm, osv, fields -from tools.translate import _ +from openerp import models, fields, api, exceptions, _ -class account_tax_declaration_analysis(orm.TransientModel): +class AccountTaxDeclarationAnalysis(models.TransientModel): _name = 'account.vat.declaration.analysis' _description = 'Account Vat Declaration' - _columns = { - 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscalyear', - help='Fiscalyear to look on', - required=True), - 'period_list': fields.many2many('account.period', - 'account_tax_period_rel', - 'tax_analysis', 'period_id', - 'Period _list', required=True), - } + fiscalyear_id = fields.Many2one( + comodel_name='account.fiscalyear', + string='Fiscalyear', + help='Fiscalyear to look on', + required=True, + ) - def create_vat(self, cr, uid, ids, context=None): - mod_obj = self.pool.get('ir.model.data') - action_obj = self.pool.get('ir.actions.act_window') - domain = [] - data = self.read(cr, uid, ids, [], context=context)[0] - period_list = data['period_list'] - if period_list: - domain = [('period_id', 'in', period_list)] - else: - raise osv.except_osv(_('No period defined'), - _("You must selected period ")) - actions = mod_obj.get_object_reference(cr, uid, - 'account_tax_analysis', - 'action_view_tax_analysis') - id_action = actions[1] if actions else False - action_mod = action_obj.read(cr, uid, id_action) - action_mod['domain'] = domain - return action_mod + period_list = fields.Many2many( + comodel_name='account.period', + relation='account_tax_period_rel', + column1='tax_analysis', + column2='period_id', + string='Periods', + required=True, + ) -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + @api.multi + def show_vat(self): + action_obj = self.env['ir.actions.act_window'] + if not self.period_list: + raise exceptions.Warning(_("You must select periods")) + domain = [('period_id', 'in', self.period_list.ids)] + action = self.env.ref('account_tax_analysis.action_view_tax_analysis') + action_fields = action.read()[0] + action_fields['domain'] = domain + return action_fields From 20076948e130de4784c2944fa63254f276e95653 Mon Sep 17 00:00:00 2001 From: Guewen Baconnier Date: Tue, 11 Nov 2014 16:30:04 +0100 Subject: [PATCH 05/11] type is useless, wrong name --- account_tax_analysis/account_tax_analysis_view.xml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/account_tax_analysis/account_tax_analysis_view.xml b/account_tax_analysis/account_tax_analysis_view.xml index 53f2f8dc8..317c6368e 100644 --- a/account_tax_analysis/account_tax_analysis_view.xml +++ b/account_tax_analysis/account_tax_analysis_view.xml @@ -3,7 +3,6 @@ Journal Items Tax account.move.line - search @@ -50,7 +49,6 @@ account.move.line.tree account.move.line - tree @@ -73,7 +71,7 @@ - Recurring Models + Taxes Analysis account.move.line form tree @@ -84,7 +82,6 @@ Account Vat Declaration account.vat.declaration.analysis - form
@@ -94,7 +91,7 @@