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

16 add account fix statement line creation #674

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Next Next commit
16.0 ADD account_fix_statement_line_creation module
  • Loading branch information
mourad-ehm committed Jun 27, 2024
commit 8cc26e0c8815c6415e2b6e925750e018d5f26b0e
80 changes: 80 additions & 0 deletions account_fix_statement_line_creation/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
========================================
Account bank statement fix line creation
========================================

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

.. |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/16.0/account_fix_statement_line_creation
: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_fix_statement_line_creation
: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 fix bug about creation of new statement line on statement that contain
lines.
The bug is reported in this issue https://github.com/odoo/odoo/issues/171077

**Table of contents**

.. contents::
:local:

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

* Akretion

Contributors
~~~~~~~~~~~~

* Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.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.

This module is part of the `OCA/account-reconcile <https://github.com/OCA/account-reconcile/tree/16.0/account_fix_statement_line_creation>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions account_fix_statement_line_creation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
15 changes: 15 additions & 0 deletions account_fix_statement_line_creation/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2024 Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
{
"name": "Account bank statement fix line creation",
"version": "16.0.1.0.0",
"author": "Akretion, Odoo Community Association (OCA)",
"maintainer": "Akretion",
"category": "Hidden/Dependency",
"depends": [
"account",
],
"website": "https://github.com/OCA/account-reconcile",
"installable": True,
"license": "AGPL-3",
}
1 change: 1 addition & 0 deletions account_fix_statement_line_creation/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_bank_statement
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2024 Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)


from odoo import api, models


class AccountBankStatement(models.Model):
_inherit = "account.bank.statement"

# -------------------------------------------------------------------------
# COMPUTE METHODS
# -------------------------------------------------------------------------
@api.depends("line_ids.internal_index", "line_ids.state")
def _compute_date_index(self):
for stmt in self:
# When we create a new statement line for existing statement,
# internal_index field of line can be False
# And we can not sort str and bool type (python error)
# sort only line with internal_index != False to avoid bug when sort value from
# different type
sorted_lines = stmt.line_ids.filtered(lambda l: l.internal_index).sorted(
"internal_index"
)
if not sorted_lines:
sorted_lines = stmt.line_ids
stmt.first_line_index = sorted_lines[:1].internal_index
stmt.date = sorted_lines.filtered(lambda l: l.state == "posted")[-1:].date
2 changes: 2 additions & 0 deletions account_fix_statement_line_creation/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>

4 changes: 4 additions & 0 deletions account_fix_statement_line_creation/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

This module fix bug about creation of new statement line on statement that contain
lines.
The bug is reported in this issue https://github.com/odoo/odoo/issues/171077
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading