diff --git a/account_reconcile_manual_tax/README.rst b/account_reconcile_manual_tax/README.rst new file mode 100644 index 00000000..730dbdee --- /dev/null +++ b/account_reconcile_manual_tax/README.rst @@ -0,0 +1,101 @@ +============================== +Taxes in manual reconciliaiton +============================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:4b34b13c2c66ef191993b5a96c02315d7eb330d531916ab6328f2da05a725033 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png + :target: https://odoo-community.org/page/development-status + :alt: Alpha +.. |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--reconcile-lightgray.png?logo=github + :target: https://github.com/OCA/account-reconcile/tree/16.0/account_reconcile_manual_tax + :alt: OCA/account-reconcile +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-reconcile-16-0/account-reconcile-16-0-account_reconcile_manual_tax + :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-reconcile&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows to set taxes (price included) on manual +reconciliation lines. + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To use this module, you need to: + +1. Enter the reconciliation screen +2. Switch to manual operation +3. Set the field ``Taxes``. Note only price included taxes can be + selected. + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Hunki Enterprises BV + +Contributors +------------ + +- Holger Brunn + (https://hunki-enterprises.com) + +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. + +.. |maintainer-hbrunn| image:: https://github.com/hbrunn.png?size=40px + :target: https://github.com/hbrunn + :alt: hbrunn + +Current `maintainer `__: + +|maintainer-hbrunn| + +This module is part of the `OCA/account-reconcile `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_reconcile_manual_tax/__init__.py b/account_reconcile_manual_tax/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/account_reconcile_manual_tax/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/account_reconcile_manual_tax/__manifest__.py b/account_reconcile_manual_tax/__manifest__.py new file mode 100644 index 00000000..1f765172 --- /dev/null +++ b/account_reconcile_manual_tax/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2025 Hunki Enterprises BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) + +{ + "name": "Taxes in manual reconciliaiton", + "summary": "Select taxes in the manual operation tab of the reconciliation widget", + "version": "16.0.1.0.0", + "development_status": "Alpha", + "category": "Accounting", + "website": "https://github.com/OCA/account-reconcile", + "author": "Hunki Enterprises BV, Odoo Community Association (OCA)", + "maintainers": ["hbrunn"], + "license": "AGPL-3", + "depends": [ + "account_reconcile_oca", + ], + "data": [ + "views/account_bank_statement_line.xml", + ], + "demo": [], +} diff --git a/account_reconcile_manual_tax/models/__init__.py b/account_reconcile_manual_tax/models/__init__.py new file mode 100644 index 00000000..b625fd62 --- /dev/null +++ b/account_reconcile_manual_tax/models/__init__.py @@ -0,0 +1 @@ +from . import account_bank_statement_line diff --git a/account_reconcile_manual_tax/models/account_bank_statement_line.py b/account_reconcile_manual_tax/models/account_bank_statement_line.py new file mode 100644 index 00000000..3c2e5e91 --- /dev/null +++ b/account_reconcile_manual_tax/models/account_bank_statement_line.py @@ -0,0 +1,119 @@ +# Copyright 2025 Hunki Enterprises BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0) + +from odoo import api, fields, models + + +class AccountBankStatementLine(models.Model): + _inherit = "account.bank.statement.line" + + manual_tax_ids = fields.Many2many( + "account.tax", + relation="account_bank_statement_line_manual_tax_ids_rel", + check_company=True, + string="Taxes", + domain=[("price_include", "=", True)], + ) + + @api.onchange( + "manual_tax_ids", + ) + def _onchange_manual_tax_ids(self): + return super()._onchange_manual_reconcile_vals() + + def _check_line_changed(self, line): + changed = set(line.get("tax_ids") or []) != { + tax.id.origin for tax in self.manual_tax_ids + } + return changed or super()._check_line_changed(line) + + def _get_manual_delete_vals(self): + return dict( + super()._get_manual_delete_vals(), manual_tax_ids=[fields.Command.set([])] + ) + + def _process_manual_reconcile_from_line(self, line): + self.manual_tax_ids = line.get("tax_ids") + return super()._process_manual_reconcile_from_line(line) + + def _get_manual_reconcile_vals(self): + return dict( + super()._get_manual_reconcile_vals(), + tax_ids=[tax.id.origin for tax in self.manual_tax_ids], + ) + + def _reconcile_move_line_vals(self, line, move_id=False): + return dict( + super()._reconcile_move_line_vals(line, move_id=move_id), + tax_repartition_line_id=line.get("tax_repartition_line_id"), + ) + + def _recompute_suspense_line(self, data, reconcile_auxiliary_id, manual_reference): + result = super()._recompute_suspense_line( + data, reconcile_auxiliary_id, manual_reference + ) + if self.manual_model_id: + return result + i = 0 + lines = result.get("data", []) + while i < len(lines): + line = lines[i] + if line.get("reconcile_model_id"): + i += 1 + continue + new_lines = [] + if line["kind"] == "tax": + lines[i : i + 1] = [] + i -= 1 + continue + if line.get("tax_ids"): + new_lines = self._recompute_suspense_line_manual_tax(line) + elif line.get("amount_before_taxes"): + line["amount"] = line.pop("amount_before_taxes") + line["debit"] = line["debit"] and line["amount"] + line["credit"] = line["credit"] and line["amount"] + lines[i + 1 : i + 1] = new_lines + i += len(new_lines) + 1 + + return result + + def _recompute_suspense_line_manual_tax(self, line): + AccountMoveLine = self.env["account.move.line"] + new_line = AccountMoveLine.new( + { + key: value + for key, value in line.items() + if key in AccountMoveLine._fields + } + ) + sign = 1 if line["amount"] > 0 else -1 + taxes = new_line.tax_ids.compute_all( + line.get("amount_before_taxes", sign * line["amount"]), + handle_price_include=True, + ) + + line.setdefault("amount_before_taxes", line["amount"]) + line["amount"] = sign * taxes["total_excluded"] + line["credit"] = line["credit"] and taxes["total_excluded"] or line["credit"] + line["debit"] = line["debit"] and taxes["total_excluded"] or line["debit"] + + return [ + { + "reference": line["reference"] + f"-{sequence}", + "id": False, + "account_id": (tax["account_id"] or self.account_id.id, tax["name"]), + "partner_id": line.get("partner_id"), + "date": line["date"], + "name": tax["name"], + "amount": sign * tax["amount"], + "credit": line["credit"] and tax["amount"], + "debit": line["debit"] and tax["amount"], + "kind": "tax", + "currency_id": line["currency_id"], + "line_currency_id": line["line_currency_id"], + "currency_amount": 0, + "tax_repartition_line_id": tax["tax_repartition_line_id"].origin, + "tax_tag_ids": tax["tag_ids"], + } + for sequence, tax in enumerate(taxes["taxes"]) + ] diff --git a/account_reconcile_manual_tax/readme/CONTRIBUTORS.md b/account_reconcile_manual_tax/readme/CONTRIBUTORS.md new file mode 100644 index 00000000..b28199e1 --- /dev/null +++ b/account_reconcile_manual_tax/readme/CONTRIBUTORS.md @@ -0,0 +1 @@ +- Holger Brunn \ (https://hunki-enterprises.com) diff --git a/account_reconcile_manual_tax/readme/DESCRIPTION.md b/account_reconcile_manual_tax/readme/DESCRIPTION.md new file mode 100644 index 00000000..d0d9f734 --- /dev/null +++ b/account_reconcile_manual_tax/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module allows to set taxes (price included) on manual reconciliation lines. diff --git a/account_reconcile_manual_tax/readme/USAGE.md b/account_reconcile_manual_tax/readme/USAGE.md new file mode 100644 index 00000000..333116ec --- /dev/null +++ b/account_reconcile_manual_tax/readme/USAGE.md @@ -0,0 +1,5 @@ +To use this module, you need to: + +1. Enter the reconciliation screen +2. Switch to manual operation +3. Set the field `Taxes`. Note only price included taxes can be selected. diff --git a/account_reconcile_manual_tax/static/description/icon.png b/account_reconcile_manual_tax/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/account_reconcile_manual_tax/static/description/icon.png differ diff --git a/account_reconcile_manual_tax/static/description/index.html b/account_reconcile_manual_tax/static/description/index.html new file mode 100644 index 00000000..352e7505 --- /dev/null +++ b/account_reconcile_manual_tax/static/description/index.html @@ -0,0 +1,444 @@ + + + + + +Taxes in manual reconciliaiton + + + +
+

