Browse Source

Merge pull request #84 from coopiteasy/12.0-setup-travis

[12.0] MAKE TRAVIS GREEN AGAIN
pull/85/head
Robin Keunen 4 years ago
committed by GitHub
parent
commit
142372b6bc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 291
      .eslintrc
  2. 10
      .flake8
  3. 27
      .gitignore
  4. 12
      .isort.cfg
  5. 69
      .pre-commit-config.yaml
  6. 86
      .pylintrc
  7. 64
      .pylintrc-mandatory
  8. 34
      .travis.yml
  9. 42
      README.md
  10. 58
      easy_my_coop/README.rst
  11. 6
      easy_my_coop/__init__.py
  12. 101
      easy_my_coop/__manifest__.py
  13. 87
      easy_my_coop/data/easy_my_coop_data.xml
  14. 940
      easy_my_coop/data/mail_template_data.xml
  15. 4
      easy_my_coop/data/paperformat.xml
  16. 34
      easy_my_coop/demo/coop.xml
  17. 6
      easy_my_coop/demo/users.xml
  18. 59
      easy_my_coop/migrations/8.0.1.0/pre-migration.py
  19. 372
      easy_my_coop/models/account_invoice.py
  20. 27
      easy_my_coop/models/account_journal.py
  21. 176
      easy_my_coop/models/company.py
  22. 1714
      easy_my_coop/models/coop.py
  23. 2
      easy_my_coop/models/mail_template.py
  24. 771
      easy_my_coop/models/operation_request.py
  25. 202
      easy_my_coop/models/partner.py
  26. 78
      easy_my_coop/models/product.py
  27. 29
      easy_my_coop/models/res_partner_bank.py
  28. 1
      easy_my_coop/readme/CONTRIBUTORS.rst
  29. 1
      easy_my_coop/readme/DESCRIPTION.rst
  30. 32
      easy_my_coop/report/account_invoice_report.py
  31. 35
      easy_my_coop/report/cooperator_certificat_G001.xml
  32. 136
      easy_my_coop/report/cooperator_invoice_G002.xml
  33. 250
      easy_my_coop/report/cooperator_register_G001.xml
  34. 222
      easy_my_coop/report/cooperator_subscription_G001.xml
  35. 76
      easy_my_coop/report/easy_my_coop_report.xml
  36. 65
      easy_my_coop/report/layout.xml
  37. 32
      easy_my_coop/security/ir.model.access.csv
  38. 6
      easy_my_coop/security/res_groups.xml
  39. 414
      easy_my_coop/static/description/index.html
  40. 54
      easy_my_coop/static/src/css/coop_report.css
  41. 100
      easy_my_coop/static/src/js/easy_my_coop.js
  42. 3125
      easy_my_coop/static/src/js/jquery.inputmask.bundle.js
  43. 5
      easy_my_coop/tests/test_emc.py
  44. 166
      easy_my_coop/views/account_invoice_view.xml
  45. 54
      easy_my_coop/views/account_journal_view.xml
  46. 161
      easy_my_coop/views/cooperator_register_view.xml
  47. 30
      easy_my_coop/views/email_template_view.xml
  48. 62
      easy_my_coop/views/menus.xml
  49. 238
      easy_my_coop/views/operation_request_view.xml
  50. 321
      easy_my_coop/views/product_view.xml
  51. 69
      easy_my_coop/views/res_company_view.xml
  52. 396
      easy_my_coop/views/res_partner_view.xml
  53. 439
      easy_my_coop/views/subscription_request_view.xml
  54. 10
      easy_my_coop/wizard/account_invoice_refund.py
  55. 83
      easy_my_coop/wizard/cooperative_history_wizard.xml
  56. 216
      easy_my_coop/wizard/create_subscription_from_partner.py
  57. 41
      easy_my_coop/wizard/create_subscription_from_partner.xml
  58. 49
      easy_my_coop/wizard/update_partner_info.py
  59. 27
      easy_my_coop/wizard/update_partner_info.xml
  60. 44
      easy_my_coop/wizard/update_share_line.py
  61. 76
      easy_my_coop/wizard/update_share_line.xml
  62. 8
      easy_my_coop/wizard/validate_subscription_request.py
  63. 17
      easy_my_coop/wizard/validate_subscription_request.xml
  64. 58
      easy_my_coop_be/README.rst
  65. 2
      easy_my_coop_be/__init__.py
  66. 19
      easy_my_coop_be/__manifest__.py
  67. 4
      easy_my_coop_be/models/__init__.py
  68. 53
      easy_my_coop_be/models/coop.py
  69. 24
      easy_my_coop_be/models/partner.py
  70. 1
      easy_my_coop_be/readme/CONTRIBUTORS.rst
  71. 1
      easy_my_coop_be/readme/DESCRIPTION.rst
  72. 414
      easy_my_coop_be/static/description/index.html
  73. 55
      easy_my_coop_ch/README.rst
  74. 2
      easy_my_coop_ch/__init__.py
  75. 46
      easy_my_coop_ch/__manifest__.py
  76. 4
      easy_my_coop_ch/models/__init__.py
  77. 47
      easy_my_coop_ch/models/coop.py
  78. 34
      easy_my_coop_ch/models/partner.py
  79. 2
      easy_my_coop_ch/readme/CONTRIBUTORS.rst
  80. 1
      easy_my_coop_ch/readme/DESCRIPTION.rst
  81. 414
      easy_my_coop_ch/static/description/index.html
  82. 63
      easy_my_coop_ch/views/certificate_template.xml
  83. 65
      easy_my_coop_ch/views/subscription_template.xml
  84. 62
      easy_my_coop_dividend/README.rst
  85. 1
      easy_my_coop_dividend/__init__.py
  86. 38
      easy_my_coop_dividend/__manifest__.py
  87. 1
      easy_my_coop_dividend/models/__init__.py
  88. 403
      easy_my_coop_dividend/models/dividend.py
  89. 2
      easy_my_coop_dividend/readme/CONTRIBUTORS.rst
  90. 3
      easy_my_coop_dividend/readme/DESCRIPTION.rst
  91. 2
      easy_my_coop_dividend/security/ir.model.access.csv
  92. 419
      easy_my_coop_dividend/static/description/index.html
  93. 349
      easy_my_coop_dividend/views/dividend_views.xml
  94. 54
      easy_my_coop_eater/README.rst
  95. 2
      easy_my_coop_eater/__init__.py
  96. 17
      easy_my_coop_eater/__manifest__.py
  97. 35
      easy_my_coop_eater/__openerp__.py
  98. 4
      easy_my_coop_eater/models/__init__.py
  99. 57
      easy_my_coop_eater/models/coop.py
  100. 20
      easy_my_coop_eater/models/product.py

291
.eslintrc

@ -0,0 +1,291 @@
{
"globals": {
"$": false,
"_": false,
"fuzzy": false,
"jQuery": false,
"moment": false,
"odoo": false,
"openerp": false,
"self": false
},
"env": {
"browser": true
},
"rules": {
"no-alert": "warn",
"no-array-constructor": "warn",
"no-bitwise": "off",
"no-caller": "warn",
"no-case-declarations": "warn",
"no-catch-shadow": "warn",
"no-class-assign": "warn",
"no-cond-assign": "warn",
"no-confusing-arrow": "warn",
"no-console": "off",
"no-const-assign": "warn",
"no-constant-condition": "warn",
"no-continue": "off",
"no-control-regex": "warn",
"no-debugger": "warn",
"no-delete-var": "warn",
"no-div-regex": "warn",
"no-dupe-args": "warn",
"no-dupe-class-members": "warn",
"no-dupe-keys": "warn",
"no-duplicate-case": "warn",
"no-duplicate-imports": "warn",
"no-else-return": "warn",
"no-empty": "warn",
"no-empty-character-class": "warn",
"no-empty-function": "warn",
"no-empty-pattern": "warn",
"no-eq-null": "warn",
"no-eval": "warn",
"no-ex-assign": "warn",
"no-extend-native": "warn",
"no-extra-bind": "warn",
"no-extra-boolean-cast": "warn",
"no-extra-label": "warn",
"no-extra-parens": "warn",
"no-extra-semi": "warn",
"no-fallthrough": "warn",
"no-floating-decimal": "warn",
"no-func-assign": "warn",
"no-implicit-coercion": ["warn", {
"allow": ["~"]
}],
"no-implicit-globals": "warn",
"no-implied-eval": "warn",
"no-inline-comments": "warn",
"no-inner-declarations": "warn",
"no-invalid-regexp": "warn",
"no-invalid-this": "off",
"no-irregular-whitespace": "warn",
"no-iterator": "warn",
"no-label-var": "warn",
"no-labels": "warn",
"no-lone-blocks": "warn",
"no-lonely-if": "warn",
"no-loop-func": "off",
"no-magic-numbers": "off",
"no-mixed-operators": "warn",
"no-mixed-requires": "warn",
"no-mixed-spaces-and-tabs": "warn",
"no-multi-spaces": "warn",
"no-multi-str": "warn",
"no-multiple-empty-lines": "warn",
"no-native-reassign": "warn",
"no-negated-condition": "warn",
"no-negated-in-lhs": "warn",
"no-nested-ternary": "off",
"no-new": "warn",
"no-new-func": "warn",
"no-new-object": "warn",
"no-new-require": "warn",
"no-new-symbol": "warn",
"no-new-wrappers": "warn",
"no-obj-calls": "warn",
"no-octal": "warn",
"no-octal-escape": "warn",
"no-param-reassign": "warn",
"no-path-concat": "warn",
"no-plusplus": "off",
"no-process-env": "warn",
"no-process-exit": "warn",
"no-proto": "warn",
"no-prototype-builtins": "warn",
"no-redeclare": "warn",
"no-regex-spaces": "warn",
"no-restricted-globals": "warn",
"no-restricted-imports": "warn",
"no-restricted-modules": "warn",
"no-restricted-syntax": "warn",
"no-return-assign": "warn",
"no-script-url": "warn",
"no-self-assign": "warn",
"no-self-compare": "warn",
"no-sequences": "warn",
"no-shadow": "warn",
"no-shadow-restricted-names": "warn",
"no-whitespace-before-property": "warn",
"no-spaced-func": "warn",
"no-sparse-arrays": "warn",
"no-sync": "warn",
"no-tabs": "warn",
"no-ternary": "off",
"no-trailing-spaces": "warn",
"no-this-before-super": "warn",
"no-throw-literal": "warn",
"no-undef": "warn",
"no-undef-init": "warn",
"no-undefined": "off",
"no-unexpected-multiline": "warn",
"no-underscore-dangle": "off",
"no-unmodified-loop-condition": "warn",
"no-unneeded-ternary": "warn",
"no-unreachable": "warn",
"no-unsafe-finally": "warn",
"no-unused-expressions": "warn",
"no-unused-labels": "warn",
"no-unused-vars": "warn",
"no-use-before-define": "warn",
"no-useless-call": "warn",
"no-useless-computed-key": "warn",
"no-useless-concat": "warn",
"no-useless-constructor": "warn",
"no-useless-escape": "warn",
"no-useless-rename": "warn",
"no-void": "warn",
"no-var": "off",
"no-warning-comments": "off",
"no-with": "warn",
"array-bracket-spacing": "off",
"array-callback-return": "warn",
"arrow-body-style": "warn",
"arrow-parens": "warn",
"arrow-spacing": "off",
"accessor-pairs": "warn",
"block-scoped-var": "off",
"block-spacing": ["warn", "always"],
"brace-style": "warn",
"callback-return": "warn",
"camelcase": "off",
"capitalized-comments": ["warn", "always", {
"ignoreConsecutiveComments": true,
"ignoreInlineComments": true
}],
"comma-dangle": ["warn", "always-multiline"],
"comma-spacing": ["warn", {
"before": false,
"after": true
}],
"comma-style": "warn",
"complexity": [
"warn",
15
],
"computed-property-spacing": "off",
"consistent-return": "off",
"consistent-this": "off",
"constructor-super": "warn",
"curly": "warn",
"default-case": "off",
"dot-location": ["warn", "property"],
"dot-notation": "warn",
"eol-last": "warn",
"eqeqeq": "warn",
"func-names": "off",
"func-style": "off",
"generator-star-spacing": "off",
"global-require": "warn",
"guard-for-in": "off",
"handle-callback-err": "warn",
"id-blacklist": "warn",
"id-length": "off",
"id-match": "warn",
"indent": "warn",
"init-declarations": "warn",
"jsx-quotes": "warn",
"key-spacing": "off",
"keyword-spacing": "warn",
"linebreak-style": [
"warn",
"unix"
],
"lines-around-comment": "warn",
"max-depth": "warn",
"max-len": ["warn", {
"code": 88,
"ignorePattern": "odoo\\.define\\(",
"tabWidth": 4
}],
"max-lines": "off",
"max-nested-callbacks": "warn",
"max-params": "off",
"max-statements": "off",
"max-statements-per-line": "warn",
"multiline-ternary": "off",
"new-cap": "off",
"new-parens": "warn",
"newline-after-var": "off",
"newline-before-return": "off",
"newline-per-chained-call": "off",
"object-curly-newline": ["warn", { "consistent": true }],
"object-curly-spacing": ["warn", "never"],
"object-property-newline": ["warn", {
"allowAllPropertiesOnSameLine": true
}],
"object-shorthand": "off",
"one-var": "off",
"one-var-declaration-per-line": "off",
"operator-assignment": "warn",
"operator-linebreak": "warn",
"padded-blocks": "off",
"prefer-arrow-callback": "off",
"prefer-const": "warn",
"prefer-reflect": "off",
"prefer-rest-params": "off",
"prefer-spread": "off",
"prefer-template": "off",
"quote-props": "off",
"quotes": "off",
"radix": "warn",
"require-yield": "warn",
"rest-spread-spacing": "off",
"semi": [
"warn",
"always"
],
"semi-spacing": "warn",
"sort-imports": "warn",
"sort-vars": "off",
"space-before-blocks": "warn",
"space-before-function-paren": "warn",
"space-in-parens": "off",
"space-infix-ops": "off",
"space-unary-ops": "off",
"spaced-comment": ["warn", "always"],
"strict": ["warn", "function"],
"template-curly-spacing": "off",
"unicode-bom": "warn",
"use-isnan": "warn",
"valid-jsdoc": ["warn", {
"prefer": {
"arg": "param",
"argument": "param",
"augments": "extends",
"constructor": "class",
"exception": "throws",
"func": "function",
"method": "function",
"prop": "property",
"return": "returns",
"virtual": "abstract",
"yield": "yields"
},
"preferType": {
"array": "Array",
"bool": "Boolean",
"boolean": "Boolean",
"number": "Number",
"object": "Object",
"str": "String",
"string": "String"
},
"requireParamDescription": false,
"requireReturn": false,
"requireReturnDescription": false,
"requireReturnType": false
}],
"valid-typeof": "warn",
"vars-on-top": "off",
"wrap-iife": "warn",
"wrap-regex": "warn",
"yield-star-spacing": "off",
"yoda": "warn"
},
"parserOptions": {
"ecmaVersion": 2017
}
}

10
.flake8

@ -0,0 +1,10 @@
[flake8]
max-line-length = 79
max-complexity = 16
# B = bugbear
# B9 = bugbear opinionated (incl line length)
select = C,E,F,W,B,B9
# E203: whitespace before ':' (black behaviour)
# E501: flake8 line length (covered by bugbear B950)
# W503: line break before binary operator (black behaviour)
ignore = E203,E501,W503

27
.gitignore

@ -8,7 +8,6 @@ __pycache__/
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
@ -20,9 +19,11 @@ lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
@ -42,8 +43,9 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
*,cover
*.cover
.hypothesis/
.pytest_cache/
# Translations
*.mo
@ -52,6 +54,7 @@ coverage.xml
# Django stuff:
*.log
local_settings.py
db.sqlite3
# Flask stuff:
instance/
@ -66,7 +69,7 @@ docs/_build/
# PyBuilder
target/
# IPython Notebook
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
@ -75,15 +78,27 @@ target/
# celery beat schedule file
celerybeat-schedule
# dotenv
.env
# SageMath parsed files
*.sage.py
# virtualenv
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/

12
.isort.cfg

@ -0,0 +1,12 @@
[settings]
; see https://github.com/psf/black
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
combine_as_imports=True
use_parentheses=True
line_length=79
known_odoo=odoo
known_odoo_addons=odoo.addons
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
known_third_party=addons,cStringIO,openerp,requests,werkzeug,xlsxwriter

69
.pre-commit-config.yaml

@ -0,0 +1,69 @@
exclude: "^setup/|/static/lib/|/static/src/lib/"
default_language_version:
python: python3
repos:
- repo: https://github.com/psf/black
rev: 19.3b0
hooks:
- id: black
args: [-l 79]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: trailing-whitespace
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: end-of-file-fixer
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: debug-statements
- id: flake8
name: flake8 except __init__.py
exclude: /__init__\.py$
additional_dependencies: ["flake8-bugbear==19.8.0"]
- id: flake8
name: flake8 only __init__.py
args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py
files: /__init__\.py$
additional_dependencies: ["flake8-bugbear==19.8.0"]
- id: fix-encoding-pragma
args: ["--remove"]
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
# - id: check-xml
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.3.1
hooks:
- id: pylint
name: pylint with optional checks
args: ["--rcfile=.pylintrc", "--exit-zero"]
verbose: true
additional_dependencies: ["pylint-odoo==3.0.3"]
- id: pylint
name: pylint with mandatory checks
args: ["--rcfile=.pylintrc-mandatory"]
additional_dependencies: ["pylint-odoo==3.0.3"]
- repo: https://github.com/asottile/pyupgrade
rev: v1.24.0
hooks:
- id: pyupgrade
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.3
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
name: isort except __init__.py
exclude: /__init__\.py$
#- repo: https://github.com/pre-commit/mirrors-eslint
# rev: v6.5.1
# hooks:
# - id: eslint
# verbose: true

86
.pylintrc

