diff --git a/account_reconcile_payment_order/README.rst b/account_reconcile_payment_order/README.rst index 9ce5ae5f..d16c8eae 100644 --- a/account_reconcile_payment_order/README.rst +++ b/account_reconcile_payment_order/README.rst @@ -1,23 +1,41 @@ .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :alt: License: AGPL-3 + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +======================== Reconcile payment orders ======================== -Payment orders that show up as as one big transaction can be difficult for the accounting to handle if a transfer acount is used. In this case, we need to reconcile this transaction with possibly hunderds 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. +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. + +Installation +============ + +This module requires the module **account_banking_payment_transfer**, available +in https://github.com/OCA/bank-payment. Usage ===== -It should just work. What the module does is to search for a payment order in state 'sent' that has the same amount as the statement line, and the same bank account than the statement. +It should just work. What the module does is to search for a payment order in +state 'sent' (for orders transferred to an intermediate account) or done (for +orders non transferred) that has the same amount as the statement line, and the +same bank account than the statement. If any, all move lines are automatically +proposed for the reconcile. -For further information, please visit: - -* https://www.odoo.com/forum/help-1 +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/98/8.0 Known issues / Roadmap ====================== -* it would be good to check references too, but at least the bank in use here changes some characters, so this doesn't seem to be a general solution. +* it would be good to check references too, but at least the bank in use here + changes some characters, so this doesn't seem to be a general solution. Bug Tracker =========== @@ -34,6 +52,7 @@ Contributors ------------ * Holger Brunn +* Pedro M. Baeza Maintainer ---------- diff --git a/account_reconcile_payment_order/__openerp__.py b/account_reconcile_payment_order/__openerp__.py index 3b45c14e..84e2a80d 100644 --- a/account_reconcile_payment_order/__openerp__.py +++ b/account_reconcile_payment_order/__openerp__.py @@ -19,11 +19,13 @@ ############################################################################## { "name": "Reconcile payment orders", - "version": "1.0", - "author": "Therp BV,Odoo Community Association (OCA)", + "version": "8.0.1.0.0", + "author": "Therp BV," + "Serv. Tecnol. Avanzados - Pedro M. Baeza," + "Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Accounting & Finance", - "summary": "Automatically reconcile all lines from sent payment orders", + "summary": "Automatically reconcile all lines from payment orders", "depends": [ 'account_banking_payment_transfer', ], diff --git a/account_reconcile_payment_order/models/account_bank_statement_line.py b/account_reconcile_payment_order/models/account_bank_statement_line.py index 759f3aee..ece9f634 100644 --- a/account_reconcile_payment_order/models/account_bank_statement_line.py +++ b/account_reconcile_payment_order/models/account_bank_statement_line.py @@ -35,7 +35,7 @@ class AccountBankStatementLine(models.Model): select order_id, sum(amount_currency) as amount from payment_line join payment_order o on o.id=order_id - where o.state = 'sent' + where o.state in ('sent', 'done') group by order_id) select order_id from order_sums where amount = %s''', (Decimal(float_repr(abs(this.amount), digits)),)) @@ -55,9 +55,14 @@ class AccountBankStatementLine(models.Model): def get_reconcile_lines_from_order(self, this, orders, excluded_ids=None): """return lines to reconcile our statement line with""" order = orders[0] + if order.state == 'sent': + move_lines_list = list(set(order._get_transfer_move_lines())) + else: + move_lines = order.line_ids.mapped('move_line_id').filtered( + lambda x: not x.reconcile_id) + move_lines_list = [x for x in move_lines] return self.env['account.move.line']\ - .prepare_move_lines_for_reconciliation_widget( - list(set(order._get_transfer_move_lines()))) + .prepare_move_lines_for_reconciliation_widget(move_lines_list) @api.model def get_reconciliation_proposition(self, this, excluded_ids=None):