Browse Source

[12.0][MIG] account_tax_balance

pull/468/head
Andrea 6 years ago
committed by Pedro M. Baeza
parent
commit
8ef198053b
  1. 77
      account_tax_balance/README.rst
  2. 9
      account_tax_balance/__manifest__.py
  3. 13
      account_tax_balance/models/account_move.py
  4. 8
      account_tax_balance/models/account_tax.py
  5. 6
      account_tax_balance/readme/CONTRIBUTORS.rst
  6. 3
      account_tax_balance/readme/DESCRIPTION.rst
  7. 5
      account_tax_balance/readme/USAGE.rst
  8. 9
      account_tax_balance/tests/test_account_tax_balance.py
  9. 3
      account_tax_balance/views/account_move_view.xml
  10. 6
      account_tax_balance/views/account_tax_view.xml
  11. 6
      account_tax_balance/wizard/open_tax_balances.py
  12. 1
      account_tax_balance/wizard/open_tax_balances_view.xml
  13. 1
      oca_dependencies.txt

77
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
<https://github.com/OCA/account-financial-reporting/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 <https://github.com/OCA/account-financial-reporting/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 <https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20account_tax_balance%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Images
------
Authors
~~~~~~~
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
* Agile Business Group
* Therp BV
* Tecnativa
* ACSONE SA/NV
Contributors
------------
~~~~~~~~~~~~
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
* Giovanni Capalbo <giovanni@therp.nl>
* Tecnativa - Antonio Espinosa
* Tecnativa - Pedro M. Baeza
* ACSONE SA/NV - Stéphane Bidoul
* Andrea Stirpe <a.stirpe@onestein.nl>
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 <https://github.com/OCA/account-financial-reporting/tree/12.0/account_tax_balance>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

9
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",
]
}

13
account_tax_balance/models/account_move.py

@ -1,21 +1,26 @@
# © 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# 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(

8
account_tax_balance/models/account_tax.py

@ -2,7 +2,7 @@
# © 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
# 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)]

6
account_tax_balance/readme/CONTRIBUTORS.rst

@ -0,0 +1,6 @@
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
* Giovanni Capalbo <giovanni@therp.nl>
* Tecnativa - Antonio Espinosa
* Tecnativa - Pedro M. Baeza
* ACSONE SA/NV - Stéphane Bidoul
* Andrea Stirpe <a.stirpe@onestein.nl>

3
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).

5
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

9
account_tax_balance/tests/test_account_tax_balance.py

@ -2,11 +2,13 @@
# © 2016 Giovanni Capalbo <giovanni@therp.nl>
# 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.)

3
account_tax_balance/views/account_move_view.xml

@ -3,7 +3,6 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_move_tree" model="ir.ui.view">
<field name="name">Add move type column</field>
<field name="model">account.move</field>
@ -32,7 +31,7 @@
<field name="inherit_id" ref="account.view_account_move_filter"/>
<field name="arch" type="xml">
<group expand="0" position="inside">
<filter string="Move type" domain="[]" context="{'group_by':'move_type'}"/>
<filter name="move_type" string="Move type" domain="[]" context="{'group_by':'move_type'}"/>
</group>
</field>
</record>

6
account_tax_balance/views/account_tax_view.xml

@ -47,9 +47,9 @@
<field name="type_tax_use"/>
<field name="account_id"/>
<group expand="0" string="Group By">
<filter string="Tax Group" domain="[]" context="{'group_by':'tax_group_id'}"/>
<filter string="Tax Scope" domain="[]" context="{'group_by':'type_tax_use'}"/>
<filter string="Account" domain="[]" context="{'group_by':'account_id'}"/>
<filter name="tax_group" string="Tax Group" domain="[]" context="{'group_by':'tax_group_id'}"/>
<filter name="tax_scope" string="Tax Scope" domain="[]" context="{'group_by':'type_tax_use'}"/>
<filter name="tax_account" string="Account" domain="[]" context="{'group_by':'account_id'}"/>
</group>
</search>
</field>

6
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)

1
account_tax_balance/wizard/open_tax_balances_view.xml

@ -4,7 +4,6 @@
<odoo>
<record id="wizard_open_tax_balances" model="ir.ui.view">
<field name="name">wizard_open_tax_balances</field>
<field name="model">wizard.open.tax.balances</field>
<field name="arch" type="xml">
<form string="Taxes Balance">

1
oca_dependencies.txt

@ -0,0 +1 @@
server-ux
Loading…
Cancel
Save