@ -0,0 +1,86 @@
[MASTER]
load-plugins=pylint_odoo
score=n
[ODOOLINT]
readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
# manifest_required_authors=
manifest_required_keys=license
manifest_deprecated_keys=description,active
license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
valid_odoo_versions=12.0
[MESSAGES CONTROL]
disable=all
# This .pylintrc contains optional AND mandatory checks and is meant to be
# loaded in an IDE to have it check everything, in the hope this will make
# optional checks more visible to contributors who otherwise never look at a
# green travis to see optional checks that failed.
# .pylintrc-mandatory containing only mandatory checks is used the pre-commit
# config as a blocking check.
enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
manifest-required-key,
manifest-version-format,
method-compute,
method-inverse,
method-required-super,
method-search,
missing-import-error,
missing-manifest-dependency,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
# messages that do not cause the lint step to fail
consider-merging-classes-inherited,
create-user-wo-reset-password,
dangerous-filter-wo-user,
deprecated-module,
file-not-used,
invalid-commit,
missing-newline-extrafiles,
missing-readme,
no-utf8-coding-comment,
odoo-addons-relative-import,
old-api7-method-defined,
redefined-builtin,
too-complex,
unnecessary-utf8-coding-comment
[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
reports=no

64
.pylintrc-mandatory

@ -0,0 +1,64 @@
[MASTER]
load-plugins=pylint_odoo
score=n
[ODOOLINT]
readme_template_url="https://github.com/OCA/maintainer-tools/blob/master/template/module/README.rst"
# manifest_required_authors=
manifest_required_keys=license
manifest_deprecated_keys=description,active
license_allowed=AGPL-3,GPL-2,GPL-2 or any later version,GPL-3,GPL-3 or any later version,LGPL-3
valid_odoo_versions=12.0
[MESSAGES CONTROL]
disable=all
enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
manifest-required-key,
manifest-version-format,
method-compute,
method-inverse,
method-required-super,
method-search,
missing-import-error,
missing-manifest-dependency,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error
[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized
reports=no

34
.travis.yml

@ -0,0 +1,34 @@
language: python
sudo: false
cache: pip
python:
- "3.5"
addons:
postgresql: "9.6"
apt:
packages:
- expect-dev # provides unbuffer utility
env:
global:
- VERSION="12.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0"
matrix:
- LINT_CHECK="1"
- TESTS="1" ODOO_REPO="OCA/OCB"
- TESTS="1" ODOO_REPO="OCA/OCB" UNIT_TEST="1"
install:
- git clone --depth=1 https://github.com/coopiteasy/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly
- pip install unidecode
script:
- travis_run_tests
after_success:
- travis_after_tests_success

42
README.md

@ -1,2 +1,44 @@
# vertical-cooperative
This repository gather odoo modules for cooperatives
# MAKE TRAVIS GREEN AGAIN
pre-commit still issues these messages. They need to be fixed.
```
************* Module easy_my_coop.models.partner
easy_my_coop/models/partner.py:56: [E8103(sql-injection), ResPartner._invoice_total] SQL injection risk. Use parameters if you can. - More info https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#no-sql-injection
************* Module partner_age.models.partner
partner_age/models/partner.py:13: [E8103(sql-injection), ResPartner._search_age] SQL injection risk. Use parameters if you can. - More info https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#no-sql-injection
************* Module easy_my_coop_taxshelter_report.models.tax_shelter_declaration
easy_my_coop_taxshelter_report/models/tax_shelter_declaration.py:325: [E8102(invalid-commit), TaxShelterCertificate.send_certificates] Use of cr.commit() directly - More info https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#never-commit-the-transaction
************* Module easy_my_coop.models.account_invoice
easy_my_coop/models/account_invoice.py:11: [C8104(class-camelcase), account_invoice] Use `CamelCase` "AccountInvoice" in class name "account_invoice". You can use oca-autopep8 of https://github.com/OCA/maintainer-tools to auto fix it.
************* Module easy_my_coop.models.operation_request
easy_my_coop/models/operation_request.py:12: [C8104(class-camelcase), operation_request] Use `CamelCase` "OperationRequest" in class name "operation_request". You can use oca-autopep8 of https://github.com/OCA/maintainer-tools to auto fix it.
************* Module easy_my_coop.models.coop
easy_my_coop/models/coop.py:287: [C8108(method-compute), SubscriptionRequest] Name of compute method should start with "_compute_"
************* Module website_recaptcha_reloaded.models.res_config
website_recaptcha_reloaded/models/res_config.py:7: [C8104(class-camelcase), website_config_settings] Use `CamelCase` "WebsiteConfigSettings" in class name "website_config_settings". You can use oca-autopep8 of https://github.com/OCA/maintainer-tools to auto fix it.
************* Module easy_my_coop.models.company
easy_my_coop/models/company.py:61: [C8108(method-compute), ResCompany] Name of compute method should start with "_compute_"
pylint with mandatory checks.............................................Failed
- hook id: pylint
- exit code: 18
************* Module easy_my_coop.models.partner
easy_my_coop/models/partner.py:56: [E8103(sql-injection), ResPartner._invoice_total] SQL injection risk. Use parameters if you can. - More info https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#no-sql-injection
************* Module partner_age.models.partner
partner_age/models/partner.py:13: [E8103(sql-injection), ResPartner._search_age] SQL injection risk. Use parameters if you can. - More info https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#no-sql-injection
************* Module easy_my_coop.models.account_invoice
easy_my_coop/models/account_invoice.py:11: [C8104(class-camelcase), account_invoice] Use `CamelCase` "AccountInvoice" in class name "account_invoice". You can use oca-autopep8 of https://github.com/OCA/maintainer-tools to auto fix it.
************* Module easy_my_coop.models.operation_request
easy_my_coop/models/operation_request.py:12: [C8104(class-camelcase), operation_request] Use `CamelCase` "OperationRequest" in class name "operation_request". You can use oca-autopep8 of https://github.com/OCA/maintainer-tools to auto fix it.
************* Module easy_my_coop.models.coop
easy_my_coop/models/coop.py:287: [C8108(method-compute), SubscriptionRequest] Name of compute method should start with "_compute_"
************* Module website_recaptcha_reloaded.models.res_config
website_recaptcha_reloaded/models/res_config.py:7: [C8104(class-camelcase), website_config_settings] Use `CamelCase` "WebsiteConfigSettings" in class name "website_config_settings". You can use oca-autopep8 of https://github.com/OCA/maintainer-tools to auto fix it.
************* Module easy_my_coop.models.company
easy_my_coop/models/company.py:61: [C8108(method-compute), ResCompany] Name of compute method should start with "_compute_"
```

58
easy_my_coop/README.rst

@ -0,0 +1,58 @@
============
Easy My Coop
============
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-coopiteasy%2Fvertical--cooperative-lightgray.png?logo=github
:target: https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop
:alt: coopiteasy/vertical-cooperative
|badge1| |badge2| |badge3|
This module allows to manage the cooperator subscription and all the cooperative business processes.
**Table of contents**
.. contents::
:local:
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/coopiteasy/vertical-cooperative/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/coopiteasy/vertical-cooperative/issues/new?body=module:%20easy_my_coop%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Coop IT Easy SCRLfs
Contributors
~~~~~~~~~~~~
* Coop IT Easy SCRLfs
Maintainers
~~~~~~~~~~~
This module is part of the `coopiteasy/vertical-cooperative <https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop>`_ project on GitHub.
You are welcome to contribute.

6
easy_my_coop/__init__.py

@ -1,3 +1,3 @@
from . import models
from . import report
from . import wizard
from . import models
from . import report
from . import wizard

101
easy_my_coop/__manifest__.py

@ -4,59 +4,54 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
'name': 'Easy My Coop',
'version': '12.0.3.0.1',
'depends': [
'base',
'web',
'sale',
'account',
'base_iban',
'product',
'partner_firstname',
'partner_contact_birthdate',
'partner_contact_address',
'email_template_config',
"name": "Easy My Coop",
"summary": "Manage your cooperative shares",
"version": "12.0.3.0.1",
"depends": [
"base",
"web",
"sale",
"account",
"base_iban",
"product",
"partner_firstname",
"partner_contact_birthdate",
"partner_contact_address",
"email_template_config",
],
'author': 'Coop IT Easy SCRLfs',
'category': 'Cooperative management',
'website': 'https://www.coopiteasy.be',
'license': 'AGPL-3',
'description': """
This module allows to manage the cooperator subscription and all the
cooperative business processes.
""",
'data': [
'data/easy_my_coop_data.xml',
'data/paperformat.xml',
'security/res_groups.xml',
'security/ir.model.access.csv',
'wizard/create_subscription_from_partner.xml',
'wizard/update_partner_info.xml',
'wizard/validate_subscription_request.xml',
'wizard/update_share_line.xml',
'views/subscription_request_view.xml',
'views/email_template_view.xml',
'views/res_partner_view.xml',
'views/cooperator_register_view.xml',
'views/operation_request_view.xml',
'views/account_invoice_view.xml',
'views/product_view.xml',
'views/res_company_view.xml',
'views/account_journal_view.xml',
'views/menus.xml',
'report/easy_my_coop_report.xml',
'report/layout.xml',
'report/cooperator_invoice_G002.xml',
'report/cooperator_certificat_G001.xml',
'report/cooperator_subscription_G001.xml',
'report/cooperator_register_G001.xml',
'data/mail_template_data.xml', # Must be loaded after reports
"author": "Coop IT Easy SCRLfs",
"category": "Cooperative management",
"website": "https://www.coopiteasy.be",
"license": "AGPL-3",
"data": [
"data/easy_my_coop_data.xml",
"data/paperformat.xml",
"security/res_groups.xml",
"security/ir.model.access.csv",
"wizard/create_subscription_from_partner.xml",
"wizard/cooperative_history_wizard.xml", # todo remove?
"wizard/update_partner_info.xml",
"wizard/validate_subscription_request.xml",
"wizard/update_share_line.xml",
"views/subscription_request_view.xml",
"views/email_template_view.xml",
"views/res_partner_view.xml",
"views/cooperator_register_view.xml",
"views/operation_request_view.xml",
"views/account_invoice_view.xml",
"views/product_view.xml",
"views/res_company_view.xml",
"views/account_journal_view.xml",
"views/menus.xml",
"report/easy_my_coop_report.xml",
"report/layout.xml",
"report/cooperator_invoice_G002.xml",
"report/cooperator_certificat_G001.xml",
"report/cooperator_subscription_G001.xml",
"report/cooperator_register_G001.xml",
"data/mail_template_data.xml", # Must be loaded after reports
],
'demo': [
'demo/coop.xml',
'demo/users.xml',
],
'installable': True,
'application': True,
"demo": ["demo/coop.xml", "demo/users.xml"],
"installable": True,
"application": True,
}

87
easy_my_coop/data/easy_my_coop_data.xml

@ -1,43 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record model="ir.module.category" id="module_category_cooperator_management">
<field name="name">Cooperative Management</field>
<field name="description">Manage your cooperative.</field>
<field name="sequence">3</field>
</record>
<!-- Product -->
<record id="product_category_company_share" model="product.category">
<field name="name">Company Share</field>
</record>
<record id="sequence_subscription_journal" model="ir.sequence">
<field name="name">Account Default Subscription Journal</field>
<field eval="3" name="padding"/>
<field name="prefix">SUBJ/%(year)s/</field>
<field name="use_date_range">True</field>
</record>
<record id="subscription_journal" model="account.journal">
<field name="name">Subscription Journal</field>
<field name="code">SUBJ</field>
<field name="type">sale</field>
<field name="sequence_id" ref="sequence_subscription_journal"/>
</record>
<record id="sequence_subscription" model="ir.sequence">
<field name="name">Subscription Register</field>
<field name="code">subscription.register</field>
<field eval="1" name="number_next"/>
<field eval="1" name="number_increment"/>
</record>
<record id="sequence_register_operation" model="ir.sequence">
<field name="name">Register Operation</field>
<field name="code">register.operation</field>
<field eval="1" name="number_next"/>
<field eval="1" name="number_increment"/>
</record>
</data>
</openerp>
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record model="ir.module.category"
id="module_category_cooperator_management">
<field name="name">Cooperative Management</field>
<field name="description">Manage your cooperative.</field>
<field name="sequence">3</field>
</record>
<!-- Product -->
<record id="product_category_company_share" model="product.category">
<field name="name">Company Share</field>
</record>
<record id="sequence_subscription_journal" model="ir.sequence">
<field name="name">Account Default Subscription Journal</field>
<field eval="3" name="padding"/>
<field name="prefix">SUBJ/%(year)s/</field>
<field name="use_date_range">True</field>
</record>
<record id="subscription_journal" model="account.journal">
<field name="name">Subscription Journal</field>
<field name="code">SUBJ</field>
<field name="type">sale</field>
<field name="sequence_id" ref="sequence_subscription_journal"/>
</record>
<record id="sequence_subscription" model="ir.sequence">
<field name="name">Subscription Register</field>
<field name="code">subscription.register</field>
<field eval="1" name="number_next"/>
<field eval="1" name="number_increment"/>
</record>
<record id="sequence_register_operation" model="ir.sequence">
<field name="name">Register Operation</field>
<field name="code">register.operation</field>
<field eval="1" name="number_next"/>
<field eval="1" name="number_increment"/>
</record>
</data>
</openerp>

940
easy_my_coop/data/mail_template_data.xml

@ -1,443 +1,497 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Mail template are declared in a NOUPDATE block
so users can freely customize/delete them -->
<data noupdate="1">
<!--Request to release capital Email template -->
<record id="email_template_release_capital" model="mail.template">
<field name="name">Request to Release Capital - Send by Email</field>
<field name="email_from">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="subject">${object.company_id.name} Request to Release Capital (Ref ${object.number or 'n/a'})</field>
<field name="partner_to">${object.partner_id.id}</field>
<field name="reply_to">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="model_id" ref="account.model_account_invoice"/>
<field name="auto_delete" eval="True"/>
<field name="report_template" ref="action_cooperator_invoices"/>
<field name="report_name">${(object.number or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.partner_id.name},</p>
<p>You will find in attachment all the necessary information for the payment. We kindly remind you that your subscription will be effective only once we received the payment.</p>
<p>Do not forget to add the structured communication to the payment.</p>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_confirmation" model="mail.template">
<field name="name">Confirmation Email</field>
<field name="email_from">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="subject">Subscription request confirmation</field>
<field name="email_to">${object.email}</field>
<field name="reply_to">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="model_id" ref="model_subscription_request"/>
<field name="auto_delete" eval="True"/>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>Your request will be soon processed by our team. If all the provided info are correct you will soon receive the payment information in another email</p>
<br/>
<p>If you have any question, do not hesitate to contact us.</p>
<br/>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_waiting_list" model="mail.template">
<field name="name">Waiting List Email</field>
<field name="email_from">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="subject">Subscription request added on waiting list. </field>
<field name="email_to">${object.email}</field>
<field name="reply_to">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="model_id" ref="model_subscription_request"/>
<field name="auto_delete" eval="True"/>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>Thank you for your subscription request. There are currently no project to raise funds for, thus we added it on waiting list.
We will contact you as soon as the subscription requests are re-opened.
</p>
<br/>
<p>If you have any question, do not hesitate to contact us.</p>
<br/>
<p>Sustainably yours,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_confirmation_company" model="mail.template">
<field name="name">Company Confirmation Email</field>
<field name="email_from">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="subject">Subscription request confirmation</field>
<field name="email_to">${object.email},${object.company_email}</field>
<field name="reply_to">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="model_id" ref="model_subscription_request"/>
<field name="auto_delete" eval="True"/>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>We have received your subscription request for ${object.company_id.name}. Thank you for your support.</p>
<p>Your request will be soon processed by our team "gestion et participation des membres". If all the provided info are correct you will soon receive the payment information in another email</p>
<br/>
<p>If you have any question, do not hesitate to contact us.</p>
<br/>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_certificat" model="mail.template">
<field name="name">Payment Received Confirmation - Send By Email</field>
<field name="email_from">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="subject">Payment Received Confirmation</field>
<field name="partner_to">${object.id}</field>
<field name="reply_to">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="model_id" ref="model_res_partner"/>
<field name="auto_delete" eval="True"/>
<field name="report_template" ref="action_cooperator_report_certificat"/>
<field name="report_name">Certificat ${(object.cooperator_register_number or '')}</field>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>We confirm the reception of you payment. You are now shareholder of our cooperative</p>
<br/>
<p>Find in attachment your ${object.company_id.name} certificate.</p>
<p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
<br/>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_certificat_increase" model="mail.template">
<field name="name">Share Increase - Payment Received Confirmation - Send By Email</field>
<field name="email_from">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="subject">Payment Received Confirmation</field>
<field name="partner_to">${object.id}</field>
<field name="reply_to">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="model_id" ref="model_res_partner"/>
<field name="auto_delete" eval="True"/>
<field name="report_template" ref="action_cooperator_report_certificat"/>
<field name="report_name">Certificat ${(object.cooperator_register_number or '')}</field>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>We confirm the reception of you payment for the new share(s) you have taken.</p>
<br/>
<p>Find in attachment your ${object.company_id.name} certificate.</p>
<p>Thank you for trusting ${object.company_id.name or 'us'}!</p>
<br/>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_share_transfer" model="mail.template">
<field name="name">Share transfer - Send By Email</field>
<field name="email_from">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="subject">Share transfert</field>
<field name="partner_to">${object.id}</field>
<field name="reply_to">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="model_id" ref="model_res_partner"/>
<field name="auto_delete" eval="True"/>
<field name="report_template" ref="action_cooperator_report_certificat"/>
<field name="report_name">Certificat ${(object.cooperator_register_number or '')}</field>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>We confirm you that the shares have been transfered to you. If you was not already cooperator, you are now shareholder of our cooperative</p>
<br/>
<p>Find in attachment your ${object.company_id.name} certificate.</p>
<p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
<br/>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_share_update" model="mail.template">
<field name="name">Share update - Send By Email</field>
<field name="email_from">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="subject">Share update</field>
<field name="partner_to">${object.id}</field>
<field name="reply_to">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</field>
<field name="model_id" ref="model_res_partner"/>
<field name="auto_delete" eval="True"/>
<field name="report_template" ref="action_cooperator_report_certificat"/>
<field name="report_name">Certificat ${(object.cooperator_register_number or '')}</field>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>We confirm you that the adaptation on shares portfolio has been succesfully performed. Your cooperator certificate has been adapted accordingly</p>
<br/>
<p>Find in attachment your ${object.company_id.name} certificate.</p>
<p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
<br/>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
</data>
</odoo>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Mail template are declared in a NOUPDATE block
so users can freely customize/delete them -->
<data noupdate="1">
<!--Request to release capital Email template -->
<record id="email_template_release_capital" model="mail.template">
<field name="name">Request to Release Capital - Send by Email
</field>
<field name="email_from">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="subject">${object.company_id.name} Request to Release
Capital (Ref ${object.number or 'n/a'})
</field>
<field name="partner_to">${object.partner_id.id}</field>
<field name="reply_to">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="model_id" ref="account.model_account_invoice"/>
<field name="auto_delete" eval="True"/>
<field name="report_template" ref="action_cooperator_invoices"/>
<field name="report_name">
${(object.number or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}
</field>
<field name="lang">${object.partner_id.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.partner_id.name},</p>
<p>You will find in attachment all the necessary information for the payment. We kindly remind you that your subscription will be effective only once we received the payment.</p>
<p>Do not forget to add the structured communication to the payment.</p>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_confirmation" model="mail.template">
<field name="name">Confirmation Email</field>
<field name="email_from">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="subject">Subscription request confirmation</field>
<field name="email_to">${object.email}</field>
<field name="reply_to">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="model_id" ref="model_subscription_request"/>
<field name="auto_delete" eval="True"/>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>Your request will be soon processed by our team. If all the provided info are correct you will soon receive the payment information in another email</p>
<br/>
<p>If you have any question, do not hesitate to contact us.</p>
<br/>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_waiting_list" model="mail.template">
<field name="name">Waiting List Email</field>
<field name="email_from">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="subject">Subscription request added on waiting list.
</field>
<field name="email_to">${object.email}</field>
<field name="reply_to">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="model_id" ref="model_subscription_request"/>
<field name="auto_delete" eval="True"/>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>Thank you for your subscription request. There are currently no project to raise funds for, thus we added it on waiting list.
We will contact you as soon as the subscription requests are re-opened.
</p>
<br/>
<p>If you have any question, do not hesitate to contact us.</p>
<br/>
<p>Sustainably yours,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_confirmation_company" model="mail.template">
<field name="name">Company Confirmation Email</field>
<field name="email_from">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="subject">Subscription request confirmation</field>
<field name="email_to">${object.email},${object.company_email}
</field>
<field name="reply_to">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="model_id" ref="model_subscription_request"/>
<field name="auto_delete" eval="True"/>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>We have received your subscription request for ${object.company_id.name}. Thank you for your support.</p>
<p>Your request will be soon processed by our team "gestion et participation des membres". If all the provided info are correct you will soon receive the payment information in another email</p>
<br/>
<p>If you have any question, do not hesitate to contact us.</p>
<br/>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_certificat" model="mail.template">
<field name="name">Payment Received Confirmation - Send By Email
</field>
<field name="email_from">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="subject">Payment Received Confirmation</field>
<field name="partner_to">${object.id}</field>
<field name="reply_to">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="model_id" ref="model_res_partner"/>
<field name="auto_delete" eval="True"/>
<field name="report_template"
ref="action_cooperator_report_certificat"/>
<field name="report_name">Certificat
${(object.cooperator_register_number or '')}
</field>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>We confirm the reception of you payment. You are now shareholder of our cooperative</p>
<br/>
<p>Find in attachment your ${object.company_id.name} certificate.</p>
<p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
<br/>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_certificat_increase" model="mail.template">
<field name="name">Share Increase - Payment Received Confirmation -
Send By Email
</field>
<field name="email_from">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="subject">Payment Received Confirmation</field>
<field name="partner_to">${object.id}</field>
<field name="reply_to">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="model_id" ref="model_res_partner"/>
<field name="auto_delete" eval="True"/>
<field name="report_template"
ref="action_cooperator_report_certificat"/>
<field name="report_name">Certificat
${(object.cooperator_register_number or '')}
</field>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>We confirm the reception of you payment for the new share(s) you have taken.</p>
<br/>
<p>Find in attachment your ${object.company_id.name} certificate.</p>
<p>Thank you for trusting ${object.company_id.name or 'us'}!</p>
<br/>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_share_transfer" model="mail.template">
<field name="name">Share transfer - Send By Email</field>
<field name="email_from">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="subject">Share transfert</field>
<field name="partner_to">${object.id}</field>
<field name="reply_to">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="model_id" ref="model_res_partner"/>
<field name="auto_delete" eval="True"/>
<field name="report_template"
ref="action_cooperator_report_certificat"/>
<field name="report_name">Certificat
${(object.cooperator_register_number or '')}
</field>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>We confirm you that the shares have been transfered to you. If you was not already cooperator, you are now shareholder of our cooperative</p>
<br/>
<p>Find in attachment your ${object.company_id.name} certificate.</p>
<p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
<br/>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
<record id="email_template_share_update" model="mail.template">
<field name="name">Share update - Send By Email</field>
<field name="email_from">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="subject">Share update</field>
<field name="partner_to">${object.id}</field>
<field name="reply_to">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="model_id" ref="model_res_partner"/>
<field name="auto_delete" eval="True"/>
<field name="report_template"
ref="action_cooperator_report_certificat"/>
<field name="report_name">Certificat
${(object.cooperator_register_number or '')}
</field>
<field name="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #FFF; ">
<p>Hello ${object.name},</p>
<p>We confirm you that the adaptation on shares portfolio has been succesfully performed. Your cooperator certificate has been adapted accordingly</p>
<br/>
<p>Find in attachment your ${object.company_id.name} certificate.</p>
<p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
<br/>
<p>Sustainably your,</p>
<p>${object.company_id.name}.</p>
% if object.company_id.street:
${object.company_id.street}
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
${object.company_id.zip} ${object.company_id.city}<br/>
% endif
% if object.company_id.country_id:
${object.company_id.state_id and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
% if object.company_id.phone:
Phone:&nbsp; ${object.company_id.phone}
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<div>
<img src=${object.company_id.logo_url}>
</div>
</div>
]]></field>
</record>
</data>
</odoo>

4
easy_my_coop/data/paperformat.xml

@ -3,7 +3,7 @@
<record id="paperformat_emc_larger_logo" model="report.paperformat">
<field name="name">A4 easy my coop larger logo</field>
<field name="default" eval="True" />
<field name="default" eval="True"/>
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
@ -12,7 +12,7 @@
<field name="margin_bottom">20</field>
<field name="margin_left">7</field>
<field name="margin_right">7</field>
<field name="header_line" eval="False" />
<field name="header_line" eval="False"/>
<field name="header_spacing">45</field>
<field name="dpi">90</field>
</record>

34
easy_my_coop/demo/coop.xml

@ -18,9 +18,9 @@
</record>
<record id="bank_account_virginie_demo" model="res.partner.bank">
<field name="acc_number">FR7611808009101234567890147</field>
<field name="bank_name">Bank</field>
<field name="partner_id" ref="res_partner_cooperator_1_demo"/>
<field name="acc_number">FR7611808009101234567890147</field>
<field name="bank_name">Bank</field>
<field name="partner_id" ref="res_partner_cooperator_1_demo"/>
</record>
<record id="res_partner_cooperator_2_demo" model="res.partner">
@ -53,9 +53,9 @@
</record>
<record id="bank_account_vincent_demo" model="res.partner.bank">
<field name="acc_number">BE71096123456769</field>
<field name="bank_name">Bank</field>
<field name="partner_id" ref="res_partner_cooperator_3_demo"/>
<field name="acc_number">BE71096123456769</field>
<field name="bank_name">Bank</field>
<field name="partner_id" ref="res_partner_cooperator_3_demo"/>
</record>
<record id="res_partner_cooperator_4_demo" model="res.partner">
@ -68,8 +68,8 @@
<field name="zip">5101</field>
<field name="country_id" ref="base.be"/>
</record>
<record id="easy_my_coop.account_cooperator_demo" model="account.account">
<record id="account_cooperator_demo" model="account.account">
<field name="code">416101</field>
<field name="name">Cooperators</field>
<field name="user_type_id" ref="account.data_account_type_receivable"/>
@ -77,7 +77,8 @@
</record>
<record id="base.main_company" model="res.company">
<field name="property_cooperator_account" ref="easy_my_coop.account_cooperator_demo"/>
<field name="property_cooperator_account"
ref="account_cooperator_demo"/>
</record>
<record id="product_template_share_type_1_demo" model="product.template">
@ -116,24 +117,29 @@
<field name="date" eval="datetime.now() - timedelta(days=12)"/>
<field name="source">manual</field>
<field name="ordered_parts">3</field>
<field name="share_product_id" model="product.template" eval="obj(ref('product_template_share_type_2_demo')).product_variant_id.id"/>
<field name="share_product_id" model="product.template"
eval="obj(ref('product_template_share_type_2_demo')).product_variant_id.id"/>
<field name="lang">en_US</field>
<field name="skip_control_ng" eval="True"/>
</record>
<record id="share_line_1_demo" model="share.line">
<field name="share_product_id" model="product.template" eval="obj(ref('product_template_share_type_1_demo')).product_variant_id.id"/>
<field name="share_product_id" model="product.template"
eval="obj(ref('product_template_share_type_1_demo')).product_variant_id.id"/>
<field name="share_number">2</field>
<field name="share_unit_price">50</field>
<field name="partner_id" ref="res_partner_cooperator_1_demo"/>
<field name="effective_date" eval="datetime.now() - timedelta(days=120)"/>
<field name="effective_date"
eval="datetime.now() - timedelta(days=120)"/>
</record>
<record id="share_line_2_demo" model="share.line">
<field name="share_product_id" model="product.template" eval="obj(ref('product_template_share_type_1_demo')).product_variant_id.id"/>
<field name="share_product_id" model="product.template"
eval="obj(ref('product_template_share_type_1_demo')).product_variant_id.id"/>
<field name="share_number">4</field>
<field name="share_unit_price">50</field>
<field name="partner_id" ref="res_partner_cooperator_2_demo"/>
<field name="effective_date" eval="datetime.now() - timedelta(days=120)"/>
<field name="effective_date"
eval="datetime.now() - timedelta(days=120)"/>
</record>
</odoo>

6
easy_my_coop/demo/users.xml

@ -20,7 +20,8 @@
<field name="partner_id" ref="res_partner_user_emc_demo"/>
<field name="login">user-emc</field>
<field name="password">demo</field>
<field name="groups_id" eval="[(4, ref('easy_my_coop.group_easy_my_coop_user'))]"/>
<field name="groups_id"
eval="[(4, ref('easy_my_coop.group_easy_my_coop_user'))]"/>
</record>
<record id="res_partner_manager_emc_demo" model="res.partner">
@ -38,7 +39,8 @@
<field name="partner_id" ref="res_partner_manager_emc_demo"/>
<field name="login">manager-emc</field>
<field name="password">demo</field>
<field name="groups_id" eval="[(4, ref('easy_my_coop.group_easy_my_coop_manager'))]"/>
<field name="groups_id"
eval="[(4, ref('easy_my_coop.group_easy_my_coop_manager'))]"/>
</record>
</odoo>

59
easy_my_coop/migrations/8.0.1.0/pre-migration.py

@ -1,30 +1,29 @@
# -*- coding: utf-8 -*-
from openerp.openupgrade import openupgrade
import logging
logger = logging.getLogger('OpenUpgrade')
column_renames = {
'job_sync_line': [
('adresse', 'address'),
('ville', 'city'),
('codepostal', 'zip'),
('sync_date','date'),
],
}
tables_renames = [
('job_sync_line','subscription_request'),
('job_sync',None),
('external_db',None),
]
@openupgrade.migrate()
def migrate(cr, version):
if not version:
return
openupgrade.rename_columns(cr, column_renames)
openupgrade.rename_tables(cr, tables_renames)
import logging
from openerp.openupgrade import openupgrade
logger = logging.getLogger("OpenUpgrade")
column_renames = {
"job_sync_line": [
("adresse", "address"),
("ville", "city"),
("codepostal", "zip"),
("sync_date", "date"),
]
}
tables_renames = [
("job_sync_line", "subscription_request"),
("job_sync", None),
("external_db", None),
]
@openupgrade.migrate()
def migrate(cr, version):
if not version:
return
openupgrade.rename_columns(cr, column_renames)
openupgrade.rename_tables(cr, tables_renames)

372
easy_my_coop/models/account_invoice.py

@ -1,175 +1,197 @@
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import datetime
from odoo import api, fields, models
class account_invoice(models.Model):
_inherit = 'account.invoice'
subscription_request = fields.Many2one('subscription.request',
string='Subscription request')
release_capital_request = fields.Boolean(
string='Release of capital request')
@api.model
def _prepare_refund(self, invoice, date_invoice=None, date=None,
description=None, journal_id=None):
values = super(account_invoice, self)._prepare_refund(
invoice, date_invoice, date,
description, journal_id)
values['release_capital_request'] = self.release_capital_request
return values
def create_user(self, partner):
user_obj = self.env['res.users']
email = partner.email
user = user_obj.search([('login', '=', email)])
if not user:
user = user_obj.search([('login', '=', email),
('active', '=', False)])
if user:
user.sudo().write({'active': True})
else:
user_values = {'partner_id': partner.id, 'login': email}
user = user_obj.sudo()._signup_create_user(user_values)
user.sudo().with_context({'create_user': True}).action_reset_password()
return user
def get_mail_template_certificate(self):
if self.partner_id.member:
mail_template = 'easy_my_coop.email_template_certificat_increase'
else:
mail_template = 'easy_my_coop.email_template_certificat'
return self.env.ref(mail_template)
def get_sequence_register(self):
return self.env.ref('easy_my_coop.sequence_subscription', False)
def get_sequence_operation(self):
return self.env.ref('easy_my_coop.sequence_register_operation', False)
def get_share_line_vals(self, line, effective_date):
return {
'share_number': line.quantity,
'share_product_id': line.product_id.id,
'partner_id': self.partner_id.id,
'share_unit_price': line.price_unit,
'effective_date': effective_date
}
def get_subscription_register_vals(self, line, effective_date):
return {
'partner_id': self.partner_id.id,
'quantity': line.quantity,
'share_product_id': line.product_id.id,
'share_unit_price': line.price_unit,
'date': effective_date,
'type': 'subscription'
}
def get_membership_vals(self):
# flag the partner as an effective member
# if not yet cooperator we generate a cooperator number
vals = {}
if self.partner_id.member is False \
and self.partner_id.old_member is False:
sequence_id = self.get_sequence_register()
sub_reg_num = sequence_id.next_by_id()
vals = {'member': True, 'old_member': False,
'cooperator_register_number': int(sub_reg_num)
}
elif self.partner_id.old_member:
vals = {'member': True, 'old_member': False}
return vals
def set_membership(self):
vals = self.get_membership_vals()
self.partner_id.write(vals)
return True
def send_certificate_email(self, certificate_email_template, sub_reg_line):
# we send the email with the certificate in attachment
certificate_email_template.sudo().send_mail(self.partner_id.id, False)
def set_cooperator_effective(self, effective_date):
sub_register_obj = self.env['subscription.register']
share_line_obj = self.env['share.line']
certificate_email_template = self.get_mail_template_certificate()
self.set_membership()
sequence_operation = self.get_sequence_operation()
sub_reg_operation = sequence_operation.next_by_id()
for line in self.invoice_line_ids:
sub_reg_vals = self.get_subscription_register_vals(line,
effective_date)
sub_reg_vals['name'] = sub_reg_operation
sub_reg_vals['register_number_operation'] = int(sub_reg_operation)
sub_reg_line = sub_register_obj.create(sub_reg_vals)
share_line_vals = self.get_share_line_vals(line, effective_date)
share_line_obj.create(share_line_vals)
if line.product_id.mail_template:
certificate_email_template = line.product_id.mail_template
self.send_certificate_email(certificate_email_template, sub_reg_line)
if self.company_id.create_user:
self.create_user(self.partner_id)
return True
def post_process_confirm_paid(self, effective_date):
self.set_cooperator_effective(effective_date)
return True
def get_refund_domain(self, invoice):
return [
('type', '=', 'out_refund'),
('origin', '=', invoice.move_name)
]
@api.multi
def action_invoice_paid(self):
super(account_invoice, self).action_invoice_paid()
for invoice in self:
# we check if there is an open refund for this invoice. in this
# case we don't run the process_subscription function as the
# invoice has been reconciled with a refund and not a payment.
domain = self.get_refund_domain(invoice)
refund = self.search(domain)
if invoice.partner_id.cooperator \
and invoice.release_capital_request \
and invoice.type == 'out_invoice' and not refund:
# take the effective date from the payment.
# by default the confirmation date is the payment date
effective_date = datetime.now().strftime("%d/%m/%Y")
if invoice.payment_move_line_ids:
move_line = invoice.payment_move_line_ids[0]
effective_date = move_line.date
invoice.subscription_request.state = 'paid'
invoice.post_process_confirm_paid(effective_date)
# if there is a open refund we mark the subscription as cancelled
elif invoice.partner_id.cooperator \
and invoice.release_capital_request \
and invoice.type == 'out_invoice' and refund:
invoice.subscription_request.state = 'cancelled'
return True
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import datetime
from odoo import api, fields, models
class AccountInvoice(models.Model):
_inherit = "account.invoice"
subscription_request = fields.Many2one(
"subscription.request", string="Subscription request"
)
release_capital_request = fields.Boolean(
string="Release of capital request"
)
@api.model
def _prepare_refund(
self,
invoice,
date_invoice=None,
date=None,
description=None,
journal_id=None,
):
values = super(AccountInvoice, self)._prepare_refund(
invoice, date_invoice, date, description, journal_id
)
values["release_capital_request"] = self.release_capital_request
return values
def create_user(self, partner):
user_obj = self.env["res.users"]
email = partner.email
user = user_obj.search([("login", "=", email)])
if not user:
user = user_obj.search(
[("login", "=", email), ("active", "=", False)]
)
if user:
user.sudo().write({"active": True})
else:
user_values = {"partner_id": partner.id, "login": email}
user = user_obj.sudo()._signup_create_user(user_values)
user.sudo().with_context(
{"create_user": True}
).action_reset_password()
return user
def get_mail_template_certificate(self):
if self.partner_id.member:
mail_template = "easy_my_coop.email_template_certificat_increase"
else:
mail_template = "easy_my_coop.email_template_certificat"
return self.env.ref(mail_template)
def get_sequence_register(self):
return self.env.ref("easy_my_coop.sequence_subscription", False)
def get_sequence_operation(self):
return self.env.ref("easy_my_coop.sequence_register_operation", False)
def get_share_line_vals(self, line, effective_date):
return {
"share_number": line.quantity,
"share_product_id": line.product_id.id,
"partner_id": self.partner_id.id,
"share_unit_price": line.price_unit,
"effective_date": effective_date,
}
def get_subscription_register_vals(self, line, effective_date):
return {
"partner_id": self.partner_id.id,
"quantity": line.quantity,
"share_product_id": line.product_id.id,
"share_unit_price": line.price_unit,
"date": effective_date,
"type": "subscription",
}
def get_membership_vals(self):
# flag the partner as an effective member
# if not yet cooperator we generate a cooperator number
vals = {}
if (
self.partner_id.member is False
and self.partner_id.old_member is False
):
sequence_id = self.get_sequence_register()
sub_reg_num = sequence_id.next_by_id()
vals = {
"member": True,
"old_member": False,
"cooperator_register_number": int(sub_reg_num),
}
elif self.partner_id.old_member:
vals = {"member": True, "old_member": False}
return vals
def set_membership(self):
vals = self.get_membership_vals()
self.partner_id.write(vals)
return True
def send_certificate_email(self, certificate_email_template, sub_reg_line):
# we send the email with the certificate in attachment
certificate_email_template.sudo().send_mail(self.partner_id.id, False)
def set_cooperator_effective(self, effective_date):
sub_register_obj = self.env["subscription.register"]
share_line_obj = self.env["share.line"]
certificate_email_template = self.get_mail_template_certificate()
self.set_membership()
sequence_operation = self.get_sequence_operation()
sub_reg_operation = sequence_operation.next_by_id()
for line in self.invoice_line_ids:
sub_reg_vals = self.get_subscription_register_vals(
line, effective_date
)
sub_reg_vals["name"] = sub_reg_operation
sub_reg_vals["register_number_operation"] = int(sub_reg_operation)
sub_reg_line = sub_register_obj.create(sub_reg_vals)
share_line_vals = self.get_share_line_vals(line, effective_date)
share_line_obj.create(share_line_vals)
if line.product_id.mail_template:
certificate_email_template = line.product_id.mail_template
self.send_certificate_email(certificate_email_template, sub_reg_line)
if self.company_id.create_user:
self.create_user(self.partner_id)
return True
def post_process_confirm_paid(self, effective_date):
self.set_cooperator_effective(effective_date)
return True
def get_refund_domain(self, invoice):
return [
("type", "=", "out_refund"),
("origin", "=", invoice.move_name),
]
@api.multi
def action_invoice_paid(self):
super(AccountInvoice, self).action_invoice_paid()
for invoice in self:
# we check if there is an open refund for this invoice. in this
# case we don't run the process_subscription function as the
# invoice has been reconciled with a refund and not a payment.
domain = self.get_refund_domain(invoice)
refund = self.search(domain)
if (
invoice.partner_id.cooperator
and invoice.release_capital_request
and invoice.type == "out_invoice"
and not refund
):
# take the effective date from the payment.
# by default the confirmation date is the payment date
effective_date = datetime.now().strftime("%d/%m/%Y")
if invoice.payment_move_line_ids:
move_line = invoice.payment_move_line_ids[0]
effective_date = move_line.date
invoice.subscription_request.state = "paid"
invoice.post_process_confirm_paid(effective_date)
# if there is a open refund we mark the subscription as cancelled
elif (
invoice.partner_id.cooperator
and invoice.release_capital_request
and invoice.type == "out_invoice"
and refund
):
invoice.subscription_request.state = "cancelled"
return True

27
easy_my_coop/models/account_journal.py

@ -1,14 +1,13 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class AccountJournal(models.Model):
_inherit = "account.journal"
get_cooperator_payment = fields.Boolean('Get cooperator payments?')
get_general_payment = fields.Boolean(string='Get general payments?')
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
class AccountJournal(models.Model):
_inherit = "account.journal"
get_cooperator_payment = fields.Boolean("Get cooperator payments?")
get_general_payment = fields.Boolean(string="Get general payments?")

176
easy_my_coop/models/company.py

@ -1,83 +1,93 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class ResCompany(models.Model):
_inherit = 'res.company'
def _get_base_logo(self):
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
self.logo_url = base_url + "/logo.png"
coop_email_contact = fields.Char(string="Contact email address for the"
" cooperator")
subscription_maximum_amount = fields.Float(string="Maximum authorised"
" subscription amount")
default_country_id = fields.Many2one('res.country',
string="Default country",
default=lambda self: self.country_id)
default_lang_id = fields.Many2one('res.lang',
string="Default lang")
allow_id_card_upload = fields.Boolean(string="Allow ID Card upload")
create_user = fields.Boolean(string="Create user for cooperator",
default=False)
board_representative = fields.Char(string="Board representative name")
signature_scan = fields.Binary(string="Board representative signature")
property_cooperator_account = fields.Many2one('account.account',
company_dependent=True,
string="Cooperator Account",
domain=[('internal_type', '=', 'receivable'),
('deprecated', '=', False)],
help="This account will be"
" the default one as the"
" receivable account for the"
" cooperators",
required=True)
unmix_share_type = fields.Boolean(string="Unmix share type",
default=True,
help="If checked, A cooperator will be"
" authorised to have only one type"
" of share")
display_logo1 = fields.Boolean(string="Display logo 1")
display_logo2 = fields.Boolean(string="Display logo 2")
bottom_logo1 = fields.Binary(string="Bottom logo 1")
bottom_logo2 = fields.Binary(string="Bottom logo 2")
logo_url = fields.Char(string="logo url",
compute="_get_base_logo")
display_data_policy_approval = fields.Boolean(
help="Choose to display a data policy checkbox on the cooperator"
" website form."
)
data_policy_approval_required = fields.Boolean(
string="Is data policy approval required?"
)
data_policy_approval_text = fields.Html(
translate=True,
help="Text to display aside the checkbox to approve data policy."
)
display_internal_rules_approval = fields.Boolean(
help="Choose to display an internal rules checkbox on the"
" cooperator website form."
)
internal_rules_approval_required = fields.Boolean(
string="Is internal rules approval required?"
)
internal_rules_approval_text = fields.Html(
translate=True,
help="Text to display aside the checkbox to approve internal rules."
)
@api.onchange('data_policy_approval_required')
def onchange_data_policy_approval_required(self):
if self.data_policy_approval_required:
self.display_data_policy_approval = True
@api.onchange('internal_rules_approval_required')
def onchange_internal_rules_approval_required(self):
if self.internal_rules_approval_required:
self.display_internal_rules_approval = True
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class ResCompany(models.Model):
_inherit = "res.company"
def _compute_base_logo(self):
base_url = (
self.env["ir.config_parameter"].sudo().get_param("web.base.url")
)
self.logo_url = base_url + "/logo.png"
coop_email_contact = fields.Char(
string="Contact email address for the" " cooperator"
)
subscription_maximum_amount = fields.Float(
string="Maximum authorised" " subscription amount"
)
default_country_id = fields.Many2one(
"res.country",
string="Default country",
default=lambda self: self.country_id,
)
default_lang_id = fields.Many2one("res.lang", string="Default lang")
allow_id_card_upload = fields.Boolean(string="Allow ID Card upload")
create_user = fields.Boolean(
string="Create user for cooperator", default=False
)
board_representative = fields.Char(string="Board representative name")
signature_scan = fields.Binary(string="Board representative signature")
property_cooperator_account = fields.Many2one(
"account.account",
company_dependent=True,
string="Cooperator Account",
domain=[
("internal_type", "=", "receivable"),
("deprecated", "=", False),
],
help="This account will be"
" the default one as the"
" receivable account for the"
" cooperators",
required=True,
)
unmix_share_type = fields.Boolean(
string="Unmix share type",
default=True,
help="If checked, A cooperator will be"
" authorised to have only one type"
" of share",
)
display_logo1 = fields.Boolean(string="Display logo 1")
display_logo2 = fields.Boolean(string="Display logo 2")
bottom_logo1 = fields.Binary(string="Bottom logo 1")
bottom_logo2 = fields.Binary(string="Bottom logo 2")
logo_url = fields.Char(string="logo url", compute="_compute_base_logo")
display_data_policy_approval = fields.Boolean(
help="Choose to display a data policy checkbox on the cooperator"
" website form."
)
data_policy_approval_required = fields.Boolean(
string="Is data policy approval required?"
)
data_policy_approval_text = fields.Html(
translate=True,
help="Text to display aside the checkbox to approve data policy.",
)
display_internal_rules_approval = fields.Boolean(
help="Choose to display an internal rules checkbox on the"
" cooperator website form."
)
internal_rules_approval_required = fields.Boolean(
string="Is internal rules approval required?"
)
internal_rules_approval_text = fields.Html(
translate=True,
help="Text to display aside the checkbox to approve internal rules.",
)
@api.onchange("data_policy_approval_required")
def onchange_data_policy_approval_required(self):
if self.data_policy_approval_required:
self.display_data_policy_approval = True
@api.onchange("internal_rules_approval_required")
def onchange_internal_rules_approval_required(self):
if self.internal_rules_approval_required:
self.display_internal_rules_approval = True

1714
easy_my_coop/models/coop.py
File diff suppressed because it is too large
View File

2
easy_my_coop/models/mail_template.py

@ -1,4 +1,4 @@
from odoo import models, fields
from odoo import fields, models
class MailTemplate(models.Model):

771
easy_my_coop/models/operation_request.py

@ -1,335 +1,436 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import datetime
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class operation_request(models.Model):
_name = 'operation.request'
_description = "Operation request"
def get_date_now(self):
# fixme odoo 12 uses date types
return datetime.strftime(datetime.now(), '%Y-%m-%d')
@api.multi
@api.depends('share_product_id', 'share_product_id.list_price', 'quantity')
def _compute_subscription_amount(self):
for operation_request in self:
operation_request.subscription_amount = (operation_request.
share_product_id.
list_price *
operation_request.
quantity)
request_date = fields.Date(string='Request date',
default=lambda self: self.get_date_now())
partner_id = fields.Many2one('res.partner',
string='Cooperator',
domain=[('member', '=', True)],
required=True)
partner_id_to = fields.Many2one('res.partner',
string='Transfered to',
domain=[('cooperator', '=', True)])
operation_type = fields.Selection([('subscription', 'Subscription'),
('transfer', 'Transfer'),
('sell_back', 'Sell Back'),
('convert', 'Conversion')],
string='Operation Type',
required=True)
share_product_id = fields.Many2one('product.product',
string='Share type',
domain=[('is_share', '=', True)],
required=True)
share_to_product_id = fields.Many2one('product.product',
string='Convert to this share type',
domain=[('is_share', '=', True)])
share_short_name = fields.Char(related='share_product_id.short_name',
string='Share type name')
share_to_short_name = fields.Char(related='share_to_product_id.short_name',
string='Share to type name')
share_unit_price = fields.Float(related='share_product_id.list_price',
string='Share price')
share_to_unit_price = fields.Float(related='share_to_product_id.list_price',
string='Share to price')
subscription_amount = fields.Float(compute='_compute_subscription_amount',
string='Operation amount')
quantity = fields.Integer(string='Number of share',
required=True)
state = fields.Selection([('draft', 'Draft'),
('waiting', 'Waiting'),
('approved', 'Approved'),
('done', 'Done'),
('cancelled', 'Cancelled'),
('refused', 'Refused')],
string='State',
required=True,
default='draft')
user_id = fields.Many2one('res.users',
string='Responsible',
readonly=True,
default=lambda self: self.env.user)
subscription_request = fields.One2many('subscription.request',
'operation_request_id',
string="Share Receiver Info",
help="In case on a transfer of"
" share. If the share receiver"
" isn't a effective member then a"
" subscription form should"
" be filled.")
receiver_not_member = fields.Boolean(string='Receiver is not a member')
company_id = fields.Many2one('res.company',
string='Company',
required=True,
change_default=True,
readonly=True,
default=lambda self: self.env['res.company']._company_default_get())
invoice = fields.Many2one('account.invoice',
string="Invoice")
@api.multi
def approve_operation(self):
for rec in self:
rec.write({'state': 'approved'})
@api.multi
def refuse_operation(self):
for rec in self:
rec.write({'state': 'refused'})
@api.multi
def submit_operation(self):
for rec in self:
rec.validate()
rec.write({'state': 'waiting'})
@api.multi
def cancel_operation(self):
for rec in self:
rec.write({'state': 'cancelled'})
@api.multi
def reset_to_draft(self):
for rec in self:
rec.write({'state': 'draft'})
def get_total_share_dic(self, partner):
total_share_dic = {}
share_products = self.env['product.product'].search([('is_share', '=', True)])
for share_product in share_products:
total_share_dic[share_product.id] = 0
for line in partner.share_ids:
total_share_dic[line.share_product_id.id] += line.share_number
return total_share_dic
# This function doesn't handle the case of a cooperator can own
# different kinds of share type
def hand_share_over(self, partner, share_product_id, quantity):
if not partner.member:
raise ValidationError(_("This operation can't be executed if the"
" cooperator is not an effective member"))
share_ind = len(partner.share_ids)
i = 1
while quantity > 0:
line = self.partner_id.share_ids[share_ind-i]
if line.share_product_id.id == share_product_id.id:
if quantity > line.share_number:
quantity -= line.share_number
line.unlink()
else:
share_left = line.share_number - quantity
quantity = 0
line.write({'share_number': share_left})
i += 1
# if the cooperator sold all his shares he's no more
# an effective member
remaning_share_dict = 0
for share_quant in self.get_total_share_dic(partner).values():
remaning_share_dict += share_quant
if remaning_share_dict == 0:
self.partner_id.write({'member': False, 'old_member': True})
def has_share_type(self):
for line in self.partner_id.share_ids:
if line.share_product_id.id == self.share_product_id.id:
return True
return False
def validate(self):
if not self.has_share_type() and \
self.operation_type in ['sell_back', 'transfer']:
raise ValidationError(_("The cooperator doesn't own this share"
" type. Please choose the appropriate"
" share type."))
if self.operation_type in ['sell_back', 'convert', 'transfer']:
total_share_dic = self.get_total_share_dic(self.partner_id)
if self.quantity > total_share_dic[self.share_product_id.id]:
raise ValidationError(_("The cooperator can't hand over more"
" shares that he/she owns."))
if self.operation_type == 'convert':
if self.company_id.unmix_share_type:
if self.share_product_id.code == self.share_to_product_id.code:
raise ValidationError(_("You can't convert the share to"
" the same share type."))
if self.subscription_amount != self.partner_id.total_value:
raise ValidationError(_("You must convert all the shares"
" to the selected type."))
else:
if self.subscription_amount != self.partner_id.total_value:
raise ValidationError(_("Converting just part of the"
" shares is not yet implemented"))
elif self.operation_type == 'transfer':
if not self.receiver_not_member and self.company_id.unmix_share_type \
and (self.partner_id_to.cooperator_type
and self.partner_id.cooperator_type != self.partner_id_to.cooperator_type):
raise ValidationError(_("This share type could not be"
" transfered to " +
self.partner_id_to.name))
if self.partner_id_to.is_company \
and not self.share_product_id.by_company:
raise ValidationError(_("This share can not be"
" subscribed by a company"))
if not self.partner_id_to.is_company \
and not self.share_product_id.by_individual:
raise ValidationError(_("This share can not be"
" subscribed an individual"))
if self.receiver_not_member and self.subscription_request \
and not self.subscription_request.validated:
raise ValidationError(_("The information of the receiver"
" are not correct. Please correct"
" the information before"
" submitting"))
def get_share_trans_mail_template(self):
return self.env.ref('easy_my_coop.email_template_share_transfer',
False)
def get_share_update_mail_template(self):
return self.env.ref('easy_my_coop.email_template_share_update',
False)
def send_share_trans_mail(self, sub_register_line): # Unused argument is used in synergie project. Do not remove.
cert_email_template = self.get_share_trans_mail_template()
cert_email_template.send_mail(self.partner_id_to.id, False)
def send_share_update_mail(self, sub_register_line): # Unused argument is used in synergie project. Do not remove.
cert_email_template = self.get_share_update_mail_template()
cert_email_template.send_mail(self.partner_id.id, False)
def get_subscription_register_vals(self, effective_date):
return {
'partner_id': self.partner_id.id, 'quantity': self.quantity,
'share_product_id': self.share_product_id.id,
'type': self.operation_type,
'share_unit_price': self.share_unit_price,
'date': effective_date,
}
@api.multi
def execute_operation(self):
self.ensure_one()
effective_date = self.get_date_now()
sub_request = self.env['subscription.request']
self.validate()
if self.state != 'approved':
raise ValidationError(_("This operation must be approved"
" before to be executed"))
values = self.get_subscription_register_vals(effective_date)
if self.operation_type == 'sell_back':
self.hand_share_over(self.partner_id, self.share_product_id,
self.quantity)
elif self.operation_type == 'convert':
amount_to_convert = self.share_unit_price * self.quantity
convert_quant = int(amount_to_convert / self.share_to_product_id.list_price)
remainder = amount_to_convert % self.share_to_product_id.list_price
if convert_quant > 0 and remainder == 0:
share_ids = self.partner_id.share_ids
line = share_ids[0]
if len(share_ids) > 1:
share_ids[1:len(share_ids)].unlink()
line.write({
'share_number': convert_quant,
'share_product_id': self.share_to_product_id.id,
'share_unit_price': self.share_to_unit_price,
'share_short_name': self.share_to_short_name
})
values['share_to_product_id'] = self.share_to_product_id.id
values['quantity_to'] = convert_quant
else:
raise ValidationError(_("Converting just part of the"
" shares is not yet implemented"))
elif self.operation_type == 'transfer':
sequence_id = self.env.ref('easy_my_coop.sequence_subscription', False)
partner_vals = {'member': True}
if self.receiver_not_member:
partner = self.subscription_request.create_coop_partner()
# get cooperator number
sub_reg_num = int(sequence_id.next_by_id())
partner_vals.update(sub_request.get_eater_vals(
partner,
self.share_product_id))
partner_vals['cooperator_register_number'] = sub_reg_num
partner.write(partner_vals)
self.partner_id_to = partner
else:
# means an old member or cooperator candidate
if not self.partner_id_to.member:
if self.partner_id_to.cooperator_register_number == 0:
sub_reg_num = int(sequence_id.next_by_id())
partner_vals['cooperator_register_number'] = sub_reg_num
partner_vals.update(sub_request.get_eater_vals(
self.partner_id_to,
self.share_product_id))
partner_vals['old_member'] = False
self.partner_id_to.write(partner_vals)
# remove the parts to the giver
self.hand_share_over(self.partner_id,
self.share_product_id,
self.quantity)
# give the share to the receiver
self.env['share.line'].create({
'share_number': self.quantity,
'partner_id': self.partner_id_to.id,
'share_product_id': self.share_product_id.id,
'share_unit_price': self.share_unit_price,
'effective_date': effective_date})
values['partner_id_to'] = self.partner_id_to.id
else:
raise ValidationError(_("This operation is not yet"
" implemented."))
sequence_operation = self.env.ref('easy_my_coop.sequence_register_operation', False) #noqa
sub_reg_operation = sequence_operation.next_by_id()
values['name'] = sub_reg_operation
values['register_number_operation'] = int(sub_reg_operation)
self.write({'state': 'done'})
sub_register_line = self.env['subscription.register'].create(values)
# send mail to the receiver
if self.operation_type == 'transfer':
self.send_share_trans_mail(sub_register_line)
self.send_share_update_mail(sub_register_line)
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import datetime
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class OperationRequest(models.Model):
_name = "operation.request"
_description = "Operation request"
def get_date_now(self):
# fixme odoo 12 uses date types
return datetime.strftime(datetime.now(), "%Y-%m-%d")
@api.multi
@api.depends("share_product_id", "share_product_id.list_price", "quantity")
def _compute_subscription_amount(self):
for operation_request in self:
operation_request.subscription_amount = (
operation_request.share_product_id.list_price
* operation_request.quantity
)
request_date = fields.Date(
string="Request date", default=lambda self: self.get_date_now()
)
partner_id = fields.Many2one(
"res.partner",
string="Cooperator",
domain=[("member", "=", True)],
required=True,
)
partner_id_to = fields.Many2one(
"res.partner",
string="Transfered to",
domain=[("cooperator", "=", True)],
)
operation_type = fields.Selection(
[
("subscription", "Subscription"),
("transfer", "Transfer"),
("sell_back", "Sell Back"),
("convert", "Conversion"),
],
string="Operation Type",
required=True,
)
share_product_id = fields.Many2one(
"product.product",
string="Share type",
domain=[("is_share", "=", True)],
required=True,
)
share_to_product_id = fields.Many2one(
"product.product",
string="Convert to this share type",
domain=[("is_share", "=", True)],
)
share_short_name = fields.Char(
related="share_product_id.short_name", string="Share type name"
)
share_to_short_name = fields.Char(
related="share_to_product_id.short_name", string="Share to type name"
)
share_unit_price = fields.Float(
related="share_product_id.list_price", string="Share price"
)
share_to_unit_price = fields.Float(
related="share_to_product_id.list_price", string="Share to price"
)
subscription_amount = fields.Float(
compute="_compute_subscription_amount", string="Operation amount"
)
quantity = fields.Integer(string="Number of share", required=True)
state = fields.Selection(
[
("draft", "Draft"),
("waiting", "Waiting"),
("approved", "Approved"),
("done", "Done"),
("cancelled", "Cancelled"),
("refused", "Refused"),
],
string="State",
required=True,
default="draft",
)
user_id = fields.Many2one(
"res.users",
string="Responsible",
readonly=True,
default=lambda self: self.env.user,
)
subscription_request = fields.One2many(
"subscription.request",
"operation_request_id",
string="Share Receiver Info",
help="In case on a transfer of"
" share. If the share receiver"
" isn't a effective member then a"
" subscription form should"
" be filled.",
)
receiver_not_member = fields.Boolean(string="Receiver is not a member")
company_id = fields.Many2one(
"res.company",
string="Company",
required=True,
change_default=True,
readonly=True,
default=lambda self: self.env["res.company"]._company_default_get(),
)
invoice = fields.Many2one("account.invoice", string="Invoice")
@api.multi
def approve_operation(self):
for rec in self:
rec.write({"state": "approved"})
@api.multi
def refuse_operation(self):
for rec in self:
rec.write({"state": "refused"})
@api.multi
def submit_operation(self):
for rec in self:
rec.validate()
rec.write({"state": "waiting"})
@api.multi
def cancel_operation(self):
for rec in self:
rec.write({"state": "cancelled"})
@api.multi
def reset_to_draft(self):
for rec in self:
rec.write({"state": "draft"})
def get_total_share_dic(self, partner):
total_share_dic = {}
share_products = self.env["product.product"].search(
[("is_share", "=", True)]
)
for share_product in share_products:
total_share_dic[share_product.id] = 0
for line in partner.share_ids:
total_share_dic[line.share_product_id.id] += line.share_number
return total_share_dic
# This function doesn't handle the case of a cooperator can own
# different kinds of share type
def hand_share_over(self, partner, share_product_id, quantity):
if not partner.member:
raise ValidationError(
_(
"This operation can't be executed if the"
" cooperator is not an effective member"
)
)
share_ind = len(partner.share_ids)
i = 1
while quantity > 0:
line = self.partner_id.share_ids[share_ind - i]
if line.share_product_id.id == share_product_id.id:
if quantity > line.share_number:
quantity -= line.share_number
line.unlink()
else:
share_left = line.share_number - quantity
quantity = 0
line.write({"share_number": share_left})
i += 1
# if the cooperator sold all his shares he's no more
# an effective member
remaning_share_dict = 0
for share_quant in self.get_total_share_dic(partner).values():
remaning_share_dict += share_quant
if remaning_share_dict == 0:
self.partner_id.write({"member": False, "old_member": True})
def has_share_type(self):
for line in self.partner_id.share_ids:
if line.share_product_id.id == self.share_product_id.id:
return True
return False
def validate(self):
if not self.has_share_type() and self.operation_type in [
"sell_back",
"transfer",
]:
raise ValidationError(
_(
"The cooperator doesn't own this share"
" type. Please choose the appropriate"
" share type."
)
)
if self.operation_type in ["sell_back", "convert", "transfer"]:
total_share_dic = self.get_total_share_dic(self.partner_id)
if self.quantity > total_share_dic[self.share_product_id.id]:
raise ValidationError(
_(
"The cooperator can't hand over more"
" shares that he/she owns."
)
)
if self.operation_type == "convert":
if self.company_id.unmix_share_type:
if self.share_product_id.code == self.share_to_product_id.code:
raise ValidationError(
_(
"You can't convert the share to"
" the same share type."
)
)
if self.subscription_amount != self.partner_id.total_value:
raise ValidationError(
_(
"You must convert all the shares"
" to the selected type."
)
)
else:
if self.subscription_amount != self.partner_id.total_value:
raise ValidationError(
_(
"Converting just part of the"
" shares is not yet implemented"
)
)
elif self.operation_type == "transfer":
if (
not self.receiver_not_member
and self.company_id.unmix_share_type
and (
self.partner_id_to.cooperator_type
and self.partner_id.cooperator_type
!= self.partner_id_to.cooperator_type
)
):
raise ValidationError(
_(
"This share type could not be"
" transfered to " + self.partner_id_to.name
)
)
if (
self.partner_id_to.is_company
and not self.share_product_id.by_company
):
raise ValidationError(
_("This share can not be" " subscribed by a company")
)
if (
not self.partner_id_to.is_company
and not self.share_product_id.by_individual
):
raise ValidationError(
_("This share can not be" " subscribed an individual")
)
if (
self.receiver_not_member
and self.subscription_request
and not self.subscription_request.validated
):
raise ValidationError(
_(
"The information of the receiver"
" are not correct. Please correct"
" the information before"
" submitting"
)
)
def get_share_trans_mail_template(self):
return self.env.ref(
"easy_my_coop.email_template_share_transfer", False
)
def get_share_update_mail_template(self):
return self.env.ref("easy_my_coop.email_template_share_update", False)
def send_share_trans_mail(
self, sub_register_line
): # Unused argument is used in synergie project. Do not remove.
cert_email_template = self.get_share_trans_mail_template()
cert_email_template.send_mail(self.partner_id_to.id, False)
def send_share_update_mail(
self, sub_register_line
): # Unused argument is used in synergie project. Do not remove.
cert_email_template = self.get_share_update_mail_template()
cert_email_template.send_mail(self.partner_id.id, False)
def get_subscription_register_vals(self, effective_date):
return {
"partner_id": self.partner_id.id,
"quantity": self.quantity,
"share_product_id": self.share_product_id.id,
"type": self.operation_type,
"share_unit_price": self.share_unit_price,
"date": effective_date,
}
@api.multi
def execute_operation(self):
self.ensure_one()
effective_date = self.get_date_now()
sub_request = self.env["subscription.request"]
self.validate()
if self.state != "approved":
raise ValidationError(
_("This operation must be approved" " before to be executed")
)
values = self.get_subscription_register_vals(effective_date)
if self.operation_type == "sell_back":
self.hand_share_over(
self.partner_id, self.share_product_id, self.quantity
)
elif self.operation_type == "convert":
amount_to_convert = self.share_unit_price * self.quantity
convert_quant = int(
amount_to_convert / self.share_to_product_id.list_price
)
remainder = amount_to_convert % self.share_to_product_id.list_price
if convert_quant > 0 and remainder == 0:
share_ids = self.partner_id.share_ids
line = share_ids[0]
if len(share_ids) > 1:
share_ids[1 : len(share_ids)].unlink()
line.write(
{
"share_number": convert_quant,
"share_product_id": self.share_to_product_id.id,
"share_unit_price": self.share_to_unit_price,
"share_short_name": self.share_to_short_name,
}
)
values["share_to_product_id"] = self.share_to_product_id.id
values["quantity_to"] = convert_quant
else:
raise ValidationError(
_(
"Converting just part of the"
" shares is not yet implemented"
)
)
elif self.operation_type == "transfer":
sequence_id = self.env.ref(
"easy_my_coop.sequence_subscription", False
)
partner_vals = {"member": True}
if self.receiver_not_member:
partner = self.subscription_request.create_coop_partner()
# get cooperator number
sub_reg_num = int(sequence_id.next_by_id())
partner_vals.update(
sub_request.get_eater_vals(partner, self.share_product_id)
)
partner_vals["cooperator_register_number"] = sub_reg_num
partner.write(partner_vals)
self.partner_id_to = partner
else:
# means an old member or cooperator candidate
if not self.partner_id_to.member:
if self.partner_id_to.cooperator_register_number == 0:
sub_reg_num = int(sequence_id.next_by_id())
partner_vals[
"cooperator_register_number"
] = sub_reg_num
partner_vals.update(
sub_request.get_eater_vals(
self.partner_id_to, self.share_product_id
)
)
partner_vals["old_member"] = False
self.partner_id_to.write(partner_vals)
# remove the parts to the giver
self.hand_share_over(
self.partner_id, self.share_product_id, self.quantity
)
# give the share to the receiver
self.env["share.line"].create(
{
"share_number": self.quantity,
"partner_id": self.partner_id_to.id,
"share_product_id": self.share_product_id.id,
"share_unit_price": self.share_unit_price,
"effective_date": effective_date,
}
)
values["partner_id_to"] = self.partner_id_to.id
else:
raise ValidationError(
_("This operation is not yet" " implemented.")
)
sequence_operation = self.env.ref(
"easy_my_coop.sequence_register_operation", False
) # noqa
sub_reg_operation = sequence_operation.next_by_id()
values["name"] = sub_reg_operation
values["register_number_operation"] = int(sub_reg_operation)
self.write({"state": "done"})
sub_register_line = self.env["subscription.register"].create(values)
# send mail to the receiver
if self.operation_type == "transfer":
self.send_share_trans_mail(sub_register_line)
self.send_share_update_mail(sub_register_line)

202
easy_my_coop/models/partner.py

@ -7,7 +7,7 @@ from odoo import api, fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
_inherit = "res.partner"
@api.multi
def _get_report_base_filename(self):
@ -15,11 +15,11 @@ class ResPartner(models.Model):
if self.member:
return "Cooperator Certificate - %s" % self.name
else:
return 'unknown'
return "unknown"
@api.multi
def _invoice_total(self):
account_invoice_report = self.env['account.invoice.report']
account_invoice_report = self.env["account.invoice.report"]
if not self.ids:
self.total_invoiced = 0.0
return True
@ -28,7 +28,9 @@ class ResPartner(models.Model):
all_partner_ids = []
for partner in self:
# price_total is in the company currency
all_partners_and_children[partner] = self.search([('id', 'child_of', partner.id)]).ids
all_partners_and_children[partner] = self.search(
[("id", "child_of", partner.id)]
).ids
all_partner_ids += all_partners_and_children[partner]
# searching account.invoice.report via the orm is comparatively
@ -38,30 +40,46 @@ class ResPartner(models.Model):
# the user's company access directly these elements
# generate where clause to include multicompany rules
where_query = account_invoice_report._where_calc([
('partner_id', 'in', all_partner_ids),
('state', 'not in', ['draft', 'cancel']),
('company_id', '=', self.env.user.company_id.id),
('type', 'in', ('out_invoice', 'out_refund')),
('release_capital_request', '=', False),
])
account_invoice_report._apply_ir_rules(where_query, 'read')
where_query = account_invoice_report._where_calc(
[
("partner_id", "in", all_partner_ids),
("state", "not in", ["draft", "cancel"]),
("company_id", "=", self.env.user.company_id.id),
("type", "in", ("out_invoice", "out_refund")),
("release_capital_request", "=", False),
]
)
account_invoice_report._apply_ir_rules(where_query, "read")
from_clause, where_clause, where_clause_params = where_query.get_sql()
# price_total is in the company currency
query = """
SELECT SUM(price_total) as total, partner_id
FROM account_invoice_report account_invoice_report
WHERE %s
GROUP BY partner_id
""" % where_clause
# fixme while you're here, please fix the query
# to pass pylint sql-injection
# Note de Houssine: note que c'est la
# surcharge d'une fonction standard de la facturation Odoo. Elle
# date de la 9 voir si la v12 a été adaptée où est équivalente à la 12
# price_total is in the company currency pylint:
# pylint: disable=sql-injection
query = (
"""
SELECT SUM(price_total) as total, partner_id
FROM account_invoice_report account_invoice_report
WHERE %s
GROUP BY partner_id
"""
% where_clause
)
self.env.cr.execute(query, where_clause_params)
price_totals = self.env.cr.dictfetchall()
for partner, child_ids in all_partners_and_children.items():
partner.total_invoiced = sum(price['total'] for price in price_totals if price['partner_id'] in child_ids)
partner.total_invoiced = sum(
price["total"]
for price in price_totals
if price["partner_id"] in child_ids
)
@api.multi
@api.depends('share_ids')
@api.depends("share_ids")
def _compute_effective_date(self):
# TODO change it to compute it from the share register
for partner in self:
@ -70,22 +88,20 @@ class ResPartner(models.Model):
@api.multi
def _get_share_type(self):
shares = (
self.env['product.product']
.search([('is_share', '=', True)])
)
share_types = [
(share.default_code, share.short_name) for share in shares
]
return [('', '')] + share_types
shares = self.env["product.product"].search([("is_share", "=", True)])
share_types = [(s.default_code, s.short_name) for s in shares]
return [("", "")] + share_types
@api.multi
@api.depends('share_ids', 'share_ids.share_product_id',
'share_ids.share_product_id.default_code',
'share_ids.share_number')
@api.depends(
"share_ids",
"share_ids.share_product_id",
"share_ids.share_product_id.default_code",
"share_ids.share_number",
)
def _compute_cooperator_type(self):
for partner in self:
share_type = ''
share_type = ""
for line in partner.share_ids:
if line.share_number > 0:
share_type = line.share_product_id.default_code
@ -93,7 +109,7 @@ class ResPartner(models.Model):
partner.cooperator_type = share_type
@api.multi
@api.depends('share_ids')
@api.depends("share_ids")
def _compute_share_info(self):
for partner in self:
number_of_share = 0
@ -104,62 +120,75 @@ class ResPartner(models.Model):
partner.number_of_share = number_of_share
partner.total_value = total_value
cooperator = fields.Boolean(string='Cooperator',
help="Check this box if this contact is a"
" cooperator (effective or not).")
member = fields.Boolean(string='Effective cooperator',
help="Check this box if this cooperator"
" is an effective member.")
coop_candidate = fields.Boolean(string="Cooperator candidate",
compute="_compute_coop_candidate",
store=True,
readonly=True)
old_member = fields.Boolean(string='Old cooperator',
help="Check this box if this cooperator is"
" no more an effective member.")
cooperator = fields.Boolean(
string="Cooperator",
help="Check this box if this contact is a"
" cooperator (effective or not).",
)
member = fields.Boolean(
string="Effective cooperator",
help="Check this box if this cooperator" " is an effective member.",
)
coop_candidate = fields.Boolean(
string="Cooperator candidate",
compute="_compute_coop_candidate",
store=True,
readonly=True,
)
old_member = fields.Boolean(
string="Old cooperator",
help="Check this box if this cooperator is"
" no more an effective member.",
)
# todo use oca partner_contact_gender
gender = fields.Selection([('male', 'Male'),
('female', 'Female'),
('other', 'Other')],
string='Gender')
share_ids = fields.One2many('share.line',
'partner_id',
string='Share Lines')
cooperator_register_number = fields.Integer(string='Cooperator Number')
number_of_share = fields.Integer(compute="_compute_share_info",
multi='share',
string='Number of share',
readonly=True)
total_value = fields.Float(compute="_compute_share_info",
multi='share',
string='Total value of shares',
readonly=True)
company_register_number = fields.Char(string='Company Register Number')
cooperator_type = fields.Selection(selection='_get_share_type',
compute=_compute_cooperator_type,
string='Cooperator Type',
store=True)
effective_date = fields.Date(sting="Effective Date",
compute=_compute_effective_date,
store=True)
gender = fields.Selection(
[("male", "Male"), ("female", "Female"), ("other", "Other")],
string="Gender",
)
share_ids = fields.One2many(
"share.line", "partner_id", string="Share Lines"
)
cooperator_register_number = fields.Integer(string="Cooperator Number")
number_of_share = fields.Integer(
compute="_compute_share_info",
multi="share",
string="Number of share",
readonly=True,
)
total_value = fields.Float(
compute="_compute_share_info",
multi="share",
string="Total value of shares",
readonly=True,
)
company_register_number = fields.Char(string="Company Register Number")
cooperator_type = fields.Selection(
selection="_get_share_type",
compute=_compute_cooperator_type,
string="Cooperator Type",
store=True,
)
effective_date = fields.Date(
sting="Effective Date", compute=_compute_effective_date, store=True
)
representative = fields.Boolean(string="Legal Representative")
subscription_request_ids = fields.One2many('subscription.request',
'partner_id',
string="Subscription request")
legal_form = fields.Selection([('', '')],
string="Legal form")
subscription_request_ids = fields.One2many(
"subscription.request", "partner_id", string="Subscription request"
)
legal_form = fields.Selection([("", "")], string="Legal form")
data_policy_approved = fields.Boolean(string="Approved Data Policy")
internal_rules_approved = fields.Boolean(string="Approved Internal Rules")
@api.multi
@api.depends('subscription_request_ids.state')
@api.depends("subscription_request_ids.state")
def _compute_coop_candidate(self):
for partner in self:
if partner.member:
is_candidate = False
else:
sub_requests = partner.subscription_request_ids.filtered(
lambda record: record.state == 'done')
lambda record: record.state == "done"
)
is_candidate = bool(sub_requests)
partner.coop_candidate = is_candidate
@ -167,19 +196,24 @@ class ResPartner(models.Model):
@api.multi
def has_representative(self):
self.ensure_one()
if self.child_ids.filtered('representative'):
if self.child_ids.filtered("representative"):
return True
return False
@api.multi
def get_representative(self):
self.ensure_one()
return self.child_ids.filtered('representative')
return self.child_ids.filtered("representative")
def get_cooperator_from_email(self, email):
return self.env['res.partner'].search([('cooperator', '=', True),
('email', '=', email)])
return self.env["res.partner"].search(
[("cooperator", "=", True), ("email", "=", email)]
)
def get_cooperator_from_crn(self, company_register_number):
return self.env['res.partner'].search([('cooperator', '=', True),
('company_register_number', '=', company_register_number)])
return self.env["res.partner"].search(
[
("cooperator", "=", True),
("company_register_number", "=", company_register_number),
]
)

78
easy_my_coop/models/product.py

@ -1,37 +1,41 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
is_share = fields.Boolean(string="Is share?")
short_name = fields.Char(string="Short name")
display_on_website = fields.Boolean(string="Display on website")
default_share_product = fields.Boolean(string="Default share product")
minimum_quantity = fields.Integer(string="Minimum quantity", default=1)
force_min_qty = fields.Boolean(String="Force minimum quantity?")
by_company = fields.Boolean(string="Can be subscribed by companies?")
by_individual = fields.Boolean(string="Can be subscribed by individuals?")
customer = fields.Boolean(string="Become customer")
mail_template = fields.Many2one('mail.template',
string="Mail template")
@api.multi
def get_web_share_products(self, is_company):
if is_company is True:
product_templates = self.env['product.template'].search([
('is_share', '=', True),
('display_on_website', '=', True),
('by_company', '=', True)])
else:
product_templates = self.env['product.template'].search([
('is_share', '=', True),
('display_on_website', '=', True),
('by_individual', '=', True)])
return product_templates
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class ProductTemplate(models.Model):
_inherit = "product.template"
is_share = fields.Boolean(string="Is share?")
short_name = fields.Char(string="Short name")
display_on_website = fields.Boolean(string="Display on website")
default_share_product = fields.Boolean(string="Default share product")
minimum_quantity = fields.Integer(string="Minimum quantity", default=1)
force_min_qty = fields.Boolean(String="Force minimum quantity?")
by_company = fields.Boolean(string="Can be subscribed by companies?")
by_individual = fields.Boolean(string="Can be subscribed by individuals?")
customer = fields.Boolean(string="Become customer")
mail_template = fields.Many2one("mail.template", string="Mail template")
@api.multi
def get_web_share_products(self, is_company):
if is_company is True:
product_templates = self.env["product.template"].search(
[
("is_share", "=", True),
("display_on_website", "=", True),
("by_company", "=", True),
]
)
else:
product_templates = self.env["product.template"].search(
[
("is_share", "=", True),
("display_on_website", "=", True),
("by_individual", "=", True),
]
)
return product_templates

29
easy_my_coop/models/res_partner_bank.py

@ -1,15 +1,14 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models
class ResPartnerBank(models.Model):
_inherit = 'res.partner.bank'
_sql_constraints = [
('unique_number', 'Check(1=1)', 'Account Number must be unique!'),
]
# Copyright 2019 Coop IT Easy SCRL fs
# Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models
class ResPartnerBank(models.Model):
_inherit = "res.partner.bank"
_sql_constraints = [
("unique_number", "Check(1=1)", "Account Number must be unique!")
]

1
easy_my_coop/readme/CONTRIBUTORS.rst

@ -0,0 +1 @@
* Coop IT Easy SCRLfs

1
easy_my_coop/readme/DESCRIPTION.rst

@ -0,0 +1 @@
This module allows to manage the cooperator subscription and all the cooperative business processes.

32
easy_my_coop/report/account_invoice_report.py

@ -1,13 +1,19 @@
from odoo import fields, models
class AccountInvoiceReport(models.Model):
_inherit = "account.invoice.report"
release_capital_request = fields.Boolean(string="Release capital request")
def _select(self):
return super(AccountInvoiceReport, self)._select() + ", sub.release_capital_request as release_capital_request"
def _sub_select(self):
return super(AccountInvoiceReport, self)._sub_select() + ", ai.release_capital_request as release_capital_request"
from odoo import fields, models
class AccountInvoiceReport(models.Model):
_inherit = "account.invoice.report"
release_capital_request = fields.Boolean(string="Release capital request")
def _select(self):
return (
super(AccountInvoiceReport, self)._select()
+ ", sub.release_capital_request as release_capital_request"
)
def _sub_select(self):
return (
super(AccountInvoiceReport, self)._sub_select()
+ ", ai.release_capital_request as release_capital_request"
)

35
easy_my_coop/report/cooperator_certificat_G001.xml

@ -5,7 +5,8 @@
<t t-call="web.external_layout">
<t t-set="address">
<address t-field="o.commercial_partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<address t-field="o.commercial_partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/>
</t>
<div class="page mt32">
<h2>
@ -13,9 +14,9 @@
</h2>
<p name="certificate_generation_date" class="mt16">
<span> Certificate generated on </span>
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%d/%m/%Y')"/>
</p>
<span>Certificate generated on</span>
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%d/%m/%Y')"/>
</p>
<p name="label_coop_number" class="mt16">
<span t-field="o.name"/>
@ -24,7 +25,8 @@
</p>
<table class="table table-sm o_main_table mt16" name="invoice_line_table">
<table class="table table-sm o_main_table mt16"
name="invoice_line_table">
<thead>
<tr>
<t t-set="colspan" t-value="5"/>
@ -51,11 +53,11 @@
<td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"
name="share_unit_price">
<span t-field="line.share_unit_price"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
<td class="text-right" name="total_amount_line">
<span t-field="line.total_amount_line"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
</tr>
</t>
@ -67,14 +69,16 @@
<div t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto">
<table class="table table-sm">
<tr class="border-black o_total">
<td><strong>Total</strong></td>
<td>
<strong>Total</strong>
</td>
<td class="text-right">
<span t-field="o.number_of_share"/>
<span> share(s) </span>
<span>share(s)</span>
</td>
<td class="text-right">
<span t-field="o.total_value"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
</tr>
</table>
@ -85,7 +89,7 @@
<div class="row mt32">
<div name="board_commitee" class="col-sm-6">
<p>
For the board of <span t-field="o.company_id.name"/>.
For the board of<span t-field="o.company_id.name"/>.
</p>
<p>
<strong>
@ -93,9 +97,9 @@
</strong>
</p>
<img t-if="o.company_id.signature_scan"
t-attf-class="mt16 w-50"
t-attf-style="{{ 'min-width: 100px; max-width: 250px' if report_type == 'pdf' else '' }}"
t-att-src="'data:image/png;base64,%s' % o.company_id.signature_scan.decode()"/>
t-attf-class="mt16 w-50"
t-attf-style="{{ 'min-width: 100px; max-width: 250px' if report_type == 'pdf' else '' }}"
t-att-src="'data:image/png;base64,%s' % o.company_id.signature_scan.decode()"/>
</div>
</div>
@ -107,7 +111,8 @@
<template id="cooperator_certificat_G001">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="easy_my_coop.cooperator_certificat_G001_document" t-lang="o.lang"/>
<t t-call="easy_my_coop.cooperator_certificat_G001_document"
t-lang="o.lang"/>
</t>
</t>
</template>

136
easy_my_coop/report/cooperator_invoice_G002.xml

@ -5,39 +5,56 @@
<t t-call="web.external_layout">
<t t-set="address">
<address t-field="o.partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<div t-if="o.partner_id.vat" class="mt16"><t t-esc="o.company_id.country_id.vat_label or 'Tax ID'"/>: <span t-field="o.partner_id.vat"/></div>
<address t-field="o.partner_id"
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'/>
<div t-if="o.partner_id.vat" class="mt16"><t
t-esc="o.company_id.country_id.vat_label or 'Tax ID'"/>:
<span t-field="o.partner_id.vat"/>
</div>
</t>
<div class="page mt32">
<h2>
<span t-if="o.release_capital_request">Request to Release Capital</span>
<span t-if="o.release_capital_request">Request to Release
Capital
</span>
<span t-else="">
<span t-if="o.type == 'out_invoice' and o.state in ('open', 'in_payment', 'paid')">Invoice</span>
<span t-if="o.type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span>
<span t-if="o.type == 'out_invoice' and o.state == 'cancel'">Cancelled Invoice</span>
<span t-if="o.type == 'out_invoice' and o.state in ('open', 'in_payment', 'paid')">
Invoice
</span>
<span t-if="o.type == 'out_invoice' and o.state == 'draft'">
Draft Invoice
</span>
<span t-if="o.type == 'out_invoice' and o.state == 'cancel'">
Cancelled Invoice
</span>
<span t-if="o.type == 'out_refund'">Credit Note</span>
<span t-if="o.type == 'in_refund'">Vendor Credit Note</span>
<span t-if="o.type == 'in_refund'">Vendor Credit Note
</span>
<span t-if="o.type == 'in_invoice'">Vendor Bill</span>
</span>
<span t-field="o.number"/>
</h2>
<div id="informations" class="row mt32 mb32">
<div class="col-auto mw-100 mb-2" t-if="o.name" name="description">
<div class="col-auto mw-100 mb-2" t-if="o.name"
name="description">
<strong>Description:</strong>
<p class="m-0" t-field="o.name"/>
</div>
<div class="col-auto mw-100 mb-2" t-if="o.date_invoice" name="invoice_date">
<div class="col-auto mw-100 mb-2" t-if="o.date_invoice"
name="invoice_date">
<strong>Request Date:</strong>
<p class="m-0" t-field="o.date_invoice"/>
</div>
<div name="reference" class="col-auto mw-100 mb-2" t-if="o.reference">
<div name="reference" class="col-auto mw-100 mb-2"
t-if="o.reference">
<strong>Structured Communication:</strong>
<p class="m-0" t-field="o.reference"/>
</div>
<div name="account_number" class="col-auto mw-100 mb-2">
<strong>Account Number:</strong>
<t t-foreach="o.company_id.bank_journal_ids" t-as="journal">
<t t-foreach="o.company_id.bank_journal_ids"
t-as="journal">
<t t-set="b" t-value="journal.bank_account_id"/>
<t t-if="o.release_capital_request and journal.get_cooperator_payment">
<p class="m-0" t-field="b.acc_number"/>
@ -53,20 +70,36 @@
</div>
</div>
<t t-set="display_discount" t-value="any([l.discount for l in o.invoice_line_ids])"/>
<t t-set="display_discount"
t-value="any([l.discount for l in o.invoice_line_ids])"/>
<table class="table table-sm o_main_table" name="invoice_line_table">
<table class="table table-sm o_main_table"
name="invoice_line_table">
<thead>
<tr>
<t t-set="colspan" t-value="5"/>
<th class="text-left"><span>Description</span></th>
<th class="d-none text-left"><span>Source Document</span></th>
<th class="text-right"><span>Part Type</span></th>
<th class="text-right"><span>Quantity</span></th>
<th t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"><span>Unit Price</span></th>
<th class="text-left">
<span>Description</span>
</th>
<th class="d-none text-left">
<span>Source Document</span>
</th>
<th class="text-right">
<span groups="account.group_show_line_subtotals_tax_excluded">Amount</span>
<span groups="account.group_show_line_subtotals_tax_included">Total Price</span>
<span>Part Type</span>
</th>
<th class="text-right">
<span>Quantity</span>
</th>
<th t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span>Unit Price</span>
</th>
<th class="text-right">
<span groups="account.group_show_line_subtotals_tax_excluded">
Amount
</span>
<span groups="account.group_show_line_subtotals_tax_included">
Total Price
</span>
</th>
</tr>
</thead>
@ -75,26 +108,38 @@
<t t-foreach="o.invoice_line_ids" t-as="line">
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
<t t-set="current_subtotal"
t-value="current_subtotal + line.price_subtotal"
groups="account.group_show_line_subtotals_tax_excluded"/>
<t t-set="current_subtotal"
t-value="current_subtotal + line.price_total"
groups="account.group_show_line_subtotals_tax_included"/>
<tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''">
<t t-if="not line.display_type" name="account_invoice_line_accountable">
<td name="account_invoice_line_name"><span t-field="line.name"/></td>
<td class="d-none"><span t-field="line.origin"/></td>
<t t-if="not line.display_type"
name="account_invoice_line_accountable">
<td name="account_invoice_line_name">
<span t-field="line.name"/>
</td>
<td class="d-none">
<span t-field="line.origin"/>
</td>
<td class="text-right">
<span t-field="line.product_id.short_name"/>
</td>
<td class="text-right">
<span t-field="line.quantity"/>
<span t-field="line.uom_id" groups="uom.group_uom"/>
<span t-field="line.uom_id"
groups="uom.group_uom"/>
</td>
<td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span t-field="line.price_unit"/>
</td>
<td class="text-right o_price_total">
<span t-field="line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<span t-field="line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
<span t-field="line.price_subtotal"
groups="account.group_show_line_subtotals_tax_excluded"/>
<span t-field="line.price_total"
groups="account.group_show_line_subtotals_tax_included"/>
</td>
</t>
<t t-if="line.display_type == 'line_section'">
@ -116,9 +161,9 @@
<td colspan="99">
<strong class="mr16">Subtotal</strong>
<span
t-esc="current_subtotal"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'
/>
t-esc="current_subtotal"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'
/>
</td>
</tr>
</t>
@ -131,7 +176,9 @@
<div t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto">
<table class="table table-sm">
<tr class="border-black o_total">
<td><strong>Total</strong></td>
<td>
<strong>Total</strong>
</td>
<td class="text-right">
<span t-field="o.amount_total"/>
</td>
@ -141,7 +188,10 @@
</div>
</div>
<p t-if="o.reference">
Please use the following communication for your payment : <b><span t-field="o.reference"/></b>
Please use the following communication for your payment :
<b>
<span t-field="o.reference"/>
</b>
</p>
<p t-if="o.comment" name="comment">
<span t-field="o.comment"/>
@ -152,13 +202,22 @@
<p t-if="o.fiscal_position_id.note" name="note">
<span t-field="o.fiscal_position_id.note"/>
</p>
<div id="qrcode" t-if="(o.partner_id.country_id.code in ['BE', 'AT', 'DE', 'FI', 'NL']) and (o.company_id.qr_code) and (o.currency_id.name == 'EUR') and (o.partner_bank_id.acc_number != False)">
<div id="qrcode"
t-if="(o.partner_id.country_id.code in ['BE', 'AT', 'DE', 'FI', 'NL']) and (o.company_id.qr_code) and (o.currency_id.name == 'EUR') and (o.partner_bank_id.acc_number != False)">
<p t-if="(o.partner_bank_id.qr_code_valid)">
<strong class="text-center">Scan me with your banking app.</strong><br /><br />
<img class="border border-dark rounded" t-att-src="o.partner_bank_id.build_qr_code_url(o.residual,(o.reference) if (o.reference) else o.number)"/>
<strong class="text-center">Scan me with your banking
app.
</strong>
<br/>
<br/>
<img class="border border-dark rounded"
t-att-src="o.partner_bank_id.build_qr_code_url(o.residual,(o.reference) if (o.reference) else o.number)"/>
</p>
<p t-if="(o.partner_bank_id.qr_code_valid == False)">
<strong class="text-center">The SEPA QR Code informations are not set correctly.</strong><br />
<strong class="text-center">The SEPA QR Code
informations are not set correctly.
</strong>
<br/>
</p>
</div>
</div>
@ -169,7 +228,8 @@
<template id="theme_invoice_G002">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="easy_my_coop.theme_invoice_G002_document" t-lang="o.partner_id.lang"/>
<t t-call="easy_my_coop.theme_invoice_G002_document"
t-lang="o.partner_id.lang"/>
</t>
</t>
</template>

250
easy_my_coop/report/cooperator_register_G001.xml

@ -1,121 +1,145 @@
<odoo>
<template id="cooperator_register_G001">
<t t-call="web.html_container">
<template id="cooperator_register_G001">
<t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="5"/>
<t t-set="data_report_header_spacing" t-value="0"/>
<t t-set="data_report_dpi" t-value="110"/>
<!--<t t-call="theme_light.report_layout_002">-->
<t t-set="data_report_margin_top" t-value="5"/>
<t t-set="data_report_header_spacing" t-value="0"/>
<t t-set="data_report_dpi" t-value="110"/>
<div class="page">
<head>
<!--<link href="/theme_light/static/css/invoice_G002.css" rel="stylesheet"/>-->
</head>
<!--<t t-call="theme_light.list_header_G002"/>-->
<!--<t t-call="theme_light.report_layout_002">-->
<br/><br/><br/><br/><br/>
<table class="title_table">
<tr>
<td>
<span class="color_text" t-esc="time.strftime('%Y-%m-%d')"/>
</td>
<td>
<div class="title_doc" style="font-size:16px">
<span>COOPERATOR REGISTER</span>
</div>
</td>
</tr>
</table>
<div class="page">
<head>
<!--<link href="/theme_light/static/css/invoice_G002.css" rel="stylesheet"/>-->
</head>
<br/><br/><br/><br/><br/>
<!--<t t-call="theme_light.list_header_G002"/>-->
<table class="list_line_table_head" width="100%" >
<t t-set="total_quantity" t-value="0"/>
<t t-set="total_amount" t-value="0"/>
<br />
<tr>
<th width="15%" style="text-align: center;" >Number</th>
<th width="25%" style="text-align: center;" >Name</th>
<th width="20%" style="text-align: center;" >Email</th>
<th width="15%" style="text-align: center;" >Effective date</th>
<th width="10%" style="text-align: center;" >Quantity</th>
<th width="15%" style="text-align: center;" >Total</th>
</tr>
<t t-set="nb_ligne" t-value="0"/>
<t t-foreach="docs" t-as="partner">
<t t-set="new_partner" t-value="0"/>
<br/>
<br/>
<br/>
<br/>
<br/>
<table class="title_table">
<tr>
<td>
<span class="color_text"
t-esc="time.strftime('%Y-%m-%d')"/>
</td>
<td>
<div class="title_doc" style="font-size:16px">
<span>COOPERATOR REGISTER</span>
</div>
</td>
</tr>
</table>
<t t-foreach="partner.share_ids" t-as="line">
<t t-set="nb_ligne" t-value="nb_ligne+1"/>
<tr height="40px">
<div t-if="(nb_ligne%2)==1" >
<div t-if="(new_partner)==0">
<td class="lgn_impair" style="text-align:left;text-indent:20px;">
<span t-field="partner.cooperator_register_number" ></span>
</td>
<td style="text-align:left">
<span t-field="partner.name" ></span>
</td>
<td style="text-align:left">
<span t-field="partner.email" ></span>
</td>
</div>
<div t-if="(new_partner)!=0">
<td class="lgn_impair" style="text-align:left;text-indent:20px;" colspan="3">
</td>
</div>
<td>
<span t-field="line.effective_date" ></span>
</td>
<td>
<span t-field="line.share_number" ></span>
</td>
<td>
<span t-field="line.total_amount_line"
t-field-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
</td>
</div>
<div t-if="(nb_ligne%2)==0" >
<div t-if="(new_partner)==0" >
<td class="lgn_pair" style="text-align:left;text-indent:20px;background-color:#ffffff">
<span t-field="partner.cooperator_register_number" ></span>
</td>
<td class="lgn_pair" style="background-color:#ffffff;text-align:left">
<span t-field="partner.name" ></span>
</td>
<td class="lgn_pair" style="background-color:#ffffff;text-align:left">
<span t-field="partner.email" ></span>
</td>
</div>
<div t-if="(new_partner)!=0" style="background-color:#ffffff">
<td class="lgn_pair" style="text-align:left;text-indent:20px;background-color:#ffffff" colspan="3">
</td>
</div>
<td class="lgn_pair" style="background-color:#ffffff">
<span t-field="line.effective_date"> </span>
</td>
<td class="lgn_pair" style="background-color:#ffffff">
<span t-field="line.share_number" ></span>
</td>
<td class="lgn_pair" style="background-color:#ffffff">
<span t-field="line.total_amount_line"
t-field-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
</td>
</div>
</tr>
<t t-set="new_partner" t-value="new_partner+1"/>
</t>
</t>
</table>
</div>
</t>
<!--</t>-->
</template>
<br/>
<br/>
<br/>
<br/>
<br/>
<table class="list_line_table_head" width="100%">
<t t-set="total_quantity" t-value="0"/>
<t t-set="total_amount" t-value="0"/>
<br/>
<tr>
<th width="15%" style="text-align: center;">Number</th>
<th width="25%" style="text-align: center;">Name</th>
<th width="20%" style="text-align: center;">Email</th>
<th width="15%" style="text-align: center;">Effective
date
</th>
<th width="10%" style="text-align: center;">Quantity
</th>
<th width="15%" style="text-align: center;">Total</th>
</tr>
<t t-set="nb_ligne" t-value="0"/>
<t t-foreach="docs" t-as="partner">
<t t-set="new_partner" t-value="0"/>
<t t-foreach="partner.share_ids" t-as="line">
<t t-set="nb_ligne" t-value="nb_ligne+1"/>
<tr height="40px">
<div t-if="(nb_ligne%2)==1">
<div t-if="(new_partner)==0">
<td class="lgn_impair"
style="text-align:left;text-indent:20px;">
<span t-field="partner.cooperator_register_number"></span>
</td>
<td style="text-align:left">
<span t-field="partner.name"></span>
</td>
<td style="text-align:left">
<span t-field="partner.email"></span>
</td>
</div>
<div t-if="(new_partner)!=0">
<td class="lgn_impair"
style="text-align:left;text-indent:20px;"
colspan="3">
</td>
</div>
<td>
<span t-field="line.effective_date"></span>
</td>
<td>
<span t-field="line.share_number"></span>
</td>
<td>
<span t-field="line.total_amount_line"
t-field-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
</td>
</div>
<div t-if="(nb_ligne%2)==0">
<div t-if="(new_partner)==0">
<td class="lgn_pair"
style="text-align:left;text-indent:20px;background-color:#ffffff">
<span t-field="partner.cooperator_register_number"></span>
</td>
<td class="lgn_pair"
style="background-color:#ffffff;text-align:left">
<span t-field="partner.name"></span>
</td>
<td class="lgn_pair"
style="background-color:#ffffff;text-align:left">
<span t-field="partner.email"></span>
</td>
</div>
<div t-if="(new_partner)!=0"
style="background-color:#ffffff">
<td class="lgn_pair"
style="text-align:left;text-indent:20px;background-color:#ffffff"
colspan="3">
</td>
</div>
<td class="lgn_pair"
style="background-color:#ffffff">
<span t-field="line.effective_date"></span>
</td>
<td class="lgn_pair"
style="background-color:#ffffff">
<span t-field="line.share_number"></span>
</td>
<td class="lgn_pair"
style="background-color:#ffffff">
<span t-field="line.total_amount_line"
t-field-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
</td>
</div>
</tr>
<t t-set="new_partner" t-value="new_partner+1"/>
</t>
</t>
</table>
</div>
</t>
<!--</t>-->
</template>
</odoo>

222
easy_my_coop/report/cooperator_subscription_G001.xml

@ -1,106 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="cooperator_subscription_G001">
<t t-call="web.html_container">
<template id="cooperator_subscription_G001">
<t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="5"/>
<t t-set="data_report_header_spacing" t-value="0"/>
<t t-set="data_report_dpi" t-value="110"/>
<!--<t t-call="theme_light.report_layout_002">-->
<t t-set="data_report_margin_top" t-value="5"/>
<t t-set="data_report_header_spacing" t-value="0"/>
<t t-set="data_report_dpi" t-value="110"/>
<div class="page">
<head>
<!--<link href="/theme_light/static/css/invoice_G002.css" rel="stylesheet"/>-->
</head>
<!--<t t-call="theme_light.list_header_G002"/>-->
<!--<t t-call="theme_light.report_layout_002">-->
<br/><br/><br/><br/><br/>
<table class="title_table">
<tr>
<td>
<span class="color_text" t-esc="time.strftime('%Y-%m-%d')"/>
</td>
<td>
<div class="title_doc" style="font-size:16px">
<span>SUBSCRIPTION REGISTER</span>
</div>
</td>
</tr>
</table>
<div class="page">
<head>
<!--<link href="/theme_light/static/css/invoice_G002.css" rel="stylesheet"/>-->
</head>
<br/><br/><br/><br/><br/>
<table class="list_line_table_head" width="100%" >
<br />
<tr>
<th width="15%" style="text-align: center;" >Operation number</th>
<th width="30%" style="text-align: left;text-indent:15px" >Cooperator</th>
<th width="15%" style="text-align: center;" >Subscription date</th>
<th width="25%" style="text-align: center;" >Operation type</th>
<th width="15%" style="text-align: center;" >Share number</th>
</tr>
<t t-set="nb_ligne" t-value="0"/>
<p t-foreach="docs" t-as="transaction">
<t t-set="nb_ligne" t-value="nb_ligne+1"/>
<tr height="40px">
<div t-if="(nb_ligne%2)==1" >
<td class="lgn_impair" style="text-align:left;text-indent:10px">
<span t-field="transaction.register_number_operation" ></span>
</td>
<td style="text-align:left;text-indent:15px">
<span t-field="transaction.partner_id.name" ></span>
</td>
<td style="text-align:center">
<span t-field="transaction.date" ></span>
</td>
<td style="text-align:center">
<span t-field="transaction.type"/>
</td>
<td style="text-align:center">
<span t-field="transaction.quantity" ></span>
</td>
</div>
<div t-if="(nb_ligne%2)==0" >
<td class="lgn_pair" style="text-align:left;text-indent:10px;background-color:#ffffff">
<span t-field="transaction.register_number_operation" ></span>
</td>
<td class="lgn_pair" style="text-align:left;text-indent:15px;background-color:#ffffff">
<span t-field="transaction.partner_id.name" ></span>
</td>
<td style="text-align:center;background-color:#ffffff">
<span t-field="transaction.date" ></span>
</td>
<td style="text-align:center;background-color:#ffffff">
<span t-field="transaction.type"/>
</td>
<td style="text-align:center;background-color:#ffffff">
<span t-field="transaction.quantity" ></span>
</td>
</div>
</tr>
</p>
</table>
<table width="100%" >
<br />
<tr height="40px">
<th width="15%"></th>
<th width="30%"></th>
<th width="15%"></th>
<th class="total_table color_text" width="25%"> TOTAL : </th>
<th class="total_table" style="text-align:center" width="15%">
<span t-esc="sum(t.quantity for t in docs)"/>
</th>
</tr>
</table>
</div>
</t>
<!--</t>-->
</template>
<!--<t t-call="theme_light.list_header_G002"/>-->
<br/>
<br/>
<br/>
<br/>
<br/>
<table class="title_table">
<tr>
<td>
<span class="color_text"
t-esc="time.strftime('%Y-%m-%d')"/>
</td>
<td>
<div class="title_doc" style="font-size:16px">
<span>SUBSCRIPTION REGISTER</span>
</div>
</td>
</tr>
</table>
<br/>
<br/>
<br/>
<br/>
<br/>
<table class="list_line_table_head" width="100%">
<br/>
<tr>
<th width="15%" style="text-align: center;">Operation
number
</th>
<th width="30%"
style="text-align: left;text-indent:15px">Cooperator
</th>
<th width="15%" style="text-align: center;">Subscription
date
</th>
<th width="25%" style="text-align: center;">Operation
type
</th>
<th width="15%" style="text-align: center;">Share
number
</th>
</tr>
<t t-set="nb_ligne" t-value="0"/>
<p t-foreach="docs" t-as="transaction">
<t t-set="nb_ligne" t-value="nb_ligne+1"/>
<tr height="40px">
<div t-if="(nb_ligne%2)==1">
<td class="lgn_impair"
style="text-align:left;text-indent:10px">
<span t-field="transaction.register_number_operation"></span>
</td>
<td style="text-align:left;text-indent:15px">
<span t-field="transaction.partner_id.name"></span>
</td>
<td style="text-align:center">
<span t-field="transaction.date"></span>
</td>
<td style="text-align:center">
<span t-field="transaction.type"/>
</td>
<td style="text-align:center">
<span t-field="transaction.quantity"></span>
</td>
</div>
<div t-if="(nb_ligne%2)==0">
<td class="lgn_pair"
style="text-align:left;text-indent:10px;background-color:#ffffff">
<span t-field="transaction.register_number_operation"></span>
</td>
<td class="lgn_pair"
style="text-align:left;text-indent:15px;background-color:#ffffff">
<span t-field="transaction.partner_id.name"></span>
</td>
<td style="text-align:center;background-color:#ffffff">
<span t-field="transaction.date"></span>
</td>
<td style="text-align:center;background-color:#ffffff">
<span t-field="transaction.type"/>
</td>
<td style="text-align:center;background-color:#ffffff">
<span t-field="transaction.quantity"></span>
</td>
</div>
</tr>
</p>
</table>
<table width="100%">
<br/>
<tr height="40px">
<th width="15%"></th>
<th width="30%"></th>
<th width="15%"></th>
<th class="total_table color_text" width="25%">TOTAL :
</th>
<th class="total_table" style="text-align:center"
width="15%">
<span t-esc="sum(t.quantity for t in docs)"/>
</th>
</tr>
</table>
</div>
</t>
<!--</t>-->
</template>
</odoo>

76
easy_my_coop/report/easy_my_coop_report.xml

@ -1,49 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<report
id="action_cooperator_invoices"
model="account.invoice"
string="Capital release request"
report_type="qweb-pdf"
name="easy_my_coop.theme_invoice_G002"
file="easy_my_coop.cooperator_invoice_G002.xml"
attachment="(object.state in ('open','paid')) and ('SUBJ'+(object.number or '').replace('/','')+'.pdf')"
<data noupdate="1">
<report
id="action_cooperator_invoices"
model="account.invoice"
string="Capital release request"
report_type="qweb-pdf"
name="easy_my_coop.theme_invoice_G002"
file="easy_my_coop.cooperator_invoice_G002.xml"
attachment="(object.state in ('open','paid')) and ('SUBJ'+(object.number or '').replace('/','')+'.pdf')"
/>
<report
id="action_cooperator_subscription_report"
model="subscription.register"
string="Subscription Register Report"
report_type="qweb-pdf"
name="easy_my_coop.cooperator_subscription_G001"
file="easy_my_coop.cooperator_subscription_G001.xml"
multi="True"
menu="True"
id="action_cooperator_subscription_report"
model="subscription.register"
string="Subscription Register Report"
report_type="qweb-pdf"
name="easy_my_coop.cooperator_subscription_G001"
file="easy_my_coop.cooperator_subscription_G001.xml"
multi="True"
menu="True"
/>
<report
id="action_cooperator_report_certificat"
model="res.partner"
string="Cooperator certificat"
report_type="qweb-pdf"
name="easy_my_coop.cooperator_certificat_G001"
file="easy_my_coop.cooperator_certificat_G001.xml"
multi="True"
menu="True"
<report
id="action_cooperator_report_certificat"
model="res.partner"
string="Cooperator certificat"
report_type="qweb-pdf"
name="easy_my_coop.cooperator_certificat_G001"
file="easy_my_coop.cooperator_certificat_G001.xml"
multi="True"
menu="True"
/>
<report
id="action_report_cooperator_register"
model="res.partner"
string="Cooperator register"
report_type="qweb-pdf"
name="easy_my_coop.cooperator_register_G001"
file="easy_my_coop.cooperator_register_G001.xml"
multi="True"
menu="True"
id="action_report_cooperator_register"
model="res.partner"
string="Cooperator register"
report_type="qweb-pdf"
name="easy_my_coop.cooperator_register_G001"
file="easy_my_coop.cooperator_register_G001.xml"
multi="True"
menu="True"
/>
</data>
</data>
</odoo>

65
easy_my_coop/report/layout.xml

@ -1,38 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="emc_external_layout_standard" inherit_id="web.external_layout_standard" primary="True">
<xpath expr="//div[hasclass('o_standard_footer')]" position="attributes">
<template id="emc_external_layout_standard"
inherit_id="web.external_layout_standard" primary="True">
<xpath expr="//div[hasclass('o_standard_footer')]"
position="attributes">
<attribute name="style">display: none;</attribute>
</xpath>
<xpath expr="//div[hasclass('footer', 'o_standard_footer')]" position="before">
<div class="footer o_emc_footer" name="footer" style="font-size: 0.8em;">
<xpath expr="//div[hasclass('footer', 'o_standard_footer')]"
position="before">
<div class="footer o_emc_footer" name="footer"
style="font-size: 0.8em;">
<div class="row">
<div t-att-class="'text-center col-10' if company.display_logo1 or company.display_logo2 else 'text-center col'">
<ul class="list-inline mb4">
<li t-if="company.phone" class="list-inline-item">Phone: <span t-field="company.phone"/></li>
<li t-if="company.email" class="list-inline-item">Email: <span t-field="company.email"/></li>
<li t-if="company.website" class="list-inline-item">Web: <span t-field="company.website"/></li>
<li t-if="company.vat" class="list-inline-item"><t t-esc="company.country_id.vat_label or 'Tax ID'"/>: <span t-field="company.vat"/></li>
<li t-if="company.phone" class="list-inline-item">
Phone:
<span t-field="company.phone"/>
</li>
<li t-if="company.email" class="list-inline-item">
Email:
<span t-field="company.email"/>
</li>
<li t-if="company.website" class="list-inline-item">
Web:
<span t-field="company.website"/>
</li>
<li t-if="company.vat" class="list-inline-item"><t
t-esc="company.country_id.vat_label or 'Tax ID'"/>
:
<span t-field="company.vat"/>
</li>
</ul>
<div name="financial_infos">
<span t-field="company.report_footer"/>
</div>
<div t-if="report_type == 'pdf'" class="text-muted text-center">
Page: <span class="page"/> / <span class="topage"/>
<div t-if="report_type == 'pdf'"
class="text-muted text-center">
Page:
<span class="page"/>
/
<span class="topage"/>
</div>
</div>
<div name="logos" class="col-2 text-center" t-if="company.display_logo1 or company.display_logo2">
<div name="logos" class="col-2 text-center"
t-if="company.display_logo1 or company.display_logo2">
<img class="img img-responsive"
t-if="company.display_logo1"
t-attf-src="data:image/*;base64,{{company.bottom_logo1}}"
style="display: block; margin: auto; max-width: 100%; max-height: 3em;"/>
t-if="company.display_logo1"
t-attf-src="data:image/*;base64,{{company.bottom_logo1}}"
style="display: block; margin: auto; max-width: 100%; max-height: 3em;"/>
<img class="img img-responsive"
t-if="company.display_logo2"
t-attf-src="data:image/*;base64,{{company.bottom_logo2}}"
style="display: block; margin: auto; max-width: 100%; max-height: 3em;"/>
t-if="company.display_logo2"
t-attf-src="data:image/*;base64,{{company.bottom_logo2}}"
style="display: block; margin: auto; max-width: 100%; max-height: 3em;"/>
</div>
</div>
</div>
@ -40,15 +62,16 @@
</template>
<template
id="emc_external_layout_larger_logo"
inherit_id="easy_my_coop.emc_external_layout_standard"
primary="True">
id="emc_external_layout_larger_logo"
inherit_id="easy_my_coop.emc_external_layout_standard"
primary="True">
<!--
This template should be used with the special paperformat
that extend margin. See paperformat in data.
-->
<xpath expr="//div[hasclass('header')]//div//img" position="attributes">
<attribute name="style">min-height: 75px; max-height: 75px;</attribute>
<attribute name="style">min-height: 75px; max-height: 75px;
</attribute>
</xpath>
</template>

32
easy_my_coop/security/ir.model.access.csv

@ -1,16 +1,16 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_product_product_easy_my_coop_user,access_product_product_easy_my_coop_user,product.model_product_product,group_easy_my_coop_user,1,1,0,0
access_product_product_easy_my_coop_manager,access_product_product_easy_my_coop_manager,product.model_product_product,group_easy_my_coop_manager,1,1,1,1
access_product_template_easy_my_coop_user,access_product_template_easy_my_coop_user,product.model_product_template,group_easy_my_coop_user,1,1,0,0
access_product_template_easy_my_coop_manager,access_product_template_easy_my_coop_manager,product.model_product_template,group_easy_my_coop_manager,1,1,1,1
access_subscription_request_user,access_subscription_request_user.subscription,model_subscription_request,base.group_user,1,0,0,0
access_subscription_request_easy_my_coop_user,access_subscription_request_easy_my_coop_user,model_subscription_request,group_easy_my_coop_user,1,1,1,0
access_subscription_request_easy_my_coop_manager,access_subscription_request_easy_my_coop_manager,model_subscription_request,group_easy_my_coop_manager,1,1,1,1
access_share_line_user,access_share_line_user,model_share_line,base.group_user,1,0,0,0
access_share_line_easy_my_coop_user,access_share_line_easy_my_coop_user,model_share_line,group_easy_my_coop_user,1,1,1,0
access_share_line_easy_my_coop_manager,access_share_line_easy_my_coop_manager,model_share_line,group_easy_my_coop_manager,1,1,1,1
access_res_partner_easy_my_coop_user,access_res_partner_easy_my_coop_user,base.model_res_partner,group_easy_my_coop_user,1,1,1,0
access_account_invoice_easy_my_coop_user,access_account_invoice_easy_my_coop_user,model_account_invoice,group_easy_my_coop_user,1,1,1,0
access_subscription_register_easy_my_coop_user,access_subscription_register_easy_my_coop_user,model_subscription_register,group_easy_my_coop_user,1,1,1,0
access_operation_request_easy_my_coop_user,access_operation_request_easy_my_coop_user,model_operation_request,group_easy_my_coop_user,1,1,1,0
access_operation_request_easy_my_coop_manager,access_operation_request_easy_my_coop_manager,model_operation_request,group_easy_my_coop_manager,1,1,1,1
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_product_product_easy_my_coop_user,access_product_product_easy_my_coop_user,product.model_product_product,group_easy_my_coop_user,1,1,0,0
access_product_product_easy_my_coop_manager,access_product_product_easy_my_coop_manager,product.model_product_product,group_easy_my_coop_manager,1,1,1,1
access_product_template_easy_my_coop_user,access_product_template_easy_my_coop_user,product.model_product_template,group_easy_my_coop_user,1,1,0,0
access_product_template_easy_my_coop_manager,access_product_template_easy_my_coop_manager,product.model_product_template,group_easy_my_coop_manager,1,1,1,1
access_subscription_request_user,access_subscription_request_user.subscription,model_subscription_request,base.group_user,1,0,0,0
access_subscription_request_easy_my_coop_user,access_subscription_request_easy_my_coop_user,model_subscription_request,group_easy_my_coop_user,1,1,1,0
access_subscription_request_easy_my_coop_manager,access_subscription_request_easy_my_coop_manager,model_subscription_request,group_easy_my_coop_manager,1,1,1,1
access_share_line_user,access_share_line_user,model_share_line,base.group_user,1,0,0,0
access_share_line_easy_my_coop_user,access_share_line_easy_my_coop_user,model_share_line,group_easy_my_coop_user,1,1,1,0
access_share_line_easy_my_coop_manager,access_share_line_easy_my_coop_manager,model_share_line,group_easy_my_coop_manager,1,1,1,1
access_res_partner_easy_my_coop_user,access_res_partner_easy_my_coop_user,base.model_res_partner,group_easy_my_coop_user,1,1,1,0
access_account_invoice_easy_my_coop_user,access_account_invoice_easy_my_coop_user,model_account_invoice,group_easy_my_coop_user,1,1,1,0
access_subscription_register_easy_my_coop_user,access_subscription_register_easy_my_coop_user,model_subscription_register,group_easy_my_coop_user,1,1,1,0
access_operation_request_easy_my_coop_user,access_operation_request_easy_my_coop_user,model_operation_request,group_easy_my_coop_user,1,1,1,0
access_operation_request_easy_my_coop_manager,access_operation_request_easy_my_coop_manager,model_operation_request,group_easy_my_coop_manager,1,1,1,1

6
easy_my_coop/security/res_groups.xml

@ -3,13 +3,15 @@
<record id="group_easy_my_coop_user" model="res.groups">
<field name="name">User</field>
<field name="category_id" ref="module_category_cooperator_management"/>
<field name="implied_ids" eval="[(6, 0, [ref('base.group_user'), ref('account.group_account_invoice')])]"/>
<field name="implied_ids"
eval="[(6, 0, [ref('base.group_user'), ref('account.group_account_invoice')])]"/>
</record>
<record id="group_easy_my_coop_manager" model="res.groups">
<field name="name">Manager</field>
<field name="category_id" ref="module_category_cooperator_management"/>
<field name="implied_ids" eval="[(4, ref('group_easy_my_coop_user'))]"/>
<field name="users" eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
<field name="users"
eval="[(4, ref('base.user_root')), (4, ref('base.user_admin'))]"/>
</record>
</openerp>

414
easy_my_coop/static/description/index.html

@ -0,0 +1,414 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Easy My Coop</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="easy-my-coop">
<h1 class="title">Easy My Coop</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop"><img alt="coopiteasy/vertical-cooperative" src="https://img.shields.io/badge/github-coopiteasy%2Fvertical--cooperative-lightgray.png?logo=github" /></a></p>
<p>This module allows to manage the cooperator subscription and all the cooperative business processes.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/issues/new?body=module:%20easy_my_coop%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Coop IT Easy SCRLfs</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li>Coop IT Easy SCRLfs</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop">coopiteasy/vertical-cooperative</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

54
easy_my_coop/static/src/css/coop_report.css

@ -1,27 +1,27 @@
.border-top-easymy-coop td {
border-top: 1pt solid #e7511e !important;
}
.border-easymy-coop th {
border-bottom: 1pt solid #e7511e !important;
}
.border-top-easymy-coop-cert td {
border-top: 1pt solid #fcc300 !important;
}
.border-easymy-coop-cert th {
border-bottom: 1pt solid #fcc300 !important;
}
.easymy-coop-normal {
font-family:Roboto-Regular;
font-size:12pt;
line-height:16pt;
}
.easymy-coop-info-title {
font-family:Roboto-Bold;
font-size:12pt;
line-height:16pt;
}
.border-top-easymy-coop td {
border-top: 1pt solid #e7511e !important;
}
.border-easymy-coop th {
border-bottom: 1pt solid #e7511e !important;
}
.border-top-easymy-coop-cert td {
border-top: 1pt solid #fcc300 !important;
}
.border-easymy-coop-cert th {
border-bottom: 1pt solid #fcc300 !important;
}
.easymy-coop-normal {
font-family:Roboto-Regular;
font-size:12pt;
line-height:16pt;
}
.easymy-coop-info-title {
font-family:Roboto-Bold;
font-size:12pt;
line-height:16pt;
}

100
easy_my_coop/static/src/js/easy_my_coop.js

@ -1,52 +1,52 @@
odoo.define('easy_my_coop.oe_easymy_coop', function (require) {
$(document).ready(function () {
"use strict";
var ajax = require('web.ajax');
$('.oe_easymy_coop').each(function () {
var oe_easymy_coop = this;
$('#share_product_id').change(function () {
var share_product_id = $("#share_product_id").val();
ajax.jsonRpc("/subscription/get_share_product", 'call', {
'share_product_id': share_product_id
})
.then(function (data) {
$('#share_price').text(data[share_product_id].list_price);
$('input.js_quantity').val(data[share_product_id].min_qty);
if(data[share_product_id].force_min_qty == true){
$('input.js_quantity').data("min",data[share_product_id].min_qty);
}
$('input.js_quantity').change();
var $share_price = $('#share_price').text()
$('input[name="total_parts"]').val($('input.js_quantity').val()*$share_price);
$('input[name="total_parts"]').change();
});
});
$(oe_easymy_coop).on('click', 'a.js_add_cart_json', function (ev) {
var $share_price = $('#share_price').text()
var $link = $(ev.currentTarget);
var $input = $link.parent().parent().find("input");
var $input_total = $("div").find(".total");
var min = parseFloat($input.data("min") || 1);
var amount_max = parseFloat($('input[name="total_parts"]').data("max"));
var quantity = ($link.has(".fa-minus").length ? -1 : 1) + parseFloat($input.val(),10);
var total_part = quantity * $share_price;
var quantity_max = amount_max / $share_price;
$input.val(quantity > min ? (total_part <= amount_max ? quantity : quantity_max) : min);
$input.change();
$('input[name="total_parts"]').val($input.val()*$share_price);
return false;
});
$(oe_easymy_coop).on('focusout', 'input.js_quantity', function (ev) {
$('a.js_add_cart_json').trigger('click');
});
$('#share_product_id').trigger('change');
$("[name='birthdate']").inputmask();
});
$(document).ready(function () {
"use strict";
var ajax = require('web.ajax');
$('.oe_easymy_coop').each(function () {
var oe_easymy_coop = this;
$('#share_product_id').change(function () {
var share_product_id = $("#share_product_id").val();
ajax.jsonRpc("/subscription/get_share_product", 'call', {
'share_product_id': share_product_id,
})
.then(function (data) {
$('#share_price').text(data[share_product_id].list_price);
$('input.js_quantity').val(data[share_product_id].min_qty);
if (data[share_product_id].force_min_qty == true) {
$('input.js_quantity').data("min", data[share_product_id].min_qty);
}
$('input.js_quantity').change();
var $share_price = $('#share_price').text();
$('input[name="total_parts"]').val($('input.js_quantity').val() * $share_price);
$('input[name="total_parts"]').change();
});
});
$(oe_easymy_coop).on('click', 'a.js_add_cart_json', function (ev) {
var $share_price = $('#share_price').text();
var $link = $(ev.currentTarget);
var $input = $link.parent().parent().find("input");
var $input_total = $("div").find(".total");
var min = parseFloat($input.data("min") || 1);
var amount_max = parseFloat($('input[name="total_parts"]').data("max"));
var quantity = ($link.has(".fa-minus").length ? -1 : 1) + parseFloat($input.val(), 10);
var total_part = quantity * $share_price;
var quantity_max = amount_max / $share_price;
$input.val(quantity > min ? total_part <= amount_max ? quantity : quantity_max : min);
$input.change();
$('input[name="total_parts"]').val($input.val() * $share_price);
return false;
});
$(oe_easymy_coop).on('focusout', 'input.js_quantity', function (ev) {
$('a.js_add_cart_json').trigger('click');
});
$('#share_product_id').trigger('change');
$("[name='birthdate']").inputmask();
});
});
});
});

3125
easy_my_coop/static/src/js/jquery.inputmask.bundle.js
File diff suppressed because it is too large
View File

5
easy_my_coop/tests/test_emc.py

@ -2,8 +2,9 @@
# Robin Keunen <robin@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo.fields import Date
from odoo.exceptions import AccessError
from odoo.fields import Date
from .test_base import EMCBaseCase
@ -174,7 +175,7 @@ class EMCCase(EMCBaseCase):
share_type.list_price = 30
share_type.unlink()
def test_validated_lines_on_subscription_request(self):
def test_compute_validated_lines_on_subscription_request(self):
request = self.request
request.skip_control_ng = False

166
easy_my_coop/views/account_invoice_view.xml

@ -1,73 +1,93 @@
<odoo>
<record id="invoice_form" model="ir.ui.view">
<field name="name">account.invoice.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form" />
<field name="arch" type="xml">
<field name="move_id" position="after">
<field name="subscription_request" />
</field>
</field>
</record>
<record id="action_invoice_tree_coop" model="ir.actions.act_window">
<field name="name">Cooperator Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph,activity</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','in',('out_invoice', 'out_refund')),('release_capital_request','=',True)]</field>
<field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale'}</field>
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a customer invoice
</p><p>
Create invoices, register payments and keep track of the discussions with your customers.
</p>
</field>
</record>
<record id="action_invoice_tree1_view1" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="account.invoice_tree"/>
<field name="act_window_id" ref="action_invoice_tree_coop"/>
</record>
<record id="action_invoice_tree1_view2" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="account.invoice_form"/>
<field name="act_window_id" ref="action_invoice_tree_coop"/>
</record>
<record id="account.action_invoice_tree1" model="ir.actions.act_window">
<field name="name">Customer Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph,activity</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','in',('out_invoice', 'out_refund')),('release_capital_request','=',False)]</field>
<field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale'}</field>
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a customer invoice
</p><p>
Create invoices, register payments and keep track of the discussions with your customers.
</p>
</field>
</record>
<record id="account.action_invoice_refund_out_tree" model="ir.actions.act_window">
<field name="name">Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,kanban,calendar,graph,pivot</field>
<field name="view_id" ref="account.invoice_tree"/>
<field name="domain">[('type','in', ['out_invoice', 'out_refund']), ('state', 'not in', ['draft', 'cancel']),('release_capital_request','=',False)]</field>
<field name="context">{'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale'}</field>
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
</record>
</odoo>
<odoo>
<record id="invoice_form" model="ir.ui.view">
<field name="name">account.invoice.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<field name="move_id" position="after">
<field name="subscription_request"/>
</field>
</field>
</record>
<record id="action_invoice_tree_coop" model="ir.actions.act_window">
<field name="name">Cooperator Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph,activity
</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','in',('out_invoice',
'out_refund')),('release_capital_request','=',True)]
</field>
<field name="context">{'default_type':'out_invoice',
'type':'out_invoice', 'journal_type': 'sale'}
</field>
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a customer invoice
</p>
<p>
Create invoices, register payments and keep track of the
discussions with your customers.
</p>
</field>
</record>
<record id="action_invoice_tree1_view1" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="account.invoice_tree"/>
<field name="act_window_id" ref="action_invoice_tree_coop"/>
</record>
<record id="action_invoice_tree1_view2" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="account.invoice_form"/>
<field name="act_window_id" ref="action_invoice_tree_coop"/>
</record>
<record id="account.action_invoice_tree1" model="ir.actions.act_window">
<field name="name">Customer Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph,activity
</field>
<field eval="False" name="view_id"/>
<field name="domain">[('type','in',('out_invoice',
'out_refund')),('release_capital_request','=',False)]
</field>
<field name="context">{'default_type':'out_invoice',
'type':'out_invoice', 'journal_type': 'sale'}
</field>
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a customer invoice
</p>
<p>
Create invoices, register payments and keep track of the
discussions with your customers.
</p>
</field>
</record>
<record id="account.action_invoice_refund_out_tree"
model="ir.actions.act_window">
<field name="name">Invoices</field>
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,kanban,calendar,graph,pivot</field>
<field name="view_id" ref="account.invoice_tree"/>
<field name="domain">[('type','in', ['out_invoice', 'out_refund']),
('state', 'not in', ['draft',
'cancel']),('release_capital_request','=',False)]
</field>
<field name="context">{'default_type':'out_invoice',
'type':'out_invoice', 'journal_type': 'sale'}
</field>
<field name="search_view_id" ref="account.view_account_invoice_filter"/>
</record>
</odoo>

