An Odoo 10 add-on module which generates BAN-PT accreditation reports for STEI ITB from existing data on Odoo.
- Repositori di Gitlab IF merupakan hasil pemindahan repositori secara manual (add remote) dari repositori di Github.
- Pull request di Github tidak dapat di-import, karena fitur import from Github pada Gitlab IF error jika digunakan. Agar mudah dicari, semua pull request tetap dilakukan di Github.
- Direktori
src/itb_academicdansrc/itb_hrmengandung kode yang diberikan olehproduct owner, sehingga seharusnya tidak diperhitungkan dalam pengukuran jumlah baris kode. Kedua direktori tersebut di-commit sementara untuk mempermudah automated testing dan konfigurasi CI.
Prerequisites: Docker Engine and Docker Compose must be installed; Internet access for pulling dependencies and Docker images (note: proxy might cause problems).
Note: Docker commands might need root privileges/sudo. If this happens, you probably need to add your user to the docker group.
- Clone this repository.
- Navigate to the project directory.
- Run
docker-compose upto start the application and its supporting services (PostgreSQL). Docker will download images if necessary. Wait until all tests are done. - Access Odoo on port 8069. Login with
adminas the username and password.
- To stop the containers, run
docker-compose stop. - To start the application again, simply run
docker-compose upordocker-compose up -dto run in the background (if you don't need to recreate containers, you can also usedocker-compose start). - Use
docker psto see list of running containers. - Use
docker exec -it <container_name> /bin/shordocker-compose exec -it <service_name> /bin/shto get a shell on a running container. - To remove the containers (reset all config and data), run
docker-compose down. To remove the containers and reset all data volumes (persistent data) too, rundocker-compose down -v.
Note: these steps are not needed if using the Docker development container.
- Log in using an administrator account.
- Install each app/custom module as needed.
- Go to
Settingspage by clicking the menu in the top menu bar. Go toUserspage by clicking the menu in the left sidebar. Add new users as needed. Don't forget to give access rights to the users (for this module, tickBAN-PT Report Generator / Managerfor full access orBAN-PT Report Generator / Viewerfor read only access to the reports).
code_generator: Python script for generating views and other data files from models.config: Odoo config for development.src: source for addon modules.src/banpt_report_generator/models: model files - define data schema and queries.src/banpt_report_generator/security: security (groups, access rights) configuration.src/banpt_report_generator/views: define Odoo views - how to display the data.
- Ensure you are on the
masterbranch (git checkout master). Create a new branch (git checkout -b <BRANCH_NAME>). Branch name for a table must be equal to the table code in lower case and with-replaced with_and.removed (e.g.3a_311). - Create model file in
src/banpt_report_generator/modelsdirectory. - Run the code generator:
cd code_generator, thenpython code_generator.py. Don't forget to return to the main directory usingcd ... - Check changes by running a Git diff, ensure all of the changes are correct.
- Restart the Docker containers if they are running (
Ctrl+cany running Docker Compose processes, thendocker-compose upagain). - Lint the code using
pylint src/banpt_report_generator(requirespylintto be installed, see Linting section below). Fix all errors or warnings. - Run tests using
docker-compose -f docker-compose.test.yml up --abort-on-container-exit, ensure there are noERRORlines. Fix all errors. - Stage (
git add --all), commit (git commit -m <COMMIT_MESSAGE>, and push changes to Git (git push -u origin <BRANCH_NAME>), then make a new pull request tomasteron Github.
Restart the Docker containers if they are running (Ctrl+c any running Docker Compose processes, then docker-compose up again). The banpt_report_generator module will be upgraded automatically.
Prerequisite: pylint.
To lint, run ./lint.sh.
If there are any errors or warning, fix the source code before committing.
Place your tests in the src/banpt_report_generator/tests directory, then import it in src/banpt_report_generator/tests/__init__.py.
To run tests, run docker-compose -f docker-compose.test.yml up --abort-on-container-exit. Check if there are any ERROR when the test finishes.
For convenience, to see only relevant test output, use docker-compose -f docker-compose.test.yml up --abort-on-container-exit | grep banpt_report_generator.
For automated testing, to return with a non-zero exit code on test failure, use docker-compose -f docker-compose.test.yml up --abort-on-container-exit | grep FAIL; test $? -eq 1.
Automatically create views, imports, manifest, and model access files from model files.
To run, cd code_generator, then python code_generator.py.
Check changes first by running a Git diff before committing.
A pgAdmin 4 container is provided on port 5050. Use odoo as the username and password.
After login, add new server. Use postgres as the hostname, odoo as the user and password.
Note: to use the pgAdmin instance for backup or restore, add /usr/bin as the PostgreSQL binary path in the Preferences menu in pgAdmin. Exported files are in the /var/lib/pgadmin/storage/odoo directory in the pgadmin container by default. Use docker cp <PGADMIN_CONTAINER_NAME>:/var/lib/pgadmin/storage/odoo/<FILE_NAME> <DESTINATION_FILE_NAME> to copy exported files from the container to the host.
- Ensure the PostgreSQL container is running (
docker-compose up). - In pgAdmin, expand server -> odoo -> Databases -> banpt -> Schemas -> public -> Tables (If server empty, create new server).
- Add column in certain table (type: varchar).
| Tables | Column |
|---|---|
| hr_employee | nik |
| itb_hr_assignment | standard_id |
| itb_hr_award | standard_id |
| itb_hr_duty_employee | standard_id |
| itb_hr_duty_employee | research_group_id |
| itb_hr_project | standard_id |
| itb_hr_publication | standard_id |
| itb_hr_training | standard_id |
- Download the file in https://drive.google.com/drive/u/1/folders/1SViDQyP-gfCJYOsdDJ7Pc9jWtREzFCYq (ibos2.sql)
- Get the name of the PostgreSQL Docker container using
docker ps(should be likebanptreports_postgres_1). - Create the database if it does not exist yet:
docker exec -i <POSTGRESQL_CONTAINER_NAME> createdb -U odoo <DESTINATION_DB>. - Run
docker exec -i <POSTGRESQL_CONTAINER_NAME> psql -U odoo -v ON_ERROR_STOP=1 <DESTINATION_DB> < <FILE_TO_IMPORT_FROM_HOST>. - If failed, do the step from the beginning (
docker-compose down -v && docker-compose up).
- Set correct dosen prodi IDs on
prodifield ofhr.employeemodel - Add
gelarfield initb.hr_educationmodel
- Add missing fields to
itb_academic_program - Add table recording akreditasi BAN-PT results for each prodi
- Add
sks_mk_dalam_kurikulum_intifield initb.academic_catalogmodel - Add
sks_mk_dalam_kurikulum_institusionalfield initb.academic_catalogmodel - Add
bobot_tugasfield initb.academic_catalogmodel - Add
kelengkapan_sapfield initb.academic_catalogmodel
- Add
bobot_tugasfield initb.academic_catalogmodel