-
-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for regulatory reporting in PAIN files
Harmonize values for reference_type on account.move and communication_type on account.payment.line: 2 possible values : free and structured (migration script provided) Simplify code for reference.
- Loading branch information
1 parent
caad76b
commit 4584b38
Showing
26 changed files
with
247 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
account_banking_pain_base/models/account_pain_regulatory_reporting.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright 2023 Akretion France (http://www.akretion.com/) | ||
# @author: Alexis de Lattre <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class AccountPainRegulatoryReporting(models.Model): | ||
_name = "account.pain.regulatory.reporting" | ||
_description = "Regulatory Reporting Codes for ISO 20022/PAIN banking standard" | ||
_order = "code, country_id" | ||
|
||
code = fields.Char(required=True, copy=False, size=10) | ||
name = fields.Char(required=True, translate=True, copy=False) | ||
country_id = fields.Many2one("res.country", ondelete="restrict", required=False) | ||
active = fields.Boolean(default=True) | ||
|
||
_sql_constraints = [ | ||
( | ||
"code_country_unique", | ||
"unique(code, country_id)", | ||
"This code already exists for that country.", | ||
) | ||
] | ||
|
||
@api.depends("code", "name") | ||
def name_get(self): | ||
res = [] | ||
for rec in self: | ||
res.append((rec.id, "[%s] %s" % (rec.code, rec.name))) | ||
return res | ||
|
||
def _name_search( | ||
self, name="", args=None, operator="ilike", limit=100, name_get_uid=None | ||
): | ||
if args is None: | ||
args = [] | ||
ids = [] | ||
if name and operator == "ilike": | ||
ids = list(self._search([("code", "=", name)] + args, limit=limit)) | ||
if ids: | ||
return ids | ||
return super()._name_search( | ||
name=name, | ||
args=args, | ||
operator=operator, | ||
limit=limit, | ||
name_get_uid=name_get_uid, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_account_pain_regulatory_reporting_read,Read access on account.pain.regulatory.reporting,model_account_pain_regulatory_reporting,base.group_user,1,0,0,0 | ||
access_account_pain_regulatory_reporting_full,Full access on account.pain.regulatory.reporting,model_account_pain_regulatory_reporting,account.group_account_manager,1,1,1,1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
account_banking_pain_base/views/account_pain_regulatory_reporting.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- | ||
Copyright 2023 Akretion France (http://www.akretion.com/) | ||
@author: Alexis de Lattre <[email protected]> | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
--> | ||
<odoo> | ||
|
||
<record id="account_pain_regulatory_reporting_form" model="ir.ui.view"> | ||
<field name="model">account.pain.regulatory.reporting</field> | ||
<field name="arch" type="xml"> | ||
<form> | ||
<widget | ||
name="web_ribbon" | ||
title="Archived" | ||
bg_color="bg-danger" | ||
attrs="{'invisible': [('active', '=', True)]}" | ||
/> | ||
<group name="main"> | ||
<field name="code" /> | ||
<field name="name" /> | ||
<field name="country_id" /> | ||
<field name="active" invisible="1" /> | ||
</group> | ||
</form> | ||
</field> | ||
</record> | ||
|
||
<record id="account_pain_regulatory_reporting_tree" model="ir.ui.view"> | ||
<field name="model">account.pain.regulatory.reporting</field> | ||
<field name="arch" type="xml"> | ||
<tree> | ||
<field name="code" decoration-bf="1" /> | ||
<field name="name" /> | ||
<field name="country_id" /> | ||
</tree> | ||
</field> | ||
</record> | ||
|
||
<record id="account_pain_regulatory_reporting_search" model="ir.ui.view"> | ||
<field name="model">account.pain.regulatory.reporting</field> | ||
<field name="arch" type="xml"> | ||
<search> | ||
<field | ||
name="name" | ||
filter_domain="['|', ('name', 'ilike', self), ('code', 'ilike', self)]" | ||
string="Code or Name" | ||
/> | ||
<field name="country_id" /> | ||
<separator /> | ||
<filter | ||
string="Archived" | ||
name="inactive" | ||
domain="[('active', '=', False)]" | ||
/> | ||
<group name="groupby"> | ||
<filter | ||
name="country_groupby" | ||
string="Country" | ||
context="{'group_by': 'country_id'}" | ||
/> | ||
</group> | ||
</search> | ||
</field> | ||
</record> | ||
|
||
<record id="account_pain_regulatory_reporting_action" model="ir.actions.act_window"> | ||
<field name="name">PAIN Regulatory Reporting</field> | ||
<field name="res_model">account.pain.regulatory.reporting</field> | ||
<field name="view_mode">tree,form</field> | ||
</record> | ||
|
||
<menuitem | ||
id="account_pain_regulatory_reporting_menu" | ||
action="account_pain_regulatory_reporting_action" | ||
parent="account.account_management_menu" | ||
sequence="200" | ||
/> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.