54
easy_my_coop/views/account_journal_view.xml

@ -1,26 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_account_journal_form_coop" model="ir.ui.view">
<field name="name">account.journal.form</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<field name="bank_id" position="after">
<field name="get_cooperator_payment" groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="get_general_payment"/>
</field>
</field>
</record>
<record id="view_account_bank_journal_form_coop" model="ir.ui.view">
<field name="name">account.bank.journal.form</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_bank_journal_form"/>
<field name="arch" type="xml">
<field name="currency_id" position="after">
<field name="get_cooperator_payment" groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="get_general_payment"/>
</field>
</field>
</record>
</odoo>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_account_journal_form_coop" model="ir.ui.view">
<field name="name">account.journal.form</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<field name="bank_id" position="after">
<field name="get_cooperator_payment"
groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="get_general_payment"/>
</field>
</field>
</record>
<record id="view_account_bank_journal_form_coop" model="ir.ui.view">
<field name="name">account.bank.journal.form</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_bank_journal_form"/>
<field name="arch" type="xml">
<field name="currency_id" position="after">
<field name="get_cooperator_payment"
groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="get_general_payment"/>
</field>
</field>
</record>
</odoo>

161
easy_my_coop/views/cooperator_register_view.xml

@ -1,77 +1,84 @@
<odoo>
<record id="subscription_register_tree" model="ir.ui.view">
<field name="name">subscription.register.tree</field>
<field name="model">subscription.register</field>
<field name="arch" type="xml">
<tree string="Subscription Register">
<field name="register_number_operation"/>
<field name="date"/>
<field name="partner_id"/>
<field name="share_short_name"/>
<field name="quantity" sum="Total quantity"/>
<field name="share_unit_price"/>
<field name="total_amount_line" sum="Total amount"/>
<field name="type"/>
</tree>
</field>
</record>
<record id="subscription_register_form" model="ir.ui.view">
<field name="name">subscription.register.form</field>
<field name="model">subscription.register</field>
<field name="arch" type="xml">
<form string="Subscription Register">
<group>
<group>
<field name="register_number_operation"/>
<field name="date"/>
<field name="partner_id"/>
<field name="share_short_name"/>
<field name="quantity"/>
<field name="share_unit_price"/>
<field name="total_amount_line"/>
</group>
<group>
<field name="partner_id_to" attrs="{'invisible':[('type','!=','transfer')]}"/>
<field name="type"/>
<field name="share_to_short_name"/>
<field name="quantity_to"/>
<field name="share_to_unit_price"/>
<field name="user_id" invisible="True"/>
</group>
</group>
</form>
</field>
</record>
<record id="view_subscription_register_filter" model="ir.ui.view">
<field name="name">Subscription Register Search</field>
<field name="model">subscription.register</field>
<field name="arch" type="xml">
<search string="Search Subscription Register">
<field name="partner_id"
filter_domain="[('partner_id','ilike',self)]"/>
<field name="register_number_operation"/>
<separator/>
<filter string="Subscription" name="type_subscription" domain="[('type','=','subscription')]"/>
<filter string="Transfer" name="type_transfer" domain="[('type','=','transfer')]"/>
<filter string="Sell back" name="type_sell_back" domain="[('type','=','sell_back')]"/>
<filter string="Convert" name="type_convert" domain="[('type','=','convert')]"/>
<separator/>
<group expand="0" name="group_by" string="Group By">
<filter name="entry_type" string="Entry type" context="{'group_by' : 'type'}" />
<filter name="subscription_date" string="Subscription Date" context="{'group_by': 'date'}"/>
</group>
</search>
</field>
</record>
<record id="subscription_register_action" model="ir.actions.act_window">
<field name="name">Subscription Register</field>
<field name="res_model">subscription.register</field>
<field name="view_type">form</field>
<field name="view_id" ref="subscription_register_tree"/>
<field name="search_view_id" ref="view_subscription_register_filter"/>
</record>
</odoo>
<odoo>
<record id="subscription_register_tree" model="ir.ui.view">
<field name="name">subscription.register.tree</field>
<field name="model">subscription.register</field>
<field name="arch" type="xml">
<tree string="Subscription Register">
<field name="register_number_operation"/>
<field name="date"/>
<field name="partner_id"/>
<field name="share_short_name"/>
<field name="quantity" sum="Total quantity"/>
<field name="share_unit_price"/>
<field name="total_amount_line" sum="Total amount"/>
<field name="type"/>
</tree>
</field>
</record>
<record id="subscription_register_form" model="ir.ui.view">
<field name="name">subscription.register.form</field>
<field name="model">subscription.register</field>
<field name="arch" type="xml">
<form string="Subscription Register">
<group>
<group>
<field name="register_number_operation"/>
<field name="date"/>
<field name="partner_id"/>
<field name="share_short_name"/>
<field name="quantity"/>
<field name="share_unit_price"/>
<field name="total_amount_line"/>
</group>
<group>
<field name="partner_id_to"
attrs="{'invisible':[('type','!=','transfer')]}"/>
<field name="type"/>
<field name="share_to_short_name"/>
<field name="quantity_to"/>
<field name="share_to_unit_price"/>
<field name="user_id" invisible="True"/>
</group>
</group>
</form>
</field>
</record>
<record id="view_subscription_register_filter" model="ir.ui.view">
<field name="name">Subscription Register Search</field>
<field name="model">subscription.register</field>
<field name="arch" type="xml">
<search string="Search Subscription Register">
<field name="partner_id"
filter_domain="[('partner_id','ilike',self)]"/>
<field name="register_number_operation"/>
<separator/>
<filter string="Subscription" name="type_subscription"
domain="[('type','=','subscription')]"/>
<filter string="Transfer" name="type_transfer"
domain="[('type','=','transfer')]"/>
<filter string="Sell back" name="type_sell_back"
domain="[('type','=','sell_back')]"/>
<filter string="Convert" name="type_convert"
domain="[('type','=','convert')]"/>
<separator/>
<group expand="0" name="group_by" string="Group By">
<filter name="entry_type" string="Entry type"
context="{'group_by' : 'type'}"/>
<filter name="subscription_date" string="Subscription Date"
context="{'group_by': 'date'}"/>
</group>
</search>
</field>
</record>
<record id="subscription_register_action" model="ir.actions.act_window">
<field name="name">Subscription Register</field>
<field name="res_model">subscription.register</field>
<field name="view_type">form</field>
<field name="view_id" ref="subscription_register_tree"/>
<field name="search_view_id" ref="view_subscription_register_filter"/>
</record>
</odoo>

