Skip to content
This repository was archived by the owner on Sep 12, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 129 additions & 0 deletions g2p_program_user_mapping/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
54 changes: 54 additions & 0 deletions g2p_program_user_mapping/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
==========================
G2P Programs: User Mapping
==========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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--program-lightgray.png?logo=github
:target: https://github.com/OpenG2P/openg2p-program/tree/15.0-develop/g2p_program_user_mapping
:alt: OpenG2P/openg2p-program

|badge1| |badge2|

G2P Program User Mapping

.. 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-program/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OpenG2P/openg2p-program/issues/new?body=module:%20g2p_program_user_mapping%0Aversion:%2015.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-program <https://github.com/OpenG2P/openg2p-program/tree/15.0-develop/g2p_program_user_mapping>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions g2p_program_user_mapping/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
26 changes: 26 additions & 0 deletions g2p_program_user_mapping/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "G2P Programs: User Mapping",
"category": "G2P",
"version": "15.0.1.1.0",
"sequence": 1,
"author": "OpenG2P",
"website": "https://github.com/openg2p/openg2p-program",
"license": "Other OSI approved licence",
"depends": ["g2p_programs"],
"development_status": "Alpha",
"data": [
"security/record_rules.xml",
"security/ir.model.access.csv",
"views/program_user_mapping.xml",
"views/res_users.xml",
],
"assets": {
"web.assets_backend": [],
"web.assets_qweb": [],
},
"demo": [],
"images": [],
"application": True,
"installable": True,
"auto_install": False,
}
1 change: 1 addition & 0 deletions g2p_program_user_mapping/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import program_user
29 changes: 29 additions & 0 deletions g2p_program_user_mapping/models/program_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from odoo import fields, models


class ProgramUsers(models.Model):
_name = "g2p.program.user.mapping"
_description = "Program user mapping"

program_id = fields.Many2one("g2p.program")
user_id = fields.Many2one("res.users")

_sql_constraints = [
(
"program_user_unique",
"unique (program_id, user_id)",
"User must be unique per program.",
),
]


class ResUsers(models.Model):
_inherit = "res.users"

assigned_program_mapping = fields.One2many("g2p.program.user.mapping", "user_id")


class G2PProgram(models.Model):
_inherit = "g2p.program"

assigned_user_mapping = fields.One2many("g2p.program.user.mapping", "program_id")
1 change: 1 addition & 0 deletions g2p_program_user_mapping/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
G2P Program User Mapping
24 changes: 24 additions & 0 deletions g2p_program_user_mapping/readme/assign_programs_program_manager.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Ability to assign number of programs to a program manager

## Introduction-

Admin can able to assign number of programs to a program manager.so that program manager can see those
programs which he was assigned.

## Getting Started-

- To get start, have to install g2p_program_user_mapping module
- Go to Programs--> select program --> open--> Go to tabs--> select program users --> Add a line --> select
user(program manager) --> click on save and close
- Now particular program assigned to particular user(program manager)

## Feature:

- This feature enables to restrict user to access the programs which assigned tho respective user only
- Admin can view all programs and assign programs to users
- program manager can view programs which alotted to him only

## Conclusion

Admin can able to assign number of programs to a program manager.so that program manager can see those
programs which he was assigned.
4 changes: 4 additions & 0 deletions g2p_program_user_mapping/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
g2p_program_user_mapping_admin,Program User Mapping Admin Access,g2p_program_user_mapping.model_g2p_program_user_mapping,g2p_registry_base.group_g2p_admin,1,1,1,1
g2p_program_user_mapping_program_manager,Program User Mapping program manager Access,g2p_program_user_mapping.model_g2p_program_user_mapping,g2p_programs.g2p_program_manager,1,0,1,0
g2p_program_user_mapping_base_user,Program User Mapping base user Access,g2p_program_user_mapping.model_g2p_program_user_mapping,base.group_user,1,0,0,0
55 changes: 55 additions & 0 deletions g2p_program_user_mapping/security/record_rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="ir.rule" id="rec_rule_program_user_program_manager">
<field name="name">Program User Program Manager</field>
<field name="model_id" ref="g2p_programs.model_g2p_program" />
<field name="domain_force">[('assigned_user_mapping.user_id.id', '=', user.id)]</field>
<field name="groups" eval="[(4, ref('g2p_programs.g2p_program_manager'))]" />
<field name="perm_read" eval="True" />
<field name="perm_create" eval="True" />
<field name="perm_write" eval="True" />
<field name="perm_unlink" eval="True" />
</record>
<record model="ir.rule" id="rec_rule_program_user_admin">
<field name="name">Program User Admin</field>
<field name="model_id" ref="g2p_programs.model_g2p_program" />
<field name="domain_force">[]</field>
<field name="groups" eval="[(4, ref('g2p_registry_base.group_g2p_admin'))]" />
<field name="perm_read" eval="True" />
<field name="perm_create" eval="True" />
<field name="perm_write" eval="True" />
<field name="perm_unlink" eval="True" />
</record>


<record model="ir.rule" id="rec_rule_program_user_mapping_program_manager">
<field name="name">Program User Mapping Program Manager</field>
<field name="model_id" ref="g2p_program_user_mapping.model_g2p_program_user_mapping" />
<field name="domain_force">[('program_id.assigned_user_mapping.user_id.id', '=', user.id)]</field>
<field name="groups" eval="[(4, ref('g2p_programs.g2p_program_manager'))]" />
<field name="perm_read" eval="True" />
<field name="perm_create" eval="True" />
<field name="perm_write" eval="True" />
<field name="perm_unlink" eval="True" />
</record>
<record model="ir.rule" id="rec_rule_program_user_mapping_admin">
<field name="name">Program User Mapping Admin</field>
<field name="model_id" ref="g2p_program_user_mapping.model_g2p_program_user_mapping" />
<field name="domain_force">[]</field>
<field name="groups" eval="[(4, ref('g2p_registry_base.group_g2p_admin'))]" />
<field name="perm_read" eval="True" />
<field name="perm_create" eval="True" />
<field name="perm_write" eval="True" />
<field name="perm_unlink" eval="True" />
</record>
<record model="ir.rule" id="rec_rule_program_user_mapping_base_user">
<field name="name">Program User Mapping Base User</field>
<field name="model_id" ref="g2p_program_user_mapping.model_g2p_program_user_mapping" />
<field name="domain_force">[]</field>
<field name="groups" eval="[(4, ref('base.group_user'))]" />
<field name="perm_read" eval="True" />
<field name="perm_create" eval="False" />
<field name="perm_write" eval="False" />
<field name="perm_unlink" eval="False" />
</record>
</odoo>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading