diff --git a/README.md b/README.md index dad6ff62ba..587a3d9159 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ addon | version | maintainers | summary [account_move_reconcile_forbid_cancel](account_move_reconcile_forbid_cancel/) | 16.0.1.0.1 | | Account Move Reconcile Forbid Cancel [account_move_so_import](account_move_so_import/) | 16.0.1.0.0 | | Journal Entry Sale Order completion [account_reconcile_oca](account_reconcile_oca/) | 16.0.2.0.5 | [![etobella](https://github.com/etobella.png?size=30px)](https://github.com/etobella) | Reconcile addons for Odoo CE accounting -[account_statement_base](account_statement_base/) | 16.0.1.11.0 | [![alexis-via](https://github.com/alexis-via.png?size=30px)](https://github.com/alexis-via) | Base module for Bank Statements +[account_statement_base](account_statement_base/) | 16.0.1.12.0 | [![alexis-via](https://github.com/alexis-via.png?size=30px)](https://github.com/alexis-via) | Base module for Bank Statements [base_transaction_id](base_transaction_id/) | 16.0.1.0.0 | | Base transaction ID for financial institutes [//]: # (end addons) diff --git a/account_statement_base/README.rst b/account_statement_base/README.rst index e1fb9b8193..d392a6ef14 100644 --- a/account_statement_base/README.rst +++ b/account_statement_base/README.rst @@ -7,7 +7,7 @@ Bank Statement Base !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:c628483ba7915f7fb03b59772a9ba6bfd64483bd36f3ef634f12b2c4d9f71336 + !! source digest: sha256:4cc388f8d9806adaa648df2193cbb547f352bec34a4d68cd012bac9e39902573 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png diff --git a/account_statement_base/__manifest__.py b/account_statement_base/__manifest__.py index 6cea9dac07..5e5e1f2998 100644 --- a/account_statement_base/__manifest__.py +++ b/account_statement_base/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Bank Statement Base", - "version": "16.0.1.11.0", + "version": "16.0.1.12.0", "category": "Accounting", "license": "LGPL-3", "summary": "Base module for Bank Statements", diff --git a/account_statement_base/models/account_bank_statement.py b/account_statement_base/models/account_bank_statement.py index 5dcae41d8d..609f70c201 100644 --- a/account_statement_base/models/account_bank_statement.py +++ b/account_statement_base/models/account_bank_statement.py @@ -4,6 +4,25 @@ class AccountBankStatement(models.Model): _inherit = "account.bank.statement" + # TODO: Delete if merged https://github.com/odoo/odoo/pull/182497 + def _compute_date_index(self): + """The super() method does not take into account lines that do not have + internal_index set yet, and causes sorted() to fail, we need to re-define + the method in these cases to avoid the error. + """ + _self = self + for stmt in self: + if any(not line.internal_index for line in stmt.line_ids): + _self -= stmt + sorted_lines = stmt.line_ids.filtered("internal_index").sorted( + "internal_index" + ) + stmt.first_line_index = sorted_lines[:1].internal_index + stmt.date = sorted_lines.filtered(lambda l: l.state == "posted")[ + -1: + ].date + return super(AccountBankStatement, _self)._compute_date_index() + def action_open_statement_lines(self): self.ensure_one() if not self: diff --git a/account_statement_base/models/account_bank_statement_line.py b/account_statement_base/models/account_bank_statement_line.py index 857619b91b..4199a73fd2 100644 --- a/account_statement_base/models/account_bank_statement_line.py +++ b/account_statement_base/models/account_bank_statement_line.py @@ -7,6 +7,13 @@ class AccountBankStatementLine(models.Model): _inherit = "account.bank.statement.line" + # TODO: Delete if merged https://github.com/odoo/odoo/pull/182497 + def _compute_running_balance(self): + # We need to set value to all records because super() does not do it using sql. + for item in self: + item.running_balance = item.running_balance + return super()._compute_running_balance() + def action_open_journal_entry(self): self.ensure_one() if not self: diff --git a/account_statement_base/static/description/index.html b/account_statement_base/static/description/index.html index 3108ba4c87..0534147fe6 100644 --- a/account_statement_base/static/description/index.html +++ b/account_statement_base/static/description/index.html @@ -367,7 +367,7 @@