Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0] [MIG] account_tax_balance: Migration to 18.0 #1263

Open
wants to merge 54 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
174a14e
[ADD] account_tax_balance: Compute tax balances based on date range
eLBati Apr 28, 2016
980f35c
tests
gfcapalbo Apr 29, 2016
a48acb1
[FIX+IMP] account_tax_balance:
eLBati Apr 29, 2016
3b74e48
Consider normal and refund operations separately
antespi Oct 21, 2016
052ebd4
[MIG] account_tax_balance 10.0
sbidoul Nov 19, 2016
d3fcbb4
[FIX+IMP] account_tax_balance:
eLBati Jan 18, 2017
48fb957
[FIX] Include tax amounts from all move types
StefanRijnhart Mar 16, 2017
28092de
[IMP] account_tax_balance: performance
sbidoul Mar 24, 2017
8fea288
[IMP] account_tax_balance: faster search of taxes with moves
sbidoul Mar 26, 2017
8ac6a73
account_tax_balance: improve test coverage
sbidoul Apr 3, 2017
3350026
add condition tax_exigible in domain variable
May 25, 2017
9c43ee9
[IMP] account_tax_balance: add index
sbidoul Aug 30, 2017
cdf59c4
[MIG] account_tax_balance: Migration to 11.0
pedrobaeza Oct 18, 2017
7213521
dynamize general ledger
JordiBForgeFlow Dec 1, 2017
49da62e
[IMP] account_tax_balance: Change tests to post instal and protect ag…
pedrobaeza Mar 9, 2018
7772169
utf-8 remove from .py files
HviorForgeFlow Mar 27, 2018
667dee8
[12.0][MIG] account_tax_balance
astirpe Oct 1, 2018
c9c51e6
[FIX] at_install/post_install test decorators
astirpe Oct 7, 2018
cc47b15
[IMP] account_tax_balance: Ensure test correctness
pedrobaeza May 8, 2019
6d7954f
[IMP] account_tax_balance: Ensure test correctness (2)
pedrobaeza May 8, 2019
235c648
[IMP] tax_balance: breadcrumb name (#548)
bealdav May 22, 2019
c4a0f59
[IMP] Ease extension if multicompany fiscal unit
astirpe Sep 16, 2019
b8e9137
[13.0][MIG] account_tax_balance
astirpe Sep 30, 2019
5574d66
Convert onchange to computed
astirpe Sep 30, 2019
873dcee
Code review
astirpe Oct 1, 2019
a16df11
Black, isort, etc...
astirpe Oct 28, 2019
6cf151a
[ADD] Prefill move_type
StefanRijnhart Jan 3, 2020
d9702bc
[RFR] Apply a mapping instead of separate queries
pedrobaeza Feb 4, 2020
30f1f36
[FIX] select company in multicompany
astirpe Feb 26, 2020
5433909
[IMP] account_tax_balance: black, isort, prettier
ozono Oct 22, 2020
9fbb756
[MIG] account_tax_balance: Migration to 14.0
ozono Oct 23, 2020
ad5031d
[FIX] account_tax_balance: Fix tests
joao-p-marques Mar 1, 2021
78617e5
[FIX] account_tax_balance: Remove unnecessary text from button
joao-p-marques May 17, 2021
81c9a3a
Manage renamed move_type column
SimoRubi Apr 16, 2021
7339f26
[IMP] account_tax_balance: use rename_fields instead of rename_columns
MiquelRForgeFlow Oct 4, 2021
be7123e
account_tax_balance: change development_status to Production/Stable
tafaRU Oct 21, 2021
a8e66f5
[FIX] account_tax_balance: Fixed translation of the financial type fi…
Oct 20, 2021
2036c14
[14.0][FIX] account_tax_balance: init hook refund confusion
StefanRijnhart Mar 30, 2021
ea203ac
[IMP] account_tax_balance: black, isort, prettier
ValentinVinagre Dec 10, 2021
ea49620
[MIG] account_tax_balance: Migration to 15.0
ValentinVinagre Dec 10, 2021
d4ddec2
[FIX] account_tax_balance: Fix development_status
ValentinVinagre Dec 28, 2021
b446a9e
[FIX] account_tax_balance: Recompute balance for different dates
SimoRubi Dec 9, 2021
e5edc31
[FIX] account_tax_balance: delete obsolete migration
mariadforgeflow Feb 4, 2022
2192620
[FIX] account_tax_balance: run test after install
LoisRForgeFlow Jul 20, 2022
1bf1bcf
[MIG] account_tax_balance: Migration to 16.0
ramiadavid Oct 27, 2022
ca85904
[16.0][IMP] account_tax_balance
Jul 12, 2023
81cc606
[IMP] account_tax_balance: test performance improvement
josep-tecnativa Oct 13, 2023
e017bb3
[IMP] account_tax_balance: pre-commit auto fixes
ramiadavid Nov 26, 2023
d16642c
[MIG] account_tax_balance: Migration to 17.0
ramiadavid Nov 27, 2023
2c2ab09
Translated using Weblate (Italian)
mymage Feb 14, 2024
20931d4
Translated using Weblate (Italian)
mymage Feb 29, 2024
614b5f8
Translated using Weblate (Catalan)
Jesarregui May 8, 2024
c0bcd49
[IMP] account_tax_balance: pre-commit auto fixes
Borruso Dec 6, 2024
c46fab2
[MIG] account_tax_balance: Migration to 18.0
Borruso Dec 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions account_tax_balance/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
===========
Tax Balance
===========

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4d5facdf6681a965b6e08ba419158ba2aeef8620a80b74a8b05225e74298acbd
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
:target: https://odoo-community.org/page/development-status
:alt: Mature
.. |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/18.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-18-0/account-financial-reporting-18-0-account_tax_balance
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-financial-reporting&target_branch=18.0
:alt: Try me on Runboat

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

**Table of contents**

.. contents::
:local:

Usage
=====

Accounting --> Reporting --> Taxes Balance

Select the company, the date range, the target moves and 'open taxes'

|image1|

.. |image1| image:: https://raw.githubusercontent.com/account_tax_balance/static/description/tax_balance.png

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-reporting/issues/new?body=module:%20account_tax_balance%0Aversion:%2018.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
=======

Authors
-------

* Agile Business Group
* Therp BV
* Tecnativa
* ACSONE SA/NV

Contributors
------------

- Lorenzo Battistini <[email protected]>
- Giovanni Capalbo <[email protected]>
- Tecnativa - Antonio Espinosa
- Tecnativa - Pedro M. Baeza
- ACSONE SA/NV - Stéphane Bidoul
- Andrea Stirpe <[email protected]>
- Iván Antón <[email protected]>
- `Sygel <https://www.sygel.es>`__:

- Valentin Vinagre

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

This module is part of the `OCA/account-financial-reporting <https://github.com/OCA/account-financial-reporting/tree/18.0/account_tax_balance>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions account_tax_balance/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
from . import wizard
from .hooks import pre_init_hook
26 changes: 26 additions & 0 deletions account_tax_balance/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2016 Lorenzo Battistini - Agile Business Group
# Copyright 2016 Tecnativa - Antonio Espinosa
# Copyright 2016 ACSONE SA/NV - Stéphane Bidoul
# Copyright 2017 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Tax Balance",
"summary": "Compute tax balances based on date range",
"version": "18.0.1.0.0",
"development_status": "Mature",
"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",
"installable": True,
"depends": ["account", "date_range"],
"data": [
"wizard/open_tax_balances_view.xml",
"views/account_move_view.xml",
"views/account_tax_view.xml",
"security/ir.model.access.csv",
],
"images": ["images/tax_balance.png"],
"pre_init_hook": "pre_init_hook",
}
47 changes: 47 additions & 0 deletions account_tax_balance/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2020 Opener B.V. <https://opener.amsterdam>
# Copyright 2020 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging

from psycopg2 import sql


def pre_init_hook(env):
"""Precreate financial_type and fill with appropriate values to prevent
a MemoryError when the ORM attempts to call its compute method on a large
amount of preexisting moves. Note that the order of the mapping is
important as one move can have move lines on accounts of multiple types
and the move type is set in the order of precedence."""
logger = logging.getLogger(__name__)
logger.info("Add account_move.financial_type column if it does not yet exist")
env.cr.execute(
"ALTER TABLE account_move ADD COLUMN IF NOT EXISTS financial_type VARCHAR"
)
MAPPING = [
("liquidity", "asset_cash", False),
("liquidity", "liability_credit_card", False),
("payable", "liability_payable", "AND aml.balance < 0"),
("payable_refund", "liability_payable", "AND aml.balance >= 0"),
("receivable", "asset_receivable", "AND aml.balance > 0"),
("receivable_refund", "asset_receivable", "AND aml.balance <= 0"),
("other", False, False),
]
for financial_type, account_type, extra_where in MAPPING:
args = [financial_type]
query = sql.SQL("UPDATE account_move am SET financial_type = %s")
if account_type:
query += sql.SQL(
"""FROM account_move_line aml
WHERE aml.account_id IN (
SELECT id FROM account_account
WHERE account_type = %s)
AND aml.move_id = am.id AND am.financial_type IS NULL
"""
)
args.append(account_type)
else:
query += sql.SQL("WHERE am.financial_type IS NULL")
if extra_where:
query += sql.SQL(extra_where)
env.cr.execute(query, tuple(args))
logger.info("%s move set to type %s", financial_type, env.cr.rowcount)
Loading
Loading