├── .copier-answers.yml ├── .editorconfig ├── .eslintrc.yml ├── .flake8 ├── .github ├── auto_assign.yml ├── dependabot.yml └── workflows │ ├── auto-assign-pr.yml │ ├── auto-assign.yml │ ├── cla.yml │ ├── code-analysis.yml │ ├── pre-commit.yml │ ├── stale.yml │ └── test.yml ├── .gitignore ├── .isort.cfg ├── .pre-commit-config.yaml ├── .prettierrc.yml ├── .pylintrc ├── .pylintrc-mandatory ├── COPYRIGHT ├── LICENSE ├── README.md ├── g2p_entitlement_cash ├── README.rst ├── __init__.py ├── __manifest__.py ├── i18n │ ├── ar.po │ ├── ckb.po │ ├── fr.po │ └── g2p_entitlement_cash.pot ├── models │ ├── __init__.py │ └── entitlement_manager.py ├── readme │ └── DESCRIPTION.rst ├── security │ └── ir.model.access.csv ├── static │ └── description │ │ ├── icon.png │ │ └── index.html ├── tests │ ├── __init__.py │ ├── test_create_program_wizard.py │ └── test_entitlement_manager.py ├── views │ └── entitlement_manager_view.xml └── wizard │ ├── __init__.py │ ├── create_program_wizard.py │ └── create_program_wizard.xml ├── license_header.txt ├── setup ├── .setuptools-odoo-make-default-ignore ├── README ├── _metapackage │ ├── VERSION.txt │ └── setup.py ├── g2p_entitlement_cash │ ├── odoo │ │ └── addons │ │ │ └── g2p_entitlement_cash │ └── setup.py ├── spp_auto_update_entitlements │ ├── odoo │ │ └── addons │ │ │ └── spp_auto_update_entitlements │ └── setup.py ├── spp_basic_cash_entitlement_spent │ ├── odoo │ │ └── addons │ │ │ └── spp_basic_cash_entitlement_spent │ └── setup.py ├── spp_dashboard │ ├── odoo │ │ └── addons │ │ │ └── spp_dashboard │ └── setup.py ├── spp_eligibility_sql │ ├── odoo │ │ └── addons │ │ │ └── spp_eligibility_sql │ └── setup.py ├── spp_eligibility_tags │ ├── odoo │ │ └── addons │ │ │ └── spp_eligibility_tags │ └── setup.py ├── spp_ent_trans │ ├── odoo │ │ └── addons │ │ │ └── spp_ent_trans │ └── setup.py ├── spp_entitlement_basket │ ├── odoo │ │ └── addons │ │ │ └── spp_entitlement_basket │ └── setup.py ├── spp_entitlement_in_kind │ ├── odoo │ │ └── addons │ │ │ └── spp_entitlement_in_kind │ └── setup.py ├── spp_exclusion_filter │ ├── odoo │ │ └── addons │ │ │ └── spp_exclusion_filter │ └── setup.py ├── spp_pos │ ├── odoo │ │ └── addons │ │ │ └── spp_pos │ └── setup.py ├── spp_program_id │ ├── odoo │ │ └── addons │ │ │ └── spp_program_id │ └── setup.py ├── spp_programs │ ├── odoo │ │ └── addons │ │ │ └── spp_programs │ └── setup.py ├── spp_programs_compliance_criteria │ ├── odoo │ │ └── addons │ │ │ └── spp_programs_compliance_criteria │ └── setup.py └── spp_programs_sp │ ├── odoo │ └── addons │ │ └── spp_programs_sp │ └── setup.py ├── spp_auto_update_entitlements ├── README.rst ├── __init__.py ├── __manifest__.py ├── models │ ├── __init__.py │ ├── cycle.py │ └── entitlement.py ├── static │ └── description │ │ ├── icon.png │ │ └── index.html └── views │ ├── cycle_view.xml │ └── entitlements_view.xml ├── spp_basic_cash_entitlement_spent ├── README.rst ├── __init__.py ├── __manifest__.py ├── i18n │ └── spp_basic_cash_entitlement_spent.pot ├── models │ ├── __init__.py │ └── entitlement.py ├── readme │ └── DESCRIPTION.rst ├── static │ └── description │ │ └── index.html └── tests │ ├── __init__.py │ └── test_g2p_entitlement.py ├── spp_dashboard ├── README.rst ├── __init__.py ├── __manifest__.py ├── controllers │ ├── __init__.py │ └── main.py ├── data │ └── dashboard_templates.xml ├── i18n │ ├── ar.po │ ├── ckb.po │ ├── fr.po │ └── spp_dashboard.pot ├── models │ ├── __init__.py │ ├── cycles.py │ ├── dashboard_block.py │ ├── dashboard_menu.py │ └── programs.py ├── readme │ └── DESCRIPTION.rst ├── static │ ├── description │ │ ├── icon.png │ │ └── index.html │ └── src │ │ └── js │ │ └── dynamic_dashboard.js └── views │ ├── cycles_view.xml │ ├── dashboard_block_view.xml │ ├── dashboard_menu_view.xml │ ├── main_view.xml │ └── programs_view.xml ├── spp_eligibility_sql ├── README.rst ├── __init__.py ├── __manifest__.py ├── models │ ├── __init__.py │ ├── eligibility_manager.py │ └── programs.py ├── security │ └── ir.model.access.csv ├── tests │ ├── __init__.py │ └── test_create_program_wizard.py ├── views │ └── eligibility_manager_view.xml └── wizard │ ├── __init__.py │ ├── create_program_wizard.py │ └── create_program_wizard.xml ├── spp_eligibility_tags ├── README.rst ├── __init__.py ├── __manifest__.py ├── i18n │ └── spp_eligibility_tags.pot ├── models │ ├── __init__.py │ └── eligibility_manager.py ├── security │ └── ir.model.access.csv ├── static │ └── description │ │ ├── icon.png │ │ └── index.html ├── tests │ ├── __init__.py │ ├── test_create_program_wizard.py │ └── test_eligibility_manager.py ├── views │ └── eligibility_manager_view.xml └── wizard │ ├── __init__.py │ ├── create_program_wizard.py │ └── create_program_wizard.xml ├── spp_ent_trans ├── README.rst ├── __init__.py ├── __manifest__.py ├── models │ ├── __init__.py │ └── transactions.py ├── security │ └── ir.model.access.csv ├── static │ └── description │ │ └── icon.png └── views │ ├── inkind_transactions_view.xml │ └── transactions_view.xml ├── spp_entitlement_basket ├── README.rst ├── __init__.py ├── __manifest__.py ├── i18n │ ├── ar.po │ ├── ckb.po │ ├── fr.po │ └── spp_entitlement_basket.pot ├── models │ ├── __init__.py │ ├── entitlement.py │ ├── entitlement_manager.py │ └── stock │ │ ├── __init__.py │ │ └── food_basket.py ├── readme │ └── DESCRIPTION.rst ├── security │ └── ir.model.access.csv ├── static │ ├── description │ │ ├── icon.png │ │ └── index.html │ └── src │ │ └── css │ │ └── spp_entitlement_basket.css ├── tests │ ├── __init__.py │ ├── common.py │ ├── test_create_program_wizard.py │ ├── test_entitlement_basket.py │ ├── test_entitlement_manager.py │ └── test_food_basket.py ├── views │ ├── entitlement_manager_view.xml │ └── stock │ │ └── entitlement_basket_view.xml └── wizard │ ├── __init__.py │ ├── create_program_wizard.py │ └── create_program_wizard.xml ├── spp_entitlement_in_kind ├── README.rst ├── __init__.py ├── __manifest__.py ├── i18n │ ├── ar.po │ ├── ckb.po │ ├── fr.po │ └── spp_entitlement_in_kind.pot ├── models │ ├── __init__.py │ ├── entitlement.py │ └── entitlement_manager.py ├── readme │ └── DESCRIPTION.rst ├── security │ └── ir.model.access.csv ├── static │ └── description │ │ ├── icon.png │ │ └── index.html ├── tests │ ├── __init__.py │ ├── test_create_program_wizard.py │ └── test_entitlement_manager.py ├── views │ └── entitlement_manager_view.xml └── wizard │ ├── __init__.py │ ├── create_program_wizard.py │ └── create_program_wizard.xml ├── spp_exclusion_filter ├── README.rst ├── __init__.py ├── __manifest__.py ├── models │ ├── __init__.py │ └── managers │ │ ├── __init__.py │ │ └── eligibility_manager.py ├── views │ └── managers │ │ └── eligibility_manager_view.xml └── wizard │ ├── __init__.py │ ├── create_program_wizard.py │ └── create_program_wizard.xml ├── spp_pos ├── README.rst ├── __init__.py ├── __manifest__.py ├── data │ └── entitlement_product.xml ├── i18n │ ├── ar.po │ ├── ckb.po │ ├── fr.po │ └── spp_pos.pot ├── models │ ├── __init__.py │ ├── entitlement.py │ ├── pos_category.py │ └── product_template.py ├── readme │ └── DESCRIPTION.rst ├── static │ ├── description │ │ ├── icon.png │ │ └── index.html │ └── src │ │ ├── js │ │ ├── action_button.js │ │ ├── check_keypress_entitlement.js │ │ ├── models.js │ │ └── popup_voucher.js │ │ └── view │ │ ├── action_button.xml │ │ └── popup_voucher.xml ├── tests │ ├── __init__.py │ ├── test_g2p_entitlement.py │ └── test_pos_category.py └── views │ └── product_template_views.xml ├── spp_program_id ├── README.rst ├── __init__.py ├── __manifest__.py ├── data │ └── ir_sequence_data.xml ├── models │ ├── __init__.py │ └── g2p_program.py └── views │ └── g2p_program_views.xml ├── spp_programs ├── README.rst ├── __init__.py ├── __manifest__.py ├── i18n │ ├── ar.po │ ├── ckb.po │ ├── fr.po │ └── spp_programs.pot ├── models │ ├── __init__.py │ ├── constants.py │ ├── cycle.py │ ├── eligibility.py │ ├── entitlement.py │ ├── entitlement_cash.py │ ├── managers │ │ ├── __init__.py │ │ ├── cycle_manager.py │ │ ├── eligibility_manager.py │ │ ├── entitlement_manager.py │ │ └── entitlement_manager_default.py │ ├── programs.py │ ├── registrant.py │ └── stock │ │ ├── __init__.py │ │ └── stock.py ├── report │ ├── program_approval_receipt.xml │ └── report_format.xml ├── security │ └── ir.model.access.csv ├── static │ ├── description │ │ ├── icon.png │ │ └── index.html │ └── src │ │ └── js │ │ ├── domain_field.js │ │ └── hide_button.js ├── tests │ ├── __init__.py │ ├── common.py │ ├── test_create_program_wiz.py │ ├── test_entitlement.py │ ├── test_entitlement_report_wiz.py │ ├── test_programs.py │ ├── test_registrant.py │ └── test_stock_rule.py ├── views │ ├── cycle_view.xml │ ├── entitlement_cash_view.xml │ ├── entitlement_view.xml │ ├── inkind_entitlement_report_view.xml │ ├── main_view.xml │ ├── managers │ │ ├── eligibility_manager_view.xml │ │ └── entitlement_manager_view.xml │ ├── programs_view.xml │ └── registrant_view.xml └── wizard │ ├── __init__.py │ ├── create_program_wizard.py │ ├── create_program_wizard.xml │ ├── inkind_entitlement_report_wiz.py │ └── inkind_entitlement_report_wiz.xml ├── spp_programs_compliance_criteria ├── README.rst ├── __init__.py ├── __manifest__.py ├── models │ ├── __init__.py │ ├── g2p_cycle.py │ ├── g2p_program.py │ ├── managers │ │ ├── __init__.py │ │ ├── g2p_cycle_manager_default.py │ │ ├── g2p_program_entitlement_manager_default.py │ │ └── spp_compliance_manager.py │ └── res_config_settings.py ├── security │ └── ir.model.access.csv ├── static │ └── src │ │ └── js │ │ └── field_domain.js ├── tests │ ├── __init__.py │ ├── common.py │ ├── test_g2p_cycle.py │ └── test_g2p_program_create_wizard.py ├── views │ ├── g2p_cycle_views.xml │ ├── g2p_program_views.xml │ └── res_config_settings_views.xml └── wizards │ ├── __init__.py │ ├── g2p_program_create_wizard.py │ └── g2p_program_create_wizard_views.xml ├── spp_programs_sp ├── README.rst ├── __init__.py ├── __manifest__.py ├── models │ ├── __init__.py │ ├── entitlement_cash.py │ ├── entitlement_inkind.py │ ├── entitlement_manager_cash.py │ ├── entitlement_manager_default.py │ ├── entitlement_manager_inkind.py │ └── programs.py ├── static │ └── description │ │ ├── icon.png │ │ └── index.html ├── views │ ├── entitlements_view.xml │ └── programs_view.xml └── wizard │ ├── __init__.py │ ├── create_program_wizard.py │ └── create_program_wizard.xml ├── test-requirements.txt └── vulnerability_disclosure_policy.md /.copier-answers.yml: -------------------------------------------------------------------------------- 1 | # Do NOT update manually; changes here will be overwritten by Copier 2 | _commit: 79935fe 3 | _src_path: https://github.com/openspp/openspp-odoo-addons-repo-template.git 4 | ci: GitHub 5 | dependency_installation_mode: OCA 6 | generate_requirements_txt: true 7 | github_check_license: false 8 | github_ci_extra_env: {} 9 | github_enable_codecov: true 10 | github_enable_makepot: true 11 | github_enable_stale_action: true 12 | github_enforce_dev_status_compatibility: false 13 | include_wkhtmltopdf: false 14 | odoo_version: 15.0 15 | org_name: OpenSPP.org 16 | org_slug: openspp 17 | rebel_module_groups: [] 18 | repo_description: Programs and cycles are used to outline a social protection program. 19 | This is an OpenSPP feature that is extremely flexible and expandable to manage 20 | different type of programs and cycles. 21 | repo_name: OpenSPP Program 22 | repo_slug: openspp-program 23 | repo_website: https://github.com/openspp/openspp-program 24 | travis_apt_packages: [] 25 | travis_apt_sources: [] 26 | 27 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Configuration for known file extensions 2 | [*.{css,js,json,less,md,py,rst,sass,scss,xml,yaml,yml}] 3 | charset = utf-8 4 | end_of_line = lf 5 | indent_size = 4 6 | indent_style = space 7 | insert_final_newline = true 8 | trim_trailing_whitespace = true 9 | 10 | [*.{json,yml,yaml,rst,md}] 11 | indent_size = 2 12 | 13 | # Do not configure editor for libs and autogenerated content 14 | [{*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst}] 15 | charset = unset 16 | end_of_line = unset 17 | indent_size = unset 18 | indent_style = unset 19 | insert_final_newline = false 20 | trim_trailing_whitespace = false 21 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length = 110 3 | max-complexity = 16 4 | # B = bugbear 5 | # B9 = bugbear opinionated (incl line length) 6 | select = C,E,F,W,B,B9 7 | # E203: whitespace before ':' (black behaviour) 8 | # E501: flake8 line length (covered by bugbear B950) 9 | # W503: line break before binary operator (black behaviour) 10 | ignore = E203,E501,W503 11 | per-file-ignores= 12 | __init__.py:F401 13 | -------------------------------------------------------------------------------- /.github/auto_assign.yml: -------------------------------------------------------------------------------- 1 | # Set to true to add reviewers to PRs 2 | addReviewers: true 3 | 4 | # Set to 'author' to add PR's author as a assignee 5 | addAssignees: author 6 | 7 | # A list of reviewers to be added to PRs (GitHub user name) 8 | reviewers: 9 | - jeremi 10 | - gonzalesedwin1123 11 | - emjay0921 12 | - reichie020212 13 | - nhatnm0612 14 | 15 | # A number of reviewers added to the PR 16 | # Set 0 to add all the reviewers (default: 0) 17 | numberOfReviewers: 0 18 | 19 | # A list of keywords to be skipped the process if PR's title include it 20 | skipKeywords: 21 | - wip 22 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | # Check for updates to GitHub Actions every weekday 12 | interval: "weekly" 13 | -------------------------------------------------------------------------------- /.github/workflows/auto-assign-pr.yml: -------------------------------------------------------------------------------- 1 | name: Auto Assign PR 2 | on: 3 | pull_request: 4 | types: [opened, ready_for_review] 5 | jobs: 6 | add-reviews: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: kentaro-m/auto-assign-action@v1.2.4 10 | -------------------------------------------------------------------------------- /.github/workflows/auto-assign.yml: -------------------------------------------------------------------------------- 1 | name: Auto Assign 2 | on: 3 | issues: 4 | types: [opened] 5 | pull_request: 6 | types: [opened] 7 | jobs: 8 | run: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: bubkoo/auto-assign@v1 12 | with: 13 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 14 | CONFIG_FILE: .github/auto-assign.yml 15 | -------------------------------------------------------------------------------- /.github/workflows/cla.yml: -------------------------------------------------------------------------------- 1 | name: "CLA Assistant" 2 | on: 3 | issue_comment: 4 | types: [created] 5 | pull_request_target: 6 | types: [opened, closed, synchronize] 7 | 8 | jobs: 9 | CLAssistant: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: "CLA Assistant" 13 | if: 14 | (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA 15 | Document and I hereby sign the CLA') || github.event_name == 'pull_request_target' 16 | # Beta Release 17 | uses: contributor-assistant/github-action@v2.2.0 18 | env: 19 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 20 | # the below token should have repo scope and must be manually added by you in the repository's secret 21 | PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} 22 | with: 23 | path-to-signatures: "signatures/version1/cla.json" 24 | path-to-document: "https://github.com/openspp/openspp-cla/tree/main" # e.g. a CLA or a DCO document 25 | # branch should not be protected 26 | branch: "main" 27 | allowlist: dependabot-preview[bot],greenkeeper[bot],dependabot[bot] 28 | remote-organization-name: openspp 29 | remote-repository-name: openspp-cla 30 | #below are the optional inputs - If the optional inputs are not given, then default values will be taken 31 | #remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository) 32 | #remote-repository-name: enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository) 33 | #create-file-commit-message: 'For example: Creating file for storing CLA Signatures' 34 | #signed-commit-message: 'For example: $contributorName has signed the CLA in #$pullRequestNo' 35 | #custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign' 36 | #custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA' 37 | #custom-allsigned-prcomment: 'pull request comment when all contributors has signed, defaults to **CLA Assistant Lite bot** All Contributors have signed the CLA.' 38 | #lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true) 39 | #use-dco-flag: true - If you are using DCO instead of CLA 40 | -------------------------------------------------------------------------------- /.github/workflows/code-analysis.yml: -------------------------------------------------------------------------------- 1 | name: "Code Scanning - Action" 2 | 3 | on: 4 | push: 5 | branches: 6 | - "{{ odoo_version }}" 7 | pull_request: 8 | branches: 9 | - "{{ odoo_version }}" 10 | schedule: 11 | # ┌───────────── minute (0 - 59) 12 | # │ ┌───────────── hour (0 - 23) 13 | # │ │ ┌───────────── day of the month (1 - 31) 14 | # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) 15 | # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) 16 | # │ │ │ │ │ 17 | # │ │ │ │ │ 18 | # │ │ │ │ │ 19 | # * * * * * 20 | - cron: '30 1 * * 2' 21 | 22 | jobs: 23 | CodeQL-Build: 24 | # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest 25 | runs-on: ubuntu-latest 26 | 27 | permissions: 28 | # required for all workflows 29 | security-events: write 30 | 31 | # only required for workflows in private repositories 32 | actions: read 33 | contents: read 34 | strategy: 35 | fail-fast: false 36 | matrix: 37 | language: [ 'python' ] 38 | 39 | steps: 40 | - name: Checkout repository 41 | uses: actions/checkout@v3 42 | 43 | # Initializes the CodeQL tools for scanning. 44 | - name: Initialize CodeQL 45 | uses: github/codeql-action/init@v2 46 | with: 47 | languages: ${{ matrix.language }} 48 | # Override language selection by uncommenting this and choosing your languages 49 | # with: 50 | # languages: go, javascript, csharp, python, cpp, java, ruby 51 | 52 | # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). 53 | # If this step fails, then you should remove it and run the build manually (see below). 54 | - name: Autobuild 55 | uses: github/codeql-action/autobuild@v2 56 | 57 | # ℹ️ Command-line programs to run using the OS shell. 58 | # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun 59 | 60 | # ✏️ If the Autobuild fails above, remove it and uncomment the following 61 | # three lines and modify them (or add more) to build your code if your 62 | # project uses a compiled language 63 | 64 | #- run: | 65 | # make bootstrap 66 | # make release 67 | 68 | - name: Perform CodeQL Analysis 69 | uses: github/codeql-action/analyze@v2 70 | 71 | - name: TruffleHog OSS 72 | uses: trufflesecurity/trufflehog@main 73 | with: 74 | path: ./ 75 | base: ${{ github.event.repository.default_branch }} 76 | head: HEAD 77 | extra_args: --debug --only-verified 78 | -------------------------------------------------------------------------------- /.github/workflows/pre-commit.yml: -------------------------------------------------------------------------------- 1 | name: pre-commit 2 | 3 | on: push 4 | 5 | jobs: 6 | pre-commit: 7 | runs-on: ubuntu-22.04 8 | steps: 9 | - uses: actions/checkout@v2 10 | - uses: actions/setup-python@v2 11 | - name: Get python version 12 | run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV 13 | - uses: actions/cache@v3 14 | with: 15 | path: ~/.cache/pre-commit 16 | key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} 17 | - name: Install pre-commit 18 | run: pip install pre-commit 19 | - name: Run pre-commit 20 | run: pre-commit run --all-files --show-diff-on-failure --color=always 21 | - name: Check that all files generated by pre-commit are in git 22 | run: | 23 | newfiles="$(git ls-files --others --exclude-from=.gitignore)" 24 | if [ "$newfiles" != "" ] ; then 25 | echo "Please check-in the following files:" 26 | echo "$newfiles" 27 | exit 1 28 | fi 29 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: tests 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - "15.0*" 7 | push: 8 | branches: 9 | - "15.0" 10 | - "rc/15.0*" 11 | - "15.0-ocabot-*" 12 | env: 13 | OCA_GIT_USER_NAME: openspp 14 | OCA_GIT_USER_EMAIL: bot@openspp.org 15 | jobs: 16 | unreleased-deps: 17 | runs-on: ubuntu-latest 18 | name: Detect unreleased dependencies 19 | steps: 20 | - uses: actions/checkout@v2 21 | - run: | 22 | for reqfile in requirements.txt test-requirements.txt ; do 23 | if [ -f ${reqfile} ] ; then 24 | result=0 25 | # reject non-comment lines that contain a / (i.e. URLs, relative paths) 26 | grep "^[^#].*/" ${reqfile} || result=$? 27 | if [ $result -eq 0 ] ; then 28 | echo "Unreleased dependencies found in ${reqfile}." 29 | # exit 1 30 | fi 31 | fi 32 | done 33 | test: 34 | runs-on: ubuntu-22.04 35 | container: ${{ matrix.container }} 36 | name: ${{ matrix.name }} 37 | strategy: 38 | fail-fast: false 39 | matrix: 40 | include: 41 | - container: ghcr.io/oca/oca-ci/py3.8-odoo15.0:latest 42 | makepot: "true" 43 | name: test with Odoo 44 | - container: ghcr.io/oca/oca-ci/py3.8-ocb15.0:latest 45 | name: test with OCB 46 | services: 47 | postgres: 48 | image: postgres:9.6 49 | env: 50 | POSTGRES_USER: odoo 51 | POSTGRES_PASSWORD: odoo 52 | POSTGRES_DB: odoo 53 | ports: 54 | - 5432:5432 55 | steps: 56 | - uses: actions/checkout@v2 57 | with: 58 | persist-credentials: false 59 | - name: Install addons and dependencies 60 | run: oca_install_addons 61 | - name: Check licenses 62 | run: manifestoo -d . check-licenses 63 | continue-on-error: true 64 | - name: Check development status 65 | run: manifestoo -d . check-dev-status --default-dev-status=Beta 66 | continue-on-error: true 67 | - name: Initialize test db 68 | run: oca_init_test_database 69 | - name: Run tests 70 | run: oca_run_tests 71 | - uses: codecov/codecov-action@v1 72 | - name: Update .pot files 73 | run: oca_export_and_push_pot https://x-access-token:${{ secrets.GIT_PUSH_TOKEN }}@github.com/${{ github.repository }} 74 | if: ${{ matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == 'openspp' }} 75 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | /.venv 5 | /.pytest_cache 6 | 7 | # C extensions 8 | *.so 9 | 10 | # Distribution / packaging 11 | .Python 12 | env/ 13 | bin/ 14 | build/ 15 | develop-eggs/ 16 | dist/ 17 | eggs/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | *.egg-info/ 23 | .installed.cfg 24 | *.egg 25 | *.eggs 26 | 27 | # Installer logs 28 | pip-log.txt 29 | pip-delete-this-directory.txt 30 | 31 | # Unit test / coverage reports 32 | htmlcov/ 33 | .tox/ 34 | .coverage 35 | .cache 36 | nosetests.xml 37 | coverage.xml 38 | 39 | # Translations 40 | *.mo 41 | 42 | # Pycharm 43 | .idea 44 | 45 | # Eclipse 46 | .settings 47 | 48 | # Visual Studio cache/options directory 49 | .vs/ 50 | .vscode 51 | 52 | # OSX Files 53 | .DS_Store 54 | 55 | # Django stuff: 56 | *.log 57 | 58 | # Mr Developer 59 | .mr.developer.cfg 60 | .project 61 | .pydevproject 62 | 63 | # Rope 64 | .ropeproject 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # Backup files 70 | *~ 71 | *.swp 72 | 73 | # OCA rules 74 | !static/lib/ 75 | -------------------------------------------------------------------------------- /.isort.cfg: -------------------------------------------------------------------------------- 1 | [settings] 2 | ; see https://github.com/psf/black 3 | multi_line_output=3 4 | include_trailing_comma=True 5 | force_grid_wrap=0 6 | combine_as_imports=True 7 | use_parentheses=True 8 | line_length=110 9 | known_odoo=odoo 10 | known_odoo_addons=odoo.addons 11 | sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER 12 | default_section=THIRDPARTY 13 | ensure_newline_before_comments = True 14 | -------------------------------------------------------------------------------- /.prettierrc.yml: -------------------------------------------------------------------------------- 1 | # Defaults for all prettier-supported languages. 2 | # Prettier will complete this with settings from .editorconfig file. 3 | bracketSpacing: false 4 | printWidth: 110 5 | proseWrap: always 6 | semi: true 7 | trailingComma: "es5" 8 | xmlWhitespaceSensitivity: "strict" 9 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | 2 | Most of the files are 3 | 4 | Copyright (c) 2022 OpenSPP.org 5 | 6 | Many files also contain contributions from third 7 | parties. In this case the original copyright of 8 | the contributions can be traced through the 9 | history of the source version control system. 10 | 11 | When that is not the case, the files contain a prominent 12 | notice stating the original copyright and applicable 13 | license, or come with their own dedicated COPYRIGHT 14 | and/or LICENSE file. 15 | -------------------------------------------------------------------------------- /g2p_entitlement_cash/README.rst: -------------------------------------------------------------------------------- 1 | ============================== 2 | SPP Program Entitlement (Cash) 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/licence-LGPL--3-blue.png 14 | :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html 15 | :alt: License: LGPL-3 16 | .. |badge3| image:: https://img.shields.io/badge/github-openspp%2Fopenspp--program-lightgray.png?logo=github 17 | :target: https://github.com/openspp/openspp-program/tree/15.0/g2p_entitlement_cash 18 | :alt: openspp/openspp-program 19 | 20 | |badge1| |badge2| |badge3| 21 | 22 | OpenSPP Cash Entitlement 23 | 24 | .. IMPORTANT:: 25 | This is an alpha version, the data model and design can change at any time without warning. 26 | Only for development or testing purpose, do not use in production. 27 | `More details on development status `_ 28 | 29 | **Table of contents** 30 | 31 | .. contents:: 32 | :local: 33 | 34 | Bug Tracker 35 | =========== 36 | 37 | Bugs are tracked on `GitHub Issues `_. 38 | In case of trouble, please check there if your issue has already been reported. 39 | If you spotted it first, help us smashing it by providing a detailed and welcomed 40 | `feedback `_. 41 | 42 | Do not contact contributors directly about support or help with technical issues. 43 | 44 | Credits 45 | ======= 46 | 47 | Authors 48 | ~~~~~~~ 49 | 50 | * OpenSPP.org 51 | 52 | Maintainers 53 | ~~~~~~~~~~~ 54 | 55 | .. |maintainer-jeremi| image:: https://github.com/jeremi.png?size=40px 56 | :target: https://github.com/jeremi 57 | :alt: jeremi 58 | .. |maintainer-gonzalesedwin1123| image:: https://github.com/gonzalesedwin1123.png?size=40px 59 | :target: https://github.com/gonzalesedwin1123 60 | :alt: gonzalesedwin1123 61 | 62 | Current maintainers: 63 | 64 | |maintainer-jeremi| |maintainer-gonzalesedwin1123| 65 | 66 | This module is part of the `openspp/openspp-program `_ project on GitHub. 67 | 68 | You are welcome to contribute. 69 | -------------------------------------------------------------------------------- /g2p_entitlement_cash/__init__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from . import models 4 | from . import wizard 5 | -------------------------------------------------------------------------------- /g2p_entitlement_cash/__manifest__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | { 3 | "name": "SPP Program Entitlement (Cash)", 4 | "category": "SPP", 5 | "version": "15.0.0.0.0", 6 | "sequence": 1, 7 | "author": "OpenSPP.org", 8 | "website": "https://github.com/openspp/openspp-program", 9 | "license": "LGPL-3", 10 | "development_status": "Alpha", 11 | "maintainers": ["jeremi", "gonzalesedwin1123"], 12 | "depends": [ 13 | "base", 14 | "g2p_registry_base", 15 | "g2p_programs", 16 | "spp_programs", 17 | ], 18 | "data": [ 19 | "security/ir.model.access.csv", 20 | "views/entitlement_manager_view.xml", 21 | "wizard/create_program_wizard.xml", 22 | ], 23 | "assets": {}, 24 | "demo": [], 25 | "images": [], 26 | "application": True, 27 | "installable": True, 28 | "auto_install": False, 29 | } 30 | -------------------------------------------------------------------------------- /g2p_entitlement_cash/models/__init__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from . import entitlement_manager 4 | -------------------------------------------------------------------------------- /g2p_entitlement_cash/readme/DESCRIPTION.rst: -------------------------------------------------------------------------------- 1 | OpenSPP Cash Entitlement 2 | -------------------------------------------------------------------------------- /g2p_entitlement_cash/security/ir.model.access.csv: -------------------------------------------------------------------------------- 1 | id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink 2 | g2p_program_entitlement_manager_cash_admin,Program Entitlement Manager Cash Admin Access,g2p_entitlement_cash.model_g2p_program_entitlement_manager_cash,g2p_registry_base.group_g2p_admin,1,1,1,1 3 | g2p_program_entitlement_manager_cash_program_manager,Program Entitlement Manager Cash Program Manager Access,g2p_entitlement_cash.model_g2p_program_entitlement_manager_cash,g2p_programs.g2p_program_manager,1,1,1,0 4 | g2p_prog_entitle_manager_cash_program_validator,Program Entitlement Manager Cash Program Validator Access,g2p_entitlement_cash.model_g2p_program_entitlement_manager_cash,g2p_programs.g2p_program_validator,1,0,0,0 5 | 6 | g2p_prog_entitle_manager_cash_item_admin,Program Entitlement Manager Cash Items Admin Access,g2p_entitlement_cash.model_g2p_program_entitlement_manager_cash_item,g2p_registry_base.group_g2p_admin,1,1,1,1 7 | g2p_prog_entitle_manager_cash_item_program_manager,Program Entitlement Manager Cash Items Program Manager Access,g2p_entitlement_cash.model_g2p_program_entitlement_manager_cash_item,g2p_programs.g2p_program_manager,1,1,1,0 8 | g2p_prog_entitle_manager_cash_item_program_validator,Program Entitlement Manager Cash Items Program Validator Access,g2p_entitlement_cash.model_g2p_program_entitlement_manager_cash_item,g2p_programs.g2p_program_validator,1,0,0,0 9 | 10 | g2p_program_create_wizard_entitlement_cash_item_admin,Create Program Wizard Entitlement Cash Items Admin Access,g2p_entitlement_cash.model_g2p_program_create_wizard_entitlement_cash_item,g2p_registry_base.group_g2p_admin,1,1,1,1 11 | g2p_program_create_wizard_entitlement_cash_item_program_manager,Create Program Wizard Program Entitlement Cash Items Manager Access,g2p_entitlement_cash.model_g2p_program_create_wizard_entitlement_cash_item,g2p_programs.g2p_program_manager,1,1,1,1 12 | -------------------------------------------------------------------------------- /g2p_entitlement_cash/static/description/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSPP/openspp-program/e9512f18a9068f42a7b397878d089204d46020c4/g2p_entitlement_cash/static/description/icon.png -------------------------------------------------------------------------------- /g2p_entitlement_cash/tests/__init__.py: -------------------------------------------------------------------------------- 1 | from . import test_create_program_wizard 2 | from . import test_entitlement_manager 3 | -------------------------------------------------------------------------------- /g2p_entitlement_cash/wizard/__init__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from . import create_program_wizard 4 | -------------------------------------------------------------------------------- /license_header.txt: -------------------------------------------------------------------------------- 1 | Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | -------------------------------------------------------------------------------- /setup/.setuptools-odoo-make-default-ignore: -------------------------------------------------------------------------------- 1 | # addons listed in this file are ignored by 2 | # setuptools-odoo-make-default (one addon per line) 3 | -------------------------------------------------------------------------------- /setup/README: -------------------------------------------------------------------------------- 1 | To learn more about this directory, please visit 2 | https://pypi.python.org/pypi/setuptools-odoo 3 | -------------------------------------------------------------------------------- /setup/_metapackage/VERSION.txt: -------------------------------------------------------------------------------- 1 | 15.0.20230419.0 -------------------------------------------------------------------------------- /setup/_metapackage/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | with open('VERSION.txt', 'r') as f: 4 | version = f.read().strip() 5 | 6 | setuptools.setup( 7 | name="odoo-addons-openspp-openspp-program", 8 | description="Meta package for openspp-openspp-program Odoo addons", 9 | version=version, 10 | install_requires=[ 11 | 'odoo-addon-g2p_entitlement_cash>=15.0dev,<15.1dev', 12 | 'odoo-addon-spp_basic_cash_entitlement_spent>=15.0dev,<15.1dev', 13 | 'odoo-addon-spp_dashboard>=15.0dev,<15.1dev', 14 | 'odoo-addon-spp_entitlement_basket>=15.0dev,<15.1dev', 15 | 'odoo-addon-spp_entitlement_in_kind>=15.0dev,<15.1dev', 16 | 'odoo-addon-spp_pos>=15.0dev,<15.1dev', 17 | 'odoo-addon-spp_programs>=15.0dev,<15.1dev', 18 | ], 19 | classifiers=[ 20 | 'Programming Language :: Python', 21 | 'Framework :: Odoo', 22 | 'Framework :: Odoo :: 15.0', 23 | ] 24 | ) 25 | -------------------------------------------------------------------------------- /setup/g2p_entitlement_cash/odoo/addons/g2p_entitlement_cash: -------------------------------------------------------------------------------- 1 | ../../../../g2p_entitlement_cash -------------------------------------------------------------------------------- /setup/g2p_entitlement_cash/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_auto_update_entitlements/odoo/addons/spp_auto_update_entitlements: -------------------------------------------------------------------------------- 1 | ../../../../spp_auto_update_entitlements -------------------------------------------------------------------------------- /setup/spp_auto_update_entitlements/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_basic_cash_entitlement_spent/odoo/addons/spp_basic_cash_entitlement_spent: -------------------------------------------------------------------------------- 1 | ../../../../spp_basic_cash_entitlement_spent -------------------------------------------------------------------------------- /setup/spp_basic_cash_entitlement_spent/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_dashboard/odoo/addons/spp_dashboard: -------------------------------------------------------------------------------- 1 | ../../../../spp_dashboard -------------------------------------------------------------------------------- /setup/spp_dashboard/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_eligibility_sql/odoo/addons/spp_eligibility_sql: -------------------------------------------------------------------------------- 1 | ../../../../spp_eligibility_sql -------------------------------------------------------------------------------- /setup/spp_eligibility_sql/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_eligibility_tags/odoo/addons/spp_eligibility_tags: -------------------------------------------------------------------------------- 1 | ../../../../spp_eligibility_tags -------------------------------------------------------------------------------- /setup/spp_eligibility_tags/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_ent_trans/odoo/addons/spp_ent_trans: -------------------------------------------------------------------------------- 1 | ../../../../spp_ent_trans -------------------------------------------------------------------------------- /setup/spp_ent_trans/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_entitlement_basket/odoo/addons/spp_entitlement_basket: -------------------------------------------------------------------------------- 1 | ../../../../spp_entitlement_basket -------------------------------------------------------------------------------- /setup/spp_entitlement_basket/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_entitlement_in_kind/odoo/addons/spp_entitlement_in_kind: -------------------------------------------------------------------------------- 1 | ../../../../spp_entitlement_in_kind -------------------------------------------------------------------------------- /setup/spp_entitlement_in_kind/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_exclusion_filter/odoo/addons/spp_exclusion_filter: -------------------------------------------------------------------------------- 1 | ../../../../spp_exclusion_filter -------------------------------------------------------------------------------- /setup/spp_exclusion_filter/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_pos/odoo/addons/spp_pos: -------------------------------------------------------------------------------- 1 | ../../../../spp_pos -------------------------------------------------------------------------------- /setup/spp_pos/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_program_id/odoo/addons/spp_program_id: -------------------------------------------------------------------------------- 1 | ../../../../spp_program_id -------------------------------------------------------------------------------- /setup/spp_program_id/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_programs/odoo/addons/spp_programs: -------------------------------------------------------------------------------- 1 | ../../../../spp_programs -------------------------------------------------------------------------------- /setup/spp_programs/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_programs_compliance_criteria/odoo/addons/spp_programs_compliance_criteria: -------------------------------------------------------------------------------- 1 | ../../../../spp_programs_compliance_criteria -------------------------------------------------------------------------------- /setup/spp_programs_compliance_criteria/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /setup/spp_programs_sp/odoo/addons/spp_programs_sp: -------------------------------------------------------------------------------- 1 | ../../../../spp_programs_sp -------------------------------------------------------------------------------- /setup/spp_programs_sp/setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | 3 | setuptools.setup( 4 | setup_requires=['setuptools-odoo'], 5 | odoo_addon=True, 6 | ) 7 | -------------------------------------------------------------------------------- /spp_auto_update_entitlements/__init__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from . import models 4 | -------------------------------------------------------------------------------- /spp_auto_update_entitlements/__manifest__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | { 3 | "name": "OpenSPP Auto-Update Entitlements when cycle are closed", 4 | "category": "OpenSPP", 5 | "version": "15.0.0.0.0", 6 | "sequence": 1, 7 | "author": "OpenSPP.org", 8 | "website": "https://github.com/openspp/openspp-program", 9 | "license": "LGPL-3", 10 | "development_status": "Alpha", 11 | "maintainers": ["jeremi", "gonzalesedwin1123"], 12 | "depends": [ 13 | "base", 14 | "g2p_programs", 15 | "spp_programs", 16 | "spp_ent_trans", 17 | ], 18 | "data": [ 19 | "views/cycle_view.xml", 20 | "views/entitlements_view.xml", 21 | ], 22 | "assets": {}, 23 | "demo": [], 24 | "images": [], 25 | "application": False, 26 | "installable": True, 27 | "auto_install": False, 28 | } 29 | -------------------------------------------------------------------------------- /spp_auto_update_entitlements/models/__init__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from . import entitlement 4 | from . import cycle 5 | -------------------------------------------------------------------------------- /spp_auto_update_entitlements/models/cycle.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from datetime import date 4 | 5 | from odoo import fields, models 6 | 7 | from odoo.addons.g2p_programs.models import constants 8 | 9 | 10 | class SPPCycle(models.Model): 11 | _inherit = "g2p.cycle" 12 | 13 | is_expired = fields.Boolean(compute="_compute_is_expired") 14 | 15 | def _compute_is_expired(self): 16 | for rec in self: 17 | is_expired = False 18 | if rec.end_date <= date.today(): 19 | is_expired = True 20 | 21 | rec.is_expired = is_expired 22 | 23 | 24 | class SPPDefaultCycleManager(models.Model): 25 | _inherit = "g2p.cycle.manager.default" 26 | 27 | def mark_ended(self, cycle): 28 | self.check_cycle_entitlements(cycle) 29 | cycle.update({"state": constants.STATE_ENDED}) 30 | 31 | def check_cycle_entitlements(self, cycle): 32 | for entitlement in cycle.entitlement_ids: 33 | state = self.check_entitlements_transactions(entitlement) 34 | entitlement.update({"state": state}) 35 | 36 | def check_entitlements_transactions(self, entitlement): 37 | balance = entitlement.entitlement_balance 38 | initial_amount = entitlement.initial_amount 39 | state = entitlement.state 40 | 41 | if initial_amount > balance: 42 | state = "parrdpd2ben" 43 | elif initial_amount == balance: 44 | state = entitlement.state 45 | 46 | if balance == 0: 47 | state = "rdpd2ben" 48 | 49 | return state 50 | -------------------------------------------------------------------------------- /spp_auto_update_entitlements/models/entitlement.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from odoo import api, fields, models 4 | 5 | 6 | class SPPEntitlement(models.Model): 7 | _inherit = "g2p.entitlement" 8 | 9 | state = fields.Selection( 10 | selection_add=[("parrdpd2ben", "Partially Redeemed/Paid to Beneficiary")] 11 | ) 12 | transaction_ids = fields.One2many( 13 | "spp.entitlement.transactions", "entitlement_id", "Transactions" 14 | ) 15 | entitlement_balance = fields.Float(compute="_compute_balance") 16 | 17 | @api.depends("transaction_ids") 18 | def _compute_balance(self): 19 | for rec in self: 20 | total_add = 0 21 | total_deduct = 0 22 | for transaction in rec.transaction_ids: 23 | if transaction.transaction_type == "PURCHASE": 24 | total_add += transaction.amount_charged_by_service_point 25 | elif transaction.transaction_type == "VOID": 26 | total_deduct += transaction.amount_charged_by_service_point 27 | initial_balance = rec.initial_amount 28 | total_balance = initial_balance - (total_add - total_deduct) 29 | rec.entitlement_balance = total_balance 30 | -------------------------------------------------------------------------------- /spp_auto_update_entitlements/static/description/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSPP/openspp-program/e9512f18a9068f42a7b397878d089204d46020c4/spp_auto_update_entitlements/static/description/icon.png -------------------------------------------------------------------------------- /spp_auto_update_entitlements/views/cycle_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | view_cycle_custom_spp_form 8 | g2p.cycle 9 | 10 | 11 | 12 | 13 | 35 | 36 | 37 | 38 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /spp_dashboard/views/dashboard_menu_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | view_dashboard_menu_tree_spp 8 | dashboard.menu 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | dashboard_menu_form_view_spp 20 | dashboard.menu 21 | 22 | 23 | 24 |
25 |
34 |
35 | 36 | 37 | 38 | 39 |
40 |
41 | 42 |
43 | -------------------------------------------------------------------------------- /spp_dashboard/views/main_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | Programs Dashboard 21 | dynamic_dashboard 22 | 23 | 24 | 31 | 32 | 33 | 34 | Program Dashboard 35 | dynamic_dashboard 36 | 37 | 38 | 45 | 46 | 47 | 48 | Cycle Dashboard 49 | dynamic_dashboard 50 | 51 | 52 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /spp_dashboard/views/programs_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | view_program_list_tree_dashboard 8 | g2p.program 9 | 10 | 11 | 12 | 35 | 36 | 37 | 38 | 44 | 45 | 46 | 47 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /spp_pos/static/src/view/popup_voucher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /spp_pos/tests/__init__.py: -------------------------------------------------------------------------------- 1 | from . import test_g2p_entitlement 2 | from . import test_pos_category 3 | -------------------------------------------------------------------------------- /spp_pos/tests/test_pos_category.py: -------------------------------------------------------------------------------- 1 | from odoo.tests import TransactionCase 2 | 3 | 4 | class TestPosCateg(TransactionCase): 5 | def test_01_get_entitlement_categ(self): 6 | res = self.env["pos.category"].get_entitlement_categ() 7 | self.assertEqual( 8 | res, 9 | self.env.ref("spp_pos.entitlement_product_categ_pos").id, 10 | "Should return correct pos category!", 11 | ) 12 | self.env.ref("spp_pos.entitlement_product_categ_pos").unlink() 13 | res = self.env["pos.category"].get_entitlement_categ() 14 | self.assertFalse(res, "POS Category is now deleted!") 15 | -------------------------------------------------------------------------------- /spp_pos/views/product_template_views.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | product_template_only_form_view 8 | product.template 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /spp_program_id/README.rst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSPP/openspp-program/e9512f18a9068f42a7b397878d089204d46020c4/spp_program_id/README.rst -------------------------------------------------------------------------------- /spp_program_id/__init__.py: -------------------------------------------------------------------------------- 1 | from odoo import SUPERUSER_ID, api 2 | 3 | from . import models 4 | 5 | 6 | def post_init_hook(cr, registry): 7 | env = api.Environment(cr, SUPERUSER_ID, {}) 8 | programs = env["g2p.program"].search([("program_id", "=", False)]) 9 | for prog in programs: 10 | prog.program_id = env["ir.sequence"].next_by_code("program.id.sequence") 11 | -------------------------------------------------------------------------------- /spp_program_id/__manifest__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | { 3 | "name": "OpenSPP Programs: Import", 4 | "category": "OpenSPP", 5 | "version": "15.0.0.0.0", 6 | "sequence": 1, 7 | "author": "OpenSPP.org", 8 | "website": "https://github.com/openspp/openspp-program", 9 | "license": "LGPL-3", 10 | "development_status": "Alpha", 11 | "maintainers": ["jeremi", "gonzalesedwin1123", "nhatnm0612"], 12 | "depends": [ 13 | "spp_programs", 14 | ], 15 | "data": [ 16 | "data/ir_sequence_data.xml", 17 | "views/g2p_program_views.xml", 18 | ], 19 | "application": False, 20 | "installable": True, 21 | "auto_install": False, 22 | "post_init_hook": "post_init_hook", 23 | } 24 | -------------------------------------------------------------------------------- /spp_program_id/data/ir_sequence_data.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Program Id Sequence 6 | program.id.sequence 7 | PROG_%(year)s_ 8 | 8 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spp_program_id/models/__init__.py: -------------------------------------------------------------------------------- 1 | from . import g2p_program 2 | -------------------------------------------------------------------------------- /spp_program_id/models/g2p_program.py: -------------------------------------------------------------------------------- 1 | from odoo import fields, models 2 | 3 | 4 | class SppProgram(models.Model): 5 | _inherit = "g2p.program" 6 | 7 | program_id = fields.Char( 8 | string="Program ID", 9 | default=lambda self: self.env["ir.sequence"].next_by_code( 10 | "program.id.sequence" 11 | ), 12 | readonly=True, 13 | copy=False, 14 | index=True, 15 | ) 16 | 17 | _sql_constraints = [ 18 | ("program_id_uniq", "UNIQUE(program_id)", "program_id should be unique!") 19 | ] 20 | -------------------------------------------------------------------------------- /spp_program_id/views/g2p_program_views.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | g2p.program.view.search.inherit 6 | g2p.program 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | g2p.program.view.list.inherit 17 | g2p.program 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | g2p.program.view.form.inherit 28 | g2p.program 29 | 30 | 31 | 32 |

