diff --git a/account_tax_balance/README.rst b/account_tax_balance/README.rst index dfb0c29e..0f84f47d 100644 --- a/account_tax_balance/README.rst +++ b/account_tax_balance/README.rst @@ -1,13 +1,38 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html - :alt: License: AGPL-3 +=========== +Tax Balance +=========== -============ -Tax Balances -============ +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--reporting-lightgray.png?logo=github + :target: https://github.com/OCA/account-financial-reporting/tree/12.0/account_tax_balance + :alt: OCA/account-financial-reporting +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-financial-reporting-11-0/account-financial-reporting-11-0-account_tax_balance + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/91/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| This module allows to compute tax balances within a certain date range. -It depends on date_range module and exposes 'compute' methods that can be called by other modules (like localization ones) +It depends on date_range module and exposes 'compute' methods that can be called by other modules +(like localization ones). + +**Table of contents** + +.. contents:: + :local: Usage ===== @@ -18,46 +43,50 @@ Select the company, the date range, the target moves and 'open taxes' .. figure:: /account_tax_balance/static/description/tax_balance.png -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/91/11.0 - Bug Tracker =========== -Bugs are tracked on `GitHub Issues -`_. In case of trouble, please -check there if your issue has already been reported. If you spotted it first, -help us smashing it by providing a detailed and welcomed feedback. +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* Agile Business Group +* Therp BV +* Tecnativa +* ACSONE SA/NV Contributors ------------- +~~~~~~~~~~~~ * Lorenzo Battistini * Giovanni Capalbo * Tecnativa - Antonio Espinosa * Tecnativa - Pedro M. Baeza * ACSONE SA/NV - Stéphane Bidoul +* Andrea Stirpe -Maintainer ----------- +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org -This module is maintained by the OCA. - OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/account-financial-reporting `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_tax_balance/__manifest__.py b/account_tax_balance/__manifest__.py index 78554c35..6d48462c 100644 --- a/account_tax_balance/__manifest__.py +++ b/account_tax_balance/__manifest__.py @@ -6,13 +6,12 @@ { "name": "Tax Balance", "summary": "Compute tax balances based on date range", - "version": "11.0.1.0.0", - "category": "Accounting & Finance", - "website": "https://www.agilebg.com/", + "version": "12.0.1.0.0", + "category": "Invoices & Payments", + "website": "https://github.com/OCA/account-financial-reporting", "author": "Agile Business Group, Therp BV, Tecnativa, ACSONE SA/NV, " "Odoo Community Association (OCA)", "license": "AGPL-3", - "application": False, "installable": True, "depends": [ "account", @@ -24,6 +23,6 @@ "views/account_tax_view.xml", ], "images": [ - 'images/tax_balance.png', + "images/tax_balance.png", ] } diff --git a/account_tax_balance/models/account_move.py b/account_tax_balance/models/account_move.py index 54da6e99..32db976a 100644 --- a/account_tax_balance/models/account_move.py +++ b/account_tax_balance/models/account_move.py @@ -1,21 +1,26 @@ # © 2016 Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api +from odoo import api, fields, models class AccountMove(models.Model): _inherit = 'account.move' - move_type = fields.Selection( - string="Move type", selection=[ + @api.model + def _selection_move_type(self): + return [ ('other', 'Other'), ('liquidity', 'Liquidity'), ('receivable', 'Receivable'), ('receivable_refund', 'Receivable refund'), ('payable', 'Payable'), ('payable_refund', 'Payable refund'), - ], compute='_compute_move_type', store=True, readonly=True) + ] + + move_type = fields.Selection( + selection='_selection_move_type', + compute='_compute_move_type', store=True, readonly=True) @api.multi @api.depends( diff --git a/account_tax_balance/models/account_tax.py b/account_tax_balance/models/account_tax.py index 13874205..e4c47356 100644 --- a/account_tax_balance/models/account_tax.py +++ b/account_tax_balance/models/account_tax.py @@ -2,7 +2,7 @@ # © 2016 Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api, _ +from odoo import _, api, fields, models class AccountTax(models.Model): @@ -80,9 +80,13 @@ class AccountTax(models.Model): for tax in self: tax.has_moves = tax.id in ids_with_moves + @api.model + def _is_unsupported_search_operator(self, operator): + return operator != '=' + @api.model def _search_has_moves(self, operator, value): - if operator != '=' or not value: + if self._is_unsupported_search_operator(operator) or not value: raise ValueError(_("Unsupported search operator")) ids_with_moves = self._account_tax_ids_with_moves() return [('id', 'in', ids_with_moves)] diff --git a/account_tax_balance/readme/CONTRIBUTORS.rst b/account_tax_balance/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..2712f89b --- /dev/null +++ b/account_tax_balance/readme/CONTRIBUTORS.rst @@ -0,0 +1,6 @@ +* Lorenzo Battistini +* Giovanni Capalbo +* Tecnativa - Antonio Espinosa +* Tecnativa - Pedro M. Baeza +* ACSONE SA/NV - Stéphane Bidoul +* Andrea Stirpe diff --git a/account_tax_balance/readme/DESCRIPTION.rst b/account_tax_balance/readme/DESCRIPTION.rst new file mode 100644 index 00000000..afaedddc --- /dev/null +++ b/account_tax_balance/readme/DESCRIPTION.rst @@ -0,0 +1,3 @@ +This module allows to compute tax balances within a certain date range. +It depends on date_range module and exposes 'compute' methods that can be called by other modules +(like localization ones). diff --git a/account_tax_balance/readme/USAGE.rst b/account_tax_balance/readme/USAGE.rst new file mode 100644 index 00000000..a17cdfc0 --- /dev/null +++ b/account_tax_balance/readme/USAGE.rst @@ -0,0 +1,5 @@ +Accounting --> Reporting --> Taxes Balance + +Select the company, the date range, the target moves and 'open taxes' + +.. figure:: /account_tax_balance/static/description/tax_balance.png diff --git a/account_tax_balance/tests/test_account_tax_balance.py b/account_tax_balance/tests/test_account_tax_balance.py index c10175a8..07ed136d 100644 --- a/account_tax_balance/tests/test_account_tax_balance.py +++ b/account_tax_balance/tests/test_account_tax_balance.py @@ -2,11 +2,13 @@ # © 2016 Giovanni Capalbo # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp.fields import Date -from openerp.tests.common import HttpCase from datetime import datetime + from dateutil.rrule import MONTHLY +from odoo.fields import Date +from odoo.tests.common import HttpCase + class TestAccountTaxBalance(HttpCase): at_install = False @@ -144,6 +146,9 @@ class TestAccountTaxBalance(HttpCase): # change the state of refund to open by clicking Validate button refund.action_invoice_open() + # force the _compute_balance() to be triggered + tax._compute_balance() + self.assertEqual(tax.base_balance, 75.) self.assertEqual(tax.balance, 7.5) self.assertEqual(tax.base_balance_regular, 100.) diff --git a/account_tax_balance/views/account_move_view.xml b/account_tax_balance/views/account_move_view.xml index 5211c056..2effe736 100644 --- a/account_tax_balance/views/account_move_view.xml +++ b/account_tax_balance/views/account_move_view.xml @@ -3,7 +3,6 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> - Add move type column account.move @@ -32,7 +31,7 @@ - + diff --git a/account_tax_balance/views/account_tax_view.xml b/account_tax_balance/views/account_tax_view.xml index 6c5ce910..fdfd092b 100644 --- a/account_tax_balance/views/account_tax_view.xml +++ b/account_tax_balance/views/account_tax_view.xml @@ -47,9 +47,9 @@ - - - + + + diff --git a/account_tax_balance/wizard/open_tax_balances.py b/account_tax_balance/wizard/open_tax_balances.py index d003f579..2a45efbc 100644 --- a/account_tax_balance/wizard/open_tax_balances.py +++ b/account_tax_balance/wizard/open_tax_balances.py @@ -1,11 +1,13 @@ # © 2016 Lorenzo Battistini - Agile Business Group # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, fields, api +from odoo import api, fields, models -class OpenTaxBalances(models.TransientModel): +class WizardOpenTaxBalances(models.TransientModel): _name = 'wizard.open.tax.balances' + _description = 'Wizard Open Tax Balances' + company_id = fields.Many2one( 'res.company', 'Company', required=True, default=lambda self: self.env.user.company_id) diff --git a/account_tax_balance/wizard/open_tax_balances_view.xml b/account_tax_balance/wizard/open_tax_balances_view.xml index 60836ee7..1cd5b0ef 100644 --- a/account_tax_balance/wizard/open_tax_balances_view.xml +++ b/account_tax_balance/wizard/open_tax_balances_view.xml @@ -4,7 +4,6 @@ - wizard_open_tax_balances wizard.open.tax.balances