-
-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by pedrobaeza
- Loading branch information
Showing
25 changed files
with
1,010 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
======================== | ||
Reconcile payment orders | ||
======================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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--reconcile-lightgray.png?logo=github | ||
:target: https://github.com/OCA/account-reconcile/tree/13.0/account_reconcile_payment_order | ||
: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-13-0/account-reconcile-13-0-account_reconcile_payment_order | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/98/13.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
Payment orders that show up as one big transaction can be difficult for the | ||
accounting to handle if a transfer account is used. In this case, we need to | ||
reconcile this transaction with possibly hundreds of move lines, which can be a | ||
bit tiresome. This module tries to recognize transactions deriving from payment | ||
orders and propose the unreconciled move lines from this payment order. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Installation | ||
============ | ||
|
||
This module requires the module **account_payment_order**, available | ||
in https://github.com/OCA/bank-payment. | ||
|
||
Configuration | ||
============= | ||
|
||
#. Go to *Settings > Users & Companies > Users*. | ||
#. Give to your user the permission "Show Full Accounting Features". | ||
|
||
Usage | ||
===== | ||
|
||
#. Go to *Invoicing > Overview*. | ||
#. Locate the bank kanban card and import or create a new statement on it. | ||
#. When reconciling, it should just work. What the module does is to search for | ||
a finished payment order that has the same amount as the statement line. If | ||
any, generated move lines (bank or AR/AP ones) are automatically proposed | ||
for the reconciliation. | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
* It would be good to check references too, but bank usually change some | ||
characters, so this doesn't seem to be a general solution. | ||
* Take into account different currencies (in payment order or in bank | ||
statement). | ||
* Try to match payment orders resulting entries grouped by due date, instead of | ||
a whole, but this will affect performance for sure. | ||
* When the reconcile models end with more inheritable code, implement this | ||
as a new type of reconciliation in this model. | ||
* Develop real UI tests, instead of mimicking the call to the involved method. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-reconcile/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-reconcile/issues/new?body=module:%20account_reconcile_payment_order%0Aversion:%2013.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 | ||
~~~~~~~ | ||
|
||
* Therp BV | ||
* Tecnativa | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Holger Brunn | ||
* `Tecnativa <https://www.tecnativa.com>`__: | ||
|
||
* Pedro M. Baeza | ||
* João Marques | ||
|
||
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-pedrobaeza| image:: https://github.com/pedrobaeza.png?size=40px | ||
:target: https://github.com/pedrobaeza | ||
:alt: pedrobaeza | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-pedrobaeza| | ||
|
||
This module is part of the `OCA/account-reconcile <https://github.com/OCA/account-reconcile/tree/13.0/account_reconcile_payment_order>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2015 Therp BV (<http://therp.nl>). | ||
# Copyright 2019 Tecnativa - Pedro M. Baeza | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
{ | ||
"name": "Reconcile payment orders", | ||
"version": "13.0.1.0.0", | ||
"author": "Therp BV," "Tecnativa," "Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"website": "https://github.com/OCA/account-reconcile", | ||
"category": "Invoicing Management", | ||
"summary": "Automatically propose all lines generated from payment orders", | ||
"depends": ["account_payment_order"], | ||
"installable": True, | ||
"maintainers": ["pedrobaeza"], | ||
} |
20 changes: 20 additions & 0 deletions
20
account_reconcile_payment_order/i18n/account_reconcile_payment_order.pot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_reconcile_payment_order | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: account_reconcile_payment_order | ||
#: model:ir.model,name:account_reconcile_payment_order.model_account_reconciliation_widget | ||
msgid "Account Reconciliation widget" | ||
msgstr "" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_reconcile_payment_order | ||
# | ||
# Translators: | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: bank-statement-reconcile (8.0)\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2015-10-14 09:25+0000\n" | ||
"PO-Revision-Date: 2021-02-16 07:24+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: German (http://www.transifex.com/oca/OCA-bank-statement-" | ||
"reconcile-8-0/language/de/)\n" | ||
"Language: de\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"X-Generator: Poedit 2.4.2\n" | ||
|
||
#. module: account_reconcile_payment_order | ||
#: model:ir.model,name:account_reconcile_payment_order.model_account_reconciliation_widget | ||
msgid "Account Reconciliation widget" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_reconcile_payment_order | ||
# | ||
# Translators: | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: bank-statement-reconcile (8.0)\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2016-04-20 02:39+0000\n" | ||
"PO-Revision-Date: 2021-02-16 07:24+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: French (http://www.transifex.com/oca/OCA-bank-statement-" | ||
"reconcile-8-0/language/fr/)\n" | ||
"Language: fr\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n > 1);\n" | ||
"X-Generator: Poedit 2.4.2\n" | ||
|
||
#. module: account_reconcile_payment_order | ||
#: model:ir.model,name:account_reconcile_payment_order.model_account_reconciliation_widget | ||
msgid "Account Reconciliation widget" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_reconcile_payment_order | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2020-03-05 17:13+0000\n" | ||
"Last-Translator: Bole <bole@dajmi5.com>\n" | ||
"Language-Team: none\n" | ||
"Language: hr\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=" | ||
"4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" | ||
"X-Generator: Weblate 3.10\n" | ||
|
||
#. module: account_reconcile_payment_order | ||
#: model:ir.model,name:account_reconcile_payment_order.model_account_reconciliation_widget | ||
msgid "Account Reconciliation widget" | ||
msgstr "Widget zatvaranja" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_reconcile_payment_order | ||
# | ||
# Translators: | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: bank-statement-reconcile (8.0)\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2015-10-14 09:25+0000\n" | ||
"PO-Revision-Date: 2021-02-16 07:24+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: Italian (http://www.transifex.com/oca/OCA-bank-statement-" | ||
"reconcile-8-0/language/it/)\n" | ||
"Language: it\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"X-Generator: Poedit 2.4.2\n" | ||
|
||
#. module: account_reconcile_payment_order | ||
#: model:ir.model,name:account_reconcile_payment_order.model_account_reconciliation_widget | ||
msgid "Account Reconciliation widget" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_reconcile_payment_order | ||
# | ||
# Translators: | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: bank-statement-reconcile (8.0)\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2017-06-24 00:30+0000\n" | ||
"PO-Revision-Date: 2021-02-16 07:25+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: Dutch (Netherlands) (http://www.transifex.com/oca/OCA-bank-" | ||
"statement-reconcile-8-0/language/nl_NL/)\n" | ||
"Language: nl_NL\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=2; plural=(n != 1);\n" | ||
"X-Generator: Poedit 2.4.2\n" | ||
|
||
#. module: account_reconcile_payment_order | ||
#: model:ir.model,name:account_reconcile_payment_order.model_account_reconciliation_widget | ||
msgid "Account Reconciliation widget" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * account_reconcile_payment_order | ||
# | ||
# Translators: | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: bank-statement-reconcile (8.0)\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2015-08-19 00:32+0000\n" | ||
"PO-Revision-Date: 2021-02-16 07:25+0000\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-bank-statement-" | ||
"reconcile-8-0/language/sl/)\n" | ||
"Language: sl\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" | ||
"%100==4 ? 2 : 3);\n" | ||
"X-Generator: Poedit 2.4.2\n" | ||
|
||
#. module: account_reconcile_payment_order | ||
#: model:ir.model,name:account_reconcile_payment_order.model_account_reconciliation_widget | ||
msgid "Account Reconciliation widget" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from . import account_reconciliation_widget |
69 changes: 69 additions & 0 deletions
69
account_reconcile_payment_order/models/account_reconciliation_widget.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Copyright 2019 Tecnativa - Pedro M. Baeza | ||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html | ||
|
||
from odoo import api, models | ||
|
||
|
||
class AccountReconciliationWidget(models.AbstractModel): | ||
_inherit = "account.reconciliation.widget" | ||
|
||
@api.model | ||
def _get_possible_payment_orders_for_statement_line(self, st_line): | ||
"""Find orders that might be candidates for matching a statement | ||
line. | ||
""" | ||
return self.env["account.payment.order"].search( | ||
[ | ||
("total_company_currency", "=", st_line.amount), | ||
("state", "in", ["done", "uploaded"]), | ||
] | ||
) | ||
|
||
@api.model | ||
def _get_reconcile_lines_from_order(self, st_line, order, excluded_ids=None): | ||
"""Return lines to reconcile our statement line with.""" | ||
aml_obj = self.env["account.move.line"] | ||
reconciled_lines = aml_obj.search( | ||
[("bank_payment_line_id", "in", order.bank_line_ids.ids)] | ||
) | ||
return ( | ||
reconciled_lines.mapped("move_id.line_ids") | ||
- reconciled_lines | ||
- aml_obj.browse(excluded_ids) | ||
).filtered(lambda x: not x.reconciled) | ||
|
||
def _prepare_proposition_from_orders(self, st_line, orders, excluded_ids=None): | ||
"""Fill with the expected format the reconciliation proposition | ||
for the given statement line and possible payment orders. | ||
""" | ||
target_currency = ( | ||
st_line.currency_id | ||
or st_line.journal_id.currency_id | ||
or st_line.journal_id.company_id.currency_id | ||
) | ||
for order in orders: | ||
elegible_lines = self._get_reconcile_lines_from_order( | ||
st_line, order, excluded_ids=excluded_ids, | ||
) | ||
if elegible_lines: | ||
return self._prepare_move_lines( | ||
elegible_lines, | ||
target_currency=target_currency, | ||
target_date=st_line.date, | ||
) | ||
return [] | ||
|
||
def get_bank_statement_line_data(self, st_line_ids, excluded_ids=None): | ||
res = super().get_bank_statement_line_data( | ||
st_line_ids, excluded_ids=excluded_ids, | ||
) | ||
st_line_obj = self.env["account.bank.statement.line"] | ||
for line_vals in res.get("lines", []): | ||
st_line = st_line_obj.browse(line_vals["st_line"]["id"]) | ||
orders = self._get_possible_payment_orders_for_statement_line(st_line) | ||
proposition_vals = self._prepare_proposition_from_orders( | ||
st_line, orders, excluded_ids=excluded_ids, | ||
) | ||
if proposition_vals: | ||
line_vals["reconciliation_proposition"] = proposition_vals | ||
return res |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#. Go to *Settings > Users & Companies > Users*. | ||
#. Give to your user the permission "Show Full Accounting Features". |
Oops, something went wrong.