30
easy_my_coop/views/email_template_view.xml

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.actions.act_window"
id="action_easy_my_coop_email_templates">
<field name="name">Mail Templates</field>
<field name="res_model">mail.template</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="domain">[('easy_my_coop','=',True)]</field>
<field name="view_id" ref="mail.email_template_tree" />
<field name="search_view_id" ref="mail.view_email_template_search" />
</record>
</odoo>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.actions.act_window"
id="action_easy_my_coop_email_templates">
<field name="name">Mail Templates</field>
<field name="res_model">mail.template</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="domain">[('easy_my_coop','=',True)]</field>
<field name="view_id" ref="mail.email_template_tree"/>
<field name="search_view_id" ref="mail.view_email_template_search"/>
</record>
</odoo>

62
easy_my_coop/views/menus.xml

@ -4,23 +4,55 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<menuitem name="Easy-My Coop" id="menu_main_easy_my_coop" groups="easy_my_coop.group_easy_my_coop_user" sequence="40" />
<menuitem name="Easy-My Coop" id="menu_main_easy_my_coop"
groups="easy_my_coop.group_easy_my_coop_user" sequence="40"/>
<menuitem name="Share Management" id="menu_easy_my_coop_main_subscription" parent="menu_main_easy_my_coop" groups="easy_my_coop.group_easy_my_coop_user" sequence="10" />
<menuitem name="Subscriptions" id="menu_easy_my_coop_subscription_request" action="subscription_request_action" parent="menu_easy_my_coop_main_subscription" sequence="110" />
<menuitem name="Register Payment" id="menu_action_invoice_tree_coop" action="action_invoice_tree_coop" parent="menu_easy_my_coop_main_subscription" groups="easy_my_coop.group_easy_my_coop_user" sequence="130" />
<menuitem name="Cooperator Candidates" id="menu_easy_my_coop_cooperator_candidate" action="action_partner_cooperator_candidate_form" parent="menu_easy_my_coop_main_subscription" sequence="140" />
<menuitem name="Subscription Register" id="menu_easy_my_coop_subscription_register" action="subscription_register_action" parent="menu_easy_my_coop_main_subscription" sequence="150" />
<menuitem name="Operation request" id="menu_easy_my_coop_operation_request" action="operation_request_action" parent="menu_easy_my_coop_main_subscription" groups="easy_my_coop.group_easy_my_coop_user" sequence="160" />
<!-- <menuitem name="Share Lines" id="menu_easy_my_coop_share_line" action="share_line_action" parent="menu_easy_my_coop_main_subscription" groups="base.group_erp_manager" sequence="170" />-->
<menuitem name="Share Management" id="menu_easy_my_coop_main_subscription"
parent="menu_main_easy_my_coop"
groups="easy_my_coop.group_easy_my_coop_user" sequence="10"/>
<menuitem name="Subscriptions" id="menu_easy_my_coop_subscription_request"
action="subscription_request_action"
parent="menu_easy_my_coop_main_subscription" sequence="110"/>
<menuitem name="Register Payment" id="menu_action_invoice_tree_coop"
action="action_invoice_tree_coop"
parent="menu_easy_my_coop_main_subscription"
groups="easy_my_coop.group_easy_my_coop_user" sequence="130"/>
<menuitem name="Cooperator Candidates"
id="menu_easy_my_coop_cooperator_candidate"
action="action_partner_cooperator_candidate_form"
parent="menu_easy_my_coop_main_subscription" sequence="140"/>
<menuitem name="Subscription Register"
id="menu_easy_my_coop_subscription_register"
action="subscription_register_action"
parent="menu_easy_my_coop_main_subscription" sequence="150"/>
<menuitem name="Operation request" id="menu_easy_my_coop_operation_request"
action="operation_request_action"
parent="menu_easy_my_coop_main_subscription"
groups="easy_my_coop.group_easy_my_coop_user" sequence="160"/>
<!-- <menuitem name="Share Lines" id="menu_easy_my_coop_share_line" action="share_line_action" parent="menu_easy_my_coop_main_subscription" groups="base.group_erp_manager" sequence="170" />-->
<menuitem name="Contacts" id="menu_easy_my_coop_main_coop" parent="menu_main_easy_my_coop" sequence="20"/>
<menuitem name="Cooperators" id="menu_easy_my_coop_cooperator" action="action_partner_cooperator_form" parent="menu_easy_my_coop_main_coop" sequence="210" />
<menuitem name="Company representative" id="menu_easy_my_coop_company_representative" action="action_company_representative_form" parent="menu_easy_my_coop_main_coop" groups="base.group_erp_manager" sequence="220" />
<menuitem name="Contacts" id="menu_easy_my_coop_main_coop"
parent="menu_main_easy_my_coop" sequence="20"/>
<menuitem name="Cooperators" id="menu_easy_my_coop_cooperator"
action="action_partner_cooperator_form"
parent="menu_easy_my_coop_main_coop" sequence="210"/>
<menuitem name="Company representative"
id="menu_easy_my_coop_company_representative"
action="action_company_representative_form"
parent="menu_easy_my_coop_main_coop"
groups="base.group_erp_manager" sequence="220"/>
<menuitem name="Reporting" id="menu_easy_my_coop_main_reporting" parent="menu_main_easy_my_coop" groups="easy_my_coop.group_easy_my_coop_user" sequence="30" />
<menuitem name="Reporting" id="menu_easy_my_coop_main_reporting"
parent="menu_main_easy_my_coop"
groups="easy_my_coop.group_easy_my_coop_user" sequence="30"/>
<menuitem name="Configuration" id="menu_easy_my_coop_config" parent="menu_main_easy_my_coop" sequence="40" groups="group_easy_my_coop_manager" />
<menuitem name="Share type" id="menu_easy_my_coop_share_product" action="share_product_action" parent="menu_easy_my_coop_config" sequence="410" />
<menuitem name="Mail Templates" id="menu_easy_my_coop_templates" action="action_easy_my_coop_email_templates" parent="menu_easy_my_coop_config" sequence="430" />
<menuitem name="Configuration" id="menu_easy_my_coop_config"
parent="menu_main_easy_my_coop" sequence="40"
groups="group_easy_my_coop_manager"/>
<menuitem name="Share type" id="menu_easy_my_coop_share_product"
action="share_product_action" parent="menu_easy_my_coop_config"
sequence="410"/>
<menuitem name="Mail Templates" id="menu_easy_my_coop_templates"
action="action_easy_my_coop_email_templates"
parent="menu_easy_my_coop_config" sequence="430"/>
</odoo>