33 |

36 |
37 |
38 |
39 | 40 |
41 | -------------------------------------------------------------------------------- /spp_programs/README.rst: -------------------------------------------------------------------------------- 1 | ===================================== 2 | OpenSPP Program Entitlement (In-Kind) 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/licence-LGPL--3-blue.png 14 | :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html 15 | :alt: License: LGPL-3 16 | .. |badge3| image:: https://img.shields.io/badge/github-openspp%2Fopenspp--program-lightgray.png?logo=github 17 | :target: https://github.com/openspp/openspp-program/tree/15.0/spp_entitlement_in_kind 18 | :alt: openspp/openspp-program 19 | 20 | |badge1| |badge2| |badge3| 21 | 22 | OpenSPP In-Kind Entitlement 23 | 24 | .. IMPORTANT:: 25 | This is an alpha version, the data model and design can change at any time without warning. 26 | Only for development or testing purpose, do not use in production. 27 | `More details on development status `_ 28 | 29 | **Table of contents** 30 | 31 | .. contents:: 32 | :local: 33 | 34 | Bug Tracker 35 | =========== 36 | 37 | Bugs are tracked on `GitHub Issues `_. 38 | In case of trouble, please check there if your issue has already been reported. 39 | If you spotted it first, help us smashing it by providing a detailed and welcomed 40 | `feedback `_. 41 | 42 | Do not contact contributors directly about support or help with technical issues. 43 | 44 | Credits 45 | ======= 46 | 47 | Authors 48 | ~~~~~~~ 49 | 50 | * OpenSPP.org 51 | 52 | Maintainers 53 | ~~~~~~~~~~~ 54 | 55 | .. |maintainer-jeremi| image:: https://github.com/jeremi.png?size=40px 56 | :target: https://github.com/jeremi 57 | :alt: jeremi 58 | .. |maintainer-gonzalesedwin1123| image:: https://github.com/gonzalesedwin1123.png?size=40px 59 | :target: https://github.com/gonzalesedwin1123 60 | :alt: gonzalesedwin1123 61 | 62 | Current maintainers: 63 | 64 | |maintainer-jeremi| |maintainer-gonzalesedwin1123| 65 | 66 | This module is part of the `openspp/openspp-program `_ project on GitHub. 67 | 68 | You are welcome to contribute. 69 | -------------------------------------------------------------------------------- /spp_programs/__init__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from . import models 4 | from . import wizard 5 | -------------------------------------------------------------------------------- /spp_programs/__manifest__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | { 3 | "name": "OpenSPP Programs", 4 | "category": "OpenSPP", 5 | "version": "15.0.0.0.0", 6 | "sequence": 1, 7 | "author": "OpenSPP.org", 8 | "website": "https://github.com/openspp/openspp-program", 9 | "license": "LGPL-3", 10 | "development_status": "Alpha", 11 | "maintainers": ["jeremi", "gonzalesedwin1123"], 12 | "depends": [ 13 | "base", 14 | "web", 15 | "g2p_registry_base", 16 | "g2p_programs", 17 | "spp_area", 18 | "product", 19 | "stock", 20 | "web_domain_field", 21 | ], 22 | "data": [ 23 | "security/ir.model.access.csv", 24 | "views/main_view.xml", 25 | "views/entitlement_view.xml", 26 | "views/entitlement_cash_view.xml", 27 | "views/cycle_view.xml", 28 | "views/programs_view.xml", 29 | "views/registrant_view.xml", 30 | "views/inkind_entitlement_report_view.xml", 31 | "views/managers/eligibility_manager_view.xml", 32 | "views/managers/entitlement_manager_view.xml", 33 | "wizard/inkind_entitlement_report_wiz.xml", 34 | "wizard/create_program_wizard.xml", 35 | "report/program_approval_receipt.xml", 36 | "report/report_format.xml", 37 | ], 38 | "assets": { 39 | "web.assets_backend": [ 40 | "spp_programs/static/src/js/hide_button.js", 41 | "spp_programs/static/src/js/domain_field.js", 42 | ], 43 | }, 44 | "demo": [], 45 | "images": [], 46 | "application": False, 47 | "installable": True, 48 | "auto_install": False, 49 | } 50 | -------------------------------------------------------------------------------- /spp_programs/models/__init__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from . import constants 4 | from . import cycle 5 | from . import entitlement 6 | from . import entitlement_cash 7 | from . import registrant 8 | from . import stock 9 | from . import managers 10 | from . import programs 11 | from . import eligibility 12 | -------------------------------------------------------------------------------- /spp_programs/models/constants.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | STATE_DRAFT = "draft" 3 | STATE_TO_APPROVE = "to_approve" 4 | STATE_APPROVED = "approved" 5 | STATE_DISTRIBUTED = "distributed" 6 | # STATE_ACTIVE = "active" 7 | STATE_ENDED = "ended" 8 | STATE_CANCELLED = "cancelled" 9 | 10 | MANAGER_ELIGIBILITY = 1 11 | MANAGER_CYCLE = 2 12 | MANAGER_PROGRAM = 3 13 | MANAGER_ENTITLEMENT = 4 14 | MANAGER_DEDUPLICATION = 5 15 | MANAGER_NOTIFICATION = 6 16 | MANAGER_PAYMENT = 7 17 | -------------------------------------------------------------------------------- /spp_programs/models/cycle.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from odoo import fields, models 4 | 5 | 6 | class G2PCycle(models.Model): 7 | _inherit = "g2p.cycle" 8 | 9 | inkind_entitlement_ids = fields.One2many( 10 | "g2p.entitlement.inkind", "cycle_id", "In-Kind Entitlements" 11 | ) 12 | inkind_entitlements_count = fields.Integer( 13 | string="# In-kind Entitlements", readonly=True 14 | ) 15 | 16 | # Stock Management Fields 17 | picking_ids = fields.One2many("stock.picking", "cycle_id", string="Stock Transfers") 18 | procurement_group_id = fields.Many2one("procurement.group", "Procurement Group") 19 | 20 | validate_async_err = fields.Boolean(default=False) 21 | 22 | def _compute_inkind_entitlements_count(self): 23 | for rec in self: 24 | entitlements_count = self.env["g2p.entitlement.inkind"].search_count( 25 | [("cycle_id", "=", rec.id)] 26 | ) 27 | rec.update({"inkind_entitlements_count": entitlements_count}) 28 | -------------------------------------------------------------------------------- /spp_programs/models/eligibility.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | import logging 4 | 5 | from odoo import models 6 | 7 | _logger = logging.getLogger(__name__) 8 | 9 | 10 | class CustomDefaultEligibilityManager(models.Model): 11 | _inherit = "g2p.program_membership.manager.default" 12 | 13 | def import_eligible_registrants(self, state="draft"): 14 | ben_count = 0 15 | for rec in self: 16 | domain = rec._prepare_eligible_domain() 17 | new_beneficiaries = self.env["res.partner"].search(domain) 18 | # _logger.debug("Found %s beneficiaries", len(new_beneficiaries)) 19 | 20 | # Exclude already added beneficiaries 21 | beneficiary_ids = rec.program_id.get_beneficiaries().mapped("partner_id") 22 | 23 | # _logger.debug("Excluding %s beneficiaries", len(beneficiary_ids)) 24 | new_beneficiaries = new_beneficiaries - beneficiary_ids 25 | # _logger.debug("Finally %s beneficiaries", len(new_beneficiaries)) 26 | 27 | ben_count = len(new_beneficiaries) 28 | if ben_count < 1000: 29 | rec._import_registrants(new_beneficiaries, state=state, do_count=True) 30 | else: 31 | rec._import_registrants_async(new_beneficiaries, state=state) 32 | 33 | return ben_count 34 | -------------------------------------------------------------------------------- /spp_programs/models/entitlement_cash.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from odoo import fields, models 4 | 5 | 6 | class CashEntitlement(models.Model): 7 | _inherit = "g2p.entitlement" 8 | 9 | id_number = fields.Char() 10 | -------------------------------------------------------------------------------- /spp_programs/models/managers/__init__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from . import eligibility_manager 4 | from . import cycle_manager 5 | from . import entitlement_manager 6 | from . import entitlement_manager_default 7 | -------------------------------------------------------------------------------- /spp_programs/models/managers/cycle_manager.py: -------------------------------------------------------------------------------- 1 | from odoo import models 2 | 3 | 4 | class CustomDefaultCycleManager(models.Model): 5 | _inherit = "g2p.cycle.manager.default" 6 | 7 | def on_start_date_change(self, cycle): 8 | pass 9 | 10 | def mark_prepare_entitlement_as_done(self, cycle, msg): 11 | """Complete the preparation of entitlements. 12 | Base :meth:`mark_prepare_entitlement_as_done`. 13 | This is executed when all the jobs are completed. 14 | Post a message in the chatter. 15 | 16 | :param cycle: A recordset of cycle 17 | :param msg: A string to be posted in the chatter 18 | :return: 19 | """ 20 | super().mark_prepare_entitlement_as_done(cycle, msg) 21 | # Update Statistics 22 | cycle._compute_inkind_entitlements_count() 23 | return 24 | 25 | def _prepare_entitlements(self, cycle, offset=0, limit=None, do_count=False): 26 | """Prepare Entitlements 27 | Get the beneficiaries and generate their entitlements. 28 | 29 | :param cycle: The cycle 30 | :param offset: Optional integer value for the ORM search offset 31 | :param limit: Optional integer value for the ORM search limit 32 | :param do_count: Boolean - set to False to not run compute function 33 | :return: 34 | """ 35 | super()._prepare_entitlements(cycle, offset, limit, do_count) 36 | if do_count: 37 | # Update Statistics 38 | cycle._compute_inkind_entitlements_count() 39 | return 40 | -------------------------------------------------------------------------------- /spp_programs/models/managers/eligibility_manager.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | import logging 3 | 4 | from odoo import api, fields, models 5 | 6 | _logger = logging.getLogger(__name__) 7 | 8 | 9 | class SPPDefaultEligibilityManager(models.Model): 10 | _inherit = "g2p.program_membership.manager.default" 11 | 12 | @api.model 13 | def _get_admin_area_domain(self): 14 | return [("kind", "=", self.env.ref("spp_area.admin_area_kind").id)] 15 | 16 | admin_area_ids = fields.Many2many("spp.area", domain=_get_admin_area_domain) 17 | target_type = fields.Selection(related="program_id.target_type") 18 | 19 | @api.onchange("admin_area_ids") 20 | def on_admin_area_ids_change(self): 21 | eligibility_domain = "[]" 22 | if self.admin_area_ids: 23 | area_ids = self.admin_area_ids.ids 24 | eligibility_domain = "[('area_id', 'in', ({}))]".format(area_ids) 25 | 26 | self.eligibility_domain = eligibility_domain 27 | 28 | def _prepare_eligible_domain(self, membership=None): 29 | domain = super()._prepare_eligible_domain(membership) 30 | 31 | domain += [("is_registrant", "=", True)] 32 | 33 | return domain 34 | -------------------------------------------------------------------------------- /spp_programs/models/managers/entitlement_manager.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | from odoo import fields, models 3 | 4 | 5 | class BaseEntitlementManager(models.AbstractModel): 6 | _inherit = "g2p.base.program.entitlement.manager" 7 | 8 | id_type = fields.Many2one("g2p.id.type", "ID Type to store in entitlements") 9 | -------------------------------------------------------------------------------- /spp_programs/models/programs.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | import logging 4 | 5 | from odoo import _, fields, models 6 | 7 | _logger = logging.getLogger(__name__) 8 | 9 | 10 | class CustomG2PProgram(models.Model): 11 | _inherit = "g2p.program" 12 | 13 | is_one_time_distribution = fields.Boolean("One-time Distribution") 14 | 15 | def import_eligible_registrants(self, state="draft"): 16 | eligibility_managers = self.get_managers(self.MANAGER_ELIGIBILITY) 17 | if eligibility_managers: 18 | manager = eligibility_managers[0] 19 | 20 | new_beneficiaries_count = manager.import_eligible_registrants() 21 | 22 | if new_beneficiaries_count < 1000: 23 | message = _("%s Imported Beneficiaries") % new_beneficiaries_count 24 | kind = "success" 25 | else: 26 | message = ( 27 | _("Started importing %s beneficiaries") % new_beneficiaries_count 28 | ) 29 | kind = "warning" 30 | else: 31 | message = _("No Eligibility Manager defined.") 32 | kind = "danger" 33 | 34 | return { 35 | "type": "ir.actions.client", 36 | "tag": "display_notification", 37 | "params": { 38 | "title": _("Import"), 39 | "message": message, 40 | "sticky": True, 41 | "type": kind, 42 | "next": { 43 | "type": "ir.actions.act_window_close", 44 | }, 45 | }, 46 | } 47 | -------------------------------------------------------------------------------- /spp_programs/models/registrant.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | # Part of OpenG2P. See LICENSE file for full copyright and licensing details. 4 | from odoo import api, fields, models 5 | 6 | 7 | class G2PRegistrantCustom(models.Model): 8 | _inherit = "res.partner" 9 | 10 | # Custom Fields 11 | inkind_entitlement_ids = fields.One2many( 12 | "g2p.entitlement.inkind", "partner_id", "In-kind Entitlements" 13 | ) 14 | 15 | # Statistics 16 | inkind_entitlements_count = fields.Integer( 17 | string="# In-kind Entitlements", 18 | compute="_compute_inkind_entitlements_count", 19 | store=True, 20 | ) 21 | 22 | @api.depends("inkind_entitlement_ids") 23 | def _compute_inkind_entitlements_count(self): 24 | for rec in self: 25 | inkind_entitlements_count = self.env["g2p.entitlement.inkind"].search_count( 26 | [("partner_id", "=", rec.id)] 27 | ) 28 | rec.update({"inkind_entitlements_count": inkind_entitlements_count}) 29 | -------------------------------------------------------------------------------- /spp_programs/models/stock/__init__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from . import stock 4 | -------------------------------------------------------------------------------- /spp_programs/models/stock/stock.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from odoo import api, fields, models 4 | from odoo.tools.sql import column_exists, create_column 5 | 6 | 7 | class StockMove(models.Model): 8 | _inherit = "stock.move" 9 | entitlement_id = fields.Many2one( 10 | "g2p.entitlement.inkind", "In-kind Entitlement", index=True 11 | ) 12 | 13 | @api.model 14 | def _prepare_merge_moves_distinct_fields(self): 15 | distinct_fields = super()._prepare_merge_moves_distinct_fields() 16 | distinct_fields.append("entitlement_id") 17 | return distinct_fields 18 | 19 | def _get_source_document(self): 20 | res = super()._get_source_document() 21 | return self.entitlement_id.cycle_id or res 22 | 23 | def _assign_picking_post_process(self, new=False): 24 | super()._assign_picking_post_process(new=new) 25 | if new: 26 | picking_id = self.mapped("picking_id") 27 | entitlement_ids = self.mapped("entitlement_id.cycle_id") 28 | for entitlement_id in entitlement_ids: 29 | picking_id.message_post_with_view( 30 | "mail.message_origin_link", 31 | values={"self": picking_id, "origin": entitlement_id}, 32 | subtype_id=self.env.ref("mail.mt_note").id, 33 | ) 34 | return 35 | 36 | 37 | class ProcurementGroup(models.Model): 38 | _inherit = "procurement.group" 39 | 40 | cycle_id = fields.Many2one("g2p.cycle", "Cycle") 41 | 42 | 43 | class StockRule(models.Model): 44 | _inherit = "stock.rule" 45 | 46 | def _get_custom_move_fields(self): 47 | fields = super()._get_custom_move_fields() 48 | fields += ["entitlement_id"] 49 | return fields 50 | 51 | 52 | class StockPicking(models.Model): 53 | _inherit = "stock.picking" 54 | 55 | cycle_id = fields.Many2one( 56 | related="group_id.cycle_id", string="Cycle", store=True, readonly=False 57 | ) 58 | 59 | def _auto_init(self): 60 | """ 61 | Create related field here, too slow 62 | when computing it afterwards through _compute_related. 63 | 64 | Since group_id.cycle_id is created in this module, 65 | no need for an UPDATE statement. 66 | """ 67 | if not column_exists(self.env.cr, "stock_picking", "cycle_id"): 68 | create_column(self.env.cr, "stock_picking", "cycle_id", "int4") 69 | return super()._auto_init() 70 | -------------------------------------------------------------------------------- /spp_programs/report/report_format.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Program Approval Receipt 4 | g2p.program 5 | qweb-pdf 6 | spp_programs.print_program_approval_receipt 7 | spp_programs.print_program_approval_receipt 8 | 'Program Approval Receipt' 9 | 10 | report 11 | 12 | 13 | -------------------------------------------------------------------------------- /spp_programs/static/description/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSPP/openspp-program/e9512f18a9068f42a7b397878d089204d46020c4/spp_programs/static/description/icon.png -------------------------------------------------------------------------------- /spp_programs/static/src/js/hide_button.js: -------------------------------------------------------------------------------- 1 | odoo.define("g2p_programs.view_cycle_form", function (require) { 2 | var FormController = require("web.FormController"); 3 | const hide_states = ["approved", "distributed", "cancelled", "ended"]; 4 | 5 | FormController.include({ 6 | updateButtons: function () { 7 | this._super.apply(this, arguments); 8 | 9 | if ( 10 | this.modelName === "g2p.cycle" && 11 | this.$buttons && 12 | this.renderer.state.data.state && 13 | hide_states.includes(this.renderer.state.data.state) 14 | ) { 15 | this.$buttons.find(".o_form_button_edit").toggleClass("o_hidden", true); 16 | var edit_mode = this.mode === "edit"; 17 | this.$buttons.find(".o_form_buttons_edit").toggleClass("o_hidden", !edit_mode); 18 | this.$buttons.find(".o_form_buttons_view").toggleClass("o_hidden", edit_mode); 19 | } 20 | }, 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /spp_programs/tests/__init__.py: -------------------------------------------------------------------------------- 1 | from . import test_create_program_wiz 2 | from . import test_entitlement_report_wiz 3 | from . import test_entitlement 4 | from . import test_programs 5 | from . import test_registrant 6 | from . import test_stock_rule 7 | -------------------------------------------------------------------------------- /spp_programs/tests/common.py: -------------------------------------------------------------------------------- 1 | from odoo import fields 2 | from odoo.tests import TransactionCase 3 | 4 | 5 | class Common(TransactionCase): 6 | def setUp(self): 7 | super().setUp() 8 | 9 | self.program = self.env["g2p.program"].create({"name": "Test Program"}) 10 | 11 | self.registrant = self.env["res.partner"].create( 12 | { 13 | "name": "test registrant", 14 | "is_registrant": True, 15 | } 16 | ) 17 | 18 | self.cycle = self.env["g2p.cycle"].create( 19 | { 20 | "name": "Test Cycle", 21 | "program_id": self.program.id, 22 | "start_date": fields.Date.today(), 23 | "end_date": fields.Date.today(), 24 | } 25 | ) 26 | 27 | self.entitlement = self.env["g2p.entitlement.inkind"].create( 28 | { 29 | "partner_id": self.registrant.id, 30 | "cycle_id": self.cycle.id, 31 | } 32 | ) 33 | -------------------------------------------------------------------------------- /spp_programs/tests/test_entitlement_report_wiz.py: -------------------------------------------------------------------------------- 1 | from .common import Common 2 | 3 | 4 | class TestEntitlementReportWiz(Common): 5 | def setUp(self): 6 | super().setUp() 7 | self._test_record = self.env["g2p.entitlement.inkind.report.wizard"].create( 8 | { 9 | "cycle_id": self.cycle.id, 10 | "program_id": self.program.id, 11 | } 12 | ) 13 | 14 | def test_01_compute_cycle_id_domain(self): 15 | self._test_record._compute_cycle_id_domain() 16 | self.assertEqual( 17 | self._test_record.cycle_id_domain, 18 | f'[["program_id", "=", {self.program.id}]]', 19 | "Cycle Domain should be correct!", 20 | ) 21 | 22 | def test_02_generate_report(self): 23 | res = self._test_record.generate_report() 24 | self.assertEqual(type(res), dict, "Action should be return as a dictionary!") 25 | for key in ["res_model", "domain", "type", "flags"]: 26 | self.assertIn(key, res.keys(), f"> `{key}` should be in return action!") 27 | self.assertEqual( 28 | res["res_model"], "g2p.entitlement.inkind", "Should return correct model!" 29 | ) 30 | self.assertEqual( 31 | res["domain"], 32 | [("program_id", "=", self.program.id), ("cycle_id", "=", self.cycle.id)], 33 | "Should return correct domain!", 34 | ) 35 | self.assertEqual( 36 | res["type"], "ir.actions.act_window", "Should return action window!" 37 | ) 38 | self.assertEqual( 39 | res["flags"], {"mode": "readonly"}, "Should be readonly action!" 40 | ) 41 | -------------------------------------------------------------------------------- /spp_programs/tests/test_programs.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import patch 2 | 3 | from odoo.tests import TransactionCase 4 | from odoo.tools import mute_logger 5 | 6 | 7 | class TestProgram(TransactionCase): 8 | def setUp(self): 9 | super().setUp() 10 | 11 | self.program = self.env["g2p.program"].create({"name": "Test Program"}) 12 | 13 | manager_default = self.env["g2p.program_membership.manager.default"].create( 14 | { 15 | "name": "Default", 16 | "program_id": self.program.id, 17 | } 18 | ) 19 | eligibility_manager = self.env["g2p.eligibility.manager"].create( 20 | { 21 | "program_id": self.program.id, 22 | "manager_ref_id": "%s,%s" 23 | % (manager_default._name, str(manager_default.id)), 24 | } 25 | ) 26 | self.program.update({"eligibility_managers": [(4, eligibility_manager.id)]}) 27 | 28 | self.program_2 = self.env["g2p.program"].create({"name": "Test Program 2"}) 29 | 30 | @mute_logger("root") 31 | @patch("odoo.addons.spp_programs.models.programs.len") 32 | def test_01_import_eligible_registrants(self, mocker): 33 | mocker.__name__ = "len__mocker" 34 | action = self.program_2.import_eligible_registrants() 35 | 36 | self.assertEqual( 37 | [ 38 | action.get("type"), 39 | action.get("tag"), 40 | action["params"].get("message"), 41 | action["params"].get("type"), 42 | ], 43 | [ 44 | "ir.actions.client", 45 | "display_notification", 46 | "No Eligibility Manager defined.", 47 | "danger", 48 | ], 49 | ) 50 | 51 | mocker.return_value = 1 52 | action_2 = self.program.import_eligible_registrants() 53 | 54 | self.assertEqual( 55 | [action_2.get("type"), action_2.get("tag"), action_2["params"].get("type")], 56 | ["ir.actions.client", "display_notification", "success"], 57 | ) 58 | 59 | mocker.return_value = 1000 60 | action_3 = self.program.import_eligible_registrants() 61 | 62 | self.assertEqual( 63 | [action_3.get("type"), action_3.get("tag"), action_3["params"].get("type")], 64 | ["ir.actions.client", "display_notification", "warning"], 65 | ) 66 | -------------------------------------------------------------------------------- /spp_programs/tests/test_registrant.py: -------------------------------------------------------------------------------- 1 | from .common import Common 2 | 3 | 4 | class TestRegistrant(Common): 5 | def test_01_compute_inkind_entitlements_count(self): 6 | self.registrant._compute_inkind_entitlements_count() 7 | self.assertEqual( 8 | self.registrant.inkind_entitlements_count, 9 | 1, 10 | "Registrant should have correct inkind entitlements count!", 11 | ) 12 | -------------------------------------------------------------------------------- /spp_programs/tests/test_stock_rule.py: -------------------------------------------------------------------------------- 1 | from odoo.tests import TransactionCase 2 | 3 | 4 | class TestStockRule(TransactionCase): 5 | def test_01_get_custom_move_fields(self): 6 | res = self.env["stock.rule"]._get_custom_move_fields() 7 | self.assertIn( 8 | "entitlement_id", res, "`entitlement_id` should be in custom move fields!" 9 | ) 10 | -------------------------------------------------------------------------------- /spp_programs/views/cycle_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | view_cycle_custom_spp_tree 8 | g2p.cycle 9 | 10 | 11 | 12 | Cash Entitlements 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | view_cycle_custom_spp_form 22 | g2p.cycle 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | {'invisible':[('entitlements_count','=',0)]} 31 | 32 | 33 | 45 | 46 | 47 | 0 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /spp_programs/views/entitlement_cash_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | view_entitlement_tree_custom_spp_programs 8 | g2p.entitlement 9 | 10 | 2000 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | view_entitlement_form_custom_spp_programs 20 | g2p.entitlement 21 | 22 | 2000 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /spp_programs/views/main_view.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 12 | 13 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /spp_programs/views/managers/eligibility_manager_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | view_eligibility_manager_default_form_spp 9 | g2p.program_membership.manager.default 10 | 1000 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /spp_programs/views/managers/entitlement_manager_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | view_entitlement_manager_default_form_spp 9 | g2p.program.entitlement.manager.default 10 | 1000 11 | 12 | 13 | 14 | 19 | 20 | 21 | 2 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /spp_programs/wizard/__init__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | from . import inkind_entitlement_report_wiz 4 | from . import create_program_wizard 5 | -------------------------------------------------------------------------------- /spp_programs/wizard/inkind_entitlement_report_wiz.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | 3 | import json 4 | 5 | from odoo import _, api, fields, models 6 | 7 | 8 | class InKindEntitlement(models.TransientModel): 9 | _name = "g2p.entitlement.inkind.report.wizard" 10 | _description = "In-kind Entitlement Report Wizard" 11 | 12 | cycle_id = fields.Many2one("g2p.cycle", string="Cycle") 13 | program_id = fields.Many2one("g2p.program", string="Program", required=True) 14 | 15 | cycle_id_domain = fields.Char( 16 | compute="_compute_cycle_id_domain", 17 | readonly=True, 18 | store=False, 19 | ) 20 | 21 | @api.depends("program_id") 22 | def _compute_cycle_id_domain(self): 23 | for rec in self: 24 | domain = [("program_id", "=", rec.program_id.id)] 25 | rec.cycle_id_domain = json.dumps(domain) 26 | 27 | def generate_report(self): 28 | for rec in self: 29 | domain = [("program_id", "=", rec.program_id.id)] 30 | if rec.cycle_id: 31 | domain.append(("cycle_id", "=", rec.cycle_id.id)) 32 | context = { 33 | "create": False, 34 | "edit": False, 35 | "delete": False, 36 | } 37 | tree_id = self.env.ref( 38 | "spp_programs.view_entitlement_inkind_report_tree" 39 | ).id 40 | form_id = self.env.ref("spp_programs.view_entitlement_inkind_form").id 41 | return { 42 | "name": _("In-kind Entitlement Report"), 43 | "view_mode": "tree", 44 | "res_model": "g2p.entitlement.inkind", 45 | "views": [(tree_id, "tree"), (form_id, "form")], 46 | "search_view_id": self.env.ref( 47 | "spp_programs.action_entitlement_report_inkind" 48 | ).id, 49 | "domain": domain, 50 | "context": context, 51 | "type": "ir.actions.act_window", 52 | "target": "current", 53 | "flags": {"mode": "readonly"}, 54 | } 55 | -------------------------------------------------------------------------------- /spp_programs/wizard/inkind_entitlement_report_wiz.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | inkind_entitlement_report_wizard 4 | g2p.entitlement.inkind.report.wizard 5 | 6 |
7 | 8 |
9 | Filter Program: 10 |

