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: reconcile lines from statement #757

Merged
merged 1 commit into from
Nov 26, 2024
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
15 changes: 15 additions & 0 deletions account_reconcile_oca/models/account_bank_statement.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2024 Dixmit
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models
from odoo.tools.safe_eval import safe_eval


class AccountBankStatement(models.Model):
Expand All @@ -13,3 +14,17 @@
)
action["res_id"] = self.id
return action

def action_open_statement_lines(self):
"""Open in reconciling view directly"""
self.ensure_one()

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

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_bank_statement.py#L20

Added line #L20 was not covered by tests
if not self:
return {}
action = self.env["ir.actions.act_window"]._for_xml_id(

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

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_bank_statement.py#L22-L23

Added lines #L22 - L23 were not covered by tests
"account_reconcile_oca.action_bank_statement_line_reconcile"
)
action["domain"] = [("statement_id", "=", self.id)]
action["context"] = safe_eval(

Check warning on line 27 in account_reconcile_oca/models/account_bank_statement.py

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_bank_statement.py#L26-L27

Added lines #L26 - L27 were not covered by tests
action["context"], locals_dict={"active_id": self._context.get("active_id")}
)
return action

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

View check run for this annotation

Codecov / codecov/patch

account_reconcile_oca/models/account_bank_statement.py#L30

Added line #L30 was not covered by tests
17 changes: 16 additions & 1 deletion account_reconcile_oca/views/account_bank_statement.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,22 @@
</form>
</field>
</record>

<record id="view_bank_statement_form" model="ir.ui.view">
<field name="model">account.bank.statement</field>
<field
name="inherit_id"
ref="account_statement_base.view_bank_statement_form"
/>
<field name="arch" type="xml">
<xpath
expr="//button[contains(@context,'search_default_statement_id')]"
position="attributes"
>
<attribute name="type">object</attribute>
<attribute name="name">action_open_statement_lines</attribute>
</xpath>
</field>
</record>
<record id="account_bank_statement_action_edit" model="ir.actions.act_window">
<field name="name">Edit Bank Statement</field>
<field name="res_model">account.bank.statement</field>
Expand Down
Loading