238
easy_my_coop/views/operation_request_view.xml

@ -1,105 +1,133 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="operation_request_tree" model="ir.ui.view">
<field name="name">operation.request.tree</field>
<field name="model">operation.request</field>
<field name="arch" type="xml">
<tree string="Operation requests" colors="green:state in ('approved'); blue:state in ('draft');grey: state in ('done')">
<field name="request_date"/>
<field name="partner_id"/>
<field name="operation_type"/>
<field name="quantity"/>
<field name="user_id"/>
<field name="state"/>
</tree>
</field>
</record>
<record id="operation_request_form" model="ir.ui.view">
<field name="name">operation.request.form</field>
<field name="model">operation.request</field>
<field name="arch" type="xml">
<form string="Operation request">
<header>
<button string="Submit" type="object" name="submit_operation" states="draft"/>
<button string="Approve" type="object" name="approve_operation" states="waiting"/>
<button string="Refuse" type="object" name="refuse_operation" states="waiting"/>
<button string="Cancel" type="object" name="cancel_operation" states="draft,waiting,approved"/>
<button string="Draft" type="object" name="reset_to_draft" states="waiting,cancelled"/>
<button string="Execute" type="object" name="execute_operation" states="approved"/>
<field name="state" widget="statusbar" statusbar_visible="draft,done,cancelled,refused" statusbar_colors='{"draft":"grey","done":"green","cancelled":"orange","refused":"red"}'/>
</header>
<sheet>
<group>
<group>
<field name="request_date" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="operation_type" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="receiver_not_member" attrs="{'invisible':[('operation_type','!=','transfer')]}"/>
<field name="partner_id" options="{'no_create':True}" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="partner_id_to" options="{'no_create':True}" attrs="{'invisible':['|',('operation_type','!=','transfer'), ('receiver_not_member','=',True)]}"/>
</group>
<group>
<field name="user_id"/>
<field name="share_product_id" attrs="{'readonly':[('state','!=','draft')]}" widget="selection"/>
<field name="share_short_name" readonly="True"/>
<field name="share_to_product_id" attrs="{'invisible':[('operation_type','!=','convert')],'required':[('operation_type','=','convert')],'readonly':[('state','!=','draft')]}" widget="selection"/>
<field name="share_to_short_name" readonly="True"/>
<field name="quantity" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="share_unit_price" readonly="True"/>
<field name="subscription_amount" readonly="True" />
</group>
</group>
<group>
<field name="subscription_request" attrs="{'invisible':['|',('operation_type','!=','transfer'),('receiver_not_member','=',False)]}" context="{'default_is_operation': True, 'default_ordered_parts':quantity,'default_share_product_id': share_product_id, 'default_source':'operation'}">
<tree>
<field name="name"/>
<field name="birthdate"/>
<field name="phone"/>
<field name="email"/>
<field name="iban"/>
<field name="state" invisible="True"/>
</tree>
<form string="Subscription Requests">
<sheet>
<group>
<group>
<field name="name"/>
<field name="firstname"/>
<field name="lastname"/>
<field name="birthdate"/>
<field name="gender"/>
<field name="email"/>
<field name="phone"/>
<field name="iban"/>
</group>
<group>
<field name="address"/>
<field name="zip_code"/>
<field name="city"/>
<field name="country_id"/>
<field name="lang"/>
<field name="validated"/>
<field name="skip_control_ng"/>
<field name="ordered_parts" invisible="True"/>
<field name="source" invisible="True"/>
<field name="state" invisible="True"/>
<field name="share_product_id" invisible="True"/>
</group>
</group>
</sheet>
</form>
</field>
</group>
</sheet>
</form>
</field>
</record>
<record id="operation_request_action" model="ir.actions.act_window">
<field name="name">Operation request</field>
<field name="res_model">operation.request</field>
<field name="view_type">form</field>
<field name="view_id" ref="operation_request_tree"/>
</record>
</odoo>
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="operation_request_tree" model="ir.ui.view">
<field name="name">operation.request.tree</field>
<field name="model">operation.request</field>
<field name="arch" type="xml">
<tree string="Operation requests"
colors="green:state in ('approved'); blue:state in ('draft');grey: state in ('done')">
<field name="request_date"/>
<field name="partner_id"/>
<field name="operation_type"/>
<field name="quantity"/>
<field name="user_id"/>
<field name="state"/>
</tree>
</field>
</record>
<record id="operation_request_form" model="ir.ui.view">
<field name="name">operation.request.form</field>
<field name="model">operation.request</field>
<field name="arch" type="xml">
<form string="Operation request">
<header>
<button string="Submit" type="object"
name="submit_operation" states="draft"/>
<button string="Approve" type="object"
name="approve_operation" states="waiting"/>
<button string="Refuse" type="object"
name="refuse_operation" states="waiting"/>
<button string="Cancel" type="object"
name="cancel_operation"
states="draft,waiting,approved"/>
<button string="Draft" type="object" name="reset_to_draft"
states="waiting,cancelled"/>
<button string="Execute" type="object"
name="execute_operation" states="approved"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,done,cancelled,refused"
statusbar_colors='{"draft":"grey","done":"green","cancelled":"orange","refused":"red"}'/>
</header>
<sheet>
<group>
<group>
<field name="request_date"
attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="operation_type"
attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="receiver_not_member"
attrs="{'invisible':[('operation_type','!=','transfer')]}"/>
<field name="partner_id"
options="{'no_create':True}"
attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="partner_id_to"
options="{'no_create':True}"
attrs="{'invisible':['|',('operation_type','!=','transfer'), ('receiver_not_member','=',True)]}"/>
</group>
<group>
<field name="user_id"/>
<field name="share_product_id"
attrs="{'readonly':[('state','!=','draft')]}"
widget="selection"/>
<field name="share_short_name" readonly="True"/>
<field name="share_to_product_id"
attrs="{'invisible':[('operation_type','!=','convert')],'required':[('operation_type','=','convert')],'readonly':[('state','!=','draft')]}"
widget="selection"/>
<field name="share_to_short_name" readonly="True"/>
<field name="quantity"
attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="share_unit_price" readonly="True"/>
<field name="subscription_amount" readonly="True"/>
</group>
</group>
<group>
<field name="subscription_request"
attrs="{'invisible':['|',('operation_type','!=','transfer'),('receiver_not_member','=',False)]}"
context="{'default_is_operation': True, 'default_ordered_parts':quantity,'default_share_product_id': share_product_id, 'default_source':'operation'}">
<tree>
<field name="name"/>
<field name="birthdate"/>
<field name="phone"/>
<field name="email"/>
<field name="iban"/>
<field name="state" invisible="True"/>
</tree>
<form string="Subscription Requests">
<sheet>
<group>
<group>
<field name="name"/>
<field name="firstname"/>
<field name="lastname"/>
<field name="birthdate"/>
<field name="gender"/>
<field name="email"/>
<field name="phone"/>
<field name="iban"/>
</group>
<group>
<field name="address"/>
<field name="zip_code"/>
<field name="city"/>
<field name="country_id"/>
<field name="lang"/>
<field name="validated"/>
<field name="skip_control_ng"/>
<field name="ordered_parts"
invisible="True"/>
<field name="source"
invisible="True"/>
<field name="state"
invisible="True"/>
<field name="share_product_id"
invisible="True"/>
</group>
</group>
</sheet>
</form>
</field>
</group>
</sheet>
</form>
</field>
</record>
<record id="operation_request_action" model="ir.actions.act_window">
<field name="name">Operation request</field>
<field name="res_model">operation.request</field>
<field name="view_type">form</field>
<field name="view_id" ref="operation_request_tree"/>
</record>
</odoo>

321
easy_my_coop/views/product_view.xml

@ -1,153 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="product_template_share_form_view" model="ir.ui.view">
<field name="name">product.template.share.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='purchase_ok']/.." position="after">
<div groups="easy_my_coop.group_easy_my_coop_manager">
<field name="is_share"/>
<label for="is_share"/>
</div>
<div attrs="{'invisible':[('is_share','=',False)]}" groups="easy_my_coop.group_easy_my_coop_user">
<field name="display_on_website"/>
<label for="display_on_website"/>
</div>
</xpath>
<page name="general_information" position="after">
<page string="Share Information" name="share_information" attrs="{'invisible':[('is_share','=',False)]}" groups="easy_my_coop.group_easy_my_coop_user">
<group>
<group name="Info" string="Info">
<field name="short_name"/>
<field name="default_share_product"/>
<field name="mail_template"/>
</group>
<group name="configuration" string="Configuration">
<field name="force_min_qty"/>
<field name="minimum_quantity"/>
<field name="customer" attrs="{'invisible':[('is_share','=',False)]}"/>
<field name="by_company"/>
<field name="by_individual"/>
</group>
</group>
</page>
</page>
</field>
</record>
<record id="share_product_filter" model="ir.ui.view">
<field name="name">product.template.share.filter</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml">
<xpath expr="." position="inside">
<group expand="0" name="group_by" string="Group By">
<filter name="Creation Date" context="{'group_by': 'create_date'}"/>
</group>
</xpath>
</field>
</record>
<record id="product_template_only_form_view" model="ir.ui.view">
<field name="name">product.template.product.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<field name="default_code" position="attributes">
<attribute name="attrs">{'required': [('is_share', '=', True)]}</attribute>
</field>
</field>
</record>
<record id="share_product_action" model="ir.actions.act_window">
<field name="name">Share type</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<!-- <field name="context">{"search_default_filter_to_purchase":1}</field> -->
<field name="search_view_id" eval="False" /> <!-- Force empty -->
<field name="view_id" eval="False" /> <!-- Force empty -->
<field name="domain">[('is_share','=',True)]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new share product.
</p>
</field>
</record>
<!-- overriding product views to not display share product in the purchase and sale views-->
<record id="product.product_normal_action" model="ir.actions.act_window">
<field name="name">Product</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_mode">tree,form,kanban</field>
<field name="view_type">form</field>
<field name="search_view_id" ref="product.product_search_form_view"/>
<field name="view_id" eval="False"/> <!-- Force empty -->
<field name="domain">[('is_share','=',False)]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new product.
</p><p>
You must define a product for everything you sell, whether it's
a physical product, a consumable or a service you offer to
customers.
</p><p>
The product form contains information to simplify the sale
process: price, notes in the quotation, accounting data,
procurement methods, etc.
</p>
</field>
</record>
<record id="product.product_template_action" model="ir.actions.act_window">
<field name="name">Products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_mode">tree,form,kanban</field>
<field name="view_type">form</field>
<field name="view_id" ref="product.product_template_kanban_view"/>
<field name="context">{"search_default_filter_to_sell":1}</field>
<field name="domain">[('is_share','=',False)]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new product.
</p><p>
You must define a product for everything you sell, whether it's a physical product, a consumable or a service you offer to customers.
</p><p>
The product form contains information to simplify the sale process: price, notes in the quotation, accounting data, procurement methods, etc.
</p>
</field>
</record>
<!-- move this action to another module cause the original action has been
moved to purchase module. So we want to avoid make purchase module installed
<record id="product.product_normal_action_puchased" model="ir.actions.act_window">
<field name="name">Products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{"search_default_filter_to_purchase":1}</field>
<field name="search_view_id" eval="False"/> Force empty
<field name="view_id" eval="False"/> Force empty
<field name="domain">[('is_share','=',False)]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new product.
</p><p>
You must define a product for everything you purchase, whether
it's a physical product, a consumable or services you buy to
subcontractants.
</p><p>
The product form contains detailed information to improve the
purchase process: prices, procurement logistics, accounting data,
available vendors, etc.
</p>
</field>
</record> -->
</odoo>
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="product_template_share_form_view" model="ir.ui.view">
<field name="name">product.template.share.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='purchase_ok']/.." position="after">
<div groups="easy_my_coop.group_easy_my_coop_manager">
<field name="is_share"/>
<label for="is_share"/>
</div>
<div attrs="{'invisible':[('is_share','=',False)]}"
groups="easy_my_coop.group_easy_my_coop_user">
<field name="display_on_website"/>
<label for="display_on_website"/>
</div>
</xpath>
<page name="general_information" position="after">
<page string="Share Information" name="share_information"
attrs="{'invisible':[('is_share','=',False)]}"
groups="easy_my_coop.group_easy_my_coop_user">
<group>
<group name="Info" string="Info">
<field name="short_name"/>
<field name="default_share_product"/>
<field name="mail_template"/>
</group>
<group name="configuration" string="Configuration">
<field name="force_min_qty"/>
<field name="minimum_quantity"/>
<field name="customer"
attrs="{'invisible':[('is_share','=',False)]}"/>
<field name="by_company"/>
<field name="by_individual"/>
</group>
</group>
</page>
</page>
</field>
</record>
<record id="share_product_filter" model="ir.ui.view">
<field name="name">product.template.share.filter</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml">
<xpath expr="." position="inside">
<group expand="0" name="group_by" string="Group By">
<filter name="Creation Date"
context="{'group_by': 'create_date'}"/>
</group>
</xpath>
</field>
</record>
<record id="product_template_only_form_view" model="ir.ui.view">
<field name="name">product.template.product.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<field name="default_code" position="attributes">
<attribute name="attrs">{'required': [('is_share', '=',
True)]}
</attribute>
</field>
</field>
</record>
<record id="share_product_action" model="ir.actions.act_window">
<field name="name">Share type</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<!-- <field name="context">{"search_default_filter_to_purchase":1}</field> -->
<field name="search_view_id" eval="False"/> <!-- Force empty -->
<field name="view_id" eval="False"/> <!-- Force empty -->
<field name="domain">[('is_share','=',True)]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new share product.
</p>
</field>
</record>
<!-- overriding product views to not display share product in the purchase and sale views-->
<record id="product.product_normal_action" model="ir.actions.act_window">
<field name="name">Product</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_mode">tree,form,kanban</field>
<field name="view_type">form</field>
<field name="search_view_id" ref="product.product_search_form_view"/>
<field name="view_id" eval="False"/> <!-- Force empty -->
<field name="domain">[('is_share','=',False)]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new product.
</p>
<p>
You must define a product for everything you sell, whether it's
a physical product, a consumable or a service you offer to
customers.
</p>
<p>
The product form contains information to simplify the sale
process: price, notes in the quotation, accounting data,
procurement methods, etc.
</p>
</field>
</record>
<record id="product.product_template_action" model="ir.actions.act_window">
<field name="name">Products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_mode">tree,form,kanban</field>
<field name="view_type">form</field>
<field name="view_id" ref="product.product_template_kanban_view"/>
<field name="context">{"search_default_filter_to_sell":1}</field>
<field name="domain">[('is_share','=',False)]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new product.
</p>
<p>
You must define a product for everything you sell, whether it's
a physical product, a consumable or a service you offer to
customers.
</p>
<p>
The product form contains information to simplify the sale
process: price, notes in the quotation, accounting data,
procurement methods, etc.
</p>
</field>
</record>
<!-- move this action to another module cause the original action has been
moved to purchase module. So we want to avoid make purchase module installed
<record id="product.product_normal_action_puchased" model="ir.actions.act_window">
<field name="name">Products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{"search_default_filter_to_purchase":1}</field>
<field name="search_view_id" eval="False"/> Force empty
<field name="view_id" eval="False"/> Force empty
<field name="domain">[('is_share','=',False)]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to define a new product.
</p><p>
You must define a product for everything you purchase, whether
it's a physical product, a consumable or services you buy to
subcontractants.
</p><p>
The product form contains detailed information to improve the
purchase process: prices, procurement logistics, accounting data,
available vendors, etc.
</p>
</field>
</record> -->
</odoo>