11 | 15 |

16 | Filter Cycle: 17 |

18 | 23 |

24 |
25 | 26 |
27 |
28 |
36 |
37 |
38 |
39 | 40 | 41 | In-kind Entitlement Report 42 | g2p.entitlement.inkind.report.wizard 43 | form 44 | new 45 | 46 | 47 | 55 | 56 |
57 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/README.rst: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSPP/openspp-program/e9512f18a9068f42a7b397878d089204d46020c4/spp_programs_compliance_criteria/README.rst -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/__init__.py: -------------------------------------------------------------------------------- 1 | from . import models 2 | from . import wizards 3 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/__manifest__.py: -------------------------------------------------------------------------------- 1 | # Part of OpenSPP. See LICENSE file for full copyright and licensing details. 2 | { 3 | "name": "OpenSPP Programs: Compliance Criteria", 4 | "category": "OpenSPP", 5 | "version": "15.0.0.0.0", 6 | "sequence": 1, 7 | "author": "OpenSPP.org", 8 | "website": "https://github.com/openspp/openspp-program", 9 | "license": "LGPL-3", 10 | "development_status": "Alpha", 11 | "maintainers": ["jeremi", "gonzalesedwin1123"], 12 | "depends": [ 13 | "base", 14 | "g2p_registry_base", 15 | "g2p_programs", 16 | "spp_area", 17 | "spp_programs", 18 | "spp_eligibility_sql", 19 | "spp_eligibility_tags", 20 | "web_domain_field", 21 | ], 22 | "data": [ 23 | "security/ir.model.access.csv", 24 | "views/g2p_cycle_views.xml", 25 | "views/g2p_program_views.xml", 26 | "views/res_config_settings_views.xml", 27 | "wizards/g2p_program_create_wizard_views.xml", 28 | ], 29 | "assets": { 30 | "web.assets_backend": [ 31 | "spp_programs_compliance_criteria/static/src/js/field_domain.js", 32 | ], 33 | }, 34 | "application": False, 35 | "installable": True, 36 | "auto_install": False, 37 | } 38 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/models/__init__.py: -------------------------------------------------------------------------------- 1 | from . import managers 2 | from . import g2p_cycle 3 | from . import g2p_program 4 | from . import res_config_settings 5 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/models/g2p_cycle.py: -------------------------------------------------------------------------------- 1 | from odoo import _, api, fields, models 2 | from odoo.exceptions import ValidationError 3 | from odoo.osv.expression import OR 4 | 5 | 6 | class G2pCycle(models.Model): 7 | _inherit = "g2p.cycle" 8 | 9 | allow_filter_compliance_criteria = fields.Boolean( 10 | compute="_compute_allow_filter_compliance_criteria" 11 | ) 12 | 13 | @api.depends("program_id", "program_id.compliance_managers") 14 | def _compute_allow_filter_compliance_criteria(self): 15 | for rec in self: 16 | rec.allow_filter_compliance_criteria = bool( 17 | rec.program_id.compliance_managers 18 | ) 19 | 20 | def action_filter_beneficiaries_by_compliance_criteria(self): 21 | self.ensure_one() 22 | if not self.program_id.compliance_managers: 23 | raise ValidationError( 24 | _("Cycle is not on correct condition to filter by compliance!") 25 | ) 26 | if self.state not in ("draft", "to_approve") or not self.cycle_membership_ids: 27 | return 28 | registrant_satisfied = ( 29 | self.env["res.partner"] 30 | .sudo() 31 | .search(self._get_compliance_criteria_domain()) 32 | ) 33 | membership_to_paused = self.cycle_membership_ids.filtered( 34 | lambda cm: cm.partner_id not in registrant_satisfied 35 | ) 36 | membership_to_paused.state = "paused" 37 | membership_to_enrolled = self.cycle_membership_ids - membership_to_paused 38 | membership_to_enrolled.state = "enrolled" 39 | 40 | def _get_compliance_criteria_domain(self): 41 | self.ensure_one() 42 | domain = [] 43 | for manager in self.program_id.compliance_managers: 44 | manager_ref = manager.manager_ref_id 45 | if manager_ref._name == "g2p.program_membership.manager.sql": 46 | domain.append( 47 | [("id", "in", manager_ref._get_beneficiaries_sql_query())] 48 | ) 49 | continue 50 | membership = ( 51 | self.cycle_membership_ids if self.cycle_membership_ids else None 52 | ) 53 | domain.append(manager_ref._prepare_eligible_domain(membership)) 54 | return OR(domain) 55 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/models/g2p_program.py: -------------------------------------------------------------------------------- 1 | from odoo import fields, models 2 | 3 | 4 | class G2pProgram(models.Model): 5 | _inherit = "g2p.program" 6 | 7 | compliance_managers = fields.One2many( 8 | comodel_name="spp.compliance.manager", 9 | inverse_name="program_id", 10 | auto_join=True, 11 | ) 12 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/models/managers/__init__.py: -------------------------------------------------------------------------------- 1 | from . import g2p_cycle_manager_default 2 | from . import g2p_program_entitlement_manager_default 3 | from . import spp_compliance_manager 4 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/models/managers/g2p_cycle_manager_default.py: -------------------------------------------------------------------------------- 1 | from odoo import models 2 | from odoo.osv.expression import AND 3 | 4 | 5 | class G2pCycleManagerDefault(models.Model): 6 | _inherit = "g2p.cycle.manager.default" 7 | 8 | def _add_beneficiaries(self, cycle, beneficiaries, state="draft", do_count=False): 9 | automated_beneficiaries_filtering_mechanism = ( 10 | self.env["ir.config_parameter"] 11 | .sudo() 12 | .get_param( 13 | "spp_programs_compliance_criteria.beneficiaries_automated_filtering_mechanism", 14 | "0", 15 | ) 16 | ) 17 | if ( 18 | automated_beneficiaries_filtering_mechanism == "1" 19 | and cycle.program_id.compliance_managers 20 | ): 21 | domain = cycle._get_compliance_criteria_domain() 22 | new_domain = AND([domain, [["id", "in", beneficiaries]]]) 23 | beneficiaries = self.env["res.partner"].sudo().search(new_domain).ids 24 | res = super()._add_beneficiaries(cycle, beneficiaries, state, do_count) 25 | return res 26 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/models/managers/g2p_program_entitlement_manager_default.py: -------------------------------------------------------------------------------- 1 | from odoo import models 2 | 3 | 4 | class G2pProgramEntitlementManagerDefault(models.Model): 5 | _inherit = ["g2p.program.entitlement.manager.default"] 6 | 7 | def prepare_entitlements(self, cycle, beneficiaries): 8 | automated_beneficiaries_filtering_mechanism = ( 9 | self.env["ir.config_parameter"] 10 | .sudo() 11 | .get_param( 12 | "spp_programs_compliance_criteria.beneficiaries_automated_filtering_mechanism", 13 | "0", 14 | ) 15 | ) 16 | if ( 17 | automated_beneficiaries_filtering_mechanism == "2" 18 | and cycle.program_id.compliance_managers 19 | ): 20 | satisfied_registrant_ids = ( 21 | self.env["res.partner"] 22 | .sudo() 23 | .search(cycle._get_compliance_criteria_domain()) 24 | .ids 25 | ) 26 | beneficiaries = beneficiaries.filtered( 27 | lambda cm: cm.partner_id.id in satisfied_registrant_ids 28 | ) 29 | return super().prepare_entitlements(cycle, beneficiaries) 30 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/models/managers/spp_compliance_manager.py: -------------------------------------------------------------------------------- 1 | from odoo import api, fields, models 2 | 3 | 4 | class SppComplianceManager(models.Model): 5 | _name = "spp.compliance.manager" 6 | _inherit = ["g2p.manager.mixin"] 7 | _description = "Compliance Criteria Manager" 8 | 9 | program_id = fields.Many2one( 10 | comodel_name="g2p.program", 11 | string="Program", 12 | required=True, 13 | auto_join=True, 14 | ondelete="cascade", 15 | readonly=True, 16 | ) 17 | 18 | @api.model 19 | def _selection_manager_ref_id(self): 20 | res = super()._selection_manager_ref_id() 21 | for item in [ 22 | ("g2p.program_membership.manager.default", "Default Manager"), 23 | ("g2p.program_membership.manager.sql", "SQL-based Manager"), 24 | ("g2p.program_membership.manager.tags", "Tag-based Manager"), 25 | ]: 26 | if item not in res: 27 | res.append(item) 28 | return res 29 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/models/res_config_settings.py: -------------------------------------------------------------------------------- 1 | from odoo import fields, models 2 | 3 | 4 | class ResConfigSettings(models.TransientModel): 5 | _inherit = "res.config.settings" 6 | 7 | beneficiaries_automated_filtering_mechanism = fields.Selection( 8 | selection=[ 9 | ("0", "No Automated Filtering Mechanism"), 10 | ("1", "On Cycle Memberships Creating Event"), 11 | ("2", "On Entitlement Creating Event"), 12 | ], 13 | required=True, 14 | default="0", 15 | config_parameter="spp_programs_compliance_criteria.beneficiaries_automated_filtering_mechanism", 16 | help="Automated Filtering Beneficiaries Mechanism:\n" 17 | "0. No Automated Filtering Mechanism\n" 18 | "1. On Cycle Memberships Creating Event\n" 19 | "2. On Entitlement Creating Event\n", 20 | ) 21 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/security/ir.model.access.csv: -------------------------------------------------------------------------------- 1 | id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink 2 | access_spp_compliance_manager_group_g2p_admin,spp.compliance.manager.group.g2p.admin,model_spp_compliance_manager,g2p_registry_base.group_g2p_admin,1,1,1,1 3 | access_spp_compliance_manager_g2p_program_manager,spp.compliance.manager.g2p.program.manager,model_spp_compliance_manager,g2p_programs.g2p_program_manager,1,1,1,0 4 | access_spp_compliance_manager_g2p_program_validator,spp.compliance.manager.g2p.program.validator,model_spp_compliance_manager,g2p_programs.g2p_program_validator,1,0,0,0 5 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/static/src/js/field_domain.js: -------------------------------------------------------------------------------- 1 | odoo.define("spp_programs_compliance_criteria.field_domain", function (require) { 2 | const {FieldDomain} = require("web.basic_fields"); 3 | 4 | FieldDomain.include({ 5 | init: function () { 6 | this._super.apply(this, arguments); 7 | this.hideResult = this.nodeOptions.hide_result; 8 | }, 9 | 10 | _replaceContent: function () { 11 | this._super.apply(this, arguments); 12 | if (this.hideResult) { 13 | this.$el.find(".fa-arrow-right").remove(); 14 | this.$el.find(".o_domain_show_selection_button").remove(); 15 | this.$el.find(".o_refresh_count").remove(); 16 | } 17 | }, 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/tests/__init__.py: -------------------------------------------------------------------------------- 1 | from . import test_g2p_cycle 2 | from . import test_g2p_program_create_wizard 3 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/tests/common.py: -------------------------------------------------------------------------------- 1 | from odoo.tests import TransactionCase 2 | 3 | 4 | class Common(TransactionCase): 5 | def setUp(self): 6 | super().setUp() 7 | self.areas = self.env["spp.area"].create( 8 | [ 9 | {"draft_name": "Area 1 [TEST]"}, 10 | {"draft_name": "Area 2 [TEST]"}, 11 | {"draft_name": "Area 3 [TEST]"}, 12 | ] 13 | ) 14 | self._tag = self.env["g2p.registrant.tags"].create({"name": "Tag 1 [TEST]"}) 15 | 16 | def program_create_wizard(self, vals): 17 | vals.update( 18 | { 19 | "name": "Program 1 [TEST]", 20 | "rrule_type": "monthly", 21 | "eligibility_domain": "[]", 22 | "cycle_duration": 1, 23 | "currency_id": self.env.company.currency_id.id, 24 | "admin_area_ids": [(6, 0, self.areas.ids)], 25 | "amount_per_cycle": 1.0, 26 | } 27 | ) 28 | return self.env["g2p.program.create.wizard"].create(vals) 29 | -------------------------------------------------------------------------------- /spp_programs_compliance_criteria/views/g2p_cycle_views.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | g2p.cycle.view.form.inherit 6 | g2p.cycle 7 | 8 | 9 | 10 |