first commit
This commit is contained in:
commit
eb2cd470e7
3
__init__.py
Normal file
3
__init__.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Account Reconciliation Reference addon
|
||||||
|
from . import models
|
||||||
31
__manifest__.py
Normal file
31
__manifest__.py
Normal file
@ -0,0 +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,
|
||||||
|
}
|
||||||
BIN
__pycache__/__init__.cpython-312.pyc
Normal file
BIN
__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
2
models/__init__.py
Normal file
2
models/__init__.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from . import bank_rec_widget
|
||||||
BIN
models/__pycache__/__init__.cpython-312.pyc
Normal file
BIN
models/__pycache__/__init__.cpython-312.pyc
Normal file
Binary file not shown.
BIN
models/__pycache__/bank_rec_widget.cpython-312.pyc
Normal file
BIN
models/__pycache__/bank_rec_widget.cpython-312.pyc
Normal file
Binary file not shown.
37
models/bank_rec_widget.py
Normal file
37
models/bank_rec_widget.py
Normal file
@ -0,0 +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
|
||||||
|
return super()._action_validate()
|
||||||
29
static/src/xml/bank_rec_form_inherit.xml
Normal file
29
static/src/xml/bank_rec_form_inherit.xml
Normal file
@ -0,0 +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>
|
||||||
|
</templates>
|
||||||
16
views/account_reconcile_views.xml
Normal file
16
views/account_reconcile_views.xml
Normal file
@ -0,0 +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>
|
||||||
|
</odoo>
|
||||||
42
views/bank_rec_widget_views.xml
Normal file
42
views/bank_rec_widget_views.xml
Normal file
@ -0,0 +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>
|
||||||
|
</odoo>
|
||||||
Loading…
Reference in New Issue
Block a user