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

View File

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

View File

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

Binary file not shown.

View File

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

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

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

View File

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