Taxes in manual reconciliaiton

+ + +

Alpha License: AGPL-3 OCA/account-reconcile Translate me on Weblate Try me on Runboat

+

This module allows to set taxes (price included) on manual +reconciliation lines.

+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Enter the reconciliation screen
  2. +
  3. Switch to manual operation
  4. +
  5. Set the field Taxes. Note only price included taxes can be +selected.
  6. +
+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Hunki Enterprises BV
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

Current maintainer:

+

hbrunn

+

This module is part of the OCA/account-reconcile project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_reconcile_manual_tax/views/account_bank_statement_line.xml b/account_reconcile_manual_tax/views/account_bank_statement_line.xml new file mode 100644 index 00000000..ca2eb258 --- /dev/null +++ b/account_reconcile_manual_tax/views/account_bank_statement_line.xml @@ -0,0 +1,21 @@ + + + + + account.bank.statement.line + + + + + + + + diff --git a/setup/account_reconcile_manual_tax/odoo/addons/account_reconcile_manual_tax b/setup/account_reconcile_manual_tax/odoo/addons/account_reconcile_manual_tax new file mode 120000 index 00000000..d885024c --- /dev/null +++ b/setup/account_reconcile_manual_tax/odoo/addons/account_reconcile_manual_tax @@ -0,0 +1 @@ +../../../../account_reconcile_manual_tax \ No newline at end of file diff --git a/setup/account_reconcile_manual_tax/setup.py b/setup/account_reconcile_manual_tax/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/account_reconcile_manual_tax/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)