feat: Add account_accountant dependency and enable showing and persisting reconciliation references in bank reconciliation.

This commit is contained in:
admin.suherdy 2025-12-06 19:14:30 +07:00
parent 5fedc31d4e
commit f923ca06ec
11 changed files with 208 additions and 208 deletions

110
README.md
View File

@ -1,56 +1,56 @@
# Account Reconciliation Reference
## Overview
This Odoo module enhances the bank reconciliation interface by displaying and managing reference information more effectively. It adds visibility and functionality for the 'ref' field across various reconciliation views and operations.
## Features
### Bank Reconciliation Views
- **Kanban Cards**: Shows the 'ref' field on bank reconciliation kanban cards for `account.bank.statement.line` records
- **List View**: Adds 'ref' column to bank reconciliation list view, making it visible by default
- **Search Functionality**: Includes 'ref' field in the bank reconciliation search, allowing users to filter by reference
### Journal Items Reconciliation
- Displays 'ref' field in Journal Items Reconcile list view for better visibility of reference information
### Manual Operations Panel
- Shows reference field in the Manual Operations panel for non-liquidity lines
- Makes the reference field editable for liquidity lines in the reconciliation form
- Persists the reference value to both the journal entry (`move.ref`) and statement line (`st_line.ref`) when entered
### Data Persistence
- When a reference is entered in Manual Operations, it's saved to both the journal entry reference and the statement line reference
- Reference values are maintained after validation and reconciliation operations
- Reference data is preserved when clicking Validate in reconciliation interface
## Technical Implementation
### Models
- Extends `bank.rec.widget` model to handle reference field persistence
- Implements `_line_value_changed_ref()` method to persist reference values to both journal entry and statement line
- Overrides `_action_validate()` method to ensure reference values are saved before reconciliation
### Views
- Extends kanban view for `account.bank.statement.line` to display reference
- Modifies tree view for `account.bank.statement.line` to show reference column by default
- Updates search view for `account.bank.statement.line` to include reference in search
- Extends reconciliation tree view for `account.move.line` to show reference field
- Custom XML template extends the manual operations panel in reconciliation form
## Usage
1. Navigate to the bank reconciliation interface
2. References will now be visible in kanban cards and list views
3. Use the search functionality to filter by reference
4. In Manual Operations panel, you can view and edit references for liquidity lines
5. When entering a reference and validating, it will be persisted to both the journal entry and statement line
## Dependencies
- `account_accountant` - Core accounting module with reconciliation features
## Compatibility
- Odoo Version: 17.0
- Module Version: 17.0.1.0.2
## License
# Account Reconciliation Reference
## Overview
This Odoo module enhances the bank reconciliation interface by displaying and managing reference information more effectively. It adds visibility and functionality for the 'ref' field across various reconciliation views and operations.
## Features
### Bank Reconciliation Views
- **Kanban Cards**: Shows the 'ref' field on bank reconciliation kanban cards for `account.bank.statement.line` records
- **List View**: Adds 'ref' column to bank reconciliation list view, making it visible by default
- **Search Functionality**: Includes 'ref' field in the bank reconciliation search, allowing users to filter by reference
### Journal Items Reconciliation
- Displays 'ref' field in Journal Items Reconcile list view for better visibility of reference information
### Manual Operations Panel
- Shows reference field in the Manual Operations panel for non-liquidity lines
- Makes the reference field editable for liquidity lines in the reconciliation form
- Persists the reference value to both the journal entry (`move.ref`) and statement line (`st_line.ref`) when entered
### Data Persistence
- When a reference is entered in Manual Operations, it's saved to both the journal entry reference and the statement line reference
- Reference values are maintained after validation and reconciliation operations
- Reference data is preserved when clicking Validate in reconciliation interface
## Technical Implementation
### Models
- Extends `bank.rec.widget` model to handle reference field persistence
- Implements `_line_value_changed_ref()` method to persist reference values to both journal entry and statement line
- Overrides `_action_validate()` method to ensure reference values are saved before reconciliation
### Views
- Extends kanban view for `account.bank.statement.line` to display reference
- Modifies tree view for `account.bank.statement.line` to show reference column by default
- Updates search view for `account.bank.statement.line` to include reference in search
- Extends reconciliation tree view for `account.move.line` to show reference field
- Custom XML template extends the manual operations panel in reconciliation form
## Usage
1. Navigate to the bank reconciliation interface
2. References will now be visible in kanban cards and list views
3. Use the search functionality to filter by reference
4. In Manual Operations panel, you can view and edit references for liquidity lines
5. When entering a reference and validating, it will be persisted to both the journal entry and statement line
## Dependencies
- `account_accountant` - Core accounting module with reconciliation features
## Compatibility
- Odoo Version: 17.0
- Module Version: 17.0.1.0.2
## License
LGPL-3

