Skip to content

Commit

Permalink
[ADD] l10n_nl_rgs_usability
Browse files Browse the repository at this point in the history
  • Loading branch information
astirpe committed Aug 8, 2023
1 parent 44750ae commit dfa1c0b
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 0 deletions.
6 changes: 6 additions & 0 deletions l10n_nl_rgs_usability/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
========================================
Netherlands - RGS Accounting - Usability
========================================

This module contains usability improvements for RGS accounting that are not fitting
in module l10n_nl_rgs. The idea is to leave l10n_nl_rgs as much generic as possible.
1 change: 1 addition & 0 deletions l10n_nl_rgs_usability/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions l10n_nl_rgs_usability/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

{
'name': 'Netherlands - RGS Accounting - Usability',
"version": "16.0.1.0.0",
'category': 'Accounting/Localizations/Account Charts',
'author': 'Onestein',
'website': 'https://www.onestein.eu',
'depends': [
'l10n_nl_rgs',
'base_view_inheritance_extension',
],
'data': [
'views/account_journal_views.xml',
],
'auto_install': True,
'installable': True,
'license': 'LGPL-3',
}
1 change: 1 addition & 0 deletions l10n_nl_rgs_usability/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_account
17 changes: 17 additions & 0 deletions l10n_nl_rgs_usability/models/account_account.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

from odoo import api, fields, models, _


class AccountAccount(models.Model):
_inherit = 'account.account'

@api.model
def name_search(self, name, args=None, operator="ilike", limit=100):
chart_template = self.env.company.chart_template_id
is_rgs = chart_template == self.env.ref('l10n_nl_rgs.l10nnl_rgs_chart_template')
is_bank = self.env.context.get('domain_account_journal_type') == "bank"
prefix = chart_template.bank_account_code_prefix
if is_rgs and is_bank and prefix and operator == "ilike":
args = args or []
args = [("code", "=ilike", prefix + "%")] + args
return super().name_search(name, args=args, operator=operator, limit=limit)
17 changes: 17 additions & 0 deletions l10n_nl_rgs_usability/views/account_journal_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_account_journal_form" model="ir.ui.view">
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<field name='default_account_id' position="attributes">
<attribute name="context" operation="update">
{
"domain_account_journal_type": type,
}
</attribute>
<attribute name="options">{'no_create': True}</attribute>
</field>
</field>
</record>
</odoo>
1 change: 1 addition & 0 deletions package.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ container_password_security
l10n_nl_rgs
l10n_nl_rgs_account_financial_report
l10n_nl_rgs_asset
l10n_nl_rgs_usability
l10n_nl_rgs_mis_report
membership_accessibility
services_org_install
Expand Down

0 comments on commit dfa1c0b

Please # to comment.