Skip to content

Commit 76a8745

Browse files
committed
Added Additional Info view and widget
1 parent 9949618 commit 76a8745

File tree

14 files changed

+663
-0
lines changed

14 files changed

+663
-0
lines changed

g2p_registry_addl_info/README.rst

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
=============================
2+
G2P Registry: Additional Info
3+
=============================
4+
5+
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6+
!! This file is generated by oca-gen-addon-readme !!
7+
!! changes will be overwritten. !!
8+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9+
10+
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
11+
:target: https://odoo-community.org/page/development-status
12+
:alt: Alpha
13+
.. |badge2| image:: https://img.shields.io/badge/github-OpenG2P%2Fopeng2p--registry-lightgray.png?logo=github
14+
:target: https://github.com/OpenG2P/openg2p-registry/tree/15.0-develop/g2p_registry_addl_info
15+
:alt: OpenG2P/openg2p-registry
16+
17+
|badge1| |badge2|
18+
19+
This module adds support to Registry modules (registry_base, registry_individual and registry_group)
20+
to accept a new field called additional_g2p_info, which stores data as json and displays it as form.
21+
22+
.. IMPORTANT::
23+
This is an alpha version, the data model and design can change at any time without warning.
24+
Only for development or testing purpose, do not use in production.
25+
`More details on development status <https://odoo-community.org/page/development-status>`_
26+
27+
**Table of contents**
28+
29+
.. contents::
30+
:local:
31+
32+
Bug Tracker
33+
===========
34+
35+
Bugs are tracked on `GitHub Issues <https://github.com/OpenG2P/openg2p-registry/issues>`_.
36+
In case of trouble, please check there if your issue has already been reported.
37+
If you spotted it first, help us smashing it by providing a detailed and welcomed
38+
`feedback <https://github.com/OpenG2P/openg2p-registry/issues/new?body=module:%20g2p_registry_addl_info%0Aversion:%2015.0-develop%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
39+
40+
Do not contact contributors directly about support or help with technical issues.
41+
42+
Credits
43+
=======
44+
45+
Authors
46+
~~~~~~~
47+
48+
* OpenG2P
49+
50+
Maintainers
51+
~~~~~~~~~~~
52+
53+
This module is part of the `OpenG2P/openg2p-registry <https://github.com/OpenG2P/openg2p-registry/tree/15.0-develop/g2p_registry_addl_info>`_ project on GitHub.
54+
55+
You are welcome to contribute.

g2p_registry_addl_info/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "G2P Registry: Additional Info",
3+
"category": "G2P",
4+
"version": "15.0.0.0.1",
5+
"sequence": 1,
6+
"author": "OpenG2P",
7+
"website": "https://github.com/openg2p/openg2p-registry",
8+
"license": "Other OSI approved licence",
9+
"development_status": "Alpha",
10+
"depends": ["g2p_registry_base", "g2p_registry_individual", "g2p_registry_group"],
11+
"data": [
12+
"views/registrant_individual.xml",
13+
"views/registrant_group.xml",
14+
],
15+
"assets": {
16+
"web.assets_backend": [
17+
"/g2p_registry_addl_info/static/src/js/g2p_additional_info.js",
18+
],
19+
"web.assets_qweb": [
20+
"/g2p_registry_addl_info/static/src/xml/g2p_additional_info.xml",
21+
],
22+
},
23+
"demo": [],
24+
"images": [],
25+
"application": False,
26+
"installable": True,
27+
"auto_install": False,
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import registrant
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import json
2+
3+
from odoo import _, api, fields, models
4+
from odoo.exceptions import ValidationError
5+
6+
7+
class G2PRegistrant(models.Model):
8+
_inherit = "res.partner"
9+
10+
additional_g2p_info = fields.Text("Additional Information", default="{}")
11+
12+
@api.onchange("additional_g2p_info")
13+
def _onchange_additional_g2p_info(self):
14+
for rec in self:
15+
if rec.additional_g2p_info:
16+
addl_json = {}
17+
try:
18+
addl_json = json.loads(rec.additional_g2p_info)
19+
except ValueError as ve:
20+
raise ValidationError(
21+
_("Additional Information is not valid json.")
22+
) from ve
23+
rec.additional_g2p_info = json.dumps(addl_json, separators=(",", ":"))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
This module adds support to Registry modules (registry_base, registry_individual and registry_group)
2+
to accept a new field called additional_g2p_info, which stores data as json and displays it as form.
Loading

0 commit comments

Comments
 (0)