Browse Source

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

[12.0] MAKE TRAVIS GREEN AGAIN
pull/85/head
Robin Keunen 5 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. 101
      easy_my_coop/__manifest__.py
  12. 3
      easy_my_coop/data/easy_my_coop_data.xml
  13. 116
      easy_my_coop/data/mail_template_data.xml
  14. 4
      easy_my_coop/data/paperformat.xml
  15. 20
      easy_my_coop/demo/coop.xml
  16. 6
      easy_my_coop/demo/users.xml
  17. 27
      easy_my_coop/migrations/8.0.1.0/pre-migration.py
  18. 132
      easy_my_coop/models/account_invoice.py
  19. 5
      easy_my_coop/models/account_journal.py
  20. 62
      easy_my_coop/models/company.py
  21. 906
      easy_my_coop/models/coop.py
  22. 2
      easy_my_coop/models/mail_template.py
  23. 445
      easy_my_coop/models/operation_request.py
  24. 184
      easy_my_coop/models/partner.py
  25. 28
      easy_my_coop/models/product.py
  26. 5
      easy_my_coop/models/res_partner_bank.py
  27. 1
      easy_my_coop/readme/CONTRIBUTORS.rst
  28. 1
      easy_my_coop/readme/DESCRIPTION.rst
  29. 10
      easy_my_coop/report/account_invoice_report.py
  30. 19
      easy_my_coop/report/cooperator_certificat_G001.xml
  31. 130
      easy_my_coop/report/cooperator_invoice_G002.xml
  32. 92
      easy_my_coop/report/cooperator_register_G001.xml
  33. 82
      easy_my_coop/report/cooperator_subscription_G001.xml
  34. 47
      easy_my_coop/report/layout.xml
  35. 6
      easy_my_coop/security/res_groups.xml
  36. 414
      easy_my_coop/static/description/index.html
  37. 22
      easy_my_coop/static/src/js/easy_my_coop.js
  38. 1911
      easy_my_coop/static/src/js/jquery.inputmask.bundle.js
  39. 5
      easy_my_coop/tests/test_emc.py
  40. 50
      easy_my_coop/views/account_invoice_view.xml
  41. 6
      easy_my_coop/views/account_journal_view.xml
  42. 21
      easy_my_coop/views/cooperator_register_view.xml
  43. 4
      easy_my_coop/views/email_template_view.xml
  44. 62
      easy_my_coop/views/menus.xml
  45. 72
      easy_my_coop/views/operation_request_view.xml
  46. 41
      easy_my_coop/views/product_view.xml
  47. 3
      easy_my_coop/views/res_company_view.xml
  48. 136
      easy_my_coop/views/res_partner_view.xml
  49. 97
      easy_my_coop/views/subscription_request_view.xml
  50. 10
      easy_my_coop/wizard/account_invoice_refund.py
  51. 81
      easy_my_coop/wizard/cooperative_history_wizard.xml
  52. 210
      easy_my_coop/wizard/create_subscription_from_partner.py
  53. 25
      easy_my_coop/wizard/create_subscription_from_partner.xml
  54. 49
      easy_my_coop/wizard/update_partner_info.py
  55. 15
      easy_my_coop/wizard/update_partner_info.xml
  56. 44
      easy_my_coop/wizard/update_share_line.py
  57. 12
      easy_my_coop/wizard/update_share_line.xml
  58. 8
      easy_my_coop/wizard/validate_subscription_request.py
  59. 11
      easy_my_coop/wizard/validate_subscription_request.xml
  60. 58
      easy_my_coop_be/README.rst
  61. 19
      easy_my_coop_be/__manifest__.py
  62. 19
      easy_my_coop_be/models/coop.py
  63. 14
      easy_my_coop_be/models/partner.py
  64. 1
      easy_my_coop_be/readme/CONTRIBUTORS.rst
  65. 1
      easy_my_coop_be/readme/DESCRIPTION.rst
  66. 414
      easy_my_coop_be/static/description/index.html
  67. 55
      easy_my_coop_ch/README.rst
  68. 46
      easy_my_coop_ch/__manifest__.py
  69. 27
      easy_my_coop_ch/models/coop.py
  70. 24
      easy_my_coop_ch/models/partner.py
  71. 2
      easy_my_coop_ch/readme/CONTRIBUTORS.rst
  72. 1
      easy_my_coop_ch/readme/DESCRIPTION.rst
  73. 414
      easy_my_coop_ch/static/description/index.html
  74. 63
      easy_my_coop_ch/views/certificate_template.xml
  75. 25
      easy_my_coop_ch/views/subscription_template.xml
  76. 62
      easy_my_coop_dividend/README.rst
  77. 1
      easy_my_coop_dividend/__init__.py
  78. 38
      easy_my_coop_dividend/__manifest__.py
  79. 1
      easy_my_coop_dividend/models/__init__.py
  80. 231
      easy_my_coop_dividend/models/dividend.py
  81. 2
      easy_my_coop_dividend/readme/CONTRIBUTORS.rst
  82. 3
      easy_my_coop_dividend/readme/DESCRIPTION.rst
  83. 419
      easy_my_coop_dividend/static/description/index.html
  84. 51
      easy_my_coop_dividend/views/dividend_views.xml
  85. 54
      easy_my_coop_eater/README.rst
  86. 17
      easy_my_coop_eater/__manifest__.py
  87. 35
      easy_my_coop_eater/__openerp__.py
  88. 17
      easy_my_coop_eater/models/coop.py
  89. 12
      easy_my_coop_eater/models/product.py
  90. 1
      easy_my_coop_eater/readme/CONTRIBUTORS.rst
  91. 1
      easy_my_coop_eater/readme/DESCRIPTION.rst
  92. 415
      easy_my_coop_eater/static/description/index.html
  93. 6
      easy_my_coop_eater/view/product_view.xml
  94. 60
      easy_my_coop_export_xlsx/README.rst
  95. 1
      easy_my_coop_export_xlsx/__init__.py
  96. 32
      easy_my_coop_export_xlsx/__manifest__.py
  97. 2
      easy_my_coop_export_xlsx/readme/CONTRIBUTORS.rst
  98. 2
      easy_my_coop_export_xlsx/readme/DESCRIPTION.rst
  99. 417
      easy_my_coop_export_xlsx/static/description/index.html
  100. 1
      easy_my_coop_export_xlsx/wizard/__init__.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 # Distribution / packaging
.Python .Python
env/
build/ build/
develop-eggs/ develop-eggs/
dist/ dist/
@ -20,9 +19,11 @@ lib64/
parts/ parts/
sdist/ sdist/
var/ var/
wheels/
*.egg-info/ *.egg-info/
.installed.cfg .installed.cfg
*.egg *.egg
MANIFEST
# PyInstaller # PyInstaller
# Usually these files are written by a python script from a template # Usually these files are written by a python script from a template
@ -42,8 +43,9 @@ htmlcov/
.cache .cache
nosetests.xml nosetests.xml
coverage.xml coverage.xml
*,cover
*.cover
.hypothesis/ .hypothesis/
.pytest_cache/
# Translations # Translations
*.mo *.mo
@ -52,6 +54,7 @@ coverage.xml
# Django stuff: # Django stuff:
*.log *.log
local_settings.py local_settings.py
db.sqlite3
# Flask stuff: # Flask stuff:
instance/ instance/
@ -66,7 +69,7 @@ docs/_build/
# PyBuilder # PyBuilder
target/ target/
# IPython Notebook
# Jupyter Notebook
.ipynb_checkpoints .ipynb_checkpoints
# pyenv # pyenv
@ -75,15 +78,27 @@ target/
# celery beat schedule file # celery beat schedule file
celerybeat-schedule celerybeat-schedule
# dotenv
.env
# SageMath parsed files
*.sage.py
# virtualenv
# Environments
.env
.venv
env/
venv/ venv/
ENV/ ENV/
env.bak/
venv.bak/
# Spyder project settings # Spyder project settings
.spyderproject .spyderproject
.spyproject
# Rope project settings # Rope project settings
.ropeproject .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 # vertical-cooperative
This repository gather odoo modules for cooperatives 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.

101
easy_my_coop/__manifest__.py

@ -4,59 +4,54 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # 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,
} }

3
easy_my_coop/data/easy_my_coop_data.xml

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp> <openerp>
<data noupdate="1"> <data noupdate="1">
<record model="ir.module.category" id="module_category_cooperator_management">
<record model="ir.module.category"
id="module_category_cooperator_management">
<field name="name">Cooperative Management</field> <field name="name">Cooperative Management</field>
<field name="description">Manage your cooperative.</field> <field name="description">Manage your cooperative.</field>
<field name="sequence">3</field> <field name="sequence">3</field>

116
easy_my_coop/data/mail_template_data.xml

