Skip to content

Commit

Permalink
Merge pull request #676 from OCA/16.0
Browse files Browse the repository at this point in the history
Syncing from upstream OCA/account-reconcile (16.0)
  • Loading branch information
bt-admin authored Dec 13, 2024
2 parents 4176b9f + 6070196 commit dbcb55e
Show file tree
Hide file tree
Showing 16 changed files with 76 additions and 36 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ Available addons
addon | version | maintainers | summary
--- | --- | --- | ---
[account_in_payment](account_in_payment/) | 16.0.1.0.0 | | This module enables in-payment mode for your accounting
[account_mass_reconcile](account_mass_reconcile/) | 16.0.1.1.1 | | Account Mass Reconcile
[account_mass_reconcile](account_mass_reconcile/) | 16.0.1.1.2 | | Account Mass Reconcile
[account_move_base_import](account_move_base_import/) | 16.0.1.0.1 | | Journal Entry base import
[account_move_line_reconcile_manual](account_move_line_reconcile_manual/) | 16.0.2.0.0 | [![alexis-via](https://github.com/alexis-via.png?size=30px)](https://github.com/alexis-via) | Manually reconcile Journal Items
[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_analytic_tag](account_reconcile_analytic_tag/) | 16.0.1.1.0 | [![victoralmau](https://github.com/victoralmau.png?size=30px)](https://github.com/victoralmau) | Analytic tags in account reconciliation
[account_reconcile_oca](account_reconcile_oca/) | 16.0.2.0.11 | [![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.13.2 | [![alexis-via](https://github.com/alexis-via.png?size=30px)](https://github.com/alexis-via) | Base module for Bank Statements
[account_reconcile_oca](account_reconcile_oca/) | 16.0.2.1.0 | [![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.14.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)
Expand Down
2 changes: 1 addition & 1 deletion account_mass_reconcile/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Account Mass Reconcile
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a6e5845147d3d215fc741401e37fcbed50974179194cf5f5fa8e71a7154b2a24
!! source digest: sha256:5d95f704715eea33543e706743e4d96b5d023912598d4ee1252de2e6d346faea
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion account_mass_reconcile/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "Account Mass Reconcile",
"version": "16.0.1.1.1",
"version": "16.0.1.1.2",
"depends": ["account"],
"author": "Akretion,Camptocamp,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-reconcile",
Expand Down
32 changes: 17 additions & 15 deletions account_mass_reconcile/models/mass_reconcile.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,17 @@ def _run_reconcile_method(self, reconcile_method):
return auto_rec_id.automatic_reconcile()

def run_reconcile(self):
def find_reconcile_ids(fieldname, move_line_ids):
def find_reconcile_ids(fieldname, move_line_ids, new_env):
if not move_line_ids:
return []
self.env.flush_all()
new_env.flush_all()
sql = """
SELECT DISTINCT %s FROM account_move_line
WHERE %s IS NOT NULL AND id in %s
"""
params = [AsIs(fieldname), AsIs(fieldname), tuple(move_line_ids)]
self.env.cr.execute(sql, params)
res = self.env.cr.fetchall()
new_env.cr.execute(sql, params)
res = new_env.cr.fetchall()
return [row[0] for row in res]

# we use a new cursor to be able to commit the reconciliation
Expand All @@ -169,10 +169,18 @@ def find_reconcile_ids(fieldname, move_line_ids):
# does not.

for rec in self:
ctx = self.env.context.copy()
ctx["commit_every"] = rec.account.company_id.reconciliation_commit_every
if ctx["commit_every"]:
new_cr = sql_db.db_connect(self.env.cr.dbname).cursor()
new_env = api.Environment(new_cr, self.env.uid, ctx)
else:
new_cr = self.env.cr
new_env = self.env
# SELECT FOR UPDATE the mass reconcile row ; this is done in order
# to avoid 2 processes on the same mass reconcile method.
try:
self.env.cr.execute(
new_env.cr.execute(
"SELECT id FROM account_mass_reconcile"
" WHERE id = %s"
" FOR UPDATE NOWAIT",
Expand All @@ -185,14 +193,6 @@ def find_reconcile_ids(fieldname, move_line_ids):
"please try again later."
)
) from e
ctx = self.env.context.copy()
ctx["commit_every"] = rec.account.company_id.reconciliation_commit_every
if ctx["commit_every"]:
new_cr = sql_db.db_connect(self.env.cr.dbname).cursor()
new_env = api.Environment(new_cr, self.env.uid, ctx)
else:
new_cr = self.env.cr
new_env = self.env

try:
all_ml_rec_ids = []
Expand All @@ -202,8 +202,10 @@ def find_reconcile_ids(fieldname, move_line_ids):

all_ml_rec_ids += ml_rec_ids

reconcile_ids = find_reconcile_ids("full_reconcile_id", all_ml_rec_ids)
self.env["mass.reconcile.history"].create(
reconcile_ids = find_reconcile_ids(
"full_reconcile_id", all_ml_rec_ids, new_env
)
new_env["mass.reconcile.history"].create(
{
"mass_reconcile_id": rec.id,
"date": fields.Datetime.now(),
Expand Down
14 changes: 8 additions & 6 deletions account_mass_reconcile/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Account Mass Reconcile</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a6e5845147d3d215fc741401e37fcbed50974179194cf5f5fa8e71a7154b2a24
!! source digest: sha256:5d95f704715eea33543e706743e4d96b5d023912598d4ee1252de2e6d346faea
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-reconcile/tree/16.0/account_mass_reconcile"><img alt="OCA/account-reconcile" src="https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-reconcile-16-0/account-reconcile-16-0-account_mass_reconcile"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-reconcile&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This is a shared work between Akretion and Camptocamp
Expand Down Expand Up @@ -485,7 +485,9 @@ <h2><a class="toc-backref" href="#toc-entry-6">Other credits</a></h2>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
Expand Down
2 changes: 1 addition & 1 deletion account_reconcile_oca/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Account Reconcile Oca
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0dac23b0652791509d114ed8cb7d26d7c81e19bb2929adfd27c73926f3861e1d
!! source digest: sha256:6b56b826ddaf39b82eb55bb2852ff1b5b17fe7fae7eafbe3c79e023bddadf5f0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion account_reconcile_oca/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Account Reconcile Oca",
"summary": """
Reconcile addons for Odoo CE accounting""",
"version": "16.0.2.0.11",
"version": "16.0.2.1.0",
"license": "AGPL-3",
"author": "CreuBlanca,Dixmit,Odoo Community Association (OCA)",
"maintainers": ["etobella"],
Expand Down
12 changes: 11 additions & 1 deletion account_reconcile_oca/models/account_bank_statement_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,14 @@ def _default_reconcile_data(self, from_unreconcile=False):
res = (
self.env["account.reconcile.model"]
.search(
[("rule_type", "in", ["invoice_matching", "writeoff_suggestion"])]
[
(
"rule_type",
"in",
["invoice_matching", "writeoff_suggestion"],
),
("company_id", "=", self.company_id.id),
]
)
._apply_rules(self, self._retrieve_partner())
)
Expand All @@ -555,6 +562,8 @@ def _default_reconcile_data(self, from_unreconcile=False):
)
amount -= sum(line.get("amount") for line in line_data)
data += line_data
if res.get("auto_reconcile"):
self.reconcile_bank_line()
return self._recompute_suspense_line(
data,
reconcile_auxiliary_id,
Expand Down Expand Up @@ -745,6 +754,7 @@ def create(self, mvals):
models = self.env["account.reconcile.model"].search(
[
("rule_type", "in", ["invoice_matching", "writeoff_suggestion"]),
("company_id", "in", result.company_id.ids),
("auto_reconcile", "=", True),
]
)
Expand Down
9 changes: 9 additions & 0 deletions account_reconcile_oca/models/account_journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ def get_rainbowman_message(self):
if self.get_journal_dashboard_datas()["number_to_reconcile"] > 0:
return False
return _("Well done! Everything has been reconciled")

def open_action(self):
self.ensure_one()
if self.type not in ["bank", "cash"]:
return super().open_action()
action = self.env["ir.actions.actions"]._for_xml_id(
"account_reconcile_oca.action_bank_statement_line_reconcile_all"
)
return action
2 changes: 1 addition & 1 deletion account_reconcile_oca/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Account Reconcile Oca</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0dac23b0652791509d114ed8cb7d26d7c81e19bb2929adfd27c73926f3861e1d
!! source digest: sha256:6b56b826ddaf39b82eb55bb2852ff1b5b17fe7fae7eafbe3c79e023bddadf5f0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-reconcile/tree/16.0/account_reconcile_oca"><img alt="OCA/account-reconcile" src="https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-reconcile-16-0/account-reconcile-16-0-account_reconcile_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-reconcile&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This addon allows to reconcile bank statements and account marked as <cite>reconcile</cite>.</p>
Expand Down
12 changes: 12 additions & 0 deletions account_reconcile_oca/tests/test_bank_account_reconcile.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ class TestReconciliationWidget(TestAccountReconciliationCommon):
@classmethod
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
# Auto-disable reconciliation model created automatically with
# generate_account_reconcile_model() to avoid side effects in tests
cls.invoice_matching_models = cls.env["account.reconcile.model"].search(
[
("rule_type", "=", "invoice_matching"),
("auto_reconcile", "=", True),
("company_id", "=", cls.company.id),
]
)
cls.invoice_matching_models.active = False

cls.acc_bank_stmt_model = cls.env["account.bank.statement"]
cls.acc_bank_stmt_line_model = cls.env["account.bank.statement.line"]
Expand Down Expand Up @@ -988,6 +998,8 @@ def test_partner_name_with_parent(self):
}
)

self.invoice_matching_models.active = True
self.invoice_matching_models.match_text_location_label = False
bank_stmt_line = self.acc_bank_stmt_line_model.create(
{
"name": "testLine",
Expand Down
6 changes: 3 additions & 3 deletions account_reconcile_oca/views/account_bank_statement_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,12 @@
<field
name="context"
>{'default_journal_id': active_id, 'view_ref': 'account_reconcile_oca.bank_statement_line_form_reconcile_view'}</field>
<field name="view_mode">tree,kanban</field>
<field name="view_mode">kanban,tree</field>
<field
name="view_ids"
eval="[(5, 0, 0),
(0, 0, {'view_mode': 'tree', 'view_id': ref('account_statement_base.account_bank_statement_line_tree')}),
(0, 0, {'view_mode': 'kanban', 'view_id': ref('bank_statement_line_reconcile_view')})]"
(0, 0, {'view_mode': 'kanban', 'view_id': ref('bank_statement_line_reconcile_view')}),
(0, 0, {'view_mode': 'tree', 'view_id': ref('account_statement_base.account_bank_statement_line_tree')})]"
/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Expand Down
2 changes: 1 addition & 1 deletion account_statement_base/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Bank Statement Base
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0f208a0266c9859f456e7795df2b965abe53e87be6d56a302f28b54151cb35be
!! source digest: sha256:c4a1a66924d8c6a29df9a88895936ed398b450948c7772c6c228cdcd4c940f78
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
Expand Down
2 changes: 1 addition & 1 deletion account_statement_base/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "Bank Statement Base",
"version": "16.0.1.13.2",
"version": "16.0.1.14.0",
"category": "Accounting",
"license": "LGPL-3",
"summary": "Base module for Bank Statements",
Expand Down
2 changes: 1 addition & 1 deletion account_statement_base/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Bank Statement Base</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:0f208a0266c9859f456e7795df2b965abe53e87be6d56a302f28b54151cb35be
!! source digest: sha256:c4a1a66924d8c6a29df9a88895936ed398b450948c7772c6c228cdcd4c940f78
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-reconcile/tree/16.0/account_statement_base"><img alt="OCA/account-reconcile" src="https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-reconcile-16-0/account-reconcile-16-0-account_statement_base"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-reconcile&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<dl class="docutils">
Expand Down
5 changes: 5 additions & 0 deletions account_statement_base/views/account_bank_statement_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@
string="Transaction Type"
context="{'group_by': 'transaction_type'}"
/>
<filter
name="date_groupby"
string="Date"
context="{'group_by': 'date'}"
/>
</group>
</search>
</field>
Expand Down

0 comments on commit dbcb55e

Please sign in to comment.