Skip to content

Commit

Permalink
Merge pull request #140 from Aymen-Mohammednur/aymen/registry-document
Browse files Browse the repository at this point in the history
Implement Registry Document
  • Loading branch information
shibu-narayanan authored Jul 11, 2024
2 parents 0f3fc67 + af96453 commit 5697c96
Show file tree
Hide file tree
Showing 16 changed files with 800 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ addon | version | maintainers | summary
[g2p_bank_rest_api](g2p_bank_rest_api/) | 17.0.1.0.0 | | G2P Registry: Bank Details Rest API
[g2p_registry_addl_info](g2p_registry_addl_info/) | 17.0.1.0.0 | | G2P Registry: Additional Info
[g2p_registry_base](g2p_registry_base/) | 17.0.1.0.0 | | G2P Registry: Base
[g2p_registry_documents](g2p_registry_documents/) | 17.0.1.0.0 | | G2P Registry: Documents
[g2p_registry_group](g2p_registry_group/) | 17.0.1.0.0 | | G2P Registry: Groups
[g2p_registry_individual](g2p_registry_individual/) | 17.0.1.0.0 | | G2P Registry: Individual
[g2p_registry_membership](g2p_registry_membership/) | 17.0.1.0.0 | | G2P Registry: Membership
Expand Down
57 changes: 57 additions & 0 deletions g2p_registry_documents/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
=======================
G2P Registry: Documents
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:be893f09ee3ed022984d29a10b863b4a2545a498c6519749f6b4867f967c72b0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/github-OpenG2P%2Fopeng2p--registry-lightgray.png?logo=github
:target: https://github.com/OpenG2P/openg2p-registry/tree/17.0-develop/g2p_registry_documents
:alt: OpenG2P/openg2p-registry

|badge1| |badge2|

G2P Registry Documents

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OpenG2P/openg2p-registry/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OpenG2P/openg2p-registry/issues/new?body=module:%20g2p_registry_documents%0Aversion:%2017.0-develop%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* OpenG2P

Maintainers
~~~~~~~~~~~

This module is part of the `OpenG2P/openg2p-registry <https://github.com/OpenG2P/openg2p-registry/tree/17.0-develop/g2p_registry_documents>`_ project on GitHub.

You are welcome to contribute.
2 changes: 2 additions & 0 deletions g2p_registry_documents/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Part of OpenG2P. See LICENSE file for full copyright and licensing details.
from . import models
30 changes: 30 additions & 0 deletions g2p_registry_documents/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Part of OpenG2P. See LICENSE file for full copyright and licensing details.
{
"name": "G2P Registry: Documents",
"category": "G2P",
"version": "17.0.1.0.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://openg2p.org",
"license": "Other OSI approved licence",
"development_status": "Alpha",
"depends": [
"g2p_documents",
"g2p_registry_base",
"g2p_registry_individual",
"g2p_registry_group",
],
"data": [
"views/registrant_document_views.xml",
],
"assets": {
"web.assets_backend": [
"static/src/js/preview_document.js",
],
},
"demo": [],
"images": [],
"application": True,
"installable": True,
"auto_install": False,
}
4 changes: 4 additions & 0 deletions g2p_registry_documents/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Part of OpenG2P. See LICENSE file for full copyright and licensing details.
from . import registrant_document
from . import document_file
from . import document_store
15 changes: 15 additions & 0 deletions g2p_registry_documents/models/document_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from odoo import fields, models


class G2PDocumentRegistry(models.Model):
_inherit = "storage.file"

registrant_id = fields.Many2one("res.partner")

def get_record(self):
for record in self:
return {
"mimetype": record.mimetype,
"name": record.name,
"url": record.url if record.url else "#",
}
11 changes: 11 additions & 0 deletions g2p_registry_documents/models/document_store.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from odoo import models


class G2PDocumentStore(models.Model):
_inherit = "storage.backend"

def add_file_registrant(self, data, name=None, extension=None, registrant=None, **kwargs):
res = super().add_file(data, name=name, extension=extension, **kwargs)
if registrant:
res.registrant_id = registrant
return res
7 changes: 7 additions & 0 deletions g2p_registry_documents/models/registrant_document.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from odoo import fields, models


class ResPartner(models.Model):
_inherit = "res.partner"

supporting_documents_ids = fields.One2many("storage.file", "registrant_id")
3 changes: 3 additions & 0 deletions g2p_registry_documents/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
1 change: 1 addition & 0 deletions g2p_registry_documents/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
G2P Registry Documents
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5697c96

Please sign in to comment.