View File

@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
# Account Reconciliation Reference addon
# -*- coding: utf-8 -*-
# Account Reconciliation Reference addon
from . import models

View File

@ -1,31 +1,31 @@
# -*- coding: utf-8 -*-
{
'name': 'Account Reconciliation Reference',
'version': '17.0.1.0.2',
'category': 'Accounting/Accounting',
'summary': 'Show Reference on reconciliation kanban/list and add to search',
'description': """
Show Reference on reconciliation UI
- Adds 'ref' on bank reconciliation kanban cards (account.bank.statement.line)
- Shows 'ref' column in bank reconciliation list view
- Adds 'ref' field in bank reconciliation search
- Also shows 'ref' in Journal Items Reconcile list
- Shows 'ref' on Manual Operations panel and persists it on Validate
""",
'author': 'Your Company',
'website': 'https://example.com',
'license': 'LGPL-3',
'depends': ['account_accountant'],
'data': [
'views/account_reconcile_views.xml',
'views/bank_rec_widget_views.xml',
],
'assets': {
'web.assets_backend': [
'account_reconcile_reference/static/src/xml/bank_rec_form_inherit.xml',
],
},
'installable': True,
'auto_install': False,
'application': False,
# -*- coding: utf-8 -*-
{
'name': 'Account Reconciliation Reference',
'version': '17.0.1.0.2',
'category': 'Accounting/Accounting',
'summary': 'Show Reference on reconciliation kanban/list and add to search',
'description': """
Show Reference on reconciliation UI
- Adds 'ref' on bank reconciliation kanban cards (account.bank.statement.line)
- Shows 'ref' column in bank reconciliation list view
- Adds 'ref' field in bank reconciliation search
- Also shows 'ref' in Journal Items Reconcile list
- Shows 'ref' on Manual Operations panel and persists it on Validate
""",
'author': 'Suherdy Yacob',
'website': 'https://example.com',
'license': 'LGPL-3',
'depends': ['account_accountant'],
'data': [
'views/account_reconcile_views.xml',
'views/bank_rec_widget_views.xml',
],
'assets': {
'web.assets_backend': [
'account_reconcile_reference/static/src/xml/bank_rec_form_inherit.xml',
],
},
'installable': True,
'auto_install': False,
'application': False,
}

Binary file not shown.

View File

@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from . import bank_rec_widget

Binary file not shown.

Binary file not shown.

View File

@ -1,37 +1,37 @@
# -*- coding: utf-8 -*-
from odoo import models
class BankRecWidget(models.Model):
_inherit = "bank.rec.widget"
def _line_value_changed_ref(self, line):
"""
Persist the typed Reference as both:
- Journal Entry Reference (move.ref) so it shows on journal items
- Statement Line Reference (st_line.ref) so it remains visible after validation
Works for liquidity and non-liquidity lines in Manual Operations.
"""
self.ensure_one()
ref_val = line.ref or False
# Persist to the move (journal entry)
self.st_line_id.move_id.ref = ref_val
# Persist to the statement line so the OWL form keeps showing it after validation
# (bank_rec_form.xml shows Reference for liquidity based on line.data.ref which maps to st_line.ref)
self.st_line_id.ref = ref_val
# Reload liquidity line and the record to reflect the updated reference
self._action_reload_liquidity_line()
self.return_todo_command = {"reset_record": True, "reset_global_info": True}
def _action_validate(self):
"""
Ensure the typed Reference is flushed to the target move before reconciliation creates/replaces lines.
This covers the case when the user clicks Validate immediately after typing in Manual Operations.
"""
self.ensure_one()
line = self._lines_get_line_in_edit_form()
if line and getattr(line, "ref", False):
ref_val = line.ref
self.st_line_id.move_id.ref = ref_val
self.st_line_id.ref = ref_val
# -*- coding: utf-8 -*-
from odoo import models
class BankRecWidget(models.Model):
_inherit = "bank.rec.widget"
def _line_value_changed_ref(self, line):
"""
Persist the typed Reference as both:
- Journal Entry Reference (move.ref) so it shows on journal items
- Statement Line Reference (st_line.ref) so it remains visible after validation
Works for liquidity and non-liquidity lines in Manual Operations.
"""
self.ensure_one()
ref_val = line.ref or False
# Persist to the move (journal entry)
self.st_line_id.move_id.ref = ref_val
# Persist to the statement line so the OWL form keeps showing it after validation
# (bank_rec_form.xml shows Reference for liquidity based on line.data.ref which maps to st_line.ref)
self.st_line_id.ref = ref_val
# Reload liquidity line and the record to reflect the updated reference
self._action_reload_liquidity_line()
self.return_todo_command = {"reset_record": True, "reset_global_info": True}
def _action_validate(self):
"""
Ensure the typed Reference is flushed to the target move before reconciliation creates/replaces lines.
This covers the case when the user clicks Validate immediately after typing in Manual Operations.
"""
self.ensure_one()
line = self._lines_get_line_in_edit_form()
if line and getattr(line, "ref", False):
ref_val = line.ref
self.st_line_id.move_id.ref = ref_val
self.st_line_id.ref = ref_val
return super()._action_validate()

View File

@ -1,29 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<templates xml:space="preserve">
<!-- Extend Manual Operations panel to show Reference for non-liquidity lines and make it editable -->
<t t-name="account_reconcile_reference.BankRecManualOperationsRef"
t-inherit="account_accountant.BankRecRecordNotebookManualOperations"
t-inherit-mode="extension">
<xpath expr="//div[@name='name']" position="after">
<div name="reference_manual"
t-if="line.data.flag !== 'liquidity' and (!reconciled or (reconciled and line.data.ref))"
class="o_wrap_field d-flex d-sm-contents flex-column mb-3 mb-sm-0">
<div class="o_cell o_wrap_label flex-grow-1 flex-sm-grow-0 w-100 text-break text-900">
<label class="o_form_label" t-att-class="{'o_form_label_readonly': readonly}">Reference</label>
</div>
<div class="o_cell o_wrap_input flex-grow-1 flex-sm-grow-0" style="width: 100%; margin-bottom: 5px">
<div class="o_field_widget o_field_char">
<!-- Reset patch: keep non-liquidity Reference read-only -->
<CharField name="'ref'" record="line" readonly="true"/>
</div>
</div>
</div>
</xpath>
<!-- Also make the original liquidity 'Reference' editable -->
<!-- Use a simpler XPath to avoid quoting issues in attribute predicates -->
<xpath expr="//div[@name='reference']//CharField" position="attributes">
<attribute name="readonly">false</attribute>
</xpath>
</t>
<?xml version="1.0" encoding="utf-8"?>
<templates xml:space="preserve">
<!-- Extend Manual Operations panel to show Reference for non-liquidity lines and make it editable -->
<t t-name="account_reconcile_reference.BankRecManualOperationsRef"
t-inherit="account_accountant.BankRecRecordNotebookManualOperations"
t-inherit-mode="extension">
<xpath expr="//div[@name='name']" position="after">
<div name="reference_manual"
t-if="line.data.flag !== 'liquidity' and (!reconciled or (reconciled and line.data.ref))"
class="o_wrap_field d-flex d-sm-contents flex-column mb-3 mb-sm-0">
<div class="o_cell o_wrap_label flex-grow-1 flex-sm-grow-0 w-100 text-break text-900">
<label class="o_form_label" t-att-class="{'o_form_label_readonly': readonly}">Reference</label>
</div>
<div class="o_cell o_wrap_input flex-grow-1 flex-sm-grow-0" style="width: 100%; margin-bottom: 5px">
<div class="o_field_widget o_field_char">
<!-- Reset patch: keep non-liquidity Reference read-only -->
<CharField name="'ref'" record="line" readonly="true"/>
</div>
</div>
</div>
</xpath>
<!-- Also make the original liquidity 'Reference' editable -->
<!-- Use a simpler XPath to avoid quoting issues in attribute predicates -->
<xpath expr="//div[@name='reference']//CharField" position="attributes">
<attribute name="readonly">false</attribute>
</xpath>
</t>
</templates>

View File

@ -1,16 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_move_line_reconcile_tree_inherit_ref_visible" model="ir.ui.view">
<field name="name">account.move.line.tree.reconcile.inherit.ref.visible</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account_accountant.view_move_line_reconcile_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree//field[@name='ref']" position="attributes">
<attribute name="optional">show</attribute>
<attribute name="readonly">0</attribute>
</xpath>
</field>
</record>
</data>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_move_line_reconcile_tree_inherit_ref_visible" model="ir.ui.view">
<field name="name">account.move.line.tree.reconcile.inherit.ref.visible</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account_accountant.view_move_line_reconcile_tree"/>
<field name="arch" type="xml">
<xpath expr="//tree//field[@name='ref']" position="attributes">
<attribute name="optional">show</attribute>
<attribute name="readonly">0</attribute>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@ -1,42 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Kanban: show ref on bank rec widget cards -->
<record id="view_bank_statement_line_kanban_inherit_ref" model="ir.ui.view">
<field name="name">account.bank.statement.line.kanban.inherit.ref</field>
<field name="model">account.bank.statement.line</field>
<field name="inherit_id" ref="account_accountant.view_bank_statement_line_kanban_bank_rec_widget"/>
<field name="arch" type="xml">
<xpath expr="//templates/t[@t-name='kanban-box']//div[@id='row2_col1']" position="after">
<div id="row2_ref" class="text-truncate text-muted">
<field name="ref"/>
</div>
</xpath>
</field>
</record>
<!-- Tree: show ref column by default -->
<record id="view_bank_statement_line_tree_inherit_ref_visible" model="ir.ui.view">
<field name="name">account.bank.statement.line.tree.inherit.ref.visible</field>
<field name="model">account.bank.statement.line</field>
<field name="inherit_id" ref="account_accountant.view_bank_statement_line_tree_bank_rec_widget"/>
<field name="arch" type="xml">
<xpath expr="//tree//field[@name='ref']" position="attributes">
<attribute name="optional">show</attribute>
</xpath>
</field>
</record>
<!-- Search: include ref -->
<record id="view_bank_statement_line_search_inherit_add_ref" model="ir.ui.view">
<field name="name">account.bank.statement.line.search.inherit.add.ref</field>
<field name="model">account.bank.statement.line</field>
<field name="inherit_id" ref="account_accountant.view_bank_statement_line_search_bank_rec_widget"/>
<field name="arch" type="xml">
<xpath expr="//search" position="inside">
<field name="ref"/>
</xpath>
</field>
</record>
</data>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Kanban: show ref on bank rec widget cards -->
<record id="view_bank_statement_line_kanban_inherit_ref" model="ir.ui.view">
<field name="name">account.bank.statement.line.kanban.inherit.ref</field>
<field name="model">account.bank.statement.line</field>
<field name="inherit_id" ref="account_accountant.view_bank_statement_line_kanban_bank_rec_widget"/>
<field name="arch" type="xml">
<xpath expr="//templates/t[@t-name='kanban-box']//div[@id='row2_col1']" position="after">
<div id="row2_ref" class="text-truncate text-muted">
<field name="ref"/>
</div>
</xpath>
</field>
</record>
<!-- Tree: show ref column by default -->
<record id="view_bank_statement_line_tree_inherit_ref_visible" model="ir.ui.view">
<field name="name">account.bank.statement.line.tree.inherit.ref.visible</field>
<field name="model">account.bank.statement.line</field>
<field name="inherit_id" ref="account_accountant.view_bank_statement_line_tree_bank_rec_widget"/>
<field name="arch" type="xml">
<xpath expr="//tree//field[@name='ref']" position="attributes">
<attribute name="optional">show</attribute>
</xpath>
</field>
</record>
<!-- Search: include ref -->
<record id="view_bank_statement_line_search_inherit_add_ref" model="ir.ui.view">
<field name="name">account.bank.statement.line.search.inherit.add.ref</field>
<field name="model">account.bank.statement.line</field>
<field name="inherit_id" ref="account_accountant.view_bank_statement_line_search_bank_rec_widget"/>
<field name="arch" type="xml">
<xpath expr="//search" position="inside">
<field name="ref"/>
</xpath>
</field>
</record>
</data>
</odoo>