@ -5,15 +5,24 @@
<data noupdate="1"> <data noupdate="1">
<!--Request to release capital Email template --> <!--Request to release capital Email template -->
<record id="email_template_release_capital" model="mail.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="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="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="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="model_id" ref="account.model_account_invoice"/>
<field name="auto_delete" eval="True"/> <field name="auto_delete" eval="True"/>
<field name="report_template" ref="action_cooperator_invoices"/> <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="report_name">
${(object.number or '').replace('/','_')}_${object.state == 'draft' and 'draft' or ''}
</field>
<field name="lang">${object.partner_id.lang}</field> <field name="lang">${object.partner_id.lang}</field>
<field name="easy_my_coop" eval="True"/> <field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[ <field name="body_html"><![CDATA[
@ -59,10 +68,14 @@
<record id="email_template_confirmation" model="mail.template"> <record id="email_template_confirmation" model="mail.template">
<field name="name">Confirmation Email</field> <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="email_from">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="subject">Subscription request confirmation</field> <field name="subject">Subscription request confirmation</field>
<field name="email_to">${object.email}</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="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="model_id" ref="model_subscription_request"/>
<field name="auto_delete" eval="True"/> <field name="auto_delete" eval="True"/>
<field name="lang">${object.lang}</field> <field name="lang">${object.lang}</field>
@ -112,10 +125,15 @@
<record id="email_template_waiting_list" model="mail.template"> <record id="email_template_waiting_list" model="mail.template">
<field name="name">Waiting List Email</field> <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_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="email_to">${object.email}</field>
<field name="reply_to">${(object.company_id.coop_email_contact or object.user_id.email)|safe}</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="model_id" ref="model_subscription_request"/>
<field name="auto_delete" eval="True"/> <field name="auto_delete" eval="True"/>
<field name="lang">${object.lang}</field> <field name="lang">${object.lang}</field>
@ -167,10 +185,15 @@
<record id="email_template_confirmation_company" model="mail.template"> <record id="email_template_confirmation_company" model="mail.template">
<field name="name">Company Confirmation Email</field> <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="email_from">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="subject">Subscription request confirmation</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="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="model_id" ref="model_subscription_request"/>
<field name="auto_delete" eval="True"/> <field name="auto_delete" eval="True"/>
<field name="lang">${object.lang}</field> <field name="lang">${object.lang}</field>
@ -221,15 +244,23 @@
</record> </record>
<record id="email_template_certificat" model="mail.template"> <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="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="subject">Payment Received Confirmation</field>
<field name="partner_to">${object.id}</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="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="model_id" ref="model_res_partner"/>
<field name="auto_delete" eval="True"/> <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="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="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/> <field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[ <field name="body_html"><![CDATA[
@ -276,15 +307,24 @@
</record> </record>
<record id="email_template_certificat_increase" model="mail.template"> <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="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="subject">Payment Received Confirmation</field>
<field name="partner_to">${object.id}</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="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="model_id" ref="model_res_partner"/>
<field name="auto_delete" eval="True"/> <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="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="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/> <field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[ <field name="body_html"><![CDATA[
@ -332,14 +372,21 @@
<record id="email_template_share_transfer" model="mail.template"> <record id="email_template_share_transfer" model="mail.template">
<field name="name">Share transfer - Send By Email</field> <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="email_from">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="subject">Share transfert</field> <field name="subject">Share transfert</field>
<field name="partner_to">${object.id}</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="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="model_id" ref="model_res_partner"/>
<field name="auto_delete" eval="True"/> <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="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="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/> <field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[ <field name="body_html"><![CDATA[
@ -387,14 +434,21 @@
<record id="email_template_share_update" model="mail.template"> <record id="email_template_share_update" model="mail.template">
<field name="name">Share update - Send By Email</field> <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="email_from">
${(object.company_id.coop_email_contact or object.user_id.email)|safe}
</field>
<field name="subject">Share update</field> <field name="subject">Share update</field>
<field name="partner_to">${object.id}</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="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="model_id" ref="model_res_partner"/>
<field name="auto_delete" eval="True"/> <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="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="lang">${object.lang}</field>
<field name="easy_my_coop" eval="True"/> <field name="easy_my_coop" eval="True"/>
<field name="body_html"><![CDATA[ <field name="body_html"><![CDATA[

4
easy_my_coop/data/paperformat.xml

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

20
easy_my_coop/demo/coop.xml

@ -69,7 +69,7 @@
<field name="country_id" ref="base.be"/> <field name="country_id" ref="base.be"/>
</record> </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="code">416101</field>
<field name="name">Cooperators</field> <field name="name">Cooperators</field>
<field name="user_type_id" ref="account.data_account_type_receivable"/> <field name="user_type_id" ref="account.data_account_type_receivable"/>
@ -77,7 +77,8 @@
</record> </record>
<record id="base.main_company" model="res.company"> <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>
<record id="product_template_share_type_1_demo" model="product.template"> <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="date" eval="datetime.now() - timedelta(days=12)"/>
<field name="source">manual</field> <field name="source">manual</field>
<field name="ordered_parts">3</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="lang">en_US</field>
<field name="skip_control_ng" eval="True"/> <field name="skip_control_ng" eval="True"/>
</record> </record>
<record id="share_line_1_demo" model="share.line"> <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_number">2</field>
<field name="share_unit_price">50</field> <field name="share_unit_price">50</field>
<field name="partner_id" ref="res_partner_cooperator_1_demo"/> <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>
<record id="share_line_2_demo" model="share.line"> <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_number">4</field>
<field name="share_unit_price">50</field> <field name="share_unit_price">50</field>
<field name="partner_id" ref="res_partner_cooperator_2_demo"/> <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> </record>
</odoo> </odoo>

6
easy_my_coop/demo/users.xml

@ -20,7 +20,8 @@
<field name="partner_id" ref="res_partner_user_emc_demo"/> <field name="partner_id" ref="res_partner_user_emc_demo"/>
<field name="login">user-emc</field> <field name="login">user-emc</field>
<field name="password">demo</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>
<record id="res_partner_manager_emc_demo" model="res.partner"> <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="partner_id" ref="res_partner_manager_emc_demo"/>
<field name="login">manager-emc</field> <field name="login">manager-emc</field>
<field name="password">demo</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> </record>
</odoo> </odoo>

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

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

132
easy_my_coop/models/account_invoice.py

@ -8,86 +8,101 @@ from datetime import datetime
from odoo import api, fields, models from odoo import api, fields, models
class account_invoice(models.Model):
_inherit = 'account.invoice'
class AccountInvoice(models.Model):
_inherit = "account.invoice"
subscription_request = fields.Many2one('subscription.request',
string='Subscription request')
subscription_request = fields.Many2one(
"subscription.request", string="Subscription request"
)
release_capital_request = fields.Boolean( release_capital_request = fields.Boolean(
string='Release of capital request')
string="Release of capital request"
)
@api.model @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
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 return values
def create_user(self, partner): def create_user(self, partner):
user_obj = self.env['res.users']
user_obj = self.env["res.users"]
email = partner.email email = partner.email
user = user_obj.search([('login', '=', email)])
user = user_obj.search([("login", "=", email)])
if not user: if not user:
user = user_obj.search([('login', '=', email),
('active', '=', False)])
user = user_obj.search(
[("login", "=", email), ("active", "=", False)]
)
if user: if user:
user.sudo().write({'active': True})
user.sudo().write({"active": True})
else: else:
user_values = {'partner_id': partner.id, 'login': email}
user_values = {"partner_id": partner.id, "login": email}
user = user_obj.sudo()._signup_create_user(user_values) user = user_obj.sudo()._signup_create_user(user_values)
user.sudo().with_context({'create_user': True}).action_reset_password()
user.sudo().with_context(
{"create_user": True}
).action_reset_password()
return user return user
def get_mail_template_certificate(self): def get_mail_template_certificate(self):
if self.partner_id.member: if self.partner_id.member:
mail_template = 'easy_my_coop.email_template_certificat_increase'
mail_template = "easy_my_coop.email_template_certificat_increase"
else: else:
mail_template = 'easy_my_coop.email_template_certificat'
mail_template = "easy_my_coop.email_template_certificat"
return self.env.ref(mail_template) return self.env.ref(mail_template)
def get_sequence_register(self): def get_sequence_register(self):
return self.env.ref('easy_my_coop.sequence_subscription', False)
return self.env.ref("easy_my_coop.sequence_subscription", False)
def get_sequence_operation(self): def get_sequence_operation(self):
return self.env.ref('easy_my_coop.sequence_register_operation', False)
return self.env.ref("easy_my_coop.sequence_register_operation", False)
def get_share_line_vals(self, line, effective_date): def get_share_line_vals(self, line, effective_date):
return { 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
"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): def get_subscription_register_vals(self, line, effective_date):
return { 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'
"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): def get_membership_vals(self):
# flag the partner as an effective member # flag the partner as an effective member
# if not yet cooperator we generate a cooperator number # if not yet cooperator we generate a cooperator number
vals = {} vals = {}
if self.partner_id.member is False \
and self.partner_id.old_member is False:
if (
self.partner_id.member is False
and self.partner_id.old_member is False
):
sequence_id = self.get_sequence_register() sequence_id = self.get_sequence_register()
sub_reg_num = sequence_id.next_by_id() sub_reg_num = sequence_id.next_by_id()
vals = {'member': True, 'old_member': False,
'cooperator_register_number': int(sub_reg_num)
vals = {
"member": True,
"old_member": False,
"cooperator_register_number": int(sub_reg_num),
} }
elif self.partner_id.old_member: elif self.partner_id.old_member:
vals = {'member': True, 'old_member': False}
vals = {"member": True, "old_member": False}
return vals return vals
@ -102,8 +117,8 @@ class account_invoice(models.Model):
certificate_email_template.sudo().send_mail(self.partner_id.id, False) certificate_email_template.sudo().send_mail(self.partner_id.id, False)
def set_cooperator_effective(self, effective_date): def set_cooperator_effective(self, effective_date):
sub_register_obj = self.env['subscription.register']
share_line_obj = self.env['share.line']
sub_register_obj = self.env["subscription.register"]
share_line_obj = self.env["share.line"]
certificate_email_template = self.get_mail_template_certificate() certificate_email_template = self.get_mail_template_certificate()
@ -113,10 +128,11 @@ class account_invoice(models.Model):
sub_reg_operation = sequence_operation.next_by_id() sub_reg_operation = sequence_operation.next_by_id()
for line in self.invoice_line_ids: 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_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) sub_reg_line = sub_register_obj.create(sub_reg_vals)
@ -140,13 +156,13 @@ class account_invoice(models.Model):
def get_refund_domain(self, invoice): def get_refund_domain(self, invoice):
return [ return [
('type', '=', 'out_refund'),
('origin', '=', invoice.move_name)
("type", "=", "out_refund"),
("origin", "=", invoice.move_name),
] ]
@api.multi @api.multi
def action_invoice_paid(self): def action_invoice_paid(self):
super(account_invoice, self).action_invoice_paid()
super(AccountInvoice, self).action_invoice_paid()
for invoice in self: for invoice in self:
# we check if there is an open refund for this invoice. in this # we check if there is an open refund for this invoice. in this
# case we don't run the process_subscription function as the # case we don't run the process_subscription function as the
@ -154,9 +170,12 @@ class account_invoice(models.Model):
domain = self.get_refund_domain(invoice) domain = self.get_refund_domain(invoice)
refund = self.search(domain) refund = self.search(domain)
if invoice.partner_id.cooperator \
and invoice.release_capital_request \
and invoice.type == 'out_invoice' and not refund:
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. # take the effective date from the payment.
# by default the confirmation date is the payment date # by default the confirmation date is the payment date
effective_date = datetime.now().strftime("%d/%m/%Y") effective_date = datetime.now().strftime("%d/%m/%Y")
@ -165,11 +184,14 @@ class account_invoice(models.Model):
move_line = invoice.payment_move_line_ids[0] move_line = invoice.payment_move_line_ids[0]
effective_date = move_line.date effective_date = move_line.date
invoice.subscription_request.state = 'paid'
invoice.subscription_request.state = "paid"
invoice.post_process_confirm_paid(effective_date) invoice.post_process_confirm_paid(effective_date)
# if there is a open refund we mark the subscription as cancelled # 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'
elif (
invoice.partner_id.cooperator
and invoice.release_capital_request
and invoice.type == "out_invoice"
and refund
):
invoice.subscription_request.state = "cancelled"
return True return True

5
easy_my_coop/models/account_journal.py

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

62
easy_my_coop/models/company.py

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

906
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): class MailTemplate(models.Model):

445
easy_my_coop/models/operation_request.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Coop IT Easy SCRL fs # Copyright 2019 Coop IT Easy SCRL fs
# Houssine Bakkali <houssine@coopiteasy.be> # Houssine Bakkali <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
@ -6,123 +5,150 @@
from datetime import datetime from datetime import datetime
from odoo import api, fields, models, _
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
class operation_request(models.Model):
_name = 'operation.request'
class OperationRequest(models.Model):
_name = "operation.request"
_description = "Operation request" _description = "Operation request"
def get_date_now(self): def get_date_now(self):
# fixme odoo 12 uses date types # fixme odoo 12 uses date types
return datetime.strftime(datetime.now(), '%Y-%m-%d')
return datetime.strftime(datetime.now(), "%Y-%m-%d")
@api.multi @api.multi
@api.depends('share_product_id', 'share_product_id.list_price', 'quantity')
@api.depends("share_product_id", "share_product_id.list_price", "quantity")
def _compute_subscription_amount(self): def _compute_subscription_amount(self):
for operation_request in 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',
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, required=True,
default='draft')
user_id = fields.Many2one('res.users',
string='Responsible',
)
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, readonly=True,
default=lambda self: self.env.user)
subscription_request = fields.One2many('subscription.request',
'operation_request_id',
default=lambda self: self.env.user,
)
subscription_request = fields.One2many(
"subscription.request",
"operation_request_id",
string="Share Receiver Info", string="Share Receiver Info",
help="In case on a transfer of" help="In case on a transfer of"
" share. If the share receiver" " share. If the share receiver"
" isn't a effective member then a" " isn't a effective member then a"
" subscription form should" " subscription form should"
" be filled.")
receiver_not_member = fields.Boolean(string='Receiver is not a member')
company_id = fields.Many2one('res.company',
string='Company',
" be filled.",
)
receiver_not_member = fields.Boolean(string="Receiver is not a member")
company_id = fields.Many2one(
"res.company",
string="Company",
required=True, required=True,
change_default=True, change_default=True,
readonly=True, readonly=True,
default=lambda self: self.env['res.company']._company_default_get())
default=lambda self: self.env["res.company"]._company_default_get(),
)
invoice = fields.Many2one('account.invoice',
string="Invoice")
invoice = fields.Many2one("account.invoice", string="Invoice")
@api.multi @api.multi
def approve_operation(self): def approve_operation(self):
for rec in self: for rec in self:
rec.write({'state': 'approved'})
rec.write({"state": "approved"})
@api.multi @api.multi
def refuse_operation(self): def refuse_operation(self):
for rec in self: for rec in self:
rec.write({'state': 'refused'})
rec.write({"state": "refused"})
@api.multi @api.multi
def submit_operation(self): def submit_operation(self):
for rec in self: for rec in self:
rec.validate() rec.validate()
rec.write({'state': 'waiting'})
rec.write({"state": "waiting"})
@api.multi @api.multi
def cancel_operation(self): def cancel_operation(self):
for rec in self: for rec in self:
rec.write({'state': 'cancelled'})
rec.write({"state": "cancelled"})
@api.multi @api.multi
def reset_to_draft(self): def reset_to_draft(self):
for rec in self: for rec in self:
rec.write({'state': 'draft'})
rec.write({"state": "draft"})
def get_total_share_dic(self, partner): def get_total_share_dic(self, partner):
total_share_dic = {} total_share_dic = {}
share_products = self.env['product.product'].search([('is_share', '=', True)])
share_products = self.env["product.product"].search(
[("is_share", "=", True)]
)
for share_product in share_products: for share_product in share_products:
total_share_dic[share_product.id] = 0 total_share_dic[share_product.id] = 0
@ -136,13 +162,17 @@ class operation_request(models.Model):
# different kinds of share type # different kinds of share type
def hand_share_over(self, partner, share_product_id, quantity): def hand_share_over(self, partner, share_product_id, quantity):
if not partner.member: if not partner.member:
raise ValidationError(_("This operation can't be executed if the"
" cooperator is not an effective member"))
raise ValidationError(
_(
"This operation can't be executed if the"
" cooperator is not an effective member"
)
)
share_ind = len(partner.share_ids) share_ind = len(partner.share_ids)
i = 1 i = 1
while quantity > 0: while quantity > 0:
line = self.partner_id.share_ids[share_ind-i]
line = self.partner_id.share_ids[share_ind - i]
if line.share_product_id.id == share_product_id.id: if line.share_product_id.id == share_product_id.id:
if quantity > line.share_number: if quantity > line.share_number:
quantity -= line.share_number quantity -= line.share_number
@ -150,7 +180,7 @@ class operation_request(models.Model):
else: else:
share_left = line.share_number - quantity share_left = line.share_number - quantity
quantity = 0 quantity = 0
line.write({'share_number': share_left})
line.write({"share_number": share_left})
i += 1 i += 1
# if the cooperator sold all his shares he's no more # if the cooperator sold all his shares he's no more
# an effective member # an effective member
@ -158,7 +188,7 @@ class operation_request(models.Model):
for share_quant in self.get_total_share_dic(partner).values(): for share_quant in self.get_total_share_dic(partner).values():
remaning_share_dict += share_quant remaning_share_dict += share_quant
if remaning_share_dict == 0: if remaning_share_dict == 0:
self.partner_id.write({'member': False, 'old_member': True})
self.partner_id.write({"member": False, "old_member": True})
def has_share_type(self): def has_share_type(self):
for line in self.partner_id.share_ids: for line in self.partner_id.share_ids:
@ -167,76 +197,125 @@ class operation_request(models.Model):
return False return False
def validate(self): 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"
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" " type. Please choose the appropriate"
" share type."))
" share type."
)
)
if self.operation_type in ['sell_back', 'convert', 'transfer']:
if self.operation_type in ["sell_back", "convert", "transfer"]:
total_share_dic = self.get_total_share_dic(self.partner_id) total_share_dic = self.get_total_share_dic(self.partner_id)
if self.quantity > total_share_dic[self.share_product_id.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':
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.company_id.unmix_share_type:
if self.share_product_id.code == self.share_to_product_id.code: 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."))
raise ValidationError(
_(
"You can't convert the share to"
" the same share type."
)
)
if self.subscription_amount != self.partner_id.total_value: if self.subscription_amount != self.partner_id.total_value:
raise ValidationError(_("You must convert all the shares"
" to the selected type."))
raise ValidationError(
_(
"You must convert all the shares"
" to the selected type."
)
)
else: else:
if self.subscription_amount != self.partner_id.total_value: 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"
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" " are not correct. Please correct"
" the information before" " the information before"
" submitting"))
" submitting"
)
)
def get_share_trans_mail_template(self): def get_share_trans_mail_template(self):
return self.env.ref('easy_my_coop.email_template_share_transfer',
False)
return self.env.ref(
"easy_my_coop.email_template_share_transfer", False
)
def get_share_update_mail_template(self): def get_share_update_mail_template(self):
return self.env.ref('easy_my_coop.email_template_share_update',
False)
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.
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 = self.get_share_trans_mail_template()
cert_email_template.send_mail(self.partner_id_to.id, False) 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.
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 = self.get_share_update_mail_template()
cert_email_template.send_mail(self.partner_id.id, False) cert_email_template.send_mail(self.partner_id.id, False)
def get_subscription_register_vals(self, effective_date): def get_subscription_register_vals(self, effective_date):
return { 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,
"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 @api.multi
@ -244,51 +323,63 @@ class operation_request(models.Model):
self.ensure_one() self.ensure_one()
effective_date = self.get_date_now() effective_date = self.get_date_now()
sub_request = self.env['subscription.request']
sub_request = self.env["subscription.request"]
self.validate() self.validate()
if self.state != 'approved':
raise ValidationError(_("This operation must be approved"
" before to be executed"))
if self.state != "approved":
raise ValidationError(
_("This operation must be approved" " before to be executed")
)
values = self.get_subscription_register_vals(effective_date) 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':
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 amount_to_convert = self.share_unit_price * self.quantity
convert_quant = int(amount_to_convert / self.share_to_product_id.list_price)
convert_quant = int(
amount_to_convert / self.share_to_product_id.list_price
)
remainder = 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: if convert_quant > 0 and remainder == 0:
share_ids = self.partner_id.share_ids share_ids = self.partner_id.share_ids
line = share_ids[0] line = share_ids[0]
if len(share_ids) > 1: 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
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: 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}
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: if self.receiver_not_member:
partner = self.subscription_request.create_coop_partner() partner = self.subscription_request.create_coop_partner()
# get cooperator number # get cooperator number
sub_reg_num = int(sequence_id.next_by_id()) 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_vals.update(
sub_request.get_eater_vals(partner, self.share_product_id)
)
partner_vals["cooperator_register_number"] = sub_reg_num
partner.write(partner_vals) partner.write(partner_vals)
self.partner_id_to = partner self.partner_id_to = partner
else: else:
@ -296,40 +387,50 @@ class operation_request(models.Model):
if not self.partner_id_to.member: if not self.partner_id_to.member:
if self.partner_id_to.cooperator_register_number == 0: if self.partner_id_to.cooperator_register_number == 0:
sub_reg_num = int(sequence_id.next_by_id()) 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
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) self.partner_id_to.write(partner_vals)
# remove the parts to the giver # remove the parts to the giver
self.hand_share_over(self.partner_id,
self.share_product_id,
self.quantity)
self.hand_share_over(
self.partner_id, self.share_product_id, self.quantity
)
# give the share to the receiver # 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
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: else:
raise ValidationError(_("This operation is not yet"
" implemented."))
raise ValidationError(
_("This operation is not yet" " implemented.")
)
sequence_operation = self.env.ref('easy_my_coop.sequence_register_operation', False) #noqa
sequence_operation = self.env.ref(
"easy_my_coop.sequence_register_operation", False
) # noqa
sub_reg_operation = sequence_operation.next_by_id() sub_reg_operation = sequence_operation.next_by_id()
values['name'] = sub_reg_operation
values['register_number_operation'] = int(sub_reg_operation)
values["name"] = sub_reg_operation
values["register_number_operation"] = int(sub_reg_operation)
self.write({'state': 'done'})
self.write({"state": "done"})
sub_register_line = self.env['subscription.register'].create(values)
sub_register_line = self.env["subscription.register"].create(values)
# send mail to the receiver # send mail to the receiver
if self.operation_type == 'transfer':
if self.operation_type == "transfer":
self.send_share_trans_mail(sub_register_line) self.send_share_trans_mail(sub_register_line)
self.send_share_update_mail(sub_register_line) self.send_share_update_mail(sub_register_line)

184
easy_my_coop/models/partner.py

@ -7,7 +7,7 @@ from odoo import api, fields, models
class ResPartner(models.Model): class ResPartner(models.Model):
_inherit = 'res.partner'
_inherit = "res.partner"
@api.multi @api.multi
def _get_report_base_filename(self): def _get_report_base_filename(self):
@ -15,11 +15,11 @@ class ResPartner(models.Model):
if self.member: if self.member:
return "Cooperator Certificate - %s" % self.name return "Cooperator Certificate - %s" % self.name
else: else:
return 'unknown'
return "unknown"
@api.multi @api.multi
def _invoice_total(self): def _invoice_total(self):
account_invoice_report = self.env['account.invoice.report']
account_invoice_report = self.env["account.invoice.report"]
if not self.ids: if not self.ids:
self.total_invoiced = 0.0 self.total_invoiced = 0.0
return True return True
@ -28,7 +28,9 @@ class ResPartner(models.Model):
all_partner_ids = [] all_partner_ids = []
for partner in self: for partner in self:
# price_total is in the company currency # 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] all_partner_ids += all_partners_and_children[partner]
# searching account.invoice.report via the orm is comparatively # 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 # the user's company access directly these elements
# generate where clause to include multicompany rules # 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() from_clause, where_clause, where_clause_params = where_query.get_sql()
# price_total is in the company currency
query = """
# 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 SELECT SUM(price_total) as total, partner_id
FROM account_invoice_report account_invoice_report FROM account_invoice_report account_invoice_report
WHERE %s WHERE %s
GROUP BY partner_id GROUP BY partner_id
""" % where_clause
"""
% where_clause
)
self.env.cr.execute(query, where_clause_params) self.env.cr.execute(query, where_clause_params)
price_totals = self.env.cr.dictfetchall() price_totals = self.env.cr.dictfetchall()
for partner, child_ids in all_partners_and_children.items(): 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.multi
@api.depends('share_ids')
@api.depends("share_ids")
def _compute_effective_date(self): def _compute_effective_date(self):
# TODO change it to compute it from the share register # TODO change it to compute it from the share register
for partner in self: for partner in self:
@ -70,22 +88,20 @@ class ResPartner(models.Model):
@api.multi @api.multi
def _get_share_type(self): 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.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): def _compute_cooperator_type(self):
for partner in self: for partner in self:
share_type = ''
share_type = ""
for line in partner.share_ids: for line in partner.share_ids:
if line.share_number > 0: if line.share_number > 0:
share_type = line.share_product_id.default_code share_type = line.share_product_id.default_code
@ -93,7 +109,7 @@ class ResPartner(models.Model):
partner.cooperator_type = share_type partner.cooperator_type = share_type
@api.multi @api.multi
@api.depends('share_ids')
@api.depends("share_ids")
def _compute_share_info(self): def _compute_share_info(self):
for partner in self: for partner in self:
number_of_share = 0 number_of_share = 0
@ -104,62 +120,75 @@ class ResPartner(models.Model):
partner.number_of_share = number_of_share partner.number_of_share = number_of_share
partner.total_value = total_value partner.total_value = total_value
cooperator = fields.Boolean(string='Cooperator',
cooperator = fields.Boolean(
string="Cooperator",
help="Check this box if this contact is a" 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",
" 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", compute="_compute_coop_candidate",
store=True, store=True,
readonly=True)
old_member = fields.Boolean(string='Old cooperator',
readonly=True,
)
old_member = fields.Boolean(
string="Old cooperator",
help="Check this box if this cooperator is" help="Check this box if this cooperator is"
" no more an effective member.")
" no more an effective member.",
)
# todo use oca partner_contact_gender # 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',
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, compute=_compute_cooperator_type,
string='Cooperator Type',
store=True)
effective_date = fields.Date(sting="Effective Date",
compute=_compute_effective_date,
store=True)
string="Cooperator Type",
store=True,
)
effective_date = fields.Date(
sting="Effective Date", compute=_compute_effective_date, store=True
)
representative = fields.Boolean(string="Legal Representative") 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") data_policy_approved = fields.Boolean(string="Approved Data Policy")
internal_rules_approved = fields.Boolean(string="Approved Internal Rules") internal_rules_approved = fields.Boolean(string="Approved Internal Rules")
@api.multi @api.multi
@api.depends('subscription_request_ids.state')
@api.depends("subscription_request_ids.state")
def _compute_coop_candidate(self): def _compute_coop_candidate(self):
for partner in self: for partner in self:
if partner.member: if partner.member:
is_candidate = False is_candidate = False
else: else:
sub_requests = partner.subscription_request_ids.filtered( sub_requests = partner.subscription_request_ids.filtered(
lambda record: record.state == 'done')
lambda record: record.state == "done"
)
is_candidate = bool(sub_requests) is_candidate = bool(sub_requests)
partner.coop_candidate = is_candidate partner.coop_candidate = is_candidate
@ -167,19 +196,24 @@ class ResPartner(models.Model):
@api.multi @api.multi
def has_representative(self): def has_representative(self):
self.ensure_one() self.ensure_one()
if self.child_ids.filtered('representative'):
if self.child_ids.filtered("representative"):
return True return True
return False return False
@api.multi @api.multi
def get_representative(self): def get_representative(self):
self.ensure_one() self.ensure_one()
return self.child_ids.filtered('representative')
return self.child_ids.filtered("representative")
def get_cooperator_from_email(self, email): 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): 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),
]
)

28
easy_my_coop/models/product.py

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

5
easy_my_coop/models/res_partner_bank.py

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

10
easy_my_coop/report/account_invoice_report.py

@ -7,7 +7,13 @@ class AccountInvoiceReport(models.Model):
release_capital_request = fields.Boolean(string="Release capital request") release_capital_request = fields.Boolean(string="Release capital request")
def _select(self): def _select(self):
return super(AccountInvoiceReport, self)._select() + ", sub.release_capital_request as release_capital_request"
return (
super(AccountInvoiceReport, self)._select()
+ ", sub.release_capital_request as release_capital_request"
)
def _sub_select(self): def _sub_select(self):
return super(AccountInvoiceReport, self)._sub_select() + ", ai.release_capital_request as release_capital_request"
return (
super(AccountInvoiceReport, self)._sub_select()
+ ", ai.release_capital_request as release_capital_request"
)

19
easy_my_coop/report/cooperator_certificat_G001.xml

@ -5,7 +5,8 @@
<t t-call="web.external_layout"> <t t-call="web.external_layout">
<t t-set="address"> <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> </t>
<div class="page mt32"> <div class="page mt32">
<h2> <h2>
@ -13,7 +14,7 @@
</h2> </h2>
<p name="certificate_generation_date" class="mt16"> <p name="certificate_generation_date" class="mt16">
<span> Certificate generated on </span>
<span>Certificate generated on</span>
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%d/%m/%Y')"/> <span t-esc="context_timestamp(datetime.datetime.now()).strftime('%d/%m/%Y')"/>
</p> </p>
@ -24,7 +25,8 @@
</p> </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> <thead>
<tr> <tr>
<t t-set="colspan" t-value="5"/> <t t-set="colspan" t-value="5"/>
@ -67,10 +69,12 @@
<div t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto"> <div t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto">
<table class="table table-sm"> <table class="table table-sm">
<tr class="border-black o_total"> <tr class="border-black o_total">
<td><strong>Total</strong></td>
<td>
<strong>Total</strong>
</td>
<td class="text-right"> <td class="text-right">
<span t-field="o.number_of_share"/> <span t-field="o.number_of_share"/>
<span> share(s) </span>
<span>share(s)</span>
</td> </td>
<td class="text-right"> <td class="text-right">
<span t-field="o.total_value" <span t-field="o.total_value"
@ -85,7 +89,7 @@
<div class="row mt32"> <div class="row mt32">
<div name="board_commitee" class="col-sm-6"> <div name="board_commitee" class="col-sm-6">
<p> <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>
<p> <p>
<strong> <strong>
@ -107,7 +111,8 @@
<template id="cooperator_certificat_G001"> <template id="cooperator_certificat_G001">
<t t-call="web.html_container"> <t t-call="web.html_container">
<t t-foreach="docs" t-as="o"> <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>
</t> </t>
</template> </template>

130
easy_my_coop/report/cooperator_invoice_G002.xml

@ -5,39 +5,56 @@
<t t-call="web.external_layout"> <t t-call="web.external_layout">
<t t-set="address"> <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> </t>
<div class="page mt32"> <div class="page mt32">
<h2> <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-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 == '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 t-if="o.type == 'in_invoice'">Vendor Bill</span>
</span> </span>
<span t-field="o.number"/> <span t-field="o.number"/>
</h2> </h2>
<div id="informations" class="row mt32 mb32"> <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> <strong>Description:</strong>
<p class="m-0" t-field="o.name"/> <p class="m-0" t-field="o.name"/>
</div> </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> <strong>Request Date:</strong>
<p class="m-0" t-field="o.date_invoice"/> <p class="m-0" t-field="o.date_invoice"/>
</div> </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> <strong>Structured Communication:</strong>
<p class="m-0" t-field="o.reference"/> <p class="m-0" t-field="o.reference"/>
</div> </div>
<div name="account_number" class="col-auto mw-100 mb-2"> <div name="account_number" class="col-auto mw-100 mb-2">
<strong>Account Number:</strong> <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-set="b" t-value="journal.bank_account_id"/>
<t t-if="o.release_capital_request and journal.get_cooperator_payment"> <t t-if="o.release_capital_request and journal.get_cooperator_payment">
<p class="m-0" t-field="b.acc_number"/> <p class="m-0" t-field="b.acc_number"/>
@ -53,20 +70,36 @@
</div> </div>
</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> <thead>
<tr> <tr>
<t t-set="colspan" t-value="5"/> <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>Part Type</span>
</th>
<th class="text-right"> <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>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> </th>
</tr> </tr>
</thead> </thead>
@ -75,26 +108,38 @@
<t t-foreach="o.invoice_line_ids" t-as="line"> <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 ''"> <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"> <td class="text-right">
<span t-field="line.product_id.short_name"/> <span t-field="line.product_id.short_name"/>
</td> </td>
<td class="text-right"> <td class="text-right">
<span t-field="line.quantity"/> <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>
<td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"> <td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span t-field="line.price_unit"/> <span t-field="line.price_unit"/>
</td> </td>
<td class="text-right o_price_total"> <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> </td>
</t> </t>
<t t-if="line.display_type == 'line_section'"> <t t-if="line.display_type == 'line_section'">
@ -131,7 +176,9 @@
<div t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto"> <div t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto">
<table class="table table-sm"> <table class="table table-sm">
<tr class="border-black o_total"> <tr class="border-black o_total">
<td><strong>Total</strong></td>
<td>
<strong>Total</strong>
</td>
<td class="text-right"> <td class="text-right">
<span t-field="o.amount_total"/> <span t-field="o.amount_total"/>
</td> </td>
@ -141,7 +188,10 @@
</div> </div>
</div> </div>
<p t-if="o.reference"> <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>
<p t-if="o.comment" name="comment"> <p t-if="o.comment" name="comment">
<span t-field="o.comment"/> <span t-field="o.comment"/>
@ -152,13 +202,22 @@
<p t-if="o.fiscal_position_id.note" name="note"> <p t-if="o.fiscal_position_id.note" name="note">
<span t-field="o.fiscal_position_id.note"/> <span t-field="o.fiscal_position_id.note"/>
</p> </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)"> <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>
<p t-if="(o.partner_bank_id.qr_code_valid == False)"> <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> </p>
</div> </div>
</div> </div>
@ -169,7 +228,8 @@
<template id="theme_invoice_G002"> <template id="theme_invoice_G002">
<t t-call="web.html_container"> <t t-call="web.html_container">
<t t-foreach="docs" t-as="o"> <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>
</t> </t>
</template> </template>

92
easy_my_coop/report/cooperator_register_G001.xml

@ -15,11 +15,16 @@
<!--<t t-call="theme_light.list_header_G002"/>--> <!--<t t-call="theme_light.list_header_G002"/>-->
<br/><br/><br/><br/><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<table class="title_table"> <table class="title_table">
<tr> <tr>
<td> <td>
<span class="color_text" t-esc="time.strftime('%Y-%m-%d')"/>
<span class="color_text"
t-esc="time.strftime('%Y-%m-%d')"/>
</td> </td>
<td> <td>
<div class="title_doc" style="font-size:16px"> <div class="title_doc" style="font-size:16px">
@ -29,22 +34,29 @@
</tr> </tr>
</table> </table>
<br/><br/><br/><br/><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<table class="list_line_table_head" width="100%" >
<table class="list_line_table_head" width="100%">
<t t-set="total_quantity" t-value="0"/> <t t-set="total_quantity" t-value="0"/>
<t t-set="total_amount" t-value="0"/> <t t-set="total_amount" t-value="0"/>
<br />
<br/>
<tr> <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>
<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> </tr>
<t t-set="nb_ligne" t-value="0"/> <t t-set="nb_ligne" t-value="0"/>
@ -54,57 +66,69 @@
<t t-foreach="partner.share_ids" t-as="line"> <t t-foreach="partner.share_ids" t-as="line">
<t t-set="nb_ligne" t-value="nb_ligne+1"/> <t t-set="nb_ligne" t-value="nb_ligne+1"/>
<tr height="40px"> <tr height="40px">
<div t-if="(nb_ligne%2)==1" >
<div t-if="(nb_ligne%2)==1">
<div t-if="(new_partner)==0"> <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 class="lgn_impair"
style="text-align:left;text-indent:20px;">
<span t-field="partner.cooperator_register_number"></span>
</td> </td>
<td style="text-align:left"> <td style="text-align:left">
<span t-field="partner.name" ></span>
<span t-field="partner.name"></span>
</td> </td>
<td style="text-align:left"> <td style="text-align:left">
<span t-field="partner.email" ></span>
<span t-field="partner.email"></span>
</td> </td>
</div> </div>
<div t-if="(new_partner)!=0"> <div t-if="(new_partner)!=0">
<td class="lgn_impair" style="text-align:left;text-indent:20px;" colspan="3">
<td class="lgn_impair"
style="text-align:left;text-indent:20px;"
colspan="3">
</td> </td>
</div> </div>
<td> <td>
<span t-field="line.effective_date" ></span>
<span t-field="line.effective_date"></span>
</td> </td>
<td> <td>
<span t-field="line.share_number" ></span>
<span t-field="line.share_number"></span>
</td> </td>
<td> <td>
<span t-field="line.total_amount_line" <span t-field="line.total_amount_line"
t-field-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/> t-field-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
</td> </td>
</div> </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>
<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>
<td class="lgn_pair" style="background-color:#ffffff;text-align:left">
<span t-field="partner.name" ></span>
<td class="lgn_pair"
style="background-color:#ffffff;text-align:left">
<span t-field="partner.name"></span>
</td> </td>
<td class="lgn_pair" style="background-color:#ffffff;text-align:left">
<span t-field="partner.email" ></span>
<td class="lgn_pair"
style="background-color:#ffffff;text-align:left">
<span t-field="partner.email"></span>
</td> </td>
</div> </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">
<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> </td>
</div> </div>
<td class="lgn_pair" style="background-color:#ffffff">
<span t-field="line.effective_date"> </span>
<td class="lgn_pair"
style="background-color:#ffffff">
<span t-field="line.effective_date"></span>
</td> </td>
<td class="lgn_pair" style="background-color:#ffffff">
<span t-field="line.share_number" ></span>
<td class="lgn_pair"
style="background-color:#ffffff">
<span t-field="line.share_number"></span>
</td> </td>
<td class="lgn_pair" style="background-color:#ffffff">
<td class="lgn_pair"
style="background-color:#ffffff">
<span t-field="line.total_amount_line" <span t-field="line.total_amount_line"
t-field-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/> t-field-options='{"widget": "monetary", "display_currency": "res_company.currency_id"}'/>
</td> </td>

82
easy_my_coop/report/cooperator_subscription_G001.xml

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<template id="cooperator_subscription_G001">
<template id="cooperator_subscription_G001">
<t t-call="web.html_container"> <t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="5"/> <t t-set="data_report_margin_top" t-value="5"/>
@ -16,12 +16,17 @@
<!--<t t-call="theme_light.list_header_G002"/>--> <!--<t t-call="theme_light.list_header_G002"/>-->
<br/><br/><br/><br/><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<table class="title_table"> <table class="title_table">
<tr> <tr>
<td> <td>
<span class="color_text" t-esc="time.strftime('%Y-%m-%d')"/>
<span class="color_text"
t-esc="time.strftime('%Y-%m-%d')"/>
</td> </td>
<td> <td>
<div class="title_doc" style="font-size:16px"> <div class="title_doc" style="font-size:16px">
@ -31,70 +36,89 @@
</tr> </tr>
</table> </table>
<br/><br/><br/><br/><br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<table class="list_line_table_head" width="100%" >
<br />
<table class="list_line_table_head" width="100%">
<br/>
<tr> <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>
<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> </tr>
<t t-set="nb_ligne" t-value="0"/> <t t-set="nb_ligne" t-value="0"/>
<p t-foreach="docs" t-as="transaction"> <p t-foreach="docs" t-as="transaction">
<t t-set="nb_ligne" t-value="nb_ligne+1"/> <t t-set="nb_ligne" t-value="nb_ligne+1"/>
<tr height="40px"> <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>
<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>
<td style="text-align:left;text-indent:15px"> <td style="text-align:left;text-indent:15px">
<span t-field="transaction.partner_id.name" ></span>
<span t-field="transaction.partner_id.name"></span>
</td> </td>
<td style="text-align:center"> <td style="text-align:center">
<span t-field="transaction.date" ></span>
<span t-field="transaction.date"></span>
</td> </td>
<td style="text-align:center"> <td style="text-align:center">
<span t-field="transaction.type"/> <span t-field="transaction.type"/>
</td> </td>
<td style="text-align:center"> <td style="text-align:center">
<span t-field="transaction.quantity" ></span>
<span t-field="transaction.quantity"></span>
</td> </td>
</div> </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>
<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>
<td class="lgn_pair" style="text-align:left;text-indent:15px;background-color:#ffffff">
<span t-field="transaction.partner_id.name" ></span>
<td class="lgn_pair"
style="text-align:left;text-indent:15px;background-color:#ffffff">
<span t-field="transaction.partner_id.name"></span>
</td> </td>
<td style="text-align:center;background-color:#ffffff"> <td style="text-align:center;background-color:#ffffff">
<span t-field="transaction.date" ></span>
<span t-field="transaction.date"></span>
</td> </td>
<td style="text-align:center;background-color:#ffffff"> <td style="text-align:center;background-color:#ffffff">
<span t-field="transaction.type"/> <span t-field="transaction.type"/>
</td> </td>
<td style="text-align:center;background-color:#ffffff"> <td style="text-align:center;background-color:#ffffff">
<span t-field="transaction.quantity" ></span>
<span t-field="transaction.quantity"></span>
</td> </td>
</div> </div>
</tr> </tr>
</p> </p>
</table> </table>
<table width="100%" >
<br />
<table width="100%">
<br/>
<tr height="40px"> <tr height="40px">
<th width="15%"></th> <th width="15%"></th>
<th width="30%"></th> <th width="30%"></th>
<th width="15%"></th> <th width="15%"></th>
<th class="total_table color_text" width="25%"> TOTAL : </th>
<th class="total_table color_text" width="25%">TOTAL :
</th>
<th class="total_table" style="text-align:center" width="15%">
<th class="total_table" style="text-align:center"
width="15%">
<span t-esc="sum(t.quantity for t in docs)"/> <span t-esc="sum(t.quantity for t in docs)"/>
</th> </th>
</tr> </tr>
@ -102,5 +126,5 @@
</div> </div>
</t> </t>
<!--</t>--> <!--</t>-->
</template>
</template>
</odoo> </odoo>

47
easy_my_coop/report/layout.xml

@ -1,30 +1,52 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <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> <attribute name="style">display: none;</attribute>
</xpath> </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 class="row">
<div t-att-class="'text-center col-10' if company.display_logo1 or company.display_logo2 else 'text-center col'"> <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"> <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> </ul>
<div name="financial_infos"> <div name="financial_infos">
<span t-field="company.report_footer"/> <span t-field="company.report_footer"/>
</div> </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> </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" <img class="img img-responsive"
t-if="company.display_logo1" t-if="company.display_logo1"
t-attf-src="data:image/*;base64,{{company.bottom_logo1}}" t-attf-src="data:image/*;base64,{{company.bottom_logo1}}"
@ -48,7 +70,8 @@
that extend margin. See paperformat in data. that extend margin. See paperformat in data.
--> -->
<xpath expr="//div[hasclass('header')]//div//img" position="attributes"> <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> </xpath>
</template> </template>

6
easy_my_coop/security/res_groups.xml

@ -3,13 +3,15 @@
<record id="group_easy_my_coop_user" model="res.groups"> <record id="group_easy_my_coop_user" model="res.groups">
<field name="name">User</field> <field name="name">User</field>
<field name="category_id" ref="module_category_cooperator_management"/> <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>
<record id="group_easy_my_coop_manager" model="res.groups"> <record id="group_easy_my_coop_manager" model="res.groups">
<field name="name">Manager</field> <field name="name">Manager</field>
<field name="category_id" ref="module_category_cooperator_management"/> <field name="category_id" ref="module_category_cooperator_management"/>
<field name="implied_ids" eval="[(4, ref('group_easy_my_coop_user'))]"/> <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> </record>
</openerp> </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>

22
easy_my_coop/static/src/js/easy_my_coop.js

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

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

50
easy_my_coop/views/account_invoice_view.xml

@ -2,10 +2,10 @@
<record id="invoice_form" model="ir.ui.view"> <record id="invoice_form" model="ir.ui.view">
<field name="name">account.invoice.form</field> <field name="name">account.invoice.form</field>
<field name="model">account.invoice</field> <field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form" />
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="move_id" position="after"> <field name="move_id" position="after">
<field name="subscription_request" />
<field name="subscription_request"/>
</field> </field>
</field> </field>
</record> </record>
@ -14,16 +14,23 @@
<field name="name">Cooperator Invoices</field> <field name="name">Cooperator Invoices</field>
<field name="res_model">account.invoice</field> <field name="res_model">account.invoice</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph,activity</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph,activity
</field>
<field eval="False" name="view_id"/> <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="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="search_view_id" ref="account.view_account_invoice_filter"/>
<field name="help" type="html"> <field name="help" type="html">
<p class="o_view_nocontent_smiling_face"> <p class="o_view_nocontent_smiling_face">
Create a customer invoice Create a customer invoice
</p><p>
Create invoices, register payments and keep track of the discussions with your customers.
</p>
<p>
Create invoices, register payments and keep track of the
discussions with your customers.
</p> </p>
</field> </field>
</record> </record>
@ -46,28 +53,41 @@
<field name="name">Customer Invoices</field> <field name="name">Customer Invoices</field>
<field name="res_model">account.invoice</field> <field name="res_model">account.invoice</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph,activity</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph,activity
</field>
<field eval="False" name="view_id"/> <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="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="search_view_id" ref="account.view_account_invoice_filter"/>
<field name="help" type="html"> <field name="help" type="html">
<p class="o_view_nocontent_smiling_face"> <p class="o_view_nocontent_smiling_face">
Create a customer invoice Create a customer invoice
</p><p>
Create invoices, register payments and keep track of the discussions with your customers.
</p>
<p>
Create invoices, register payments and keep track of the
discussions with your customers.
</p> </p>
</field> </field>
</record> </record>
<record id="account.action_invoice_refund_out_tree" model="ir.actions.act_window">
<record id="account.action_invoice_refund_out_tree"
model="ir.actions.act_window">
<field name="name">Invoices</field> <field name="name">Invoices</field>
<field name="res_model">account.invoice</field> <field name="res_model">account.invoice</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form,kanban,calendar,graph,pivot</field> <field name="view_mode">tree,form,kanban,calendar,graph,pivot</field>
<field name="view_id" ref="account.invoice_tree"/> <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="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"/> <field name="search_view_id" ref="account.view_account_invoice_filter"/>
</record> </record>
</odoo> </odoo>

6
easy_my_coop/views/account_journal_view.xml

@ -6,7 +6,8 @@
<field name="inherit_id" ref="account.view_account_journal_form"/> <field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="bank_id" position="after"> <field name="bank_id" position="after">
<field name="get_cooperator_payment" groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="get_cooperator_payment"
groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="get_general_payment"/> <field name="get_general_payment"/>
</field> </field>
</field> </field>
@ -18,7 +19,8 @@
<field name="inherit_id" ref="account.view_account_bank_journal_form"/> <field name="inherit_id" ref="account.view_account_bank_journal_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="currency_id" position="after"> <field name="currency_id" position="after">
<field name="get_cooperator_payment" groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="get_cooperator_payment"
groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="get_general_payment"/> <field name="get_general_payment"/>
</field> </field>
</field> </field>

21
easy_my_coop/views/cooperator_register_view.xml

@ -32,7 +32,8 @@
<field name="total_amount_line"/> <field name="total_amount_line"/>
</group> </group>
<group> <group>
<field name="partner_id_to" attrs="{'invisible':[('type','!=','transfer')]}"/>
<field name="partner_id_to"
attrs="{'invisible':[('type','!=','transfer')]}"/>
<field name="type"/> <field name="type"/>
<field name="share_to_short_name"/> <field name="share_to_short_name"/>
<field name="quantity_to"/> <field name="quantity_to"/>
@ -53,14 +54,20 @@
filter_domain="[('partner_id','ilike',self)]"/> filter_domain="[('partner_id','ilike',self)]"/>
<field name="register_number_operation"/> <field name="register_number_operation"/>
<separator/> <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')]"/>
<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/> <separator/>
<group expand="0" name="group_by" string="Group By"> <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'}"/>
<filter name="entry_type" string="Entry type"
context="{'group_by' : 'type'}"/>
<filter name="subscription_date" string="Subscription Date"
context="{'group_by': 'date'}"/>
</group> </group>
</search> </search>
</field> </field>

4
easy_my_coop/views/email_template_view.xml

@ -8,8 +8,8 @@
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">form,tree</field> <field name="view_mode">form,tree</field>
<field name="domain">[('easy_my_coop','=',True)]</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" />
<field name="view_id" ref="mail.email_template_tree"/>
<field name="search_view_id" ref="mail.view_email_template_search"/>
</record> </record>
</odoo> </odoo>

62
easy_my_coop/views/menus.xml

@ -4,23 +4,55 @@
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
<odoo> <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> </odoo>

72
easy_my_coop/views/operation_request_view.xml

@ -4,7 +4,8 @@
<field name="name">operation.request.tree</field> <field name="name">operation.request.tree</field>
<field name="model">operation.request</field> <field name="model">operation.request</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="Operation requests" colors="green:state in ('approved'); blue:state in ('draft');grey: state in ('done')">
<tree string="Operation requests"
colors="green:state in ('approved'); blue:state in ('draft');grey: state in ('done')">
<field name="request_date"/> <field name="request_date"/>
<field name="partner_id"/> <field name="partner_id"/>
<field name="operation_type"/> <field name="operation_type"/>
@ -21,36 +22,59 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Operation request"> <form string="Operation request">
<header> <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"}'/>
<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> </header>
<sheet> <sheet>
<group> <group>
<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)]}"/>
<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>
<group> <group>
<field name="user_id"/> <field name="user_id"/>
<field name="share_product_id" attrs="{'readonly':[('state','!=','draft')]}" widget="selection"/>
<field name="share_product_id"
attrs="{'readonly':[('state','!=','draft')]}"
widget="selection"/>
<field name="share_short_name" readonly="True"/> <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_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="share_to_short_name" readonly="True"/>
<field name="quantity" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="quantity"
attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="share_unit_price" readonly="True"/> <field name="share_unit_price" readonly="True"/>
<field name="subscription_amount" readonly="True" />
<field name="subscription_amount" readonly="True"/>
</group> </group>
</group> </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'}">
<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> <tree>
<field name="name"/> <field name="name"/>
<field name="birthdate"/> <field name="birthdate"/>
@ -80,10 +104,14 @@
<field name="lang"/> <field name="lang"/>
<field name="validated"/> <field name="validated"/>
<field name="skip_control_ng"/> <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"/>
<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>
</group> </group>
</sheet> </sheet>

41
easy_my_coop/views/product_view.xml

@ -10,13 +10,16 @@
<field name="is_share"/> <field name="is_share"/>
<label for="is_share"/> <label for="is_share"/>
</div> </div>
<div attrs="{'invisible':[('is_share','=',False)]}" groups="easy_my_coop.group_easy_my_coop_user">
<div attrs="{'invisible':[('is_share','=',False)]}"
groups="easy_my_coop.group_easy_my_coop_user">
<field name="display_on_website"/> <field name="display_on_website"/>
<label for="display_on_website"/> <label for="display_on_website"/>
</div> </div>
</xpath> </xpath>
<page name="general_information" position="after"> <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">
<page string="Share Information" name="share_information"
attrs="{'invisible':[('is_share','=',False)]}"
groups="easy_my_coop.group_easy_my_coop_user">
<group> <group>
<group name="Info" string="Info"> <group name="Info" string="Info">
<field name="short_name"/> <field name="short_name"/>
@ -26,7 +29,8 @@
<group name="configuration" string="Configuration"> <group name="configuration" string="Configuration">
<field name="force_min_qty"/> <field name="force_min_qty"/>
<field name="minimum_quantity"/> <field name="minimum_quantity"/>
<field name="customer" attrs="{'invisible':[('is_share','=',False)]}"/>
<field name="customer"
attrs="{'invisible':[('is_share','=',False)]}"/>
<field name="by_company"/> <field name="by_company"/>
<field name="by_individual"/> <field name="by_individual"/>
</group> </group>
@ -43,7 +47,8 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<group expand="0" name="group_by" string="Group By"> <group expand="0" name="group_by" string="Group By">
<filter name="Creation Date" context="{'group_by': 'create_date'}"/>
<filter name="Creation Date"
context="{'group_by': 'create_date'}"/>
</group> </group>
</xpath> </xpath>
</field> </field>
@ -55,7 +60,9 @@
<field name="inherit_id" ref="product.product_template_only_form_view"/> <field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="default_code" position="attributes"> <field name="default_code" position="attributes">
<attribute name="attrs">{'required': [('is_share', '=', True)]}</attribute>
<attribute name="attrs">{'required': [('is_share', '=',
True)]}
</attribute>
</field> </field>
</field> </field>
</record> </record>
@ -67,8 +74,8 @@
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field> <field name="view_mode">kanban,tree,form</field>
<!-- <field name="context">{"search_default_filter_to_purchase":1}</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="search_view_id" eval="False"/> <!-- Force empty -->
<field name="view_id" eval="False"/> <!-- Force empty -->
<field name="domain">[('is_share','=',True)]</field> <field name="domain">[('is_share','=',True)]</field>
<field name="help" type="html"> <field name="help" type="html">
<p class="oe_view_nocontent_create"> <p class="oe_view_nocontent_create">
@ -92,11 +99,13 @@
<field name="help" type="html"> <field name="help" type="html">
<p class="oe_view_nocontent_create"> <p class="oe_view_nocontent_create">
Click to define a new product. Click to define a new product.
</p><p>
</p>
<p>
You must define a product for everything you sell, whether it's You must define a product for everything you sell, whether it's
a physical product, a consumable or a service you offer to a physical product, a consumable or a service you offer to
customers. customers.
</p><p>
</p>
<p>
The product form contains information to simplify the sale The product form contains information to simplify the sale
process: price, notes in the quotation, accounting data, process: price, notes in the quotation, accounting data,
procurement methods, etc. procurement methods, etc.
@ -116,10 +125,16 @@
<field name="help" type="html"> <field name="help" type="html">
<p class="oe_view_nocontent_create"> <p class="oe_view_nocontent_create">
Click to define a new product. 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>
<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> </p>
</field> </field>
</record> </record>

3
easy_my_coop/views/res_company_view.xml

@ -6,7 +6,8 @@
<field name="model">res.company</field> <field name="model">res.company</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<group name="social_media" position="before"> <group name="social_media" position="before">
<group name="coop_grp" string="EasyMy Coop" groups="easy_my_coop.group_easy_my_coop_user">
<group name="coop_grp" string="EasyMy Coop"
groups="easy_my_coop.group_easy_my_coop_user">
<field name="unmix_share_type"/> <field name="unmix_share_type"/>
<field name="allow_id_card_upload"/> <field name="allow_id_card_upload"/>
<field name="create_user"/> <field name="create_user"/>

136
easy_my_coop/views/res_partner_view.xml

@ -12,37 +12,57 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<sheet position="before"> <sheet position="before">
<header> <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"/>
<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> </header>
</sheet> </sheet>
<xpath expr="/form/sheet/group" position='before'> <xpath expr="/form/sheet/group" position='before'>
<group> <group>
<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)]}"/>
<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>
<group> <group>
<field name="gender" attrs="{'invisible':[('is_company','=',True)]}"/>
<field name="gender"
attrs="{'invisible':[('is_company','=',True)]}"/>
</group> </group>
<group name="approvals"> <group name="approvals">
<field name="internal_rules_approved" />
<field name="data_policy_approved" />
<field name="internal_rules_approved"/>
<field name="data_policy_approved"/>
</group> </group>
</group> </group>
</xpath> </xpath>
<page name='sales_purchases' position="after"> <page name='sales_purchases' position="after">
<page string="Shares" name="share" attrs="{'invisible':[('member','=',False)]}" groups="easy_my_coop.group_easy_my_coop_user">
<page string="Shares" name="share"
attrs="{'invisible':[('member','=',False)]}"
groups="easy_my_coop.group_easy_my_coop_user">
<group> <group>
<field name="number_of_share"/> <field name="number_of_share"/>
<field name="total_value"/> <field name="total_value"/>
@ -51,19 +71,25 @@
<tree create="false"> <tree create="false">
<field name="effective_date"/> <field name="effective_date"/>
<field name="share_short_name"/> <field name="share_short_name"/>
<field name="share_number" sum="Total of shares"/>
<field name="share_number"
sum="Total of shares"/>
<field name="share_unit_price"/> <field name="share_unit_price"/>
<field name="total_amount_line" sum="Total subscribed amount"/>
<field name="total_amount_line"
sum="Total subscribed amount"/>
</tree> </tree>
</field> </field>
</page> </page>
<page string="Share subscriptions" name="share_subscription" attrs="{'invisible':[('cooperator','=',False)]}" groups="easy_my_coop.group_easy_my_coop_user">
<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"> <field name="subscription_request_ids">
<tree create="false" delete="false" edit="false"> <tree create="false" delete="false" edit="false">
<field name="share_short_name"/> <field name="share_short_name"/>
<field name="ordered_parts" sum="Total of shares"/>
<field name="ordered_parts"
sum="Total of shares"/>
<field name="share_unit_price"/> <field name="share_unit_price"/>
<field name="subscription_amount" sum="Total subscribed amount"/>
<field name="subscription_amount"
sum="Total subscribed amount"/>
<field name="type"/> <field name="type"/>
<field name="state"/> <field name="state"/>
</tree> </tree>
@ -78,8 +104,9 @@
<field name="model">res.partner</field> <field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_tree"/> <field name="inherit_id" ref="base.view_partner_tree"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="/tree/field[@name='display_name']" position='after'>
<field name="cooperator_register_number" />
<xpath expr="/tree/field[@name='display_name']"
position='after'>
<field name="cooperator_register_number"/>
<field name="cooperator_type"/> <field name="cooperator_type"/>
<field name="effective_date"/> <field name="effective_date"/>
</xpath> </xpath>
@ -92,68 +119,94 @@
<field name="inherit_id" ref="base.view_res_partner_filter"/> <field name="inherit_id" ref="base.view_res_partner_filter"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<filter name="supplier" position='after'> <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 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>
<filter name="salesperson" position="before"> <filter name="salesperson" position="before">
<filter string="Cooperator Type" name="group_by_cooperator_type" context="{'group_by': 'cooperator_type'}"/>
<filter string="Cooperator Type"
name="group_by_cooperator_type"
context="{'group_by': 'cooperator_type'}"/>
</filter> </filter>
</field> </field>
</record> </record>
<record id="action_partner_cooperator_form" model="ir.actions.act_window">
<record id="action_partner_cooperator_form"
model="ir.actions.act_window">
<field name="name">Cooperators</field> <field name="name">Cooperators</field>
<field name="res_model">res.partner</field> <field name="res_model">res.partner</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">kanban,tree,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="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"> <field name="help" type="html">
<p class="oe_view_nocontent_create"> <p class="oe_view_nocontent_create">
Click to add a contact in your address book. Click to add a contact in your address book.
</p><p>
</p>
<p>
OpenERP helps you easily track all activities related to OpenERP helps you easily track all activities related to
a cooperator: discussions, history of business opportunities,
a cooperator: discussions, history of business
opportunities,
documents, etc. documents, etc.
</p> </p>
</field> </field>
</record> </record>
<record id="action_partner_cooperator_candidate_form" model="ir.actions.act_window">
<record id="action_partner_cooperator_candidate_form"
model="ir.actions.act_window">
<field name="name">Cooperator candidates</field> <field name="name">Cooperator candidates</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field> <field name="res_model">res.partner</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field> <field name="view_mode">kanban,tree,form</field>
<field name="domain">[('cooperator','=',True)]</field> <field name="domain">[('cooperator','=',True)]</field>
<field name="context">{'default_cooperator':1, 'search_default_cooperator_candidates':1}</field>
<field name="context">{'default_cooperator':1,
'search_default_cooperator_candidates':1}
</field>
<field name="filter" eval="True"/> <field name="filter" eval="True"/>
<field name="help" type="html"> <field name="help" type="html">
<p class="oe_view_nocontent_create"> <p class="oe_view_nocontent_create">
Click to add a contact in your address book. Click to add a contact in your address book.
</p><p>
</p>
<p>
OpenERP helps you easily track all activities related to OpenERP helps you easily track all activities related to
a cooperator: discussions, history of business opportunities,
a cooperator: discussions, history of business
opportunities,
documents, etc. documents, etc.
</p> </p>
</field> </field>
</record> </record>
<record id="action_company_representative_form" model="ir.actions.act_window">
<record id="action_company_representative_form"
model="ir.actions.act_window">
<field name="name">Company representative</field> <field name="name">Company representative</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">res.partner</field> <field name="res_model">res.partner</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field> <field name="view_mode">kanban,tree,form</field>
<field name="domain">[('cooperator','=',True),('representative','=',True)]</field>
<field name="domain">
[('cooperator','=',True),('representative','=',True)]
</field>
<field name="filter" eval="True"/> <field name="filter" eval="True"/>
<field name="help" type="html"> <field name="help" type="html">
<p class="oe_view_nocontent_create"> <p class="oe_view_nocontent_create">
Click to add a contact in your address book. Click to add a contact in your address book.
</p><p>
</p>
<p>
OpenERP helps you easily track all activities related to OpenERP helps you easily track all activities related to
a cooperator: discussions, history of business opportunities,
a cooperator: discussions, history of business
opportunities,
documents, etc. documents, etc.
</p> </p>
</field> </field>
@ -162,7 +215,8 @@
<record id="remove_partner_follower" model="ir.ui.view"> <record id="remove_partner_follower" model="ir.ui.view">
<field name="name">res.partner.remove.follower.inherit</field> <field name="name">res.partner.remove.follower.inherit</field>
<field name="model">res.partner</field> <field name="model">res.partner</field>
<field name="inherit_id" ref="mail.res_partner_view_form_inherit_mail"/>
<field name="inherit_id"
ref="mail.res_partner_view_form_inherit_mail"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="message_follower_ids" position="replace"/> <field name="message_follower_ids" position="replace"/>
</field> </field>

97
easy_my_coop/views/subscription_request_view.xml

@ -6,13 +6,15 @@
<field name="model">subscription.request</field> <field name="model">subscription.request</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<!-- fixme no colors in v12 ? --> <!-- fixme no colors in v12 ? -->
<tree string="Subscription Requests" colors="red:validated == False; blue:state in ('draft'); grey: state in ('done')">
<tree string="Subscription Requests"
colors="red:validated == False; blue:state in ('draft'); grey: state in ('done')">
<field name="name"/> <field name="name"/>
<field name="company_name"/> <field name="company_name"/>
<field name="date" string="Request Date"/> <field name="date" string="Request Date"/>
<field name="type"/> <field name="type"/>
<field name="share_short_name" string="Share Type"/> <field name="share_short_name" string="Share Type"/>
<field name="ordered_parts" string="Quantity" sum="Total ordered parts"/>
<field name="ordered_parts" string="Quantity"
sum="Total ordered parts"/>
<field name="subscription_amount" sum="Total amount"/> <field name="subscription_amount" sum="Total amount"/>
<field name="email"/> <field name="email"/>
<field name="iban"/> <field name="iban"/>
@ -20,9 +22,15 @@
<field name="source"/> <field name="source"/>
<field name="state"/> <field name="state"/>
<field name="validated" invisible="True"/> <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"/>
<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> </tree>
</field> </field>
</record> </record>
@ -33,22 +41,34 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Subscription Requests"> <form string="Subscription Requests">
<header> <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"/>
<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> </header>
<sheet> <sheet>
<group> <group>
<group> <group>
<field name="validated" invisible="True"/> <field name="validated" invisible="True"/>
<field name="already_cooperator"/> <field name="already_cooperator"/>
<field name="is_company" groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="is_company"
groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="is_operation" invisible="True"/> <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="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="name"/>
<field name="firstname"/> <field name="firstname"/>
<field name="lastname"/> <field name="lastname"/>
@ -56,16 +76,19 @@
<field name="gender"/> <field name="gender"/>
<field name="email"/> <field name="email"/>
<field name="phone"/> <field name="phone"/>
<field name="contact_person_function" attrs="{'invisible':[('is_company','=',False)]}"/>
<field name="contact_person_function"
attrs="{'invisible':[('is_company','=',False)]}"/>
<!-- todo highlight iban if not valid --> <!-- todo highlight iban if not valid -->
<field name="iban"/> <field name="iban"/>
<field name="address"/> <field name="address"/>
<field name="zip_code"/> <field name="zip_code"/>
<field name="city"/> <field name="city"/>
<field name="country_id" options="{'no_create':True}"/>
<field name="country_id"
options="{'no_create':True}"/>
</group> </group>
<group> <group>
<field name="capital_release_request_date" groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="capital_release_request_date"
groups="easy_my_coop.group_easy_my_coop_manager"/>
<field name="date"/> <field name="date"/>
<field name="source"/> <field name="source"/>
<field name="ordered_parts"/> <field name="ordered_parts"/>
@ -73,7 +96,8 @@
<field name="share_short_name"/> <field name="share_short_name"/>
<field name="share_unit_price"/> <field name="share_unit_price"/>
<field name="subscription_amount"/> <field name="subscription_amount"/>
<field name="partner_id" options="{'no_create':True}"/>
<field name="partner_id"
options="{'no_create':True}"/>
<field name="type"/> <field name="type"/>
<field name="lang"/> <field name="lang"/>
<field name="skip_control_ng"/> <field name="skip_control_ng"/>
@ -81,10 +105,12 @@
</group> </group>
</group> </group>
<notebook> <notebook>
<page name="capital_release_request" string="Capital release request">
<page name="capital_release_request"
string="Capital release request">
<field name="capital_release_request"> <field name="capital_release_request">
<tree options="{'no_create':True}"> <tree options="{'no_create':True}">
<field string="Cooperator" name="partner_id"/>
<field string="Cooperator"
name="partner_id"/>
<field name="date_invoice"/> <field name="date_invoice"/>
<field name="number"/> <field name="number"/>
<field string="Reference" name="reference"/> <field string="Reference" name="reference"/>
@ -109,14 +135,20 @@
<field name="name"/> <field name="name"/>
<field name="partner_id"/> <field name="partner_id"/>
<separator/> <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')]"/>
<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/> <separator/>
<filter string="Not Validated" name="Not Validated" domain="[('validated', '=', False)]"/>
<filter string="Not Validated" name="Not Validated"
domain="[('validated', '=', False)]"/>
<group expand="0" name="group_by" string="Group By"> <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'}"/>
<filter name="request_type" string="Request type"
context="{'group_by' : 'type'}"/>
<filter name="date" string="Request Date"
context="{'group_by': 'date'}"/>
</group> </group>
</search> </search>
</field> </field>
@ -138,8 +170,11 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Share line"> <form string="Share line">
<header> <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"/>
<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> </header>
<sheet> <sheet>
<group> <group>
@ -185,8 +220,10 @@
<field name="effective_date"/> <field name="effective_date"/>
<separator/> <separator/>
<group name="group_by" string="Group By"> <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'}"/>
<filter name="cooperator" string="Cooperator"
context="{'group_by' : 'partner_id'}"/>
<filter name="effective_date" string="Effective date"
context="{'group_by': 'effective_date'}"/>
</group> </group>
</search> </search>
</field> </field>

10
easy_my_coop/wizard/account_invoice_refund.py

@ -6,14 +6,14 @@ class AccountInvoiceRefund(models.TransientModel):
_inherit = "account.invoice.refund" _inherit = "account.invoice.refund"
@api.multi @api.multi
def compute_refund(self, mode='refund'):
def compute_refund(self, mode="refund"):
result = super(AccountInvoiceRefund, self).compute_refund(mode) result = super(AccountInvoiceRefund, self).compute_refund(mode)
context = dict(self._context or {}) 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: 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] out = [t if e[0] == t[0] else e for e in domain]
result['domain'] = out
result["domain"] = out
return result return result

81
easy_my_coop/wizard/cooperative_history_wizard.xml

@ -1,41 +1,48 @@
<?xml version="1.0" ?> <?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>
<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>-->
<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>
<!-- <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>-->
<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>
<!-- <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>
</openerp>
<!-- <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>

210
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 from odoo.exceptions import UserError
import odoo.addons.decimal_precision as dp
class PartnerCreateSubscription(models.TransientModel): class PartnerCreateSubscription(models.TransientModel):
_name = "partner.create.subscription" _name = "partner.create.subscription"
_description = "Create Subscription From Partner" _description = "Create Subscription From Partner"
@api.multi @api.multi
@api.onchange('share_product')
@api.onchange("share_product")
def on_change_share_type(self): def on_change_share_type(self):
self.share_qty = self.share_product.minimum_quantity self.share_qty = self.share_product.minimum_quantity
@api.model @api.model
def _default_product_id(self): 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: if active_id:
partner = self.env['res.partner'].browse(active_id)
partner = self.env["res.partner"].browse(active_id)
if partner.is_company: if partner.is_company:
domain.append(('by_company', '=', True))
domain.append(("by_company", "=", True))
else: 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): def _get_representative(self):
partner = self._get_partner() partner = self._get_partner()
if partner.is_company: if partner.is_company:
return partner.search([('parent_id', '=', partner.id),
('representative', '=', True)])
return partner.search(
[("parent_id", "=", partner.id), ("representative", "=", True)]
)
return False return False
@api.model @api.model
@ -49,8 +53,8 @@ class PartnerCreateSubscription(models.TransientModel):
@api.model @api.model
def _get_partner(self): 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 @api.model
def _get_is_company(self): def _get_is_company(self):
@ -75,124 +79,140 @@ class PartnerCreateSubscription(models.TransientModel):
@api.model @api.model
def _get_possible_share(self): def _get_possible_share(self):
domain = [('is_share', '=', True)]
domain = [("is_share", "=", True)]
partner = self._get_partner() partner = self._get_partner()
if partner.is_company: if partner.is_company:
domain.append(('by_company', '=', True))
domain.append(("by_company", "=", True))
else: else:
domain.append(('by_individual', '=', True))
domain.append(("by_individual", "=", True))
return domain return domain
@api.multi @api.multi
@api.depends('share_product', 'share_qty')
@api.depends("share_product", "share_qty")
def _compute_subscription_amount(self): def _compute_subscription_amount(self):
for sub_request in 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',
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, domain=_get_possible_share,
default=_default_product_id, 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)
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 @api.multi
def create_subscription(self): 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 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: 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: else:
vals['name'] = cooperator.name
vals["name"] = cooperator.name
coop_vals = {} coop_vals = {}
if not self._get_email(): if not self._get_email():
coop_vals['email'] = self.email
coop_vals["email"] = self.email
if not self._get_register_number(): if not self._get_register_number():
if self.is_company: 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(): if self.is_company and not self._get_representative():
representative = False representative = False
if self.representative_email: if self.representative_email:
representative = partner_obj.search( representative = partner_obj.search(
[('email', '=', self.representative_email)])
[("email", "=", self.representative_email)]
)
if representative: if representative:
if len(representative) > 1: 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: 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 representative.parent_id = cooperator.id
else: else:
if self.representative_email: 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) partner_obj.create(represent_vals)
if not self._get_bank_account(): 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: if self.is_company:
representative = self._get_representative() representative = self._get_representative()
vals['name'] = representative.name
vals["name"] = representative.name
if coop_vals: if coop_vals:
cooperator.write(coop_vals) cooperator.write(coop_vals)
@ -200,10 +220,10 @@ class PartnerCreateSubscription(models.TransientModel):
new_sub_req = sub_req.create(vals) new_sub_req = sub_req.create(vals)
return { 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",
} }

25
easy_my_coop/wizard/create_subscription_from_partner.xml

@ -7,15 +7,19 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Create Subscription"> <form string="Create Subscription">
<p class="oe_grey"> <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> </p>
<group> <group>
<field name="is_company" invisible="True"/> <field name="is_company" invisible="True"/>
<field name="cooperator" 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="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="email"/>
<field name="register_number" attrs="{'invisible':[('is_company','=',False)],'required':[('is_company','=',True)]}"/>
<field name="register_number"
attrs="{'invisible':[('is_company','=',False)],'required':[('is_company','=',True)]}"/>
<field name="bank_account"/> <field name="bank_account"/>
<field name="share_product" widget="selection"/> <field name="share_product" widget="selection"/>
<field name="share_qty"/> <field name="share_qty"/>
@ -23,21 +27,26 @@
<field name="subscription_amount"/> <field name="subscription_amount"/>
</group> </group>
<footer> <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> </footer>
</form> </form>
</field> </field>
</record> </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="name">Create Subscription</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">partner.create.subscription</field> <field name="res_model">partner.create.subscription</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">form</field> <field name="view_mode">form</field>
<field name="target">new</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> </record>
</data> </data>

49
easy_my_coop/wizard/update_partner_info.py

@ -7,8 +7,8 @@ class PartnerUpdateInfo(models.TransientModel):
@api.model @api.model
def _get_partner(self): 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 @api.model
def _get_register_number(self): def _get_register_number(self):
@ -20,13 +20,13 @@ class PartnerUpdateInfo(models.TransientModel):
def _get_is_company(self): def _get_is_company(self):
return self._get_partner().is_company 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") all = fields.Boolean(string="Update from subscription request")
birthdate = fields.Boolean(string="Set missing birth date") birthdate = fields.Boolean(string="Set missing birth date")
legal_form = fields.Boolean(string="Set legal form") legal_form = fields.Boolean(string="Set legal form")
@ -34,41 +34,50 @@ class PartnerUpdateInfo(models.TransientModel):
@api.multi @api.multi
def update(self): def update(self):
partner_obj = self.env['res.partner']
partner_obj = self.env["res.partner"]
cooperator = self.cooperator cooperator = self.cooperator
coop_vals = {} coop_vals = {}
if self.all: if self.all:
if self.legal_form or self.representative_function: 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: for coop in coops:
coop_vals = {} 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: if sub_reqs:
sub_req = sub_reqs[0] sub_req = sub_reqs[0]
if self.legal_form: if self.legal_form:
coop_vals['legal_form'] = sub_req.company_type
coop_vals["legal_form"] = sub_req.company_type
coop.write(coop_vals) coop.write(coop_vals)
if self.representative_function: if self.representative_function:
contact = coop.get_representative() contact = coop.get_representative()
contact.function = sub_req.contact_person_function contact.function = sub_req.contact_person_function
else: 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: for coop in coops:
coop_vals = {} 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: if sub_reqs:
sub_req = sub_reqs[0] sub_req = sub_reqs[0]
if self.birthdate: if self.birthdate:
coop_vals['birthdate_date'] = sub_req.birthdate
coop_vals["birthdate_date"] = sub_req.birthdate
coop.write(coop_vals) coop.write(coop_vals)
else: else:
if cooperator: if cooperator:
if cooperator.is_company: if cooperator.is_company:
coop_vals['company_register_number'] = self.register_number
coop_vals["company_register_number"] = self.register_number
if coop_vals: if coop_vals:
cooperator.write(coop_vals) cooperator.write(coop_vals)

15
easy_my_coop/wizard/update_partner_info.xml

@ -16,24 +16,29 @@
<field name="legal_form"/> <field name="legal_form"/>
<field name="representative_function"/> <field name="representative_function"/>
<field name="cooperator" readonly="True"/> <field name="cooperator" readonly="True"/>
<field name="register_number" attrs="{'required':['|', ('is_company', '=', True), ('all', '=', False)], 'invisible':[('is_company', '=', False)]}"/>
<field name="register_number"
attrs="{'required':['|', ('is_company', '=', True), ('all', '=', False)], 'invisible':[('is_company', '=', False)]}"/>
</group> </group>
<footer> <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> </footer>
</form> </form>
</field> </field>
</record> </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="name">Update Cooperator Info</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">partner.update.info</field> <field name="res_model">partner.update.info</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">form</field> <field name="view_mode">form</field>
<field name="target">new</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> </record>
</data> </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 from odoo.exceptions import UserError
@ -8,8 +8,8 @@ class ShareLineUpdateInfo(models.TransientModel):
@api.model @api.model
def _get_share_line(self): 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 @api.model
def _get_effective_date(self): def _get_effective_date(self):
@ -17,14 +17,15 @@ class ShareLineUpdateInfo(models.TransientModel):
return share_line.effective_date 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 @api.multi
def update(self): def update(self):
@ -32,15 +33,22 @@ class ShareLineUpdateInfo(models.TransientModel):
line = self.share_line line = self.share_line
cooperator = line.partner_id 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 sub_reg:
if len(sub_reg) > 1: 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: else:
line.effective_date = self.effective_date line.effective_date = self.effective_date
sub_reg.date = self.effective_date sub_reg.date = self.effective_date

12
easy_my_coop/wizard/update_share_line.xml

@ -15,21 +15,25 @@
<field name="effective_date"/> <field name="effective_date"/>
</group> </group>
<footer> <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> </footer>
</form> </form>
</field> </field>
</record> </record>
<record id="action_view_update_share_line_info" model="ir.actions.act_window">
<record id="action_view_update_share_line_info"
model="ir.actions.act_window">
<field name="name">Update Share Line Info</field> <field name="name">Update Share Line Info</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">share.line.update.info</field> <field name="res_model">share.line.update.info</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">form</field> <field name="view_mode">form</field>
<field name="target">new</field> <field name="target">new</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> </record>
</data> </data>

8
easy_my_coop/wizard/validate_subscription_request.py

@ -7,10 +7,12 @@ class ValidateSubscriptionRequest(models.TransientModel):
@api.multi @api.multi
def validate(self): 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( 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: for subscription_request in subscription_requests:
subscription_request.validate_subscription_request() subscription_request.validate_subscription_request()

11
easy_my_coop/wizard/validate_subscription_request.xml

@ -9,8 +9,10 @@
Validate the subscription request. Validate the subscription request.
</p> </p>
<footer> <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> </footer>
</form> </form>
</field> </field>
@ -19,7 +21,8 @@
<act_window id="action_account_invoice_confirm" <act_window id="action_account_invoice_confirm"
multi="True" multi="True"
key2="client_action_multi" name="Validate subscription request" 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" />
res_model="validate.subscription.request"
src_model="subscription.request"
view_mode="form" target="new" view_type="form"/>
</odoo> </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.

19
easy_my_coop_be/__manifest__.py

@ -3,20 +3,15 @@
# - Houssine BAKKALI - <houssine@coopiteasy.be> # - Houssine BAKKALI - <houssine@coopiteasy.be>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).# # 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", "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", "category": "Cooperative management",
"website": "www.coopiteasy.be", "website": "www.coopiteasy.be",
"license": "AGPL-3", "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,
} }

19
easy_my_coop_be/models/coop.py

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

14
easy_my_coop_be/models/partner.py

@ -2,9 +2,13 @@ from odoo import fields, models
class ResPartner(models.Model): class ResPartner(models.Model):
_inherit = 'res.partner'
_inherit = "res.partner"
legal_form = fields.Selection(selection_add=[('scrl', 'SCRL'),
('asbl', 'ASBL'),
('sprl', 'SPRL'),
('sa', 'SA')])
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.

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", "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", "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,
} }

27
easy_my_coop_ch/models/coop.py

@ -2,21 +2,24 @@ from odoo import fields, models
class SubscriptionRequest(models.Model): class SubscriptionRequest(models.Model):
_inherit = 'subscription.request'
_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')])
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): def get_required_field(self):
req_fields = super(SubscriptionRequest, self).get_required_field() req_fields = super(SubscriptionRequest, self).get_required_field()
if 'iban' in req_fields:
req_fields.remove('iban')
if "iban" in req_fields:
req_fields.remove("iban")
return req_fields return req_fields

24
easy_my_coop_ch/models/partner.py

@ -2,15 +2,17 @@ from odoo import fields, models
class ResPartner(models.Model): class ResPartner(models.Model):
_inherit = 'res.partner'
_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')
])
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>

25
easy_my_coop_ch/views/subscription_template.xml

@ -1,23 +1,36 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<data> <data>
<template id="subscription_i18n_ch" inherit_id="easy_my_coop_website.becomecooperator" name="Removing fields">
<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"> <xpath expr="//label[@for='iban']/.." position="replace">
<div t-attf-class="form-group #{error and 'iban' in error and 'has-error' or ''}"> <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>
<label class="col-md-3 col-sm-4 control-label" for="iban">
Bank Account Number
</label>
<div class="col-md-7 col-sm-8"> <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"/>
<input type="text" class="form-control mandatory-field"
name="iban" t-attf-value="#{iban or ''}"
placeholder="BE48523080767127"/>
</div> </div>
</div> </div>
</xpath> </xpath>
</template> </template>
<template id="company_subscription_i18n_ch" inherit_id="easy_my_coop_website.becomecompanycooperator" name="Company Removing fields">
<template id="company_subscription_i18n_ch"
inherit_id="easy_my_coop_website.becomecompanycooperator"
name="Company Removing fields">
<xpath expr="//label[@for='iban']/.." position="replace"> <xpath expr="//label[@for='iban']/.." position="replace">
<div t-attf-class="form-group #{error and 'iban' in error and 'has-error' or ''}"> <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>
<label class="col-md-3 col-sm-4 control-label" for="iban">
Bank Account Number
</label>
<div class="col-md-7 col-sm-8"> <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"/>
<input type="text" class="form-control mandatory-field"
name="iban" t-attf-value="#{iban or ''}"
placeholder="BE48523080767127"/>
</div> </div>
</div> </div>
</xpath> </xpath>

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 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 Open Architects Consulting SPRL.
# Copyright (C) 2013-2018 Coop IT Easy SCRLfs. # 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 from . import dividend

231
easy_my_coop_dividend/models/dividend.py

@ -1,67 +1,77 @@
# -*- coding: utf-8 -*-
from __future__ import division from __future__ import division
from datetime import datetime from datetime import datetime
import openerp.addons.decimal_precision as dp
from openerp import fields, models, api
import openerp.addons.decimal_precision as dp
from openerp import api, fields, models
class dividend_year(models.Model):
_name = 'dividend.year'
class DividendYear(models.Model):
_name = "dividend.year"
@api.multi @api.multi
def _compute_dividend_info(self): def _compute_dividend_info(self):
res = {} res = {}
for dividend in self: for dividend in self:
res[dividend.id] = {'grand_total_dividend': 0.0,
'grand_total_taxes': 0.0}
res[dividend.id] = {
"grand_total_dividend": 0.0,
"grand_total_taxes": 0.0,
}
for line in dividend.dividend_ids: for line in dividend.dividend_ids:
res[dividend.id]['grand_total_dividend'] += line.dividend_amount
res[dividend.id]['grand_total_taxes'] += line.dividend_taxes
res[dividend.id][
"grand_total_dividend"
] += line.dividend_amount
res[dividend.id]["grand_total_taxes"] += line.dividend_taxes
return res 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')
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( grand_total_dividend = fields.Float(
compute=_compute_dividend_info, compute=_compute_dividend_info,
string='Grand total dividend',
digits_compute=dp.get_precision('Account'))
string="Grand total dividend",
digits_compute=dp.get_precision("Account"),
)
grand_total_taxes = fields.Float( grand_total_taxes = fields.Float(
compute=_compute_dividend_info, compute=_compute_dividend_info,
string='Grand total taxes',
digits_compute=dp.get_precision('Account'))
string="Grand total taxes",
digits_compute=dp.get_precision("Account"),
)
@api.multi @api.multi
def compute_dividend(self): def compute_dividend(self):
self.ensure_one() 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']
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 # delete lines if any
detailed_dividend_ids = det_div_line_obj.search([('dividend_year_id', '=', self.id)])
detailed_dividend_ids = det_div_line_obj.search(
[("dividend_year_id", "=", self.id)]
)
detailed_dividend_ids.unlink() detailed_dividend_ids.unlink()
dividend_ids = div_line_obj.search([('dividend_year_id', '=', self.id)])
dividend_ids = div_line_obj.search(
[("dividend_year_id", "=", self.id)]
)
dividend_ids.unlink() 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')
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 ).days + 1
for partner in partner_ids: for partner in partner_ids:
@ -70,57 +80,71 @@ class dividend_year(models.Model):
vals = {} vals = {}
vals2 = {} vals2 = {}
line_id = False 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
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 coeff = (date_res / number_of_days) * self.percentage
dividend_amount = line.total_amount_line * coeff 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
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 total_amount_dividend += dividend_amount
line_id = det_div_line_obj.create(vals) line_id = det_div_line_obj.create(vals)
elif line.effective_date < self.date_from: elif line.effective_date < self.date_from:
dividend_amount = line.total_amount_line * self.percentage 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
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 total_amount_dividend += dividend_amount
line_id = det_div_line_obj.create(vals) line_id = det_div_line_obj.create(vals)
if line_id: 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[
"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
vals2["dividend_amount_net"] = total_amount_dividend
vals2["dividend_amount"] = total_amount_dividend
# TODO set as a parameter on dividend year object # TODO set as a parameter on dividend year object
if total_amount_dividend <= 190.00: if total_amount_dividend <= 190.00:
vals2['dividend_taxes'] = 0.0
vals2["dividend_taxes"] = 0.0
else: 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_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) div_line_obj.create(vals2)
return True return True
class DetailedDividendLine(models.Model): class DetailedDividendLine(models.Model):
_name = 'detailed.dividend.line'
_name = "detailed.dividend.line"
@api.multi @api.multi
def _compute_total_line(self): def _compute_total_line(self):
@ -129,62 +153,61 @@ class DetailedDividendLine(models.Model):
res[line.id] = line.share_unit_price * line.share_number res[line.id] = line.share_unit_price * line.share_number
return res 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')
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( share_unit_price = fields.Monetary(
string='Share unit price',
related='share_line_id.share_unit_price',
string="Share unit price", related="share_line_id.share_unit_price"
)
effective_date = fields.Date(
related="share_line_id.effective_date", string="Effective date"
) )
effective_date = fields.Date(related='share_line_id.effective_date',
string='Effective date')
total_amount_line = fields.Monetary( total_amount_line = fields.Monetary(
string="Total value of share", string="Total value of share",
currency_field="company_currency_id", currency_field="company_currency_id",
compute=_compute_total_line, compute=_compute_total_line,
readonly=True, 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')
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( company_currency_id = fields.Many2one(
related="share_line_id.company_currency_id",
readonly=True,
related="share_line_id.company_currency_id", readonly=True
) )
class dividend_line(models.Model):
_name = 'dividend.line'
class DividendLine(models.Model):
_name = "dividend.line"
@api.multi @api.multi
def _get_account_number(self): def _get_account_number(self):
res = {} res = {}
for line in self: for line in self:
bank_accounts = self.env['res.partner.bank'].search(
[('partner_id', '=', line.partner_id.id)])
bank_accounts = self.env["res.partner.bank"].search(
[("partner_id", "=", line.partner_id.id)]
)
res[line.id] = bank_accounts[0].acc_number res[line.id] = bank_accounts[0].acc_number
return res 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')
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.

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>

51
easy_my_coop_dividend/views/dividend_views.xml

@ -1,6 +1,8 @@
<odoo> <odoo>
<data> <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" />
<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"> <record id="dividend_year_form" model="ir.ui.view">
<field name="name">dividend.year.form</field> <field name="name">dividend.year.form</field>
@ -8,7 +10,9 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Dividend year"> <form string="Dividend year">
<header> <header>
<button name="compute_dividend" string="Compute dividend" type="object" class="oe_highlight" groups="base.group_user"/>
<button name="compute_dividend"
string="Compute dividend" type="object"
class="oe_highlight" groups="base.group_user"/>
</header> </header>
<sheet> <sheet>
<group> <group>
@ -30,9 +34,12 @@
<tree> <tree>
<field name="coop_number"/> <field name="coop_number"/>
<field name="partner_id"/> <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"/>
<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> </tree>
</field> </field>
</page> </page>
@ -47,7 +54,9 @@
<field name="days"/> <field name="days"/>
<field name="total_amount_line"/> <field name="total_amount_line"/>
<field name="coeff"/> <field name="coeff"/>
<field name="dividend_amount" string="Dividend" sum="Total dividend"/>
<field name="dividend_amount"
string="Dividend"
sum="Total dividend"/>
</tree> </tree>
</field> </field>
</page> </page>
@ -75,7 +84,9 @@
<field name="view_id" ref="dividend_year_tree"/> <field name="view_id" ref="dividend_year_tree"/>
</record> </record>
<menuitem action="dividend_year_action" name="Dividend" id="menu_dividend_year" parent="menu_easy_my_coop_main_dividend" sequence="10"/>
<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"> <record id="view_detailed_dividend_line_filter" model="ir.ui.view">
<field name="name">detailed.dividend.line.select</field> <field name="name">detailed.dividend.line.select</field>
@ -86,8 +97,10 @@
<field name="coop_number"/> <field name="coop_number"/>
<filter name="dividend_year_id" string="Dividend Year"/> <filter name="dividend_year_id" string="Dividend Year"/>
<separator/> <separator/>
<filter string="Partner" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Dividend Year" domain="[]" context="{'group_by':'dividend_year_id'}"/>
<filter string="Partner" domain="[]"
context="{'group_by':'partner_id'}"/>
<filter string="Dividend Year" domain="[]"
context="{'group_by':'dividend_year_id'}"/>
</search> </search>
</field> </field>
</record> </record>
@ -105,19 +118,23 @@
<field name="days"/> <field name="days"/>
<field name="total_amount_line"/> <field name="total_amount_line"/>
<field name="coeff"/> <field name="coeff"/>
<field name="dividend_amount" string="Dividend" sum="Total dividend"/>
<field name="dividend_amount" string="Dividend"
sum="Total dividend"/>
</tree> </tree>
</field> </field>
</record> </record>
<record id="detailed_dividend_line_action" model="ir.actions.act_window">
<record id="detailed_dividend_line_action"
model="ir.actions.act_window">
<field name="name">Detailed dividend lines</field> <field name="name">Detailed dividend lines</field>
<field name="res_model">detailed.dividend.line</field> <field name="res_model">detailed.dividend.line</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_id" ref="detailed_dividend_line_tree"/> <field name="view_id" ref="detailed_dividend_line_tree"/>
</record> </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"/>
<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"> <record id="view_dividend_line_filter" model="ir.ui.view">
<field name="name">dividend.line.select</field> <field name="name">dividend.line.select</field>
@ -129,8 +146,10 @@
<filter name="dividend_year_id" string="Dividend Year"/> <filter name="dividend_year_id" string="Dividend Year"/>
<separator/> <separator/>
<group expand="0" string="Group By..."> <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'}"/>
<filter string="Partner" domain="[]"
context="{'group_by':'partner_id'}"/>
<filter string="Dividend Year" domain="[]"
context="{'group_by':'dividend_year_id'}"/>
</group> </group>
</search> </search>
</field> </field>
@ -159,6 +178,8 @@
<field name="view_id" ref="dividend_line_tree"/> <field name="view_id" ref="dividend_line_tree"/>
</record> </record>
<menuitem action="dividend_line_action" name="Dividend lines" id="menu_dividend_line" parent="menu_easy_my_coop_main_dividend" sequence="30"/>
<menuitem action="dividend_line_action" name="Dividend lines"
id="menu_dividend_line"
parent="menu_easy_my_coop_main_dividend" sequence="30"/>
</data> </data>
</odoo> </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.

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,
}

17
easy_my_coop_eater/models/coop.py

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

12
easy_my_coop_eater/models/product.py

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

1
easy_my_coop_eater/readme/CONTRIBUTORS.rst

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

1
easy_my_coop_eater/readme/DESCRIPTION.rst

@ -0,0 +1 @@
This module allows to manage the activity of the cooperator in the supermarket.

415
easy_my_coop_eater/static/description/index.html

@ -0,0 +1,415 @@
<?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 Eater/worker</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-eater-worker">
<h1 class="title">Easy My Coop Eater/worker</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_eater"><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 manage the activity of the cooperator in the supermarket.</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_eater%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_eater">coopiteasy/vertical-cooperative</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

6
easy_my_coop_eater/view/product_view.xml

@ -3,10 +3,12 @@
<record id="product_template_form_view_eater" model="ir.ui.view"> <record id="product_template_form_view_eater" model="ir.ui.view">
<field name="name">product.template.share.form</field> <field name="name">product.template.share.form</field>
<field name="model">product.template</field> <field name="model">product.template</field>
<field name="inherit_id" ref="easy_my_coop.product_template_form_view"/>
<field name="inherit_id"
ref="easy_my_coop.product_template_share_form_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='minimum_quantity']" position="after"> <xpath expr="//field[@name='minimum_quantity']" position="after">
<field name="eater" attrs="{'invisible':[('is_share','=',False)]}"/>
<field name="eater"
attrs="{'invisible':[('is_share','=',False)]}"/>
</xpath> </xpath>
</field> </field>
</record> </record>

60
easy_my_coop_export_xlsx/README.rst

@ -0,0 +1,60 @@
========================
Easy My Coop Export XLSX
========================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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_export_xlsx
:alt: coopiteasy/vertical-cooperative
|badge1| |badge2| |badge3|
Generate a xlsx file with information on current state of subscription
request, cooperators and capital release request.
**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_export_xlsx%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
* 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_export_xlsx>`_ project on GitHub.
You are welcome to contribute.

1
easy_my_coop_export_xlsx/__init__.py

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

32
easy_my_coop_export_xlsx/__openerp__.py → easy_my_coop_export_xlsx/__manifest__.py

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2018- Coop IT Easy SCRLfs. # Copyright (C) 2018- Coop IT Easy SCRLfs.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@ -19,26 +17,18 @@
{ {
'name': 'Easy My Coop Export XLSX',
'summary': """
"name": "Easy My Coop Export XLSX",
"summary": """
Generate a xlsx file with information on current state of subscription Generate a xlsx file with information on current state of subscription
request, cooperators and capital release request. request, cooperators and capital release request.
""", """,
'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',
],
'external_dependencies': {
'python': ['xlsxwriter'],
},
'data': [
'wizard/export_global_wizard.xml',
]
"author": "Coop IT Easy SCRLfs",
"license": "AGPL-3",
"version": "12.0.0.0.1",
"website": "www.coopiteasy.be",
"category": "Cooperative Management",
"depends": ["easy_my_coop"],
"external_dependencies": {"python": ["xlsxwriter"]},
"data": ["wizard/export_global_wizard.xml"],
"installable": False,
} }

2
easy_my_coop_export_xlsx/readme/CONTRIBUTORS.rst

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

2
easy_my_coop_export_xlsx/readme/DESCRIPTION.rst

@ -0,0 +1,2 @@
Generate a xlsx file with information on current state of subscription
request, cooperators and capital release request.

417
easy_my_coop_export_xlsx/static/description/index.html

@ -0,0 +1,417 @@
<?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 Export XLSX</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-export-xlsx">
<h1 class="title">Easy My Coop Export XLSX</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_export_xlsx"><img alt="coopiteasy/vertical-cooperative" src="https://img.shields.io/badge/github-coopiteasy%2Fvertical--cooperative-lightgray.png?logo=github" /></a></p>
<blockquote>
Generate a xlsx file with information on current state of subscription
request, cooperators and capital release request.</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_export_xlsx%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>
<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_export_xlsx">coopiteasy/vertical-cooperative</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
</div>
</body>
</html>

1
easy_my_coop_export_xlsx/wizard/__init__.py

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

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

Loading…
Cancel
Save