69
easy_my_coop/views/res_company_view.xml

@ -1,34 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record model="ir.ui.view" id="view_company_inherit_form2">
<field name="name">res.company.form.easymy.coop</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="model">res.company</field>
<field name="arch" type="xml">
<group name="social_media" position="before">
<group name="coop_grp" string="EasyMy Coop" groups="easy_my_coop.group_easy_my_coop_user">
<field name="unmix_share_type"/>
<field name="allow_id_card_upload"/>
<field name="create_user"/>
<field name="display_logo1"/>
<field name="bottom_logo1"/>
<field name="display_logo2"/>
<field name="bottom_logo2"/>
<field name="coop_email_contact"/>
<field name="subscription_maximum_amount"/>
<field name="property_cooperator_account"/>
<field name="default_country_id"/>
<field name="default_lang_id"/>
<field name="board_representative"/>
<field name="signature_scan"/>
<field name="display_data_policy_approval"/>
<field name="data_policy_approval_required"/>
<field name="data_policy_approval_text"/>
<field name="display_internal_rules_approval"/>
<field name="internal_rules_approval_required"/>
<field name="internal_rules_approval_text"/>
</group>
</group>
</field>
</record>
</odoo>
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record model="ir.ui.view" id="view_company_inherit_form2">
<field name="name">res.company.form.easymy.coop</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="model">res.company</field>
<field name="arch" type="xml">
<group name="social_media" position="before">
<group name="coop_grp" string="EasyMy Coop"
groups="easy_my_coop.group_easy_my_coop_user">
<field name="unmix_share_type"/>
<field name="allow_id_card_upload"/>
<field name="create_user"/>
<field name="display_logo1"/>
<field name="bottom_logo1"/>
<field name="display_logo2"/>
<field name="bottom_logo2"/>
<field name="coop_email_contact"/>
<field name="subscription_maximum_amount"/>
<field name="property_cooperator_account"/>
<field name="default_country_id"/>
<field name="default_lang_id"/>
<field name="board_representative"/>
<field name="signature_scan"/>
<field name="display_data_policy_approval"/>
<field name="data_policy_approval_required"/>
<field name="data_policy_approval_text"/>
<field name="display_internal_rules_approval"/>
<field name="internal_rules_approval_required"/>
<field name="internal_rules_approval_text"/>
</group>
</group>
</field>
</record>
</odoo>

396
easy_my_coop/views/res_partner_view.xml

@ -1,171 +1,225 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 Coop IT Easy
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<data>
<record id="view_partner_form_easy_my_coop" model="ir.ui.view">
<field name="name">res.partner.form.easy_my_coop</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<sheet position="before">
<header>
<button string="Create Subscription" name="%(action_view_create_subscription)d"
type="action" context="{'default_active_id': active_id}" groups="easy_my_coop.group_easy_my_coop_user"/>
<button id="action_view_update_partner_info" string="Update info" name="%(action_view_update_partner_info)d"
type="action" context="{'default_active_id': active_id}" groups="easy_my_coop.group_easy_my_coop_user"/>
</header>
</sheet>
<xpath expr="/form/sheet/group" position='before'>
<group>
<group>
<field name="representative" attrs="{'invisible':['|',('parent_id','=',False),('is_company','=',True)]}"/>
<field name="cooperator_register_number" readonly="True" attrs="{'invisible':[('member','=',False)]}"/>
<field name="company_register_number" readonly="True" attrs="{'invisible':[('is_company','=',False)]}"/>
<field name="coop_candidate" groups="easy_my_coop.group_easy_my_coop_user"/>
<field name="cooperator" invisible="True" groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="member" groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="cooperator_type" attrs="{'invisible':[('member','=',False)]}"/>
<field name="effective_date" attrs="{'invisible':[('member','=',False)]}"/>
</group>
<group>
<field name="gender" attrs="{'invisible':[('is_company','=',True)]}"/>
</group>
<group name="approvals">
<field name="internal_rules_approved" />
<field name="data_policy_approved" />
</group>
</group>
</xpath>
<page name='sales_purchases' position="after">
<page string="Shares" name="share" attrs="{'invisible':[('member','=',False)]}" groups="easy_my_coop.group_easy_my_coop_user">
<group>
<field name="number_of_share"/>
<field name="total_value"/>
</group>
<field name="share_ids">
<tree create="false">
<field name="effective_date"/>
<field name="share_short_name"/>
<field name="share_number" sum="Total of shares"/>
<field name="share_unit_price"/>
<field name="total_amount_line" sum="Total subscribed amount"/>
</tree>
</field>
</page>
<page string="Share subscriptions" name="share_subscription" attrs="{'invisible':[('cooperator','=',False)]}" groups="easy_my_coop.group_easy_my_coop_user">
<field name="subscription_request_ids">
<tree create="false" delete="false" edit="false">
<field name="share_short_name"/>
<field name="ordered_parts" sum="Total of shares"/>
<field name="share_unit_price"/>
<field name="subscription_amount" sum="Total subscribed amount"/>
<field name="type"/>
<field name="state"/>
</tree>
</field>
</page>
</page>
</field>
</record>
<record id="view_partner_tree_easy_my_coop" model="ir.ui.view">
<field name="name">res.partner.tree.easy_my_coop</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_tree"/>
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='display_name']" position='after'>
<field name="cooperator_register_number" />
<field name="cooperator_type"/>
<field name="effective_date"/>
</xpath>
</field>
</record>
<record id="view_res_partner_filter_coop" model="ir.ui.view">
<field name="name">res.partner.select</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml">
<filter name="supplier" position='after'>
<filter string="Cooperators" name="cooperators" domain="[('member','=',1)]" help="Cooperator Partners"/>
<filter string="Old Cooperators" name="old_cooperators" domain="[('old_member','=',1)]" help="Cooperator Partners"/>
<filter string="Cooperator Candidates" name="cooperator_candidates" domain="[('coop_candidate','=',1)]" help="Cooperator Partners"/>
</filter>
<filter name="salesperson" position="before">
<filter string="Cooperator Type" name="group_by_cooperator_type" context="{'group_by': 'cooperator_type'}"/>
</filter>
</field>
</record>
<record id="action_partner_cooperator_form" model="ir.actions.act_window">
<field name="name">Cooperators</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">['|', ('cooperator','=',True), '|', ('member','=',True),('old_member','=', True)]</field>
<field name="context">{'default_cooperator':1, 'search_default_cooperators':1}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a contact in your address book.
</p><p>
OpenERP helps you easily track all activities related to
a cooperator: discussions, history of business opportunities,
documents, etc.
</p>
</field>
</record>
<record id="action_partner_cooperator_candidate_form" model="ir.actions.act_window">
<field name="name">Cooperator candidates</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('cooperator','=',True)]</field>
<field name="context">{'default_cooperator':1, 'search_default_cooperator_candidates':1}</field>
<field name="filter" eval="True"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a contact in your address book.
</p><p>
OpenERP helps you easily track all activities related to
a cooperator: discussions, history of business opportunities,
documents, etc.
</p>
</field>
</record>
<record id="action_company_representative_form" model="ir.actions.act_window">
<field name="name">Company representative</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('cooperator','=',True),('representative','=',True)]</field>
<field name="filter" eval="True"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a contact in your address book.
</p><p>
OpenERP helps you easily track all activities related to
a cooperator: discussions, history of business opportunities,
documents, etc.
</p>
</field>
</record>
<record id="remove_partner_follower" model="ir.ui.view">
<field name="name">res.partner.remove.follower.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="mail.res_partner_view_form_inherit_mail"/>
<field name="arch" type="xml">
<field name="message_follower_ids" position="replace"/>
</field>
</record>
</data>
</odoo>
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2019 Coop IT Easy
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<data>
<record id="view_partner_form_easy_my_coop" model="ir.ui.view">
<field name="name">res.partner.form.easy_my_coop</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<sheet position="before">
<header>
<button string="Create Subscription"
name="%(action_view_create_subscription)d"
type="action"
context="{'default_active_id': active_id}"
groups="easy_my_coop.group_easy_my_coop_user"/>
<button id="action_view_update_partner_info"
string="Update info"
name="%(action_view_update_partner_info)d"
type="action"
context="{'default_active_id': active_id}"
groups="easy_my_coop.group_easy_my_coop_user"/>
</header>
</sheet>
<xpath expr="/form/sheet/group" position='before'>
<group>
<group>
<field name="representative"
attrs="{'invisible':['|',('parent_id','=',False),('is_company','=',True)]}"/>
<field name="cooperator_register_number"
readonly="True"
attrs="{'invisible':[('member','=',False)]}"/>
<field name="company_register_number"
readonly="True"
attrs="{'invisible':[('is_company','=',False)]}"/>
<field name="coop_candidate"
groups="easy_my_coop.group_easy_my_coop_user"/>
<field name="cooperator" invisible="True"
groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="member"
groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="cooperator_type"
attrs="{'invisible':[('member','=',False)]}"/>
<field name="effective_date"
attrs="{'invisible':[('member','=',False)]}"/>
</group>
<group>
<field name="gender"
attrs="{'invisible':[('is_company','=',True)]}"/>
</group>
<group name="approvals">
<field name="internal_rules_approved"/>
<field name="data_policy_approved"/>
</group>
</group>
</xpath>
<page name='sales_purchases' position="after">
<page string="Shares" name="share"
attrs="{'invisible':[('member','=',False)]}"
groups="easy_my_coop.group_easy_my_coop_user">
<group>
<field name="number_of_share"/>
<field name="total_value"/>
</group>
<field name="share_ids">
<tree create="false">
<field name="effective_date"/>
<field name="share_short_name"/>
<field name="share_number"
sum="Total of shares"/>
<field name="share_unit_price"/>
<field name="total_amount_line"
sum="Total subscribed amount"/>
</tree>
</field>
</page>
<page string="Share subscriptions" name="share_subscription"
attrs="{'invisible':[('cooperator','=',False)]}"
groups="easy_my_coop.group_easy_my_coop_user">
<field name="subscription_request_ids">
<tree create="false" delete="false" edit="false">
<field name="share_short_name"/>
<field name="ordered_parts"
sum="Total of shares"/>
<field name="share_unit_price"/>
<field name="subscription_amount"
sum="Total subscribed amount"/>
<field name="type"/>
<field name="state"/>
</tree>
</field>
</page>
</page>
</field>
</record>
<record id="view_partner_tree_easy_my_coop" model="ir.ui.view">
<field name="name">res.partner.tree.easy_my_coop</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_tree"/>
<field name="arch" type="xml">
<xpath expr="/tree/field[@name='display_name']"
position='after'>
<field name="cooperator_register_number"/>
<field name="cooperator_type"/>
<field name="effective_date"/>
</xpath>
</field>
</record>
<record id="view_res_partner_filter_coop" model="ir.ui.view">
<field name="name">res.partner.select</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml">
<filter name="supplier" position='after'>
<filter string="Cooperators" name="cooperators"
domain="[('member','=',1)]"
help="Cooperator Partners"/>
<filter string="Old Cooperators" name="old_cooperators"
domain="[('old_member','=',1)]"
help="Cooperator Partners"/>
<filter string="Cooperator Candidates"
name="cooperator_candidates"
domain="[('coop_candidate','=',1)]"
help="Cooperator Partners"/>
</filter>
<filter name="salesperson" position="before">
<filter string="Cooperator Type"
name="group_by_cooperator_type"
context="{'group_by': 'cooperator_type'}"/>
</filter>
</field>
</record>
<record id="action_partner_cooperator_form"
model="ir.actions.act_window">
<field name="name">Cooperators</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">['|', ('cooperator','=',True), '|',
('member','=',True),('old_member','=', True)]
</field>
<field name="context">{'default_cooperator':1,
'search_default_cooperators':1}
</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a contact in your address book.
</p>
<p>
OpenERP helps you easily track all activities related to
a cooperator: discussions, history of business
opportunities,
documents, etc.
</p>
</field>
</record>
<record id="action_partner_cooperator_candidate_form"
model="ir.actions.act_window">
<field name="name">Cooperator candidates</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('cooperator','=',True)]</field>
<field name="context">{'default_cooperator':1,
'search_default_cooperator_candidates':1}
</field>
<field name="filter" eval="True"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a contact in your address book.
</p>
<p>
OpenERP helps you easily track all activities related to
a cooperator: discussions, history of business
opportunities,
documents, etc.
</p>
</field>
</record>
<record id="action_company_representative_form"
model="ir.actions.act_window">
<field name="name">Company representative</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">
[('cooperator','=',True),('representative','=',True)]
</field>
<field name="filter" eval="True"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to add a contact in your address book.
</p>
<p>
OpenERP helps you easily track all activities related to
a cooperator: discussions, history of business
opportunities,
documents, etc.
</p>
</field>
</record>
<record id="remove_partner_follower" model="ir.ui.view">
<field name="name">res.partner.remove.follower.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id"
ref="mail.res_partner_view_form_inherit_mail"/>
<field name="arch" type="xml">
<field name="message_follower_ids" position="replace"/>
</field>
</record>
</data>
</odoo>

439
easy_my_coop/views/subscription_request_view.xml

@ -1,201 +1,238 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="subscription_request_tree" model="ir.ui.view">
<field name="name">subscription.request.tree</field>
<field name="model">subscription.request</field>
<field name="arch" type="xml">
<!-- fixme no colors in v12 ? -->
<tree string="Subscription Requests" colors="red:validated == False; blue:state in ('draft'); grey: state in ('done')">
<field name="name"/>
<field name="company_name"/>
<field name="date" string="Request Date"/>
<field name="type"/>
<field name="share_short_name" string="Share Type"/>
<field name="ordered_parts" string="Quantity" sum="Total ordered parts"/>
<field name="subscription_amount" sum="Total amount"/>
<field name="email"/>
<field name="iban"/>
<field name="partner_id"/>
<field name="source"/>
<field name="state"/>
<field name="validated" invisible="True"/>
<button type="object" string="Validate" aria-label="Validate" name="validate_subscription_request" attrs="{'invisible':['|',('state','not in',['draft','waiting']),('validated','=',False)]}"/>
<button type="object" string="Block" aria-label="Block" name="block_subscription_request" states="draft" groups="easy_my_coop.group_easy_my_coop_user"/>
<button type="object" string="Unblock" aria-label="Unblock" name="unblock_subscription_request" states="block" groups="easy_my_coop.group_easy_my_coop_user"/>
</tree>
</field>
</record>
<record id="subscription_request_form" model="ir.ui.view">
<field name="name">subscription.request.form</field>
<field name="model">subscription.request</field>
<field name="arch" type="xml">
<form string="Subscription Requests">
<header>
<button string="Validate" type="object" name="validate_subscription_request" attrs="{'invisible':['|',('state','not in',['draft','waiting']),('validated','=',False)]}"/>
<button string="Waiting list" type="object" name="put_on_waiting_list" states="draft"/>
<button string="Cancel" type="object" name="cancel_subscription_request" states="draft,waiting,done,block" groups="easy_my_coop.group_easy_my_coop_user"/>
<field name="state" widget="statusbar" statusbar_visible="draft,cancelled,done,failed"/>
</header>
<sheet>
<group>
<group>
<field name="validated" invisible="True"/>
<field name="already_cooperator"/>
<field name="is_company" groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="is_operation" invisible="True"/>
<field name="company_name" attrs="{'invisible':[('is_company','=',False)]}"/>
<field name="company_email" attrs="{'invisible':[('is_company','=',False)]}"/>
<field name="company_type" attrs="{'invisible':[('is_company','=',False)]}"/>
<field name="company_register_number" attrs="{'invisible':[('is_company','=',False)]}"/>
<field name="name"/>
<field name="firstname"/>
<field name="lastname"/>
<field name="birthdate"/>
<field name="gender"/>
<field name="email"/>
<field name="phone"/>
<field name="contact_person_function" attrs="{'invisible':[('is_company','=',False)]}"/>
<!-- todo highlight iban if not valid -->
<field name="iban"/>
<field name="address"/>
<field name="zip_code"/>
<field name="city"/>
<field name="country_id" options="{'no_create':True}"/>
</group>
<group>
<field name="capital_release_request_date" groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="date"/>
<field name="source"/>
<field name="ordered_parts"/>
<field name="share_product_id" widget="selection"/>
<field name="share_short_name"/>
<field name="share_unit_price"/>
<field name="subscription_amount"/>
<field name="partner_id" options="{'no_create':True}"/>
<field name="type"/>
<field name="lang"/>
<field name="skip_control_ng"/>
<field name="data_policy_approved"/>
</group>
</group>
<notebook>
<page name="capital_release_request" string="Capital release request">
<field name="capital_release_request">
<tree options="{'no_create':True}">
<field string="Cooperator" name="partner_id"/>
<field name="date_invoice"/>
<field name="number"/>
<field string="Reference" name="reference"/>
<field name="date_due"/>
<field name="amount_total_signed"/>
<field name="residual_signed"/>
<field name="state"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="view_subscription_request_filter" model="ir.ui.view">
<field name="name">Cooperator Subscription Search</field>
<field name="model">subscription.request</field>
<field name="arch" type="xml">
<search string="Search Subscription Request">
<field name="name"/>
<field name="partner_id"/>
<separator/>
<filter string="Draft" name="state_draft" domain="[('state','=','draft')]"/>
<filter string="Paid" name="state_paid" domain="[('state','=','paid')]"/>
<filter string="Done" name="state_done" domain="[('state','=','done')]"/>
<separator/>
<filter string="Not Validated" name="Not Validated" domain="[('validated', '=', False)]"/>
<group expand="0" name="group_by" string="Group By">
<filter name="request_type" string="Request type" context="{'group_by' : 'type'}" />
<filter name="date" string="Request Date" context="{'group_by': 'date'}"/>
</group>
</search>
</field>
</record>
<record id="subscription_request_action" model="ir.actions.act_window">
<field name="name">Subscriptions</field>
<field name="res_model">subscription.request</field>
<field name="view_type">form</field>
<field name="domain">[('is_operation','=',False)]</field>
<field name="context">{'default_source':'manual'}</field>
<field name="view_id" ref="subscription_request_tree"/>
<field name="search_view_id" ref="view_subscription_request_filter"/>
</record>
<record id="share_line_form" model="ir.ui.view">
<field name="name">share.line.form</field>
<field name="model">share.line</field>
<field name="arch" type="xml">
<form string="Share line">
<header>
<button string="Update info" name="%(action_view_update_share_line_info)d"
type="action" context="{'default_active_id': active_id}" groups="easy_my_coop.group_easy_my_coop_manager"/>
</header>
<sheet>
<group>
<group>
<field name="partner_id"/>
<field name="share_product_id"/>
<field name="share_number"/>
</group>
<group>
<field name="share_short_name"/>
<field name="share_unit_price"/>
<field name="effective_date"/>
<field name="total_amount_line"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="share_line_tree" model="ir.ui.view">
<field name="name">share.line.tree</field>
<field name="model">share.line</field>
<field name="arch" type="xml">
<tree>
<field name="partner_id"/>
<field name="share_product_id"/>
<field name="share_number"/>
<field name="share_short_name"/>
<field name="share_unit_price"/>
<field name="effective_date"/>
<field name="total_amount_line"/>
</tree>
</field>
</record>
<record id="view_share_line_filter" model="ir.ui.view">
<field name="name">Share Line Search</field>
<field name="model">share.line</field>
<field name="arch" type="xml">
<search string="Search Share Line">
<field name="partner_id"/>
<field name="effective_date"/>
<separator/>
<group name="group_by" string="Group By">
<filter name="cooperator" string="Cooperator" context="{'group_by' : 'partner_id'}" />
<filter name="effective_date" string="Effective date" context="{'group_by': 'effective_date'}"/>
</group>
</search>
</field>
</record>
<record id="share_line_action" model="ir.actions.act_window">
<field name="name">Share Lines</field>
<field name="res_model">share.line</field>
<field name="view_type">form</field>
</record>
</odoo>
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="subscription_request_tree" model="ir.ui.view">
<field name="name">subscription.request.tree</field>
<field name="model">subscription.request</field>
<field name="arch" type="xml">
<!-- fixme no colors in v12 ? -->
<tree string="Subscription Requests"
colors="red:validated == False; blue:state in ('draft'); grey: state in ('done')">
<field name="name"/>
<field name="company_name"/>
<field name="date" string="Request Date"/>
<field name="type"/>
<field name="share_short_name" string="Share Type"/>
<field name="ordered_parts" string="Quantity"
sum="Total ordered parts"/>
<field name="subscription_amount" sum="Total amount"/>
<field name="email"/>
<field name="iban"/>
<field name="partner_id"/>
<field name="source"/>
<field name="state"/>
<field name="validated" invisible="True"/>
<button type="object" string="Validate" aria-label="Validate"
name="validate_subscription_request"
attrs="{'invisible':['|',('state','not in',['draft','waiting']),('validated','=',False)]}"/>
<button type="object" string="Block" aria-label="Block"
name="block_subscription_request" states="draft"
groups="easy_my_coop.group_easy_my_coop_user"/>
<button type="object" string="Unblock" aria-label="Unblock"
name="unblock_subscription_request" states="block"
groups="easy_my_coop.group_easy_my_coop_user"/>
</tree>
</field>
</record>
<record id="subscription_request_form" model="ir.ui.view">
<field name="name">subscription.request.form</field>
<field name="model">subscription.request</field>
<field name="arch" type="xml">
<form string="Subscription Requests">
<header>
<button string="Validate" type="object"
name="validate_subscription_request"
attrs="{'invisible':['|',('state','not in',['draft','waiting']),('validated','=',False)]}"/>
<button string="Waiting list" type="object"
name="put_on_waiting_list" states="draft"/>
<button string="Cancel" type="object"
name="cancel_subscription_request"
states="draft,waiting,done,block"
groups="easy_my_coop.group_easy_my_coop_user"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,cancelled,done,failed"/>
</header>
<sheet>
<group>
<group>
<field name="validated" invisible="True"/>
<field name="already_cooperator"/>
<field name="is_company"
groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="is_operation" invisible="True"/>
<field name="company_name"
attrs="{'invisible':[('is_company','=',False)]}"/>
<field name="company_email"
attrs="{'invisible':[('is_company','=',False)]}"/>
<field name="company_type"
attrs="{'invisible':[('is_company','=',False)]}"/>
<field name="company_register_number"
attrs="{'invisible':[('is_company','=',False)]}"/>
<field name="name"/>
<field name="firstname"/>
<field name="lastname"/>
<field name="birthdate"/>
<field name="gender"/>
<field name="email"/>
<field name="phone"/>
<field name="contact_person_function"
attrs="{'invisible':[('is_company','=',False)]}"/>
<!-- todo highlight iban if not valid -->
<field name="iban"/>
<field name="address"/>
<field name="zip_code"/>
<field name="city"/>
<field name="country_id"
options="{'no_create':True}"/>
</group>
<group>
<field name="capital_release_request_date"
groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="date"/>
<field name="source"/>
<field name="ordered_parts"/>
<field name="share_product_id" widget="selection"/>
<field name="share_short_name"/>
<field name="share_unit_price"/>
<field name="subscription_amount"/>
<field name="partner_id"
options="{'no_create':True}"/>
<field name="type"/>
<field name="lang"/>
<field name="skip_control_ng"/>
<field name="data_policy_approved"/>
</group>
</group>
<notebook>
<page name="capital_release_request"
string="Capital release request">
<field name="capital_release_request">
<tree options="{'no_create':True}">
<field string="Cooperator"
name="partner_id"/>
<field name="date_invoice"/>
<field name="number"/>
<field string="Reference" name="reference"/>
<field name="date_due"/>
<field name="amount_total_signed"/>
<field name="residual_signed"/>
<field name="state"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="view_subscription_request_filter" model="ir.ui.view">
<field name="name">Cooperator Subscription Search</field>
<field name="model">subscription.request</field>
<field name="arch" type="xml">
<search string="Search Subscription Request">
<field name="name"/>
<field name="partner_id"/>
<separator/>
<filter string="Draft" name="state_draft"
domain="[('state','=','draft')]"/>
<filter string="Paid" name="state_paid"
domain="[('state','=','paid')]"/>
<filter string="Done" name="state_done"
domain="[('state','=','done')]"/>
<separator/>
<filter string="Not Validated" name="Not Validated"
domain="[('validated', '=', False)]"/>
<group expand="0" name="group_by" string="Group By">
<filter name="request_type" string="Request type"
context="{'group_by' : 'type'}"/>
<filter name="date" string="Request Date"
context="{'group_by': 'date'}"/>
</group>
</search>
</field>
</record>
<record id="subscription_request_action" model="ir.actions.act_window">
<field name="name">Subscriptions</field>
<field name="res_model">subscription.request</field>
<field name="view_type">form</field>
<field name="domain">[('is_operation','=',False)]</field>
<field name="context">{'default_source':'manual'}</field>
<field name="view_id" ref="subscription_request_tree"/>
<field name="search_view_id" ref="view_subscription_request_filter"/>
</record>
<record id="share_line_form" model="ir.ui.view">
<field name="name">share.line.form</field>
<field name="model">share.line</field>
<field name="arch" type="xml">
<form string="Share line">
<header>
<button string="Update info"
name="%(action_view_update_share_line_info)d"
type="action"
context="{'default_active_id': active_id}"
groups="easy_my_coop.group_easy_my_coop_manager"/>
</header>
<sheet>
<group>
<group>
<field name="partner_id"/>
<field name="share_product_id"/>
<field name="share_number"/>
</group>
<group>
<field name="share_short_name"/>
<field name="share_unit_price"/>
<field name="effective_date"/>
<field name="total_amount_line"/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<record id="share_line_tree" model="ir.ui.view">
<field name="name">share.line.tree</field>
<field name="model">share.line</field>
<field name="arch" type="xml">
<tree>
<field name="partner_id"/>
<field name="share_product_id"/>
<field name="share_number"/>
<field name="share_short_name"/>
<field name="share_unit_price"/>
<field name="effective_date"/>
<field name="total_amount_line"/>
</tree>
</field>
</record>
<record id="view_share_line_filter" model="ir.ui.view">
<field name="name">Share Line Search</field>
<field name="model">share.line</field>
<field name="arch" type="xml">
<search string="Search Share Line">
<field name="partner_id"/>
<field name="effective_date"/>
<separator/>
<group name="group_by" string="Group By">
<filter name="cooperator" string="Cooperator"
context="{'group_by' : 'partner_id'}"/>
<filter name="effective_date" string="Effective date"
context="{'group_by': 'effective_date'}"/>
</group>
</search>
</field>
</record>
<record id="share_line_action" model="ir.actions.act_window">
<field name="name">Share Lines</field>
<field name="res_model">share.line</field>
<field name="view_type">form</field>
</record>
</odoo>

10
easy_my_coop/wizard/account_invoice_refund.py

@ -6,14 +6,14 @@ class AccountInvoiceRefund(models.TransientModel):
_inherit = "account.invoice.refund"
@api.multi
def compute_refund(self, mode='refund'):
def compute_refund(self, mode="refund"):
result = super(AccountInvoiceRefund, self).compute_refund(mode)
context = dict(self._context or {})
inv = self.env['account.invoice'].browse(context.get('active_ids'))
inv = self.env["account.invoice"].browse(context.get("active_ids"))
if inv.release_capital_request:
domain = result['domain']
t = ('release_capital_request', '=', True)
domain = result["domain"]
t = ("release_capital_request", "=", True)
out = [t if e[0] == t[0] else e for e in domain]
result['domain'] = out
result["domain"] = out
return result

83
easy_my_coop/wizard/cooperative_history_wizard.xml

@ -1,41 +1,48 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="view_cooperative_history_wizard" model="ir.ui.view">
<field name="name">cooperative.history.wizard.form</field>
<field name="model">cooperative.history.report</field>
<field name="arch" type="xml">
<form string="Reporting" version="7.0">
<separator string="Cooperative History"/>
<group>
<field name="report"/>
</group>
<label string="This report allows you to print a pdf of history and number of share for each cooperator"/>
<group>
<field name="display_cooperator"/>
</group>
<footer>
<button name="check_report" string="Print" type="object" default_focus="1" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>
<odoo>
<!-- <data>-->
<!-- <record id="view_cooperative_history_wizard" model="ir.ui.view">-->
<!-- <field name="name">cooperative.history.wizard.form</field>-->
<!-- <field name="model">cooperative.history.report</field>-->
<!-- <field name="arch" type="xml">-->
<!-- <form string="Reporting" version="7.0">-->
<!-- <separator string="Cooperative History"/>-->
<!-- <group>-->
<!-- <field name="report"/>-->
<!-- </group>-->
<!-- <label string="This report allows you to print a pdf of history and number of share for each cooperator"/>-->
<!-- <group>-->
<!-- <field name="display_cooperator"/>-->
<!-- </group>-->
<record id="action_cooperative_history_wizard" model="ir.actions.act_window">
<field name="name">Cooperative history</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">cooperative.history.report</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_cooperative_history_wizard"/>
<field name="target">new</field>
<field name="multi">True</field>
</record>
<!-- <footer>-->
<!-- <button name="check_report" string="Print" type="object"-->
<!-- default_focus="1" class="oe_highlight"/>-->
<!-- or-->
<!-- <button string="Cancel" class="oe_link"-->
<!-- special="cancel"/>-->
<!-- </footer>-->
<!-- </form>-->
<!-- </field>-->
<!-- </record>-->
<menuitem id="menu_easy_my_coop_reporting" name="Reporting" parent="menu_main_easy_my_coop" sequence="20"/>
<menuitem id="menu_coop_history_wizard_report" name="Cooperative history report" parent="menu_easy_my_coop_reporting" action="action_cooperative_history_wizard" sequence="10"/>
</data>
</openerp>
<!-- <record id="action_cooperative_history_wizard"-->
<!-- model="ir.actions.act_window">-->
<!-- <field name="name">Cooperative history</field>-->
<!-- <field name="type">ir.actions.act_window</field>-->
<!-- <field name="res_model">cooperative.history.report</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_mode">form</field>-->
<!-- <field name="view_id" ref="view_cooperative_history_wizard"/>-->
<!-- <field name="target">new</field>-->
<!-- <field name="multi">True</field>-->
<!-- </record>-->
<!-- <menuitem id="menu_easy_my_coop_reporting" name="Reporting"-->
<!-- parent="menu_main_easy_my_coop" sequence="20"/>-->
<!-- <menuitem id="menu_coop_history_wizard_report"-->
<!-- name="Cooperative history report"-->
<!-- parent="menu_easy_my_coop_reporting"-->
<!-- action="action_cooperative_history_wizard" sequence="10"/>-->
<!-- </data>-->
</odoo>

216
easy_my_coop/wizard/create_subscription_from_partner.py

@ -1,36 +1,40 @@
from odoo import api, fields, models, _
import odoo.addons.decimal_precision as dp
from odoo import _, api, fields, models
from odoo.exceptions import UserError
import odoo.addons.decimal_precision as dp
class PartnerCreateSubscription(models.TransientModel):
_name = "partner.create.subscription"
_description = "Create Subscription From Partner"
@api.multi
@api.onchange('share_product')
@api.onchange("share_product")
def on_change_share_type(self):
self.share_qty = self.share_product.minimum_quantity
@api.model
def _default_product_id(self):
domain = [('is_share', '=', True),
('default_share_product', '=', True)]
active_id = self.env.context.get('active_id')
domain = [
("is_share", "=", True),
("default_share_product", "=", True),
]
active_id = self.env.context.get("active_id")
if active_id:
partner = self.env['res.partner'].browse(active_id)
partner = self.env["res.partner"].browse(active_id)
if partner.is_company:
domain.append(('by_company', '=', True))
domain.append(("by_company", "=", True))
else:
domain.append(('by_individual', '=', True))
domain.append(("by_individual", "=", True))
return self.env['product.product'].search(domain)[0]
return self.env["product.product"].search(domain)[0]
def _get_representative(self):
partner = self._get_partner()
if partner.is_company:
return partner.search([('parent_id', '=', partner.id),
('representative', '=', True)])
return partner.search(
[("parent_id", "=", partner.id), ("representative", "=", True)]
)
return False
@api.model
@ -49,8 +53,8 @@ class PartnerCreateSubscription(models.TransientModel):
@api.model
def _get_partner(self):
active_id = self.env.context.get('active_id')
return self.env['res.partner'].browse(active_id)
active_id = self.env.context.get("active_id")
return self.env["res.partner"].browse(active_id)
@api.model
def _get_is_company(self):
@ -75,124 +79,140 @@ class PartnerCreateSubscription(models.TransientModel):
@api.model
def _get_possible_share(self):
domain = [('is_share', '=', True)]
domain = [("is_share", "=", True)]
partner = self._get_partner()
if partner.is_company:
domain.append(('by_company', '=', True))
domain.append(("by_company", "=", True))
else:
domain.append(('by_individual', '=', True))
domain.append(("by_individual", "=", True))
return domain
@api.multi
@api.depends('share_product', 'share_qty')
@api.depends("share_product", "share_qty")
def _compute_subscription_amount(self):
for sub_request in self:
sub_request.subscription_amount = (sub_request.
share_product.list_price *
sub_request.share_qty)
is_company = fields.Boolean(String="Is company?",
default=_get_is_company)
cooperator = fields.Many2one('res.partner',
string="Cooperator",
default=_get_partner)
register_number = fields.Char(string="Register Company Number",
default=_get_register_number)
email = fields.Char(string="Email",
required=True,
default=_get_email)
bank_account = fields.Char(string="Bank account",
required=True,
default=_get_bank_account)
share_product = fields.Many2one('product.product',
string='Share Type',
domain=_get_possible_share,
default=_default_product_id,
required=True)
share_qty = fields.Integer(string="Share Quantity",
required=True)
share_unit_price = fields.Float(related='share_product.list_price',
string='Share price',
readonly=True)
subscription_amount = fields.Float(compute='_compute_subscription_amount',
string='Subscription amount',
digits=dp.get_precision('Account'),
readonly=True)
representative_name = fields.Char(string='Representative name',
default=_get_representative_name)
representative_email = fields.Char(string='Representative email',
default=_get_representative_email)
sub_request.subscription_amount = (
sub_request.share_product.list_price * sub_request.share_qty
)
is_company = fields.Boolean(String="Is company?", default=_get_is_company)
cooperator = fields.Many2one(
"res.partner", string="Cooperator", default=_get_partner
)
register_number = fields.Char(
string="Register Company Number", default=_get_register_number
)
email = fields.Char(string="Email", required=True, default=_get_email)
bank_account = fields.Char(
string="Bank account", required=True, default=_get_bank_account
)
share_product = fields.Many2one(
"product.product",
string="Share Type",
domain=_get_possible_share,
default=_default_product_id,
required=True,
)
share_qty = fields.Integer(string="Share Quantity", required=True)
share_unit_price = fields.Float(
related="share_product.list_price", string="Share price", readonly=True
)
subscription_amount = fields.Float(
compute="_compute_subscription_amount",
string="Subscription amount",
digits=dp.get_precision("Account"),
readonly=True,
)
representative_name = fields.Char(
string="Representative name", default=_get_representative_name
)
representative_email = fields.Char(
string="Representative email", default=_get_representative_email
)
@api.multi
def create_subscription(self):
sub_req = self.env['subscription.request']
partner_obj = self.env['res.partner']
sub_req = self.env["subscription.request"]
partner_obj = self.env["res.partner"]
cooperator = self.cooperator
vals = {'partner_id': cooperator.id,
'share_product_id': self.share_product.id,
'ordered_parts': self.share_qty,
'cooperator': True,
'user_id': self.env.uid,
'email': self.email,
'source': 'crm',
'address': self.cooperator.street,
'zip_code': self.cooperator.zip,
'city': self.cooperator.city,
'country_id': self.cooperator.country_id.id
}
vals = {
"partner_id": cooperator.id,
"share_product_id": self.share_product.id,
"ordered_parts": self.share_qty,
"cooperator": True,
"user_id": self.env.uid,
"email": self.email,
"source": "crm",
"address": self.cooperator.street,
"zip_code": self.cooperator.zip,
"city": self.cooperator.city,
"country_id": self.cooperator.country_id.id,
}
if self.is_company:
vals['company_name'] = cooperator.name
vals['company_email'] = cooperator.email
vals['name'] = '/'
vals['company_register_number'] = self.register_number
vals['is_company'] = True
vals["company_name"] = cooperator.name
vals["company_email"] = cooperator.email
vals["name"] = "/"
vals["company_register_number"] = self.register_number
vals["is_company"] = True
else:
vals['name'] = cooperator.name
vals["name"] = cooperator.name
coop_vals = {}
if not self._get_email():
coop_vals['email'] = self.email
coop_vals["email"] = self.email
if not self._get_register_number():
if self.is_company:
coop_vals['company_register_number'] = self.register_number
coop_vals["company_register_number"] = self.register_number
if self.is_company and not self._get_representative():
representative = False
if self.representative_email:
representative = partner_obj.search(
[('email', '=', self.representative_email)])
[("email", "=", self.representative_email)]
)
if representative:
if len(representative) > 1:
raise UserError(_('There is two different persons with '
'the same national register number. '
'Please proceed to a merge before to '
'continue'))
raise UserError(
_(
"There is two different persons with "
"the same national register number. "
"Please proceed to a merge before to "
"continue"
)
)
if representative.parent_id:
raise UserError(_("A person can't be representative of "
"two different companies."))
raise UserError(
_(
"A person can't be representative of "
"two different companies."
)
)
representative.parent_id = cooperator.id
else:
if self.representative_email:
represent_vals = {'name': self.representative_name,
'cooperator': True,
'email': self.representative_email,
'parent_id': cooperator.id,
'representative': True}
represent_vals = {
"name": self.representative_name,
"cooperator": True,
"email": self.representative_email,
"parent_id": cooperator.id,
"representative": True,
}
partner_obj.create(represent_vals)
if not self._get_bank_account():
partner_bank = self.env['res.partner.bank']
partner_bank.create({'partner_id': cooperator.id,
'acc_number': self.bank_account})
vals['iban'] = self.bank_account
partner_bank = self.env["res.partner.bank"]
partner_bank.create(
{"partner_id": cooperator.id, "acc_number": self.bank_account}
)
vals["iban"] = self.bank_account
if self.is_company:
representative = self._get_representative()
vals['name'] = representative.name
vals["name"] = representative.name
if coop_vals:
cooperator.write(coop_vals)
@ -200,10 +220,10 @@ class PartnerCreateSubscription(models.TransientModel):
new_sub_req = sub_req.create(vals)
return {
'type': 'ir.actions.act_window',
'view_type': 'form, tree',
'view_mode': 'form',
'res_model': 'subscription.request',
'res_id': new_sub_req.id,
'target': 'current',
"type": "ir.actions.act_window",
"view_type": "form, tree",
"view_mode": "form",
"res_model": "subscription.request",
"res_id": new_sub_req.id,
"target": "current",
}

41
easy_my_coop/wizard/create_subscription_from_partner.xml

@ -7,37 +7,46 @@
<field name="arch" type="xml">
<form string="Create Subscription">
<p class="oe_grey">
Subscription request will be created with data from the partner.
Subscription request will be created with data from the
partner.
</p>
<group>
<field name="is_company" invisible="True"/>
<field name="cooperator" invisible="True"/>
<field name="representative_name" attrs="{'invisible':[('is_company','=',False)],'required':[('is_company','=',True)]}"/>
<field name="representative_email" attrs="{'invisible':[('is_company','=',False)],'required':[('is_company','=',True)]}"/>
<field name="email"/>
<field name="register_number" attrs="{'invisible':[('is_company','=',False)],'required':[('is_company','=',True)]}"/>
<field name="bank_account"/>
<field name="share_product" widget="selection"/>
<field name="share_qty"/>
<field name="share_unit_price"/>
<field name="subscription_amount"/>
<field name="is_company" invisible="True"/>
<field name="cooperator" invisible="True"/>
<field name="representative_name"
attrs="{'invisible':[('is_company','=',False)],'required':[('is_company','=',True)]}"/>
<field name="representative_email"
attrs="{'invisible':[('is_company','=',False)],'required':[('is_company','=',True)]}"/>
<field name="email"/>
<field name="register_number"
attrs="{'invisible':[('is_company','=',False)],'required':[('is_company','=',True)]}"/>
<field name="bank_account"/>
<field name="share_product" widget="selection"/>
<field name="share_qty"/>
<field name="share_unit_price"/>
<field name="subscription_amount"/>
</group>
<footer>
<button name="create_subscription" string="Create Subscription" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-default" special="cancel"/>
<button name="create_subscription"
string="Create Subscription" type="object"
class="btn-primary"/>
<button string="Cancel" class="btn-default"
special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_view_create_subscription" model="ir.actions.act_window">
<record id="action_view_create_subscription"
model="ir.actions.act_window">
<field name="name">Create Subscription</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">partner.create.subscription</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="groups_id" eval="[(4,ref('easy_my_coop.group_easy_my_coop_user'))]"/>
<field name="groups_id"
eval="[(4,ref('easy_my_coop.group_easy_my_coop_user'))]"/>
</record>
</data>

49
easy_my_coop/wizard/update_partner_info.py

@ -7,8 +7,8 @@ class PartnerUpdateInfo(models.TransientModel):
@api.model
def _get_partner(self):
active_id = self.env.context.get('active_id')
return self.env['res.partner'].browse(active_id)
active_id = self.env.context.get("active_id")
return self.env["res.partner"].browse(active_id)
@api.model
def _get_register_number(self):
@ -20,13 +20,13 @@ class PartnerUpdateInfo(models.TransientModel):
def _get_is_company(self):
return self._get_partner().is_company
is_company = fields.Boolean(string="Is company",
default=_get_is_company)
register_number = fields.Char(string="Register Company Number",
default=_get_register_number)
cooperator = fields.Many2one('res.partner',
string="Cooperator",
default=_get_partner)
is_company = fields.Boolean(string="Is company", default=_get_is_company)
register_number = fields.Char(
string="Register Company Number", default=_get_register_number
)
cooperator = fields.Many2one(
"res.partner", string="Cooperator", default=_get_partner
)
all = fields.Boolean(string="Update from subscription request")
birthdate = fields.Boolean(string="Set missing birth date")
legal_form = fields.Boolean(string="Set legal form")
@ -34,41 +34,50 @@ class PartnerUpdateInfo(models.TransientModel):
@api.multi
def update(self):
partner_obj = self.env['res.partner']
partner_obj = self.env["res.partner"]
cooperator = self.cooperator
coop_vals = {}
if self.all:
if self.legal_form or self.representative_function:
coops = partner_obj.search([('cooperator', '=', True),
('is_company', '=', True)])
coops = partner_obj.search(
[("cooperator", "=", True), ("is_company", "=", True)]
)
for coop in coops:
coop_vals = {}
sub_reqs = coop.subscription_request_ids.filtered(lambda r: r.state in ['done', 'paid'])
sub_reqs = coop.subscription_request_ids.filtered(
lambda r: r.state in ["done", "paid"]
)
if sub_reqs:
sub_req = sub_reqs[0]
if self.legal_form:
coop_vals['legal_form'] = sub_req.company_type
coop_vals["legal_form"] = sub_req.company_type
coop.write(coop_vals)
if self.representative_function:
contact = coop.get_representative()
contact.function = sub_req.contact_person_function
else:
coops = partner_obj.search([('cooperator', '=', True),
('birthdate_date', '=', False),
('is_company', '=', False)])
coops = partner_obj.search(
[
("cooperator", "=", True),
("birthdate_date", "=", False),
("is_company", "=", False),
]
)
for coop in coops:
coop_vals = {}
sub_reqs = coop.subscription_request_ids.filtered(lambda r: r.state in ['done', 'paid'])
sub_reqs = coop.subscription_request_ids.filtered(
lambda r: r.state in ["done", "paid"]
)
if sub_reqs:
sub_req = sub_reqs[0]
if self.birthdate:
coop_vals['birthdate_date'] = sub_req.birthdate
coop_vals["birthdate_date"] = sub_req.birthdate
coop.write(coop_vals)
else:
if cooperator:
if cooperator.is_company:
coop_vals['company_register_number'] = self.register_number
coop_vals["company_register_number"] = self.register_number
if coop_vals:
cooperator.write(coop_vals)

27
easy_my_coop/wizard/update_partner_info.xml

@ -10,30 +10,35 @@
Update Cooperator Info.
</p>
<group>
<field name="is_company" invisible="True"/>
<field name="all"/>
<field name="birthdate"/>
<field name="legal_form"/>
<field name="representative_function"/>
<field name="cooperator" readonly="True"/>
<field name="register_number" attrs="{'required':['|', ('is_company', '=', True), ('all', '=', False)], 'invisible':[('is_company', '=', False)]}"/>
<field name="is_company" invisible="True"/>
<field name="all"/>
<field name="birthdate"/>
<field name="legal_form"/>
<field name="representative_function"/>
<field name="cooperator" readonly="True"/>
<field name="register_number"
attrs="{'required':['|', ('is_company', '=', True), ('all', '=', False)], 'invisible':[('is_company', '=', False)]}"/>
</group>
<footer>
<button name="update" string="Update Info" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-default" special="cancel"/>
<button name="update" string="Update Info" type="object"
class="btn-primary"/>
<button string="Cancel" class="btn-default"
special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_view_update_partner_info" model="ir.actions.act_window">
<record id="action_view_update_partner_info"
model="ir.actions.act_window">
<field name="name">Update Cooperator Info</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">partner.update.info</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="groups_id" eval="[(4,ref('easy_my_coop.group_easy_my_coop_user'))]"/>
<field name="groups_id"
eval="[(4,ref('easy_my_coop.group_easy_my_coop_user'))]"/>
</record>
</data>

44
easy_my_coop/wizard/update_share_line.py

@ -1,4 +1,4 @@
from odoo import api, fields, models, _
from odoo import _, api, fields, models
from odoo.exceptions import UserError
@ -8,8 +8,8 @@ class ShareLineUpdateInfo(models.TransientModel):
@api.model
def _get_share_line(self):
active_id = self.env.context.get('active_id')
return self.env['share.line'].browse(active_id)
active_id = self.env.context.get("active_id")
return self.env["share.line"].browse(active_id)
@api.model
def _get_effective_date(self):
@ -17,14 +17,15 @@ class ShareLineUpdateInfo(models.TransientModel):
return share_line.effective_date
effective_date = fields.Date(string="effective date",
required=True,
default=_get_effective_date)
cooperator = fields.Many2one(related='share_line.partner_id',
string="Cooperator")
share_line = fields.Many2one('share.line',
string="Share line",
default=_get_share_line)
effective_date = fields.Date(
string="effective date", required=True, default=_get_effective_date
)
cooperator = fields.Many2one(
related="share_line.partner_id", string="Cooperator"
)
share_line = fields.Many2one(
"share.line", string="Share line", default=_get_share_line
)
@api.multi
def update(self):
@ -32,15 +33,22 @@ class ShareLineUpdateInfo(models.TransientModel):
line = self.share_line
cooperator = line.partner_id
sub_reg = self.env['subscription.register'].search(
[('partner_id', '=', cooperator.id),
('share_product_id', '=', line.share_product_id.id),
('quantity', '=', line.share_number),
('date', '=', line.effective_date)])
sub_reg = self.env["subscription.register"].search(
[
("partner_id", "=", cooperator.id),
("share_product_id", "=", line.share_product_id.id),
("quantity", "=", line.share_number),
("date", "=", line.effective_date),
]
)
if sub_reg:
if len(sub_reg) > 1:
raise UserError(_("Error the update return more than one"
" subscription register lines."))
raise UserError(
_(
"Error the update return more than one"
" subscription register lines."
)
)
else:
line.effective_date = self.effective_date
sub_reg.date = self.effective_date

76
easy_my_coop/wizard/update_share_line.xml

@ -1,36 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_update_share_line_info" model="ir.ui.view">
<field name="name">Update Share line Info</field>
<field name="model">share.line.update.info</field>
<field name="arch" type="xml">
<form string="Update Share Line Info">
<p class="oe_grey">
Update Share Line Info.
</p>
<group>
<field name="cooperator" readonly="True"/>
<field name="share_line" readonly="True"/>
<field name="effective_date"/>
</group>
<footer>
<button name="update" string="Update Info" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_view_update_share_line_info" model="ir.actions.act_window">
<field name="name">Update Share Line Info</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">share.line.update.info</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="groups_id" eval="[(4,ref('easy_my_coop.group_easy_my_coop_manager'))]"/>
</record>
</data>
</odoo>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_update_share_line_info" model="ir.ui.view">
<field name="name">Update Share line Info</field>
<field name="model">share.line.update.info</field>
<field name="arch" type="xml">
<form string="Update Share Line Info">
<p class="oe_grey">
Update Share Line Info.
</p>
<group>
<field name="cooperator" readonly="True"/>
<field name="share_line" readonly="True"/>
<field name="effective_date"/>
</group>
<footer>
<button name="update" string="Update Info" type="object"
class="btn-primary"/>
<button string="Cancel" class="btn-default"
special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="action_view_update_share_line_info"
model="ir.actions.act_window">
<field name="name">Update Share Line Info</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">share.line.update.info</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="groups_id"
eval="[(4,ref('easy_my_coop.group_easy_my_coop_manager'))]"/>
</record>
</data>
</odoo>

8
easy_my_coop/wizard/validate_subscription_request.py

@ -7,10 +7,12 @@ class ValidateSubscriptionRequest(models.TransientModel):
@api.multi
def validate(self):
selected_requests = self.env['subscription.request'].browse(
self._context.get('active_ids'))
selected_requests = self.env["subscription.request"].browse(
self._context.get("active_ids")
)
subscription_requests = selected_requests.filtered(
lambda record: record.state in ['draft', 'waiting'])
lambda record: record.state in ["draft", "waiting"]
)
for subscription_request in subscription_requests:
subscription_request.validate_subscription_request()

17
easy_my_coop/wizard/validate_subscription_request.xml

@ -9,17 +9,20 @@
Validate the subscription request.
</p>
<footer>
<button name="validate" string="Validate" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-default" special="cancel"/>
<button name="validate" string="Validate" type="object"
class="btn-primary"/>
<button string="Cancel" class="btn-default"
special="cancel"/>
</footer>
</form>
</field>
</record>
<act_window id="action_account_invoice_confirm"
multi="True"
key2="client_action_multi" name="Validate subscription request"
res_model="validate.subscription.request" src_model="subscription.request"
view_mode="form" target="new" view_type="form" />
<act_window id="action_account_invoice_confirm"
multi="True"
key2="client_action_multi" name="Validate subscription request"
res_model="validate.subscription.request"
src_model="subscription.request"
view_mode="form" target="new" view_type="form"/>
</odoo>

58
easy_my_coop_be/README.rst

@ -0,0 +1,58 @@
====================
Easy My Coop Belgium
====================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-coopiteasy%2Fvertical--cooperative-lightgray.png?logo=github
:target: https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_be
:alt: coopiteasy/vertical-cooperative
|badge1| |badge2| |badge3|
This is the belgian localization for the easy my coop module.
**Table of contents**
.. contents::
:local:
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/coopiteasy/vertical-cooperative/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/coopiteasy/vertical-cooperative/issues/new?body=module:%20easy_my_coop_be%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Coop IT Easy SCRLfs
Contributors
~~~~~~~~~~~~
* Coop IT Easy SCRLfs
Maintainers
~~~~~~~~~~~
This module is part of the `coopiteasy/vertical-cooperative <https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_be>`_ project on GitHub.
You are welcome to contribute.

2
easy_my_coop_be/__init__.py

@ -1 +1 @@
from . import models
from . import models

19
easy_my_coop_be/__manifest__.py

@ -3,20 +3,15 @@
# - Houssine BAKKALI - <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).#
{
"name": "Easy My Coop Be",
"name": "Easy My Coop Belgium",
"summary": "Easy My Coop Belgium Localization",
"version": "12.0.1.2.0",
"depends": ["easy_my_coop",
"l10n_be",
"l10n_be_invoice_bba",
],
"author": "Houssine BAKKALI <houssine@coopiteasy.be>",
"depends": ["easy_my_coop", "l10n_be", "l10n_be_invoice_bba"],
"author": "Coop IT Easy SCRLfs",
"category": "Cooperative management",
"website": "www.coopiteasy.be",
"license": "AGPL-3",
"description": """
This is the belgian localization for the easy my coop module.
""",
'data': [],
'installable': True,
'application': False,
"data": [],
"installable": True,
"application": False,
}

4
easy_my_coop_be/models/__init__.py

@ -1,2 +1,2 @@
from . import coop
from . import partner
from . import coop
from . import partner

53
easy_my_coop_be/models/coop.py

@ -1,27 +1,26 @@
from odoo import fields, models
class SubscriptionRequest(models.Model):
_inherit = 'subscription.request'
company_type = fields.Selection([('scrl', 'SCRL'),
('asbl', 'ASBL'),
('sprl', 'SPRL'),
('sa', 'SA')])
def get_partner_company_vals(self):
vals = super(SubscriptionRequest, self).get_partner_company_vals()
vals['out_inv_comm_algorithm'] = 'random'
return vals
def get_partner_vals(self):
vals = super(SubscriptionRequest, self).get_partner_vals()
vals['out_inv_comm_type'] = 'bba'
vals['out_inv_comm_algorithm'] = 'random'
return vals
def get_representative_valst(self):
vals = super(SubscriptionRequest, self).get_representative_vals()
vals['out_inv_comm_type'] = 'bba'
vals['out_inv_comm_algorithm'] = 'random'
return vals
from odoo import fields, models
class SubscriptionRequest(models.Model):
_inherit = "subscription.request"
company_type = fields.Selection(
[("scrl", "SCRL"), ("asbl", "ASBL"), ("sprl", "SPRL"), ("sa", "SA")]
)
def get_partner_company_vals(self):
vals = super(SubscriptionRequest, self).get_partner_company_vals()
vals["out_inv_comm_algorithm"] = "random"
return vals
def get_partner_vals(self):
vals = super(SubscriptionRequest, self).get_partner_vals()
vals["out_inv_comm_type"] = "bba"
vals["out_inv_comm_algorithm"] = "random"
return vals
def get_representative_valst(self):
vals = super(SubscriptionRequest, self).get_representative_vals()
vals["out_inv_comm_type"] = "bba"
vals["out_inv_comm_algorithm"] = "random"
return vals

24
easy_my_coop_be/models/partner.py

@ -1,10 +1,14 @@
from odoo import fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
legal_form = fields.Selection(selection_add=[('scrl', 'SCRL'),
('asbl', 'ASBL'),
('sprl', 'SPRL'),
('sa', 'SA')])
from odoo import fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
legal_form = fields.Selection(
selection_add=[
("scrl", "SCRL"),
("asbl", "ASBL"),
("sprl", "SPRL"),
("sa", "SA"),
]
)

1
easy_my_coop_be/readme/CONTRIBUTORS.rst

@ -0,0 +1 @@
* Coop IT Easy SCRLfs

1
easy_my_coop_be/readme/DESCRIPTION.rst

@ -0,0 +1 @@
This is the belgian localization for the easy my coop module.

414
easy_my_coop_be/static/description/index.html

@ -0,0 +1,414 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Easy My Coop Belgium</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="easy-my-coop-belgium">
<h1 class="title">Easy My Coop Belgium</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_be"><img alt="coopiteasy/vertical-cooperative" src="https://img.shields.io/badge/github-coopiteasy%2Fvertical--cooperative-lightgray.png?logo=github" /></a></p>
<p>This is the belgian localization for the easy my coop module.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/issues/new?body=module:%20easy_my_coop_be%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Coop IT Easy SCRLfs</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li>Coop IT Easy SCRLfs</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_be">coopiteasy/vertical-cooperative</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

55
easy_my_coop_ch/README.rst

@ -0,0 +1,55 @@
========================
Easy My Coop Switzerland
========================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/github-coopiteasy%2Fvertical--cooperative-lightgray.png?logo=github
:target: https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_ch
:alt: coopiteasy/vertical-cooperative
|badge1| |badge2|
This is the swiss localization for the easy my coop module
**Table of contents**
.. contents::
:local:
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/coopiteasy/vertical-cooperative/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/coopiteasy/vertical-cooperative/issues/new?body=module:%20easy_my_coop_ch%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Houssine BAKKALI <houssine@coopiteasy.be>
Contributors
~~~~~~~~~~~~
* Coop IT Easy SCRLfs
Maintainers
~~~~~~~~~~~
This module is part of the `coopiteasy/vertical-cooperative <https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_ch>`_ project on GitHub.
You are welcome to contribute.

2
easy_my_coop_ch/__init__.py

@ -1 +1 @@
from . import models
from . import models

46
easy_my_coop_ch/__manifest__.py

@ -1,37 +1,19 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013-2017 Open Architects Consulting SPRL.
# Copyright (C) 2018- Coop IT Easy SCRLfs.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
# Copyright 2013-2018 Open Architects Consulting SPRL.
# Copyright 2018 Coop IT Easy SCRLfs (<http://www.coopiteasy.be>)
# - Houssine BAKKALI - <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Easy My Coop CH",
"name": "Easy My Coop Switzerland",
"summary": "Easy My Coop Switzerland localization",
"version": "12.0.1.0.2",
"depends": ["easy_my_coop",
"l10n_ch"],
"author": "Houssine BAKKALI <houssine@coopiteasy.be>",
"license": "AGPL-3",
"depends": ["easy_my_coop", "easy_my_coop_website", "l10n_ch"],
"author": "Coop IT Easy SCRLfs",
"category": "Cooperative management",
'webstite': "www.coopiteasy.be",
"description": """
This is the swiss localization for the easy my coop module
""",
'data': [
'views/subscription_template.xml',
'views/subscription_request_view.xml'
"webstite": "www.coopiteasy.be",
"data": [
"views/subscription_template.xml",
# "views/subscription_request_view.xml",
],
'installable': True,
"installable": True,
}

4
easy_my_coop_ch/models/__init__.py

@ -1,2 +1,2 @@
from . import coop
from . import partner
from . import coop
from . import partner

47
easy_my_coop_ch/models/coop.py

@ -1,22 +1,25 @@
from odoo import fields, models
class SubscriptionRequest(models.Model):
_inherit = 'subscription.request'
company_type = fields.Selection(selection_add=[
('ei', 'Individual company'),
('snc', 'Partnership'),
('sa', 'Limited company (SA)'),
('sarl', 'Limited liability company (Ltd)'), #noqa
('sc', 'Cooperative'),
('asso', 'Association'),
('fond', 'Foundation'),
('edp', 'Company under public law')])
def get_required_field(self):
req_fields = super(SubscriptionRequest, self).get_required_field()
if 'iban' in req_fields:
req_fields.remove('iban')
return req_fields
from odoo import fields, models
class SubscriptionRequest(models.Model):
_inherit = "subscription.request"
company_type = fields.Selection(
selection_add=[
("ei", "Individual company"),
("snc", "Partnership"),
("sa", "Limited company (SA)"),
("sarl", "Limited liability company (Ltd)"), # noqa
("sc", "Cooperative"),
("asso", "Association"),
("fond", "Foundation"),
("edp", "Company under public law"),
]
)
def get_required_field(self):
req_fields = super(SubscriptionRequest, self).get_required_field()
if "iban" in req_fields:
req_fields.remove("iban")
return req_fields

34
easy_my_coop_ch/models/partner.py

@ -1,16 +1,18 @@
from odoo import fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
legal_form = fields.Selection(selection_add=[
('ei', 'Individual company'),
('snc', 'Partnership'),
('sa', 'Limited company (SA)'),
('sarl', 'Limited liability company (Ltd)'),
('sc', 'Cooperative'),
('asso', 'Association'),
('fond', 'Foundation'),
('edp', 'Company under public law')
])
from odoo import fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
legal_form = fields.Selection(
selection_add=[
("ei", "Individual company"),
("snc", "Partnership"),
("sa", "Limited company (SA)"),
("sarl", "Limited liability company (Ltd)"),
("sc", "Cooperative"),
("asso", "Association"),
("fond", "Foundation"),
("edp", "Company under public law"),
]
)

2
easy_my_coop_ch/readme/CONTRIBUTORS.rst

@ -0,0 +1,2 @@
* Coop IT Easy SCRLfs
* Houssine BAKKALI <houssine@coopiteasy.be>

1
easy_my_coop_ch/readme/DESCRIPTION.rst

@ -0,0 +1 @@
This is the swiss localization for the easy my coop module

414
easy_my_coop_ch/static/description/index.html

@ -0,0 +1,414 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Easy My Coop Switzerland</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="easy-my-coop-switzerland">
<h1 class="title">Easy My Coop Switzerland</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_ch"><img alt="coopiteasy/vertical-cooperative" src="https://img.shields.io/badge/github-coopiteasy%2Fvertical--cooperative-lightgray.png?logo=github" /></a></p>
<p>This is the swiss localization for the easy my coop module</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/issues/new?body=module:%20easy_my_coop_ch%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Houssine BAKKALI &lt;<a class="reference external" href="mailto:houssine&#64;coopiteasy.be">houssine&#64;coopiteasy.be</a>&gt;</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li>Coop IT Easy SCRLfs</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_ch">coopiteasy/vertical-cooperative</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

63
easy_my_coop_ch/views/certificate_template.xml

@ -1,63 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="certificate_i18n_fr" inherit_id="easy_my_coop.cooperator_certificat_G001_document" name="French Layout Certificate">
<xpath expr="//div[@name='label_coop_number']" position="replace">
<div name="label_coop_number" style="position:relative;top:35px;font-size:16;">
<span>Ce document atteste de la souscription de parts sociales au capital de la SAS Coopérative à Capital Variable SuperQuinquin par </span>
<b><span t-field="o.name"></span></b>
<span>, enregistré(e) sous le <b>numéro de coopérateur </b></span>
<span t-field="o.cooperator_register_number"></span>
</div>
</xpath>
<xpath expr="//div[@name='total_table']" position="after">
<div name="legal_text" style="position:relative;top:145px;font-size:12;">
<div>Ce document atteste d’une souscription en numéraire au capital d’une société, répondant à la définition communautaire de la Petite et Moyenne Entreprise, dont les titres ne sont pas admis aux négociations sur un marché d’instruments financiers français ou étranger en application de l’article 199 terdecies 0A du CGI.<br/>
Conformément aux statuts, les souscriptions de parts sociales de type A et B n’ouvre pas droit à rémunération.<br/>
La société remplit les conditions mentionnées aux c, d et e du 2° du I de l’article 199 terdecies-0 A du code général des impôts : <br/>
c) La société est soumise à l’impôt sur les sociétés dans les conditions de droit commun ;<br/>
<br/>
c bis) La société compte au moins deux salariés à la clôture de son premier exercice ou un salarié si elle est soumise à l’obligation de s’inscrire à la chambre de métiers et de l’artisanat ;<br/>
<br/>
d) La société exerce une activité commerciale, industrielle, artisanale, libérale ou agricole, à l’exclusion des activités procurant des revenus garantis en raison de l’existence d’un tarif réglementé de rachat de la production, des activités financières, des activités de gestion de patrimoine mobilier définie à l’article 885 O quater et des activités immobilières. Toutefois, les exclusions relatives à l’exercice d’une activité financière ou immobilière ne sont pas applicables aux entreprises solidaires mentionnées à l’article L. 3332-17-1 du code du travail.<br/>
La société n’exerce pas une activité de production d’électricité utilisant l’énergie radiative du soleil ;<br/>
<br/>
d bis) Les actifs de la société ne sont pas constitués de façon prépondérante de métaux précieux, d’œuvres d’art, d’objets de collection, d’antiquités, de chevaux de course ou de concours ou, sauf si l’objet même de son activité consiste en leur consommation ou en leur vente au détail, de vins ou d’alcools ;<br/>
<br/>
d ter) Les souscriptions au capital de la société confèrent aux souscripteurs les seuls droits résultant de la qualité d’actionnaire ou d’associé, à l’exclusion de toute autre contrepartie notamment sous la forme de tarifs préférentiels ou d’accès prioritaire aux biens produits ou aux services rendus par la société ;<br/>
<br/>
e) La société doit être une petite et moyenne entreprise qui satisfait à la définition des petites et moyennes entreprises qui figure à l’annexe I au règlement (CE) n° 800/2008 de la Commission du 6 août 2008 déclarant certaines catégories d’aide compatibles avec le marché commun en application des articles 87 et 88 du traité (Règlement général d’exemption par catégorie) ;<br/>
</div>
</div>
</xpath>
<xpath expr="//div[@name='board_commitee']" position="replace">
<div name="" class="col-xs-6 pull-left" style="position:relative;top:105px;font-size:20;color:black;font-family:Roboto-Regular;">
<div style="position:relative;top:105px;">
Pour le Conseil d'administration de <span t-field="o.company_id.name"/>.
</div>
<div style="position:relative;top:110px;">
<strong><span t-field="o.company_id.board_representative"/></strong>
</div>
<div style="position:relative;top:115px;">
<img t-if="o.company_id.signature_scan" t-att-src="'data:image/png;base64,%s' % o.company_id.signature_scan" style="width:240px;height:180px;padding-bottom:5px;"/>
</div>
</div>
</xpath>
</template>
<template id="capital_release_request_i18n_fr" inherit_id="easy_my_coop.theme_invoice_G002_document" name="French Layout Certificate">
<xpath expr="//p[@t-if='o.comment']" position="before">
<div class="row">
<div style="position:relative;top:225px;font-size:16;">
Votre demande de souscription de parts sociales, détaillé dans le tableau ci-dessus, a bien été prise en compte.<br/>
<br/>
Afin de valider votre enregistrement en tant que coopérateur, vous devez tout d’abord procéder au paiement de celles-ci.<br/>
<br/>
Un email contenant les instructions de paiement vous a également été envoyé.<br/>
</div>
</div>
</xpath>
</template>
</data>
</odoo>

65
easy_my_coop_ch/views/subscription_template.xml

@ -1,26 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="subscription_i18n_ch" inherit_id="easy_my_coop_website.becomecooperator" name="Removing fields">
<xpath expr="//label[@for='iban']/.." position="replace">
<div t-attf-class="form-group #{error and 'iban' in error and 'has-error' or ''}">
<label class="col-md-3 col-sm-4 control-label" for="iban">Bank Account Number</label>
<div class="col-md-7 col-sm-8">
<input type="text" class="form-control mandatory-field" name="iban" t-attf-value="#{iban or ''}" placeholder="BE48523080767127"/>
</div>
</div>
</xpath>
</template>
<template id="company_subscription_i18n_ch" inherit_id="easy_my_coop_website.becomecompanycooperator" name="Company Removing fields">
<xpath expr="//label[@for='iban']/.." position="replace">
<div t-attf-class="form-group #{error and 'iban' in error and 'has-error' or ''}">
<label class="col-md-3 col-sm-4 control-label" for="iban">Bank Account Number</label>
<div class="col-md-7 col-sm-8">
<input type="text" class="form-control mandatory-field" name="iban" t-attf-value="#{iban or ''}" placeholder="BE48523080767127"/>
</div>
</div>
</xpath>
</template>
</data>
</odoo>
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="subscription_i18n_ch"
inherit_id="easy_my_coop_website.becomecooperator"
name="Removing fields">
<!-- fixme instead of removing here, it should be added in easy_my_coop_be -->
<xpath expr="//label[@for='iban']/.." position="replace">
<div t-attf-class="form-group #{error and 'iban' in error and 'has-error' or ''}">
<label class="col-md-3 col-sm-4 control-label" for="iban">
Bank Account Number
</label>
<div class="col-md-7 col-sm-8">
<input type="text" class="form-control mandatory-field"
name="iban" t-attf-value="#{iban or ''}"
placeholder="BE48523080767127"/>
</div>
</div>
</xpath>
</template>
<template id="company_subscription_i18n_ch"
inherit_id="easy_my_coop_website.becomecompanycooperator"
name="Company Removing fields">
<xpath expr="//label[@for='iban']/.." position="replace">
<div t-attf-class="form-group #{error and 'iban' in error and 'has-error' or ''}">
<label class="col-md-3 col-sm-4 control-label" for="iban">
Bank Account Number
</label>
<div class="col-md-7 col-sm-8">
<input type="text" class="form-control mandatory-field"
name="iban" t-attf-value="#{iban or ''}"
placeholder="BE48523080767127"/>
</div>
</div>
</xpath>
</template>
</data>
</odoo>

62
easy_my_coop_dividend/README.rst

@ -0,0 +1,62 @@
============================
Easy My Coop Dividend Engine
============================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-coopiteasy%2Fvertical--cooperative-lightgray.png?logo=github
:target: https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_dividend
:alt: coopiteasy/vertical-cooperative
|badge1| |badge2| |badge3|
This module allows to calculate the dividend to give to a cooperator base
on the amount of his shares, the percentage allocated and for how long the
shares have been owned on prorata temporis calculation.
**Table of contents**
.. contents::
:local:
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/coopiteasy/vertical-cooperative/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/coopiteasy/vertical-cooperative/issues/new?body=module:%20easy_my_coop_dividend%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Houssine BAKKALI
* <houssine@coopiteasy.be>
Contributors
~~~~~~~~~~~~
* Coop IT Easy SCRLfs
* Houssine BAKKALI, <houssine@coopiteasy.be>
Maintainers
~~~~~~~~~~~
This module is part of the `coopiteasy/vertical-cooperative <https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_dividend>`_ project on GitHub.
You are welcome to contribute.

1
easy_my_coop_dividend/__init__.py

@ -1,2 +1 @@
# -*- coding: utf8 -*-
from . import models

38
easy_my_coop_dividend/__openerp__.py → easy_my_coop_dividend/__manifest__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2013-2018 Open Architects Consulting SPRL.
# Copyright (C) 2013-2018 Coop IT Easy SCRLfs.
#
@ -20,30 +18,16 @@
{
'name': 'Easy My Coop Dividend Engine',
'summary': """
Manage the dividend calculation for a fiscal year.
"name": "Easy My Coop Dividend Engine",
"summary": """
Manage the dividend computation for a fiscal year.
""",
'description': """
This module allows to calculate the dividend to give to a cooperator base
on the amount of his shares, the percentage allocated and for how long the
shares have been owned on prorata temporis calculation.
""",
'author': 'Houssine BAKKALI, <houssine@coopiteasy.be>',
'license': 'AGPL-3',
'version': '9.0.1.0',
'website': "www.coopiteasy.be",
'category': 'Cooperative Management',
'depends': [
'easy_my_coop',
],
'data': [
'security/ir.model.access.csv',
'views/dividend_views.xml',
]
"author": "Houssine BAKKALI, <houssine@coopiteasy.be>",
"license": "AGPL-3",
"version": "12.0.0.0.1",
"website": "www.coopiteasy.be",
"category": "Cooperative Management",
"depends": ["easy_my_coop"],
"data": ["security/ir.model.access.csv", "views/dividend_views.xml"],
"installable": False,
}

1
easy_my_coop_dividend/models/__init__.py

@ -1,2 +1 @@
# -*- coding: utf8 -*-
from . import dividend

403
easy_my_coop_dividend/models/dividend.py

@ -1,190 +1,213 @@
# -*- coding: utf-8 -*-
from __future__ import division
from datetime import datetime
import openerp.addons.decimal_precision as dp
from openerp import fields, models, api
class dividend_year(models.Model):
_name = 'dividend.year'
@api.multi
def _compute_dividend_info(self):
res = {}
for dividend in self:
res[dividend.id] = {'grand_total_dividend': 0.0,
'grand_total_taxes': 0.0}
for line in dividend.dividend_ids:
res[dividend.id]['grand_total_dividend'] += line.dividend_amount
res[dividend.id]['grand_total_taxes'] += line.dividend_taxes
return res
name = fields.Char(string='Code')
date_from = fields.Date(string='Date from')
date_to = fields.Date(string='Date to')
# fiscal_year_id = fields.Many2one('account.fiscalyear',
# string='Fiscal year')
percentage = fields.Float(string='Percentage')
withholding_tax = fields.Float(string='Withholding tax')
detailed_dividend_ids = fields.One2many('detailed.dividend.line',
'dividend_year_id',
string='Dividend lines')
dividend_ids = fields.One2many('dividend.line',
'dividend_year_id',
string='Dividend lines')
grand_total_dividend = fields.Float(
compute=_compute_dividend_info,
string='Grand total dividend',
digits_compute=dp.get_precision('Account'))
grand_total_taxes = fields.Float(
compute=_compute_dividend_info,
string='Grand total taxes',
digits_compute=dp.get_precision('Account'))
@api.multi
def compute_dividend(self):
self.ensure_one()
det_div_line_obj = self.env['detailed.dividend.line']
div_line_obj = self.env['dividend.line']
res_partner_obj = self.env['res.partner']
# delete lines if any
detailed_dividend_ids = det_div_line_obj.search([('dividend_year_id', '=', self.id)])
detailed_dividend_ids.unlink()
dividend_ids = div_line_obj.search([('dividend_year_id', '=', self.id)])
dividend_ids.unlink()
partner_ids = res_partner_obj.search([
('cooperator', '=', True),
('member', '=', True)],
order='cooperator_register_number')
number_of_days = (datetime.strptime(self.date_to, '%Y-%m-%d')
- datetime.strptime(self.date_from, '%Y-%m-%d')
).days + 1
for partner in partner_ids:
total_amount_dividend = 0.0
for line in partner.share_ids:
vals = {}
vals2 = {}
line_id = False
if line.effective_date >= self.date_from \
and line.effective_date <= self.date_to:
date_res = (datetime.strptime(self.date_to, '%Y-%m-%d')
- datetime.strptime(line.effective_date, '%Y-%m-%d')).days
coeff = (date_res / number_of_days) * self.percentage
dividend_amount = line.total_amount_line * coeff
vals['days'] = date_res
vals['dividend_year_id'] = self.id
vals['coop_number'] = line.partner_id.cooperator_register_number
vals['partner_id'] = partner.id
vals['share_line_id'] = line.id
vals['coeff'] = coeff
vals['dividend_amount'] = dividend_amount
total_amount_dividend += dividend_amount
line_id = det_div_line_obj.create(vals)
elif line.effective_date < self.date_from:
dividend_amount = line.total_amount_line * self.percentage
vals['days'] = number_of_days
vals['dividend_year_id'] = self.id
vals['coop_number'] = line.partner_id.cooperator_register_number
vals['partner_id'] = partner.id
vals['share_line_id'] = line.id
vals['coeff'] = self.percentage
vals['dividend_amount'] = dividend_amount
total_amount_dividend += dividend_amount
line_id = det_div_line_obj.create(vals)
if line_id:
vals2['coop_number'] = line.partner_id.cooperator_register_number
vals2['dividend_year_id'] = self.id
vals2['partner_id'] = line.partner_id.id
vals2['dividend_amount_net'] = total_amount_dividend
vals2['dividend_amount'] = total_amount_dividend
# TODO set as a parameter on dividend year object
if total_amount_dividend <= 190.00:
vals2['dividend_taxes'] = 0.0
else:
div_tax = (total_amount_dividend - 190) * self.withholding_tax
vals2['dividend_taxes'] = div_tax
vals2['dividend_amount_net'] = total_amount_dividend - div_tax
div_line_obj.create(vals2)
return True
class DetailedDividendLine(models.Model):
_name = 'detailed.dividend.line'
@api.multi
def _compute_total_line(self):
res = {}
for line in self:
res[line.id] = line.share_unit_price * line.share_number
return res
dividend_year_id = fields.Many2one('dividend.year',
string='Dividend year')
coop_number = fields.Integer(string='Cooperator Number')
days = fields.Integer(string='Days')
partner_id = fields.Many2one('res.partner',
string='Cooperator',
readonly=True)
share_line_id = fields.Many2one('share.line',
string='Share line',
readonly=True)
share_number = fields.Integer(related='share_line_id.share_number',
string='Number of Share')
share_unit_price = fields.Monetary(
string='Share unit price',
related='share_line_id.share_unit_price',
)
effective_date = fields.Date(related='share_line_id.effective_date',
string='Effective date')
total_amount_line = fields.Monetary(
string="Total value of share",
currency_field="company_currency_id",
compute=_compute_total_line,
readonly=True,
)
coeff = fields.Float(string='Coefficient to apply',
digits=(2, 4))
dividend_amount = fields.Float(string='Gross Dividend')
dividend_amount_net = fields.Float(string='Dividend net')
dividend_taxes = fields.Float(string='Taxes')
company_currency_id = fields.Many2one(
related="share_line_id.company_currency_id",
readonly=True,
)
class dividend_line(models.Model):
_name = 'dividend.line'
@api.multi
def _get_account_number(self):
res = {}
for line in self:
bank_accounts = self.env['res.partner.bank'].search(
[('partner_id', '=', line.partner_id.id)])
res[line.id] = bank_accounts[0].acc_number
return res
coop_number = fields.Integer(string='Coop Number')
dividend_year_id = fields.Many2one('dividend.year',
string='Dividend year')
partner_id = fields.Many2one('res.partner',
string='Cooperator',
readonly=True)
account_number = fields.Char(compute=_get_account_number,
string='Account Number')
dividend_amount = fields.Float(string='Gross Dividend')
dividend_amount_net = fields.Float(string='Dividend net')
dividend_taxes = fields.Float(string='Taxes')
from __future__ import division
from datetime import datetime
import openerp.addons.decimal_precision as dp
from openerp import api, fields, models
class DividendYear(models.Model):
_name = "dividend.year"
@api.multi
def _compute_dividend_info(self):
res = {}
for dividend in self:
res[dividend.id] = {
"grand_total_dividend": 0.0,
"grand_total_taxes": 0.0,
}
for line in dividend.dividend_ids:
res[dividend.id][
"grand_total_dividend"
] += line.dividend_amount
res[dividend.id]["grand_total_taxes"] += line.dividend_taxes
return res
name = fields.Char(string="Code")
date_from = fields.Date(string="Date from")
date_to = fields.Date(string="Date to")
# fiscal_year_id = fields.Many2one('account.fiscalyear',
# string='Fiscal year')
percentage = fields.Float(string="Percentage")
withholding_tax = fields.Float(string="Withholding tax")
detailed_dividend_ids = fields.One2many(
"detailed.dividend.line", "dividend_year_id", string="Dividend lines"
)
dividend_ids = fields.One2many(
"dividend.line", "dividend_year_id", string="Dividend lines"
)
grand_total_dividend = fields.Float(
compute=_compute_dividend_info,
string="Grand total dividend",
digits_compute=dp.get_precision("Account"),
)
grand_total_taxes = fields.Float(
compute=_compute_dividend_info,
string="Grand total taxes",
digits_compute=dp.get_precision("Account"),
)
@api.multi
def compute_dividend(self):
self.ensure_one()
det_div_line_obj = self.env["detailed.dividend.line"]
div_line_obj = self.env["dividend.line"]
res_partner_obj = self.env["res.partner"]
# delete lines if any
detailed_dividend_ids = det_div_line_obj.search(
[("dividend_year_id", "=", self.id)]
)
detailed_dividend_ids.unlink()
dividend_ids = div_line_obj.search(
[("dividend_year_id", "=", self.id)]
)
dividend_ids.unlink()
partner_ids = res_partner_obj.search(
[("cooperator", "=", True), ("member", "=", True)],
order="cooperator_register_number",
)
number_of_days = (
datetime.strptime(self.date_to, "%Y-%m-%d")
- datetime.strptime(self.date_from, "%Y-%m-%d")
).days + 1
for partner in partner_ids:
total_amount_dividend = 0.0
for line in partner.share_ids:
vals = {}
vals2 = {}
line_id = False
if (
line.effective_date >= self.date_from
and line.effective_date <= self.date_to
):
date_res = (
datetime.strptime(self.date_to, "%Y-%m-%d")
- datetime.strptime(line.effective_date, "%Y-%m-%d")
).days
coeff = (date_res / number_of_days) * self.percentage
dividend_amount = line.total_amount_line * coeff
vals["days"] = date_res
vals["dividend_year_id"] = self.id
vals[
"coop_number"
] = line.partner_id.cooperator_register_number
vals["partner_id"] = partner.id
vals["share_line_id"] = line.id
vals["coeff"] = coeff
vals["dividend_amount"] = dividend_amount
total_amount_dividend += dividend_amount
line_id = det_div_line_obj.create(vals)
elif line.effective_date < self.date_from:
dividend_amount = line.total_amount_line * self.percentage
vals["days"] = number_of_days
vals["dividend_year_id"] = self.id
vals[
"coop_number"
] = line.partner_id.cooperator_register_number
vals["partner_id"] = partner.id
vals["share_line_id"] = line.id
vals["coeff"] = self.percentage
vals["dividend_amount"] = dividend_amount
total_amount_dividend += dividend_amount
line_id = det_div_line_obj.create(vals)
if line_id:
vals2[
"coop_number"
] = line.partner_id.cooperator_register_number
vals2["dividend_year_id"] = self.id
vals2["partner_id"] = line.partner_id.id
vals2["dividend_amount_net"] = total_amount_dividend
vals2["dividend_amount"] = total_amount_dividend
# TODO set as a parameter on dividend year object
if total_amount_dividend <= 190.00:
vals2["dividend_taxes"] = 0.0
else:
div_tax = (
total_amount_dividend - 190
) * self.withholding_tax
vals2["dividend_taxes"] = div_tax
vals2["dividend_amount_net"] = (
total_amount_dividend - div_tax
)
div_line_obj.create(vals2)
return True
class DetailedDividendLine(models.Model):
_name = "detailed.dividend.line"
@api.multi
def _compute_total_line(self):
res = {}
for line in self:
res[line.id] = line.share_unit_price * line.share_number
return res
dividend_year_id = fields.Many2one("dividend.year", string="Dividend year")
coop_number = fields.Integer(string="Cooperator Number")
days = fields.Integer(string="Days")
partner_id = fields.Many2one(
"res.partner", string="Cooperator", readonly=True
)
share_line_id = fields.Many2one(
"share.line", string="Share line", readonly=True
)
share_number = fields.Integer(
related="share_line_id.share_number", string="Number of Share"
)
share_unit_price = fields.Monetary(
string="Share unit price", related="share_line_id.share_unit_price"
)
effective_date = fields.Date(
related="share_line_id.effective_date", string="Effective date"
)
total_amount_line = fields.Monetary(
string="Total value of share",
currency_field="company_currency_id",
compute=_compute_total_line,
readonly=True,
)
coeff = fields.Float(string="Coefficient to apply", digits=(2, 4))
dividend_amount = fields.Float(string="Gross Dividend")
dividend_amount_net = fields.Float(string="Dividend net")
dividend_taxes = fields.Float(string="Taxes")
company_currency_id = fields.Many2one(
related="share_line_id.company_currency_id", readonly=True
)
class DividendLine(models.Model):
_name = "dividend.line"
@api.multi
def _get_account_number(self):
res = {}
for line in self:
bank_accounts = self.env["res.partner.bank"].search(
[("partner_id", "=", line.partner_id.id)]
)
res[line.id] = bank_accounts[0].acc_number
return res
coop_number = fields.Integer(string="Coop Number")
dividend_year_id = fields.Many2one("dividend.year", string="Dividend year")
partner_id = fields.Many2one(
"res.partner", string="Cooperator", readonly=True
)
account_number = fields.Char(
compute=_get_account_number, string="Account Number"
)
dividend_amount = fields.Float(string="Gross Dividend")
dividend_amount_net = fields.Float(string="Dividend net")
dividend_taxes = fields.Float(string="Taxes")

2
easy_my_coop_dividend/readme/CONTRIBUTORS.rst

@ -0,0 +1,2 @@
* Coop IT Easy SCRLfs
* Houssine BAKKALI, <houssine@coopiteasy.be>

3
easy_my_coop_dividend/readme/DESCRIPTION.rst

@ -0,0 +1,3 @@
This module allows to calculate the dividend to give to a cooperator base
on the amount of his shares, the percentage allocated and for how long the
shares have been owned on prorata temporis calculation.

2
easy_my_coop_dividend/security/ir.model.access.csv

@ -1 +1 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink

419
easy_my_coop_dividend/static/description/index.html

@ -0,0 +1,419 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<title>Easy My Coop Dividend Engine</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="easy-my-coop-dividend-engine">
<h1 class="title">Easy My Coop Dividend Engine</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_dividend"><img alt="coopiteasy/vertical-cooperative" src="https://img.shields.io/badge/github-coopiteasy%2Fvertical--cooperative-lightgray.png?logo=github" /></a></p>
<blockquote>
This module allows to calculate the dividend to give to a cooperator base
on the amount of his shares, the percentage allocated and for how long the
shares have been owned on prorata temporis calculation.</blockquote>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id5">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/issues/new?body=module:%20easy_my_coop_dividend%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<ul class="simple">
<li>Houssine BAKKALI</li>
<li>&lt;<a class="reference external" href="mailto:houssine&#64;coopiteasy.be">houssine&#64;coopiteasy.be</a>&gt;</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id4">Contributors</a></h2>
<ul class="simple">
<li>Coop IT Easy SCRLfs</li>
<li>Houssine BAKKALI, &lt;<a class="reference external" href="mailto:houssine&#64;coopiteasy.be">houssine&#64;coopiteasy.be</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id5">Maintainers</a></h2>
<p>This module is part of the <a class="reference external" href="https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_dividend">coopiteasy/vertical-cooperative</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

349
easy_my_coop_dividend/views/dividend_views.xml

@ -1,164 +1,185 @@
<odoo>
<data>
<menuitem name="Dividend" id="menu_easy_my_coop_main_dividend" parent="easy_my_coop.menu_main_easy_my_coop" groups="easy_my_coop.group_easy_my_coop_user" sequence="30" />
<record id="dividend_year_form" model="ir.ui.view">
<field name="name">dividend.year.form</field>
<field name="model">dividend.year</field>
<field name="arch" type="xml">
<form string="Dividend year">
<header>
<button name="compute_dividend" string="Compute dividend" type="object" class="oe_highlight" groups="base.group_user"/>
</header>
<sheet>
<group>
<group>
<field name="name"/>
<field name="percentage"/>
<field name="grand_total_dividend"/>
<field name="grand_total_taxes"/>
</group>
<group>
<field name="date_from"/>
<field name="date_to"/>
<field name="withholding_tax"/>
</group>
</group>
<notebook>
<page string="Dividend line">
<field name="dividend_ids">
<tree>
<field name="coop_number"/>
<field name="partner_id"/>
<field name="dividend_amount" sum="Total dividend"/>
<field name="dividend_amount_net" sum="Total dividend net"/>
<field name="dividend_taxes" sum="Total dividend taxes"/>
</tree>
</field>
</page>
<page string="Detailed dividend line">
<field name="detailed_dividend_ids">
<tree>
<field name="coop_number"/>
<field name="partner_id"/>
<field name="share_number"/>
<field name="share_unit_price"/>
<field name="effective_date"/>
<field name="days"/>
<field name="total_amount_line"/>
<field name="coeff"/>
<field name="dividend_amount" string="Dividend" sum="Total dividend"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="dividend_year_tree" model="ir.ui.view">
<field name="name">dividend.year.tree</field>
<field name="model">dividend.year</field>
<field name="arch" type="xml">
<tree string="Dividend year">
<field name="name"/>
<field name="percentage"/>
</tree>
</field>
</record>
<record id="dividend_year_action" model="ir.actions.act_window">
<field name="name">Dividend year</field>
<field name="res_model">dividend.year</field>
<field name="view_type">form</field>
<field name="view_id" ref="dividend_year_tree"/>
</record>
<menuitem action="dividend_year_action" name="Dividend" id="menu_dividend_year" parent="menu_easy_my_coop_main_dividend" sequence="10"/>
<record id="view_detailed_dividend_line_filter" model="ir.ui.view">
<field name="name">detailed.dividend.line.select</field>
<field name="model">detailed.dividend.line</field>
<field name="arch" type="xml">
<search string="Search detailed dividend line">
<field name="partner_id"/>
<field name="coop_number"/>
<filter name="dividend_year_id" string="Dividend Year"/>
<separator/>
<filter string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Dividend Year" domain="[]" context="{'group_by':'dividend_year_id'}"/>
</search>
</field>
</record>
<record id="detailed_dividend_line_tree" model="ir.ui.view">
<field name="name">detailed.dividend.line.tree</field>
<field name="model">detailed.dividend.line</field>
<field name="arch" type="xml">
<tree string="Detailed dividend lines">
<field name="dividend_year_id"/>
<field name="coop_number"/>
<field name="partner_id"/>
<field name="share_number"/>
<field name="share_unit_price"/>
<field name="effective_date"/>
<field name="days"/>
<field name="total_amount_line"/>
<field name="coeff"/>
<field name="dividend_amount" string="Dividend" sum="Total dividend"/>
</tree>
</field>
</record>
<record id="detailed_dividend_line_action" model="ir.actions.act_window">
<field name="name">Detailed dividend lines</field>
<field name="res_model">detailed.dividend.line</field>
<field name="view_type">form</field>
<field name="view_id" ref="detailed_dividend_line_tree"/>
</record>
<menuitem action="detailed_dividend_line_action" name="Detailed dividend lines" id="menu_det_dividend_line" parent="menu_easy_my_coop_main_dividend" sequence="20"/>
<record id="view_dividend_line_filter" model="ir.ui.view">
<field name="name">dividend.line.select</field>
<field name="model">dividend.line</field>
<field name="arch" type="xml">
<search string="Search Subscription">
<field name="partner_id"/>
<field name="coop_number"/>
<filter name="dividend_year_id" string="Dividend Year"/>
<separator/>
<group expand="0" string="Group By...">
<filter string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Dividend Year" domain="[]" context="{'group_by':'dividend_year_id'}"/>
</group>
</search>
</field>
</record>
<record id="dividend_line_tree" model="ir.ui.view">
<field name="name">dividend.line.tree</field>
<field name="model">dividend.line</field>
<field name="arch" type="xml">
<tree string="dividend lines">
<field name="dividend_year_id"/>
<field name="coop_number"/>
<field name="partner_id"/>
<field name="account_number"/>
<field name="dividend_amount" sum="Total dividend"/>
<field name="dividend_amount_net" sum="Total dividend net"/>
<field name="dividend_taxes" sum="Total dividend taxes"/>
</tree>
</field>
</record>
<record id="dividend_line_action" model="ir.actions.act_window">
<field name="name">Dividend lines</field>
<field name="res_model">dividend.line</field>
<field name="view_type">form</field>
<field name="view_id" ref="dividend_line_tree"/>
</record>
<menuitem action="dividend_line_action" name="Dividend lines" id="menu_dividend_line" parent="menu_easy_my_coop_main_dividend" sequence="30"/>
</data>
</odoo>
<odoo>
<data>
<menuitem name="Dividend" id="menu_easy_my_coop_main_dividend"
parent="easy_my_coop.menu_main_easy_my_coop"
groups="easy_my_coop.group_easy_my_coop_user" sequence="30"/>
<record id="dividend_year_form" model="ir.ui.view">
<field name="name">dividend.year.form</field>
<field name="model">dividend.year</field>
<field name="arch" type="xml">
<form string="Dividend year">
<header>
<button name="compute_dividend"
string="Compute dividend" type="object"
class="oe_highlight" groups="base.group_user"/>
</header>
<sheet>
<group>
<group>
<field name="name"/>
<field name="percentage"/>
<field name="grand_total_dividend"/>
<field name="grand_total_taxes"/>
</group>
<group>
<field name="date_from"/>
<field name="date_to"/>
<field name="withholding_tax"/>
</group>
</group>
<notebook>
<page string="Dividend line">
<field name="dividend_ids">
<tree>
<field name="coop_number"/>
<field name="partner_id"/>
<field name="dividend_amount"
sum="Total dividend"/>
<field name="dividend_amount_net"
sum="Total dividend net"/>
<field name="dividend_taxes"
sum="Total dividend taxes"/>
</tree>
</field>
</page>
<page string="Detailed dividend line">
<field name="detailed_dividend_ids">
<tree>
<field name="coop_number"/>
<field name="partner_id"/>
<field name="share_number"/>
<field name="share_unit_price"/>
<field name="effective_date"/>
<field name="days"/>
<field name="total_amount_line"/>
<field name="coeff"/>
<field name="dividend_amount"
string="Dividend"
sum="Total dividend"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="dividend_year_tree" model="ir.ui.view">
<field name="name">dividend.year.tree</field>
<field name="model">dividend.year</field>
<field name="arch" type="xml">
<tree string="Dividend year">
<field name="name"/>
<field name="percentage"/>
</tree>
</field>
</record>
<record id="dividend_year_action" model="ir.actions.act_window">
<field name="name">Dividend year</field>
<field name="res_model">dividend.year</field>
<field name="view_type">form</field>
<field name="view_id" ref="dividend_year_tree"/>
</record>
<menuitem action="dividend_year_action" name="Dividend"
id="menu_dividend_year"
parent="menu_easy_my_coop_main_dividend" sequence="10"/>
<record id="view_detailed_dividend_line_filter" model="ir.ui.view">
<field name="name">detailed.dividend.line.select</field>
<field name="model">detailed.dividend.line</field>
<field name="arch" type="xml">
<search string="Search detailed dividend line">
<field name="partner_id"/>
<field name="coop_number"/>
<filter name="dividend_year_id" string="Dividend Year"/>
<separator/>
<filter string="Partner" domain="[]"
context="{'group_by':'partner_id'}"/>
<filter string="Dividend Year" domain="[]"
context="{'group_by':'dividend_year_id'}"/>
</search>
</field>
</record>
<record id="detailed_dividend_line_tree" model="ir.ui.view">
<field name="name">detailed.dividend.line.tree</field>
<field name="model">detailed.dividend.line</field>
<field name="arch" type="xml">
<tree string="Detailed dividend lines">
<field name="dividend_year_id"/>
<field name="coop_number"/>
<field name="partner_id"/>
<field name="share_number"/>
<field name="share_unit_price"/>
<field name="effective_date"/>
<field name="days"/>
<field name="total_amount_line"/>
<field name="coeff"/>
<field name="dividend_amount" string="Dividend"
sum="Total dividend"/>
</tree>
</field>
</record>
<record id="detailed_dividend_line_action"
model="ir.actions.act_window">
<field name="name">Detailed dividend lines</field>
<field name="res_model">detailed.dividend.line</field>
<field name="view_type">form</field>
<field name="view_id" ref="detailed_dividend_line_tree"/>
</record>
<menuitem action="detailed_dividend_line_action"
name="Detailed dividend lines" id="menu_det_dividend_line"
parent="menu_easy_my_coop_main_dividend" sequence="20"/>
<record id="view_dividend_line_filter" model="ir.ui.view">
<field name="name">dividend.line.select</field>
<field name="model">dividend.line</field>
<field name="arch" type="xml">
<search string="Search Subscription">
<field name="partner_id"/>
<field name="coop_number"/>
<filter name="dividend_year_id" string="Dividend Year"/>
<separator/>
<group expand="0" string="Group By...">
<filter string="Partner" domain="[]"
context="{'group_by':'partner_id'}"/>
<filter string="Dividend Year" domain="[]"
context="{'group_by':'dividend_year_id'}"/>
</group>
</search>
</field>
</record>
<record id="dividend_line_tree" model="ir.ui.view">
<field name="name">dividend.line.tree</field>
<field name="model">dividend.line</field>
<field name="arch" type="xml">
<tree string="dividend lines">
<field name="dividend_year_id"/>
<field name="coop_number"/>
<field name="partner_id"/>
<field name="account_number"/>
<field name="dividend_amount" sum="Total dividend"/>
<field name="dividend_amount_net" sum="Total dividend net"/>
<field name="dividend_taxes" sum="Total dividend taxes"/>
</tree>
</field>
</record>
<record id="dividend_line_action" model="ir.actions.act_window">
<field name="name">Dividend lines</field>
<field name="res_model">dividend.line</field>
<field name="view_type">form</field>
<field name="view_id" ref="dividend_line_tree"/>
</record>
<menuitem action="dividend_line_action" name="Dividend lines"
id="menu_dividend_line"
parent="menu_easy_my_coop_main_dividend" sequence="30"/>
</data>
</odoo>

54
easy_my_coop_eater/README.rst

@ -0,0 +1,54 @@
=========================
Easy My Coop Eater/worker
=========================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/github-coopiteasy%2Fvertical--cooperative-lightgray.png?logo=github
:target: https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_eater
:alt: coopiteasy/vertical-cooperative
|badge1| |badge2|
This module allows to manage the activity of the cooperator in the supermarket.
**Table of contents**
.. contents::
:local:
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/coopiteasy/vertical-cooperative/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/coopiteasy/vertical-cooperative/issues/new?body=module:%20easy_my_coop_eater%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Coop IT Easy SCRLfs
Contributors
~~~~~~~~~~~~
* Coop IT Easy SCRLfs
Maintainers
~~~~~~~~~~~
This module is part of the `coopiteasy/vertical-cooperative <https://github.com/coopiteasy/vertical-cooperative/tree/12.0/easy_my_coop_eater>`_ project on GitHub.
You are welcome to contribute.

2
easy_my_coop_eater/__init__.py

@ -1 +1 @@
from . import models
from . import models

17
easy_my_coop_eater/__manifest__.py

@ -0,0 +1,17 @@
# Copyright 2013-2017 Open Architects Consulting SPRL.
# Copyright 2018- Coop IT Easy SCRLfs
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Easy My Coop Eater/worker",
"version": "12.0.1.0.0",
"depends": ["easy_my_coop", "partner_age"],
"author": "Coop IT Easy SCRLfs",
"license": "AGPL-3",
"category": "Cooperative management",
"website": "https://coopiteasy.be",
"summary": """
This module allows to manage the activity of the cooperator in the supermarket.
""",
"data": ["view/product_view.xml"],
"installable": True,
}

35
easy_my_coop_eater/__openerp__.py

@ -1,35 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2013-2017 Open Architects Consulting SPRL.
# Copyright (C) 2018- Coop IT Easy SCRLfs.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name": "Easy My Coop Eater/worker",
"version": "1.0",
"depends": ["easy_my_coop", "partner_age"],
"author": "Houssine BAKKALI <houssine@coopiteasy.be>",
"category": "Cooperative management",
'website': "www.coopiteasy.be",
"description": """
This module allows to manage the activity of the cooperator.
""",
'data': [
'view/product_view.xml',
],
'installable': True,
}

4
easy_my_coop_eater/models/__init__.py

@ -1,2 +1,2 @@
from . import coop
from . import product
from . import coop
from . import product

57
easy_my_coop_eater/models/coop.py

@ -1,28 +1,29 @@
# -*- coding: utf-8 -*-
from openerp import api, models
class SubscriptionRequest(models.Model):
_inherit = 'subscription.request'
def get_eater_vals(self, partner, share_product_id):
vals = {}
eater = share_product_id.eater
if partner.is_company or partner.age < 18:
eater = 'eater'
vals['eater'] = eater
return vals
@api.one
def validate_subscription_request(self):
invoice = super(SubscriptionRequest, self).validate_subscription_request()[0]
partner = invoice.partner_id
vals = self.get_eater_vals(partner, self.share_product_id)
partner.write(vals)
return invoice
from odoo import api, models
class SubscriptionRequest(models.Model):
_inherit = "subscription.request"
def get_eater_vals(self, partner, share_product_id):
vals = {}
eater = share_product_id.eater
if partner.is_company or partner.age < 18:
eater = "eater"
vals["eater"] = eater
return vals
@api.multi
def validate_subscription_request(self):
self.ensure_one()
invoice = super(
SubscriptionRequest, self
).validate_subscription_request()[0]
partner = invoice.partner_id
vals = self.get_eater_vals(partner, self.share_product_id)
partner.write(vals)
return invoice

20
easy_my_coop_eater/models/product.py

@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
from openerp import fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
eater = fields.Selection([('eater', 'Eater'),
('worker_eater', 'Worker and Eater')],
string="Eater/Worker")
from odoo import fields, models
class ProductTemplate(models.Model):
_inherit = "product.template"
eater = fields.Selection(
[("eater", "Eater"), ("worker_eater", "Worker and Eater")],
string="Eater/Worker",
)

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save