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.0][IMP] account_reconcile_oca: Add Reconcile action #613

Merged
merged 2 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 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:bc5ac758c54a958b23fe3962f890d737b6949c7054be36b79002f62095cfeffc
!! source digest: sha256:3f6bc07a9963be4143fdb984d07e4b6a0542e791f082edb98e907cc000ea0617
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down Expand Up @@ -75,6 +75,7 @@ Authors
~~~~~~~

* CreuBlanca
* Dixmit

Contributors
~~~~~~~~~~~~
Expand Down
4 changes: 2 additions & 2 deletions account_reconcile_oca/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 CreuBlanca
# Copyright 2023 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
Expand All @@ -7,7 +7,7 @@
Reconcile addons for Odoo CE accounting""",
"version": "16.0.1.2.5",
"license": "AGPL-3",
"author": "CreuBlanca,Odoo Community Association (OCA)",
"author": "CreuBlanca,Dixmit,Odoo Community Association (OCA)",
"maintainers": ["etobella"],
"website": "https://github.com/OCA/account-reconcile",
"depends": [
Expand Down
1 change: 1 addition & 0 deletions account_reconcile_oca/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
from . import account_journal
from . import account_bank_statement_line
from . import account_account_reconcile
from . import account_move_line
9 changes: 8 additions & 1 deletion account_reconcile_oca/models/account_account_reconcile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 CreuBlanca
# Copyright 2023 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models
Expand Down Expand Up @@ -84,6 +84,13 @@
def _compute_reconcile_data_info(self):
data_obj = self.env["account.account.reconcile.data"]
for record in self:
if self.env.context.get("default_account_move_lines"):
data = {

Check warning on line 88 in account_reconcile_oca/models/account_account_reconcile.py

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_account_reconcile.py#L88

Added line #L88 was not covered by tests
"data": [],
"counterparts": self.env.context.get("default_account_move_lines"),
}
record.reconcile_data_info = self._recompute_data(data)
continue

Check warning on line 93 in account_reconcile_oca/models/account_account_reconcile.py

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_account_reconcile.py#L92-L93

Added lines #L92 - L93 were not covered by tests
data_record = data_obj.search(
[("user_id", "=", self.env.user.id), ("reconcile_id", "=", record.id)]
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 CreuBlanca
# Copyright 2023 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from collections import defaultdict
Expand Down
2 changes: 1 addition & 1 deletion account_reconcile_oca/models/account_journal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 CreuBlanca
# Copyright 2023 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, fields, models
Expand Down
34 changes: 34 additions & 0 deletions account_reconcile_oca/models/account_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2023 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, models
from odoo.exceptions import ValidationError


class AccountMoveLine(models.Model):

_inherit = "account.move.line"

def action_reconcile_manually(self):
if not self:
return {}
self.mapped("account_id").ensure_one()
partner = self.mapped("partner_id")

Check warning on line 16 in account_reconcile_oca/models/account_move_line.py

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_move_line.py#L14-L16

Added lines #L14 - L16 were not covered by tests
if partner:
partner.ensure_one()

Check warning on line 18 in account_reconcile_oca/models/account_move_line.py

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_move_line.py#L18

Added line #L18 was not covered by tests
if self.filtered(lambda r: r.partner_id != partner):
raise ValidationError(

Check warning on line 20 in account_reconcile_oca/models/account_move_line.py

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_move_line.py#L20

Added line #L20 was not covered by tests
_("You must reconcile information on the same partner")
)
action = self.env["ir.actions.act_window"]._for_xml_id(

Check warning on line 23 in account_reconcile_oca/models/account_move_line.py

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_move_line.py#L23

Added line #L23 was not covered by tests
"account_reconcile_oca.account_account_reconcile_act_window"
)
action["domain"] = [

Check warning on line 26 in account_reconcile_oca/models/account_move_line.py

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_move_line.py#L26

Added line #L26 was not covered by tests
("account_id", "=", self.mapped("account_id").id),
("partner_id", "=", partner.id),
]
action["context"] = self.env.context.copy()

Check warning on line 30 in account_reconcile_oca/models/account_move_line.py

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_move_line.py#L30

Added line #L30 was not covered by tests
action["context"]["default_account_move_lines"] = self.filtered(
lambda r: not r.reconciled
).ids
return action

Check warning on line 34 in account_reconcile_oca/models/account_move_line.py

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_move_line.py#L34

Added line #L34 was not covered by tests
2 changes: 1 addition & 1 deletion account_reconcile_oca/models/account_reconcile_abstract.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 CreuBlanca
# Copyright 2023 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models
Expand Down
4 changes: 3 additions & 1 deletion account_reconcile_oca/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?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 Down Expand Up @@ -366,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:bc5ac758c54a958b23fe3962f890d737b6949c7054be36b79002f62095cfeffc
!! source digest: sha256:3f6bc07a9963be4143fdb984d07e4b6a0542e791f082edb98e907cc000ea0617
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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 Expand Up @@ -423,6 +424,7 @@ <h1><a class="toc-backref" href="#toc-entry-6">Credits</a></h1>
<h2><a class="toc-backref" href="#toc-entry-7">Authors</a></h2>
<ul class="simple">
<li>CreuBlanca</li>
<li>Dixmit</li>
</ul>
</div>
<div class="section" id="contributors">
Expand Down
2 changes: 1 addition & 1 deletion account_reconcile_oca/views/account_account.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 CreuBlanca
<!-- Copyright 2023 Dixmit
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

Expand Down
2 changes: 1 addition & 1 deletion account_reconcile_oca/views/account_account_reconcile.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 CreuBlanca
<!-- Copyright 2023 Dixmit
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 CreuBlanca
<!-- Copyright 2023 Dixmit
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

Expand Down
2 changes: 1 addition & 1 deletion account_reconcile_oca/views/account_journal.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 CreuBlanca
<!-- Copyright 2023 Dixmit
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

Expand Down
2 changes: 1 addition & 1 deletion account_reconcile_oca/views/account_move.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 CreuBlanca
<!-- Copyright 2023 Dixmit
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

Expand Down
11 changes: 10 additions & 1 deletion account_reconcile_oca/views/account_move_line.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2022 CreuBlanca
<!-- Copyright 2023 Dixmit
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>

Expand Down Expand Up @@ -101,4 +101,13 @@
</search>
</field>
</record>

<record id="action_reconcile" model="ir.actions.server">
<field name="name">Reconcile</field>
<field name="model_id" ref="account.model_account_move_line" />
<field name="binding_model_id" ref="account.model_account_move_line" />
<field name="binding_view_types">list</field>
<field name="state">code</field>
<field name="code">action = records.action_reconcile_manually()</field>
</record>
</odoo>
Loading