Browse Source

Merge branch '11.0' of github.com:it-projects-llc/mail-addons into 11.0-7cb04f82eb05c5b303d4e5686cd2711f888a1674

pull/213/head
KolushovAlexandr 5 years ago
parent
commit
657df9b331
No known key found for this signature in database GPG Key ID: C3E04B793421FD2
  1. 7
      .travis.yml
  2. 5
      README.md
  3. 35
      mail_all/README.rst
  4. 3
      mail_all/__init__.py
  5. 11
      mail_all/__manifest__.py
  6. 3
      mail_all/doc/changelog.rst
  7. 10
      mail_all/doc/index.rst
  8. 10
      mail_all/i18n/de.po
  9. 8
      mail_all/i18n/es.po
  10. 4
      mail_all/i18n/mail_all.pot
  11. 8
      mail_all/i18n/sl.po
  12. 1
      mail_all/models/__init__.py
  13. 2
      mail_all/static/description/index.html
  14. 3
      mail_all/static/src/css/mail_all.css
  15. 54
      mail_all/static/src/js/mail_all.js
  16. 2
      mail_all/static/src/xml/menu.xml
  17. 1
      mail_all/tests/__init__.py
  18. 1
      mail_all/tests/test_js.py
  19. 1
      mail_all/views/templates.xml
  20. 40
      mail_archives/README.rst
  21. 1
      mail_archives/__init__.py
  22. 3
      mail_archives/__manifest__.py
  23. 0
      mail_archives/doc/changelog.rst
  24. 20
      mail_archives/doc/index.rst
  25. 8
      mail_archives/i18n/de.po
  26. 10
      mail_archives/i18n/es.po
  27. 4
      mail_archives/i18n/mail_archives.pot
  28. 8
      mail_archives/i18n/sl.po
  29. 6
      mail_archives/static/description/index.html
  30. 3
      mail_archives/static/src/css/archives.css
  31. 63
      mail_archives/static/src/js/archives.js
  32. 2
      mail_archives/static/src/xml/menu.xml
  33. 1
      mail_archives/tests/__init__.py
  34. 1
      mail_archives/tests/test_js.py
  35. 1
      mail_archives/views/templates.xml
  36. 35
      mail_attachment_popup/README.rst
  37. 0
      mail_attachment_popup/__init__.py
  38. 29
      mail_attachment_popup/__manifest__.py
  39. 16
      mail_attachment_popup/doc/index.rst
  40. 28
      mail_attachment_popup/i18n/de.po
  41. 27
      mail_attachment_popup/i18n/es.po
  42. 22
      mail_attachment_popup/i18n/mail_attachment_popup.pot
  43. 29
      mail_attachment_popup/i18n/ru.po
  44. BIN
      mail_attachment_popup/images/popup_image.png
  45. BIN
      mail_attachment_popup/static/description/attach_image.png
  46. BIN
      mail_attachment_popup/static/description/download.png
  47. 84
      mail_attachment_popup/static/description/index.html
  48. BIN
      mail_attachment_popup/static/description/popup.png
  49. 429
      mail_attachment_popup/static/lib/js/jquery.arcticmodal.js
  50. 8
      mail_attachment_popup/static/src/css/jquery.arcticmodal.css
  51. 11
      mail_attachment_popup/static/src/css/simple.css
  52. 16
      mail_attachment_popup/static/src/css/styles.css
  53. BIN
      mail_attachment_popup/static/src/img/loading.gif
  54. 29
      mail_attachment_popup/static/src/xml/mail_attachment_popup.xml
  55. 13
      mail_attachment_popup/views/mail_attachment_popup_template.xml
  56. 32
      mail_base/README.rst
  57. 1
      mail_base/__init__.py
  58. 3
      mail_base/__manifest__.py
  59. 1
      mail_base/controllers/main.py
  60. 20
      mail_base/doc/index.rst
  61. 11
      mail_base/i18n/de.po
  62. 8
      mail_base/i18n/es.po
  63. 2
      mail_base/i18n/mail_base.pot
  64. 10
      mail_base/i18n/pt.po
  65. 10
      mail_base/i18n/pt_BR.po
  66. 8
      mail_base/i18n/sl.po
  67. 1
      mail_base/models.py
  68. 1294
      mail_base/static/lib/base.js
  69. 2
      mail_base/tests/__init__.py
  70. 16
      mail_base/tests/test_default.py
  71. 1
      mail_check_immediately/__init__.py
  72. 1
      mail_check_immediately/__manifest__.py
  73. 1
      mail_check_immediately/models.py
  74. 2
      mail_check_immediately/static/description/index.html
  75. 1
      mail_fix_553/__init__.py
  76. 1
      mail_fix_553/__manifest__.py
  77. 1
      mail_fix_553/mail_fix_553.py
  78. 49
      mail_move_message/README.rst
  79. 3
      mail_move_message/__init__.py
  80. 16
      mail_move_message/__manifest__.py
  81. 3
      mail_move_message/controllers/__init__.py
  82. 58
      mail_move_message/controllers/main.py
  83. 10
      mail_move_message/data/mail_move_message_data.xml
  84. 8
      mail_move_message/doc/changelog.rst
  85. 33
      mail_move_message/doc/index.rst
  86. 120
      mail_move_message/i18n/mail_move_message.pot
  87. 202
      mail_move_message/mail_move_message_models.py
  88. 79
      mail_move_message/mail_move_message_views.xml
  89. BIN
      mail_move_message/static/description/delete-message.png
  90. BIN
      mail_move_message/static/description/icon.png
  91. BIN
      mail_move_message/static/description/inbox-move.png
  92. 74
      mail_move_message/static/description/index.html
  93. BIN
      mail_move_message/static/description/record-move-back.png
  94. 132
      mail_move_message/static/src/js/mail_move_message.js
  95. 8
      mail_move_message/static/src/xml/mail_move_message_main.xml
  96. 3
      mail_move_message/tests/__init__.py
  97. 52
      mail_move_message/tests/test_mail_move.py
  98. 62
      mail_multi_website/README.rst
  99. 40
      mail_multi_website/__init__.py
  100. 51
      mail_multi_website/__manifest__.py

7
.travis.yml

@ -1,7 +1,7 @@
language: python language: python
python: python:
- "2.7"
- "3.5"
#dist: trusty #dist: trusty
sudo: false sudo: false
@ -16,7 +16,7 @@ addons:
env: env:
global: global:
- VERSION="10.0" TESTS="0" LINT_CHECK="0" UNIT_TEST="0"
- VERSION="11.0" TESTS="0" LINT_CHECK="0" UNIT_TEST="0"
- PYLINT_ODOO_JSLINTRC="/home/travis/maintainer-quality-tools/travis/cfg/.jslintrc" - PYLINT_ODOO_JSLINTRC="/home/travis/maintainer-quality-tools/travis/cfg/.jslintrc"
matrix: matrix:
@ -24,9 +24,6 @@ env:
- TESTS="1" ODOO_REPO="odoo/odoo" MAKEPOT="1" - TESTS="1" ODOO_REPO="odoo/odoo" MAKEPOT="1"
- TESTS="1" ODOO_REPO="OCA/OCB" - TESTS="1" ODOO_REPO="OCA/OCB"
virtualenv:
system_site_packages: true
install: install:
- pip install anybox.testing.openerp - pip install anybox.testing.openerp
- git clone https://github.com/it-projects-llc/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools - git clone https://github.com/it-projects-llc/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools

5
README.md

@ -1,7 +1,7 @@
[![Build Status](https://travis-ci.com/it-projects-llc/mail-addons.svg?branch=10.0)](https://travis-ci.com/it-projects-llc/mail-addons)
[![Build Status](https://travis-ci.com/it-projects-llc/mail-addons.svg?branch=11.0)](https://travis-ci.com/it-projects-llc/mail-addons)
# mail-addons # mail-addons
Odoo (OpenERP) mail addons
Odoo mail addons
List of repositories: List of repositories:
--------------------- ---------------------
@ -9,7 +9,6 @@ List of repositories:
* https://github.com/it-projects-llc/misc-addons * https://github.com/it-projects-llc/misc-addons
* https://github.com/it-projects-llc/pos-addons * https://github.com/it-projects-llc/pos-addons
* https://github.com/it-projects-llc/mail-addons * https://github.com/it-projects-llc/mail-addons
* https://github.com/it-projects-llc/rental-addons
* https://github.com/it-projects-llc/access-addons * https://github.com/it-projects-llc/access-addons
* https://github.com/it-projects-llc/website-addons * https://github.com/it-projects-llc/website-addons
* https://github.com/it-projects-llc/l10n-addons * https://github.com/it-projects-llc/l10n-addons

35
mail_all/README.rst

@ -2,15 +2,38 @@
Show all messages Show all messages
=================== ===================
Adds ``Discuss / All`` menu, that shows all messages accesable by current user
Adds ``Discuss / All`` menu, that shows all messages accesable by current user.
Credits
=======
Contributors
------------
* Pavel Romanchenko <apps@it-projects.info>
Sponsors
--------
* `IT-Projects LLC <https://it-projects.info>`__
Maintainers
-----------
* `IT-Projects LLC <https://it-projects.info>`__
To get a guaranteed support you are kindly requested to purchase the module at `odoo apps store <https://apps.odoo.com/apps/modules/11.0/mail_all/>`__.
Thank you for understanding!
`IT-Projects Team <https://www.it-projects.info/team>`__
Further information Further information
-------------------
===================
Demo: http://runbot.it-projects.info/demo/mail_addons/11.0
HTML Description: https://apps.odoo.com/apps/modules/9.0/mail_all/
HTML Description: https://apps.odoo.com/apps/modules/11.0/mail_all/
Usage instructions: `<doc/index.rst>`__
Usage instructions: `<doc/index.rst>`_
Changelog: `<doc/changelog.rst>`__
Changelog: `<doc/changelog.rst>`_
Tested on Odoo 9.0 d3dd4161ad0598ebaa659fbd083457c77aa9448d
Tested on Odoo 11.0 ecbf7aa4714479229658d14cce28fa00376ed390

3
mail_all/__init__.py

@ -1,3 +0,0 @@
# -*- coding: utf-8 -*-
from . import models

11
mail_all/__manifest__.py

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
{ {
"name": "Show all messages", "name": "Show all messages",
"summary": """Checkout all messages where you have access""", "summary": """Checkout all messages where you have access""",
"category": "Discuss", "category": "Discuss",
# "live_test_url": "",
"images": ['images/1.jpg'], "images": ['images/1.jpg'],
"version": "1.0.0",
"version": "11.0.1.0.0",
"application": False,
"author": "IT-Projects LLC, Pavel Romanchenko", "author": "IT-Projects LLC, Pavel Romanchenko",
"support": "apps@it-projects.info", "support": "apps@it-projects.info",
@ -24,6 +25,12 @@
"static/src/xml/menu.xml", "static/src/xml/menu.xml",
], ],
"demo": [], "demo": [],
"post_load": None,
"pre_init_hook": None,
"post_init_hook": None,
"uninstall_hook": None,
'installable': True, 'installable': True,
"auto_install": False, "auto_install": False,
} }

3
mail_all/doc/changelog.rst

@ -1,6 +1,3 @@
Updates
=======
`1.0.0` `1.0.0`
------- -------

10
mail_all/doc/index.rst

@ -2,6 +2,16 @@
Show all messages Show all messages
=================== ===================
Installation
============
* `Install <https://odoo-development.readthedocs.io/en/latest/odoo/usage/install-module.html>`__ this module in a usual way
Configuration
=============
This module does not require special configuration.
Usage Usage
===== =====

10
mail_all/i18n/de.po

@ -7,10 +7,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-05 23:11+0000\n"
"PO-Revision-Date: 2017-06-23 14:31+0000\n"
"POT-Creation-Date: 2018-05-05 23:09+0000\n"
"PO-Revision-Date: 2018-04-21 00:05+0000\n"
"Last-Translator: Dawid Runowski <dawrun@outlook.com>, 2019\n" "Last-Translator: Dawid Runowski <dawrun@outlook.com>, 2019\n"
"Language-Team: German (https://www.transifex.com/it-projects-llc/teams/76080/" "Language-Team: German (https://www.transifex.com/it-projects-llc/teams/76080/"
"de/)\n" "de/)\n"
@ -22,7 +22,7 @@ msgstr ""
#. module: mail_all #. module: mail_all
#. openerp-web #. openerp-web
#: code:addons/mail_all/static/src/js/mail_all.js:56
#: code:addons/mail_all/static/src/js/mail_all.js:49
#: code:addons/mail_all/static/src/xml/menu.xml:7 #: code:addons/mail_all/static/src/xml/menu.xml:7
#, python-format #, python-format
msgid "All messages" msgid "All messages"
@ -33,4 +33,4 @@ msgstr "Alle Nachrichten"
#: code:addons/mail_all/static/src/xml/menu.xml:15 #: code:addons/mail_all/static/src/xml/menu.xml:15
#, python-format #, python-format
msgid "No messages" msgid "No messages"
msgstr "Alle Nachrichten"
msgstr "Keine Nachrichten"

8
mail_all/i18n/es.po

@ -6,10 +6,10 @@
# Randall Castro <rcastro@treintaycinco.com>, 2018 # Randall Castro <rcastro@treintaycinco.com>, 2018
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-19 16:49+0000\n"
"PO-Revision-Date: 2017-12-19 16:49+0000\n"
"POT-Creation-Date: 2018-04-21 23:07+0000\n"
"PO-Revision-Date: 2018-04-21 23:07+0000\n"
"Last-Translator: Randall Castro <rcastro@treintaycinco.com>, 2018\n" "Last-Translator: Randall Castro <rcastro@treintaycinco.com>, 2018\n"
"Language-Team: Spanish (https://www.transifex.com/it-projects-llc/" "Language-Team: Spanish (https://www.transifex.com/it-projects-llc/"
"teams/76080/es/)\n" "teams/76080/es/)\n"
@ -21,7 +21,7 @@ msgstr ""
#. module: mail_all #. module: mail_all
#. openerp-web #. openerp-web
#: code:addons/mail_all/static/src/js/mail_all.js:56
#: code:addons/mail_all/static/src/js/mail_all.js:49
#: code:addons/mail_all/static/src/xml/menu.xml:7 #: code:addons/mail_all/static/src/xml/menu.xml:7
#, python-format #, python-format
msgid "All messages" msgid "All messages"

4
mail_all/i18n/mail_all.pot

@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
@ -15,7 +15,7 @@ msgstr ""
#. module: mail_all #. module: mail_all
#. openerp-web #. openerp-web
#: code:addons/mail_all/static/src/js/mail_all.js:56
#: code:addons/mail_all/static/src/js/mail_all.js:49
#: code:addons/mail_all/static/src/xml/menu.xml:7 #: code:addons/mail_all/static/src/xml/menu.xml:7
#, python-format #, python-format
msgid "All messages" msgid "All messages"

8
mail_all/i18n/sl.po

@ -7,10 +7,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-05 23:11+0000\n"
"PO-Revision-Date: 2017-06-23 14:31+0000\n"
"POT-Creation-Date: 2018-05-05 23:09+0000\n"
"PO-Revision-Date: 2018-04-21 00:05+0000\n"
"Last-Translator: Matjaz Mozetic <m.mozetic@matmoz.si>, 2019\n" "Last-Translator: Matjaz Mozetic <m.mozetic@matmoz.si>, 2019\n"
"Language-Team: Slovenian (https://www.transifex.com/it-projects-llc/" "Language-Team: Slovenian (https://www.transifex.com/it-projects-llc/"
"teams/76080/sl/)\n" "teams/76080/sl/)\n"
@ -23,7 +23,7 @@ msgstr ""
#. module: mail_all #. module: mail_all
#. openerp-web #. openerp-web
#: code:addons/mail_all/static/src/js/mail_all.js:56
#: code:addons/mail_all/static/src/js/mail_all.js:49
#: code:addons/mail_all/static/src/xml/menu.xml:7 #: code:addons/mail_all/static/src/xml/menu.xml:7
#, python-format #, python-format
msgid "All messages" msgid "All messages"

1
mail_all/models/__init__.py

@ -1 +0,0 @@
# -*- coding: utf-8 -*-

2
mail_all/static/description/index.html

@ -38,6 +38,8 @@ This menu shows all messages.
<ul> <ul>
<li><a href="mailto:apps@it-projects.info">apps@it-projects.info <i class="fa fa-envelope-o"></i></a></li> <li><a href="mailto:apps@it-projects.info">apps@it-projects.info <i class="fa fa-envelope-o"></i></a></li>
<li><a href="https://www.it-projects.info/page/website.contactus " target="_blank">https://www.it-projects.info/page/website.contactus <i class="fa fa-list-alt"></i></a></li> <li><a href="https://www.it-projects.info/page/website.contactus " target="_blank">https://www.it-projects.info/page/website.contactus <i class="fa fa-list-alt"></i></a></li>
<li><a href="https://m.me/itprojectsllc" target="_blank">https://m.me/itprojectsllc <i class="fa fa-facebook-square"></i></a></li>
<li>skype@it-projects.info <i class="fa fa-skype"></i></li>
</ul> </ul>
</div> </div>
<div class="oe_span4"> <div class="oe_span4">

3
mail_all/static/src/css/mail_all.css

@ -0,0 +1,3 @@
.o_channel_name.mail_all i {
margin-right: 4px;
}

54
mail_all/static/src/js/mail_all.js

@ -1,20 +1,10 @@
odoo.define('mail_all.all', function (require) { odoo.define('mail_all.all', function (require) {
"use strict"; "use strict";
var base_obj = require('mail_base.base');
//-------------------------------------------------------------------------------
var bus = require('bus.bus').bus;
var config = require('web.config');
var chat_manager = require('mail_base.base').chat_manager;
var core = require('web.core'); var core = require('web.core');
var data = require('web.data');
var Model = require('web.Model');
var session = require('web.session');
var time = require('web.time');
var web_client = require('web.web_client');
var _lt = core._lt; var _lt = core._lt;
//-------------------------------------------------------------------------------
var ChatAction = core.action_registry.get('mail.chat.instant_messaging'); var ChatAction = core.action_registry.get('mail.chat.instant_messaging');
ChatAction.include({ ChatAction.include({
@ -25,41 +15,43 @@ ChatAction.include({
} }
}); });
// Inherit class and override methods
base_obj.MailTools.include({
get_properties: function(msg){
var properties = this._super.apply(this, arguments);
// override methods
var chat_manager_super = _.clone(chat_manager);
chat_manager.get_properties = function (msg) {
var properties = chat_manager_super.get_properties.apply(this, arguments);
properties.is_all = this.property_descr("channel_all", msg, this); properties.is_all = this.property_descr("channel_all", msg, this);
return properties; return properties;
},
};
set_channel_flags: function(data, msg){
this._super.apply(this, arguments);
msg.is_all = data.author_id != 'ODOOBOT';
chat_manager.set_channel_flags = function (data, msg) {
chat_manager_super.set_channel_flags.apply(this, arguments);
msg.is_all = data.author_id !== 'ODOOBOT';
return msg; return msg;
},
};
get_channel_array: function(msg){
var arr = this._super.apply(this, arguments);
chat_manager.get_channel_array = function (msg) {
var arr = chat_manager_super.get_channel_array.apply(this, arguments);
return arr.concat('channel_all'); return arr.concat('channel_all');
},
};
chat_manager.get_domain = function (channel) {
return (channel.id === "channel_all")
? []
: chat_manager_super.get_domain.apply(this, arguments);
};
get_domain: function(channel){
return (channel.id === "channel_all") ? [] : this._super.apply(this, arguments);
}
});
base_obj.chat_manager.is_ready.then(function(){
chat_manager.is_ready.then(function () {
// Add all channel // Add all channel
base_obj.chat_manager.mail_tools.add_channel({
chat_manager.add_channel({
id: "channel_all", id: "channel_all",
name: _lt("All messages"), name: _lt("All messages"),
type: "static" type: "static"
}); });
return $.when(); return $.when();
}); });
return base_obj.chat_manager;
return chat_manager;
}); });

2
mail_all/static/src/xml/menu.xml

@ -3,7 +3,7 @@
<!--Inherit Sidebar and add All messages menu item after Starred --> <!--Inherit Sidebar and add All messages menu item after Starred -->
<t t-extend="mail.chat.Sidebar"> <t t-extend="mail.chat.Sidebar">
<t t-jquery="div[data-channel-id=channel_starred]" t-operation="after"> <t t-jquery="div[data-channel-id=channel_starred]" t-operation="after">
<div t-attf-class="o_mail_chat_channel_item #{(active_channel_id == 'channel_all') ? 'o_active': ''}" data-channel-id="channel_all">
<div t-attf-class="o_mail_chat_title_main o_mail_chat_channel_item #{(active_channel_id == 'channel_all') ? 'o_active': ''}" data-channel-id="channel_all">
<span class="o_channel_name mail_all"> <i class="fa fa-database"/> All messages </span> <span class="o_channel_name mail_all"> <i class="fa fa-database"/> All messages </span>
</div> </div>
</t> </t>

1
mail_all/tests/__init__.py

@ -1,3 +1,2 @@
# -*- coding: utf-8 -*-
from . import test_js from . import test_js

1
mail_all/tests/test_js.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import odoo.tests import odoo.tests

1
mail_all/views/templates.xml

@ -5,6 +5,7 @@
name="mail_all_assets_backend" name="mail_all_assets_backend"
inherit_id="web.assets_backend"> inherit_id="web.assets_backend">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<link rel="stylesheet" href="/mail_all/static/src/css/mail_all.css"/>
<script src="/mail_all/static/src/js/mail_all.js" type="text/javascript"></script> <script src="/mail_all/static/src/js/mail_all.js" type="text/javascript"></script>
</xpath> </xpath>
</template> </template>

40
mail_archives/README.rst

@ -1,15 +1,39 @@
Mail Archives
=============
===============
Mail Archives
===============
Adds Archive menu, which shows sent/received messages Adds Archive menu, which shows sent/received messages
Usage
-----
Click Discuss/Archive menu -- sent/received messages are displayed
Credits
=======
Contributors
------------
* Pavel Romanchenko <apps@it-projects.info>
Sponsors
--------
* `IT-Projects LLC <https://it-projects.info>`__
Maintainers
-----------
* `IT-Projects LLC <https://it-projects.info>`__
To get a guaranteed support you are kindly requested to purchase the module at `odoo apps store <https://apps.odoo.com/apps/modules/11.0/mail_archives/>`__.
Thank you for understanding!
`IT-Projects Team <https://www.it-projects.info/team>`__
Further information Further information
-------------------
===================
Demo: http://runbot.it-projects.info/demo/mail_addons/11.0
HTML Description: https://apps.odoo.com/apps/modules/11.0/mail_archives/
Usage instructions: `<doc/index.rst>`_
HTML Description: https://apps.odoo.com/apps/modules/9.0/mail_archives/
Changelog: `<doc/changelog.rst>`_
Tested on Odoo 9.0 b9f206953e3f877adf18643f154d1262842564ee
Tested on Odoo 11.0 ecbf7aa4714479229658d14cce28fa00376ed390

1
mail_archives/__init__.py

@ -1 +0,0 @@
# -*- coding: utf-8 -*-

3
mail_archives/__manifest__.py

@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
{ {
"name": "Mail archives", "name": "Mail archives",
"summary": """Adds menu to find old messages""", "summary": """Adds menu to find old messages""",
"category": "Discuss", "category": "Discuss",
"images": ['images/1.jpg'], "images": ['images/1.jpg'],
"version": "1.0.0",
"version": "11.0.1.0.0",
"author": "IT-Projects LLC, Pavel Romanchenko", "author": "IT-Projects LLC, Pavel Romanchenko",
"support": "apps@it-projects.info", "support": "apps@it-projects.info",

0
mail_attachment_popup/doc/changelog.rst → mail_archives/doc/changelog.rst

20
mail_archives/doc/index.rst

@ -0,0 +1,20 @@
==============
Mail Archives
==============
Installation
============
* `Install <https://odoo-development.readthedocs.io/en/latest/odoo/usage/install-module.html>`__ this module in a usual way
Configuration
=============
This module does not require special configuration.
Usage
=====
* Open ``Discuss``.
* Click ``Archive``.
* Sent/received messages are displayed.

8
mail_archives/i18n/de.po

@ -7,10 +7,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-05 23:11+0000\n"
"PO-Revision-Date: 2017-06-23 14:31+0000\n"
"POT-Creation-Date: 2018-05-05 23:09+0000\n"
"PO-Revision-Date: 2018-04-21 00:05+0000\n"
"Last-Translator: Dawid Runowski <dawrun@outlook.com>, 2019\n" "Last-Translator: Dawid Runowski <dawrun@outlook.com>, 2019\n"
"Language-Team: German (https://www.transifex.com/it-projects-llc/teams/76080/" "Language-Team: German (https://www.transifex.com/it-projects-llc/teams/76080/"
"de/)\n" "de/)\n"
@ -22,7 +22,7 @@ msgstr ""
#. module: mail_archives #. module: mail_archives
#. openerp-web #. openerp-web
#: code:addons/mail_archives/static/src/js/archives.js:76
#: code:addons/mail_archives/static/src/js/archives.js:68
#: code:addons/mail_archives/static/src/xml/menu.xml:7 #: code:addons/mail_archives/static/src/xml/menu.xml:7
#, python-format #, python-format
msgid "Archive" msgid "Archive"

10
mail_archives/i18n/es.po

@ -6,10 +6,10 @@
# Randall Castro <rcastro@treintaycinco.com>, 2018 # Randall Castro <rcastro@treintaycinco.com>, 2018
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-19 16:49+0000\n"
"PO-Revision-Date: 2017-12-19 16:49+0000\n"
"POT-Creation-Date: 2018-04-21 23:07+0000\n"
"PO-Revision-Date: 2018-04-21 23:07+0000\n"
"Last-Translator: Randall Castro <rcastro@treintaycinco.com>, 2018\n" "Last-Translator: Randall Castro <rcastro@treintaycinco.com>, 2018\n"
"Language-Team: Spanish (https://www.transifex.com/it-projects-llc/" "Language-Team: Spanish (https://www.transifex.com/it-projects-llc/"
"teams/76080/es/)\n" "teams/76080/es/)\n"
@ -21,7 +21,7 @@ msgstr ""
#. module: mail_archives #. module: mail_archives
#. openerp-web #. openerp-web
#: code:addons/mail_archives/static/src/js/archives.js:76
#: code:addons/mail_archives/static/src/js/archives.js:68
#: code:addons/mail_archives/static/src/xml/menu.xml:7 #: code:addons/mail_archives/static/src/xml/menu.xml:7
#, python-format #, python-format
msgid "Archive" msgid "Archive"
@ -32,4 +32,4 @@ msgstr "Archivo"
#: code:addons/mail_archives/static/src/xml/menu.xml:15 #: code:addons/mail_archives/static/src/xml/menu.xml:15
#, python-format #, python-format
msgid "Archive is empty" msgid "Archive is empty"
msgstr "El archivo está vacío"
msgstr "Archivo está vacío"

4
mail_archives/i18n/mail_archives.pot

@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
@ -15,7 +15,7 @@ msgstr ""
#. module: mail_archives #. module: mail_archives
#. openerp-web #. openerp-web
#: code:addons/mail_archives/static/src/js/archives.js:76
#: code:addons/mail_archives/static/src/js/archives.js:68
#: code:addons/mail_archives/static/src/xml/menu.xml:7 #: code:addons/mail_archives/static/src/xml/menu.xml:7
#, python-format #, python-format
msgid "Archive" msgid "Archive"

8
mail_archives/i18n/sl.po

@ -7,10 +7,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-05 23:11+0000\n"
"PO-Revision-Date: 2017-06-23 14:31+0000\n"
"POT-Creation-Date: 2018-05-05 23:09+0000\n"
"PO-Revision-Date: 2018-04-21 00:05+0000\n"
"Last-Translator: Matjaz Mozetic <m.mozetic@matmoz.si>, 2019\n" "Last-Translator: Matjaz Mozetic <m.mozetic@matmoz.si>, 2019\n"
"Language-Team: Slovenian (https://www.transifex.com/it-projects-llc/" "Language-Team: Slovenian (https://www.transifex.com/it-projects-llc/"
"teams/76080/sl/)\n" "teams/76080/sl/)\n"
@ -23,7 +23,7 @@ msgstr ""
#. module: mail_archives #. module: mail_archives
#. openerp-web #. openerp-web
#: code:addons/mail_archives/static/src/js/archives.js:76
#: code:addons/mail_archives/static/src/js/archives.js:68
#: code:addons/mail_archives/static/src/xml/menu.xml:7 #: code:addons/mail_archives/static/src/xml/menu.xml:7
#, python-format #, python-format
msgid "Archive" msgid "Archive"

6
mail_archives/static/description/index.html

@ -38,6 +38,8 @@ This menu shows archive messages, i.e. ones you sent or received.
<ul> <ul>
<li><a href="mailto:apps@it-projects.info">apps@it-projects.info <i class="fa fa-envelope-o"></i></a></li> <li><a href="mailto:apps@it-projects.info">apps@it-projects.info <i class="fa fa-envelope-o"></i></a></li>
<li><a href="https://www.it-projects.info/page/website.contactus " target="_blank">https://www.it-projects.info/page/website.contactus <i class="fa fa-list-alt"></i></a></li> <li><a href="https://www.it-projects.info/page/website.contactus " target="_blank">https://www.it-projects.info/page/website.contactus <i class="fa fa-list-alt"></i></a></li>
<li><a href="https://m.me/itprojectsllc" target="_blank">https://m.me/itprojectsllc <i class="fa fa-facebook-square"></i></a></li>
<li>skype@it-projects.info <i class="fa fa-skype"></i></li>
</ul> </ul>
</div> </div>
<div class="oe_span4"> <div class="oe_span4">
@ -57,7 +59,7 @@ This menu shows archive messages, i.e. ones you sent or received.
-o-transform: rotate(6deg); -o-transform: rotate(6deg);
-moz-transform: rotate(6deg); -moz-transform: rotate(6deg);
-ms-transform: rotate(6deg);"> -ms-transform: rotate(6deg);">
Tested on Odoo<br/>10.0 community
Tested on Odoo<br/>11.0 community
</div> </div>
<div style="margin-top: 15px; <div style="margin-top: 15px;
position: relative; position: relative;
@ -74,7 +76,7 @@ This menu shows archive messages, i.e. ones you sent or received.
-o-transform: rotate(-7deg); -o-transform: rotate(-7deg);
-moz-transform: rotate(-7deg); -moz-transform: rotate(-7deg);
-ms-transform: rotate(-7deg);"> -ms-transform: rotate(-7deg);">
Tested on Odoo<br/>10.0 enterprise
Tested on Odoo<br/>11.0 enterprise
</div> </div>
</div> </div>
</div> </div>

3
mail_archives/static/src/css/archives.css

@ -0,0 +1,3 @@
.o_channel_name.mail_archives i {
margin-right: 4px;
}

63
mail_archives/static/src/js/archives.js

@ -1,31 +1,23 @@
odoo.define('mail_archives.archives', function (require) { odoo.define('mail_archives.archives', function (require) {
"use strict"; "use strict";
var base_obj = require('mail_base.base');
//-------------------------------------------------------------------------------
var bus = require('bus.bus').bus;
var config = require('web.config');
var core = require('web.core'); var core = require('web.core');
var data = require('web.data');
var Model = require('web.Model');
var session = require('web.session'); var session = require('web.session');
var time = require('web.time');
var web_client = require('web.web_client');
var chat_manager = require('mail_base.base').chat_manager;
var _lt = core._lt; var _lt = core._lt;
//-------------------------------------------------------------------------------
var ChatAction = core.action_registry.get('mail.chat.instant_messaging'); var ChatAction = core.action_registry.get('mail.chat.instant_messaging');
ChatAction.include({ ChatAction.include({
init: function(parent, action, options) {
init: function (parent, action, options) {
this._super.apply(this, arguments); this._super.apply(this, arguments);
var channel_name = 'channel_archive'; var channel_name = 'channel_archive';
// Add channel Archive for enable "display_subject" option // Add channel Archive for enable "display_subject" option
this.channels_display_subject.push(channel_name); this.channels_display_subject.push(channel_name);
}, },
update_message_on_current_channel: function(current_channel_id, message){
update_message_on_current_channel: function (current_channel_id, message){
var result = this._super.apply(this, arguments); var result = this._super.apply(this, arguments);
var archive = current_channel_id === "channel_archive" && !message.is_archive; var archive = current_channel_id === "channel_archive" && !message.is_archive;
return archive || result; return archive || result;
@ -33,15 +25,17 @@ ChatAction.include({
}); });
// Inherit class and override methods // Inherit class and override methods
base_obj.MailTools.include({
get_properties: function(msg){
var properties = this._super.apply(this, arguments);
var chat_manager_super = _.clone(chat_manager);
chat_manager.get_properties = function (msg) {
var properties = chat_manager_super.get_properties.apply(this, arguments);
properties.is_archive = this.property_descr("channel_archive", msg, this); properties.is_archive = this.property_descr("channel_archive", msg, this);
return properties; return properties;
},
};
set_channel_flags: function(data, msg){
this._super.apply(this, arguments);
chat_manager.set_channel_flags = function (data, msg) {
chat_manager_super.set_channel_flags.apply(this, arguments);
// Get recipients ids // Get recipients ids
var recipients_ids = []; var recipients_ids = [];
for (var i = 0; i < (data.partner_ids || []).length; i++){ for (var i = 0; i < (data.partner_ids || []).length; i++){
@ -49,37 +43,34 @@ base_obj.MailTools.include({
} }
// If author or recipient // If author or recipient
if (data.author_id[0] === session.partner_id || recipients_ids.indexOf(session.partner_id) != -1) {
if (data.author_id[0] === session.partner_id || recipients_ids.indexOf(session.partner_id) !== -1) {
msg.is_archive = true; msg.is_archive = true;
} }
return msg; return msg;
},
};
get_channel_array: function(msg){
var arr = this._super.apply(this, arguments);
chat_manager.get_channel_array = function (msg) {
var arr = chat_manager_super.get_channel_array.apply(this, arguments);
return arr.concat('channel_archive'); return arr.concat('channel_archive');
},
};
get_domain: function(channel){
return (channel.id === "channel_archive") ? [
'|', ['partner_ids', 'in', [openerp.session.partner_id]],
['author_id.user_ids', 'in', [openerp.session.uid]]
] : this._super.apply(this, arguments);
}
});
chat_manager.get_domain = function (channel) {
return (channel.id === "channel_archive")
? ['|', ['partner_ids', 'in', [session.partner_id]],
['author_id', 'in', [session.partner_id]]]
: chat_manager_super.get_domain.apply(this, arguments);
};
base_obj.chat_manager.is_ready.then(function(){
// Add archive channel
base_obj.chat_manager.mail_tools.add_channel({
chat_manager.is_ready.then(function () {
chat_manager.add_channel({
id: "channel_archive", id: "channel_archive",
name: _lt("Archive"), name: _lt("Archive"),
type: "static" type: "static"
}); });
});
return $.when();
});
return base_obj.chat_manager;
return chat_manager;
}); });

2
mail_archives/static/src/xml/menu.xml

@ -3,7 +3,7 @@
<!--Inherit Sidebar and add Archive menu item after Starred --> <!--Inherit Sidebar and add Archive menu item after Starred -->
<t t-extend="mail.chat.Sidebar"> <t t-extend="mail.chat.Sidebar">
<t t-jquery="div[data-channel-id=channel_starred]" t-operation="after"> <t t-jquery="div[data-channel-id=channel_starred]" t-operation="after">
<div t-attf-class="o_mail_chat_channel_item #{(active_channel_id == 'channel_archive') ? 'o_active': ''}" data-channel-id="channel_archive">
<div t-attf-class="o_mail_chat_channel_item o_mail_chat_title_main #{(active_channel_id == 'channel_archive') ? 'o_active': ''}" data-channel-id="channel_archive">
<span class="o_channel_name mail_archives"> <i class="fa fa-archive"/> Archive </span> <span class="o_channel_name mail_archives"> <i class="fa fa-archive"/> Archive </span>
</div> </div>
</t> </t>

1
mail_archives/tests/__init__.py

@ -1,3 +1,2 @@
# -*- coding: utf-8 -*-
from . import test_js from . import test_js

1
mail_archives/tests/test_js.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import odoo.tests import odoo.tests

1
mail_archives/views/templates.xml

@ -5,6 +5,7 @@
name="res_partner_mails_count_assets_backend" name="res_partner_mails_count_assets_backend"
inherit_id="web.assets_backend"> inherit_id="web.assets_backend">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
<link rel="stylesheet" href="/mail_archives/static/src/css/archives.css"/>
<script src="/mail_archives/static/src/js/archives.js" type="text/javascript"></script> <script src="/mail_archives/static/src/js/archives.js" type="text/javascript"></script>
</xpath> </xpath>
</template> </template>

35
mail_attachment_popup/README.rst

@ -1,35 +0,0 @@
===================
Popup Attachments
===================
The module opens attached mail images in popup.
Credits
=======
Contributors
------------
* Dinar Gabbasov <gabbasov@it-projects.info>
Sponsors
--------
* `IT-Projects LLC <https://it-projects.info>`__
Maintainers
-----------
* `IT-Projects LLC <https://it-projects.info>`__
The module is not maintained in future versions because it's functionality built-in since Odoo 11.0.
Further information
===================
Demo: http://runbot.it-projects.info/demo/mail-addons/10.0
HTML Description: https://apps.odoo.com/apps/modules/10.0/mail_attachment_popup/
Usage instructions: `<doc/index.rst>`_
Changelog: `<doc/changelog.rst>`_
Tested on Odoo 10.0 9cf666288076dc4e315e62e7ca0d6fc59995a498

0
mail_attachment_popup/__init__.py

29
mail_attachment_popup/__manifest__.py

@ -1,29 +0,0 @@
# -*- coding: utf-8 -*-
{
"name": """Popup Attachments""",
"summary": """Open attached mail images in popup""",
"category": "Extra Tools",
"version": "10.0.1.0.0",
"images": ['images/popup_image.png'],
"author": "IT-Projects LLC, Dinar Gabbasov",
"support": "apps@it-projects.info",
'website': "https://twitter.com/gabbasov_dinar",
"license": "GPL-3",
"price": "50.0",
"currency": "EUR",
"depends": [
"mail",
],
"external_dependencies": {"python": [], "bin": []},
"data": [
"views/mail_attachment_popup_template.xml",
],
"qweb": [
"static/src/xml/mail_attachment_popup.xml",
],
"installable": True,
'auto_install': False,
}

16
mail_attachment_popup/doc/index.rst

@ -1,16 +0,0 @@
===================
Popup Attachments
===================
Installation
============
* `Install <https://odoo-development.readthedocs.io/en/latest/odoo/usage/install-module.html>`__ this module in a usual way
Usage
=====
* Open 'Messaging' menu
* Find any message with image in attachments
* Click on the image
* Browser opens image in popup instead of downloading it

28
mail_attachment_popup/i18n/de.po

@ -1,28 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_attachment_popup
#
# Translators:
# Dawid Runowski <dawrun@outlook.com>, 2019
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-05 23:11+0000\n"
"PO-Revision-Date: 2017-06-23 14:31+0000\n"
"Last-Translator: Dawid Runowski <dawrun@outlook.com>, 2019\n"
"Language-Team: German (https://www.transifex.com/it-projects-llc/teams/76080/"
"de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: mail_attachment_popup
#. openerp-web
#: code:addons/mail_attachment_popup/static/src/xml/mail_attachment_popup.xml:17
#, python-format
msgid "Download"
msgstr "Herunterladen"

27
mail_attachment_popup/i18n/es.po

@ -1,27 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_attachment_popup
#
# Translators:
# Randall Castro <rcastro@treintaycinco.com>, 2018
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-19 16:49+0000\n"
"PO-Revision-Date: 2017-12-19 16:49+0000\n"
"Last-Translator: Randall Castro <rcastro@treintaycinco.com>, 2018\n"
"Language-Team: Spanish (https://www.transifex.com/it-projects-llc/"
"teams/76080/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: mail_attachment_popup
#. openerp-web
#: code:addons/mail_attachment_popup/static/src/xml/mail_attachment_popup.xml:17
#, python-format
msgid "Download"
msgstr "Descargar"

22
mail_attachment_popup/i18n/mail_attachment_popup.pot

@ -1,22 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_attachment_popup
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: mail_attachment_popup
#. openerp-web
#: code:addons/mail_attachment_popup/static/src/xml/mail_attachment_popup.xml:17
#, python-format
msgid "Download"
msgstr ""

29
mail_attachment_popup/i18n/ru.po

@ -1,29 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_attachment_popup
#
# Translators:
# Dinar <gabbasov@it-projects.info>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-11-16 08:35+0000\n"
"PO-Revision-Date: 2017-11-16 08:35+0000\n"
"Last-Translator: Dinar <gabbasov@it-projects.info>, 2017\n"
"Language-Team: Russian (https://www.transifex.com/it-projects-llc/"
"teams/76080/ru/)\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n"
"%100>=11 && n%100<=14)? 2 : 3);\n"
#. module: mail_attachment_popup
#. openerp-web
#: code:addons/mail_attachment_popup/static/src/xml/mail_attachment_popup.xml:17
#, python-format
msgid "Download"
msgstr "Скачать"

BIN
mail_attachment_popup/images/popup_image.png

Before

Width: 749  |  Height: 371  |  Size: 128 KiB

BIN
mail_attachment_popup/static/description/attach_image.png

Before

Width: 361  |  Height: 382  |  Size: 63 KiB

BIN
mail_attachment_popup/static/description/download.png

Before

Width: 361  |  Height: 381  |  Size: 131 KiB

84
mail_attachment_popup/static/description/index.html

@ -1,84 +0,0 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Popup Attachments</h2>
<h3 class="oe_slogan">Open attachments in popup</h3>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<p class="oe_mt32">
The module allows to open attachments (images) in popup. It is convenient if you want to display them only without downloading.
</p>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h3 class="oe_slogan">How it works</h3>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span6">
<p class="oe_mt32">
Go to "Messaging" menu and open email that contains image(s) in attachment.
</p>
</div>
<div class="oe_span6">
<div class="oe_row_img oe_centered">
<img class="oe_demo oe_picture oe_screenshot" src="attach_image.png"/>
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<div class="oe_span6">
<div class="oe_row_img oe_centered">
<img class="oe_demo oe_picture oe_screenshot" src="popup.png"/>
</div>
</div>
<div class="oe_span6">
<p class="oe_mt32">
Click on the image and see how popup is appear.
</p>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span6">
<p class="oe_mt32">
Moreover, you can download it to your device by clicking on the "Download" button if needed.
</p>
</div>
<div class="oe_span6">
<div class="oe_row_img oe_centered">
<img class="oe_demo oe_picture oe_screenshot" src="download.png"/>
</div>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2>Need our service?</h2>
<p class="oe_mt32">Contact us by <a href="mailto:apps@it-projects.info">email</a> or fill out <a href="https://www.it-projects.info/page/website.contactus " target="_blank">request form</a></p>
<ul>
<li><a href="mailto:apps@it-projects.info">apps@it-projects.info <i class="fa fa-envelope-o"></i></a></li>
<li><a href="https://www.it-projects.info/page/website.contactus " target="_blank">https://www.it-projects.info/page/website.contactus <i class="fa fa-list-alt"></i></a></li>
</ul>
</div>
</div>
</section>

BIN
mail_attachment_popup/static/description/popup.png

Before

Width: 365  |  Height: 382  |  Size: 150 KiB

429
mail_attachment_popup/static/lib/js/jquery.arcticmodal.js

@ -1,429 +0,0 @@
/*
arcticModal jQuery plugin
Version: 0.3
Author: Sergey Predvoditelev (sergey.predvoditelev@gmail.com)
Company: Arctic Laboratory (http://arcticlab.ru/)
Docs & Examples: http://arcticlab.ru/arcticmodal/
*/
(function($) {
var default_options = {
type: 'html', // ajax или html
content: '',
url: '',
ajax: {},
ajax_request: null,
closeOnEsc: true,
closeOnOverlayClick: true,
clone: false,
overlay: {
block: undefined,
tpl: '<div class="arcticmodal-overlay"></div>',
css: {
backgroundColor: '#000',
opacity: .6
}
},
container: {
block: undefined,
tpl: '<div class="arcticmodal-container"><table class="arcticmodal-container_i"><tr><td class="arcticmodal-container_i2"></td></tr></table></div>'
},
wrap: undefined,
body: undefined,
errors: {
tpl: '<div class="arcticmodal-error arcticmodal-close"></div>',
autoclose_delay: 2000,
ajax_unsuccessful_load: 'Error'
},
openEffect: {
type: 'fade',
speed: 400
},
closeEffect: {
type: 'fade',
speed: 400
},
beforeOpen: $.noop,
afterOpen: $.noop,
beforeClose: $.noop,
afterClose: $.noop,
afterLoading: $.noop,
afterLoadingOnShow: $.noop,
errorLoading: $.noop
};
var modalID = 0;
var modals = $([]);
var utils = {
// Определяет произошло ли событие e вне блока block
isEventOut: function(blocks, e) {
var r = true;
$(blocks).each(function() {
if ($(e.target).get(0)==$(this).get(0)) r = false;
if ($(e.target).closest('HTML', $(this).get(0)).length==0) r = false;
});
return r;
}
};
var modal = {
// Возвращает элемент, которым был вызван плагин
getParentEl: function(el) {
var r = $(el);
if (r.data('arcticmodal')) return r;
r = $(el).closest('.arcticmodal-container').data('arcticmodalParentEl');
if (r) return r;
return false;
},
// Переход
transition: function(el, action, options, callback) {
callback = callback==undefined ? $.noop : callback;
switch (options.type) {
case 'fade':
action=='show' ? el.fadeIn(options.speed, callback) : el.fadeOut(options.speed, callback);
break;
case 'none':
action=='show' ? el.show() : el.hide();
callback();
break;
}
},
// Подготвка содержимого окна
prepare_body: function(D, $this) {
// Обработчик закрытия
$('.arcticmodal-close', D.body).unbind('click.arcticmodal').bind('click.arcticmodal', function() {
$this.arcticmodal('close');
return false;
});
},
// Инициализация элемента
init_el: function($this, options) {
var D = $this.data('arcticmodal');
if (D) return;
D = options;
modalID++;
D.modalID = modalID;
// Overlay
D.overlay.block = $(D.overlay.tpl);
D.overlay.block.css(D.overlay.css);
// Container
D.container.block = $(D.container.tpl);
// BODY
D.body = $('.arcticmodal-container_i2', D.container.block);
if (options.clone) {
D.body.html($this.clone(true));
} else {
$this.before('<div id="arcticmodalReserve' + D.modalID + '" style="display: none" />');
D.body.html($this);
}
// Подготовка содержимого
modal.prepare_body(D, $this);
// Закрытие при клике на overlay
if (D.closeOnOverlayClick)
D.overlay.block.add(D.container.block).click(function(e) {
if (utils.isEventOut($('>*', D.body), e))
$this.arcticmodal('close');
});
// Запомним настройки
D.container.block.data('arcticmodalParentEl', $this);
$this.data('arcticmodal', D);
modals = $.merge(modals, $this);
// Показать
$.proxy(actions.show, $this)();
if (D.type=='html') return $this;
// Ajax-загрузка
if (D.ajax.beforeSend!=undefined) {
var fn_beforeSend = D.ajax.beforeSend;
delete D.ajax.beforeSend;
}
if (D.ajax.success!=undefined) {
var fn_success = D.ajax.success;
delete D.ajax.success;
}
if (D.ajax.error!=undefined) {
var fn_error = D.ajax.error;
delete D.ajax.error;
}
var o = $.extend(true, {
url: D.url,
beforeSend: function() {
if (fn_beforeSend==undefined) {
D.body.html('<div class="arcticmodal-loading" />');
} else {
fn_beforeSend(D, $this);
}
},
success: function(responce) {
// Событие после загрузки до показа содержимого
$this.trigger('afterLoading');
D.afterLoading(D, $this, responce);
if (fn_success==undefined) {
D.body.html(responce);
} else {
fn_success(D, $this, responce);
}
modal.prepare_body(D, $this);
// Событие после загрузки после отображения содержимого
$this.trigger('afterLoadingOnShow');
D.afterLoadingOnShow(D, $this, responce);
},
error: function() {
// Событие при ошибке загрузки
$this.trigger('errorLoading');
D.errorLoading(D, $this);
if (fn_error==undefined) {
D.body.html(D.errors.tpl);
$('.arcticmodal-error', D.body).html(D.errors.ajax_unsuccessful_load);
$('.arcticmodal-close', D.body).click(function() {
$this.arcticmodal('close');
return false;
});
if (D.errors.autoclose_delay)
setTimeout(function() {
$this.arcticmodal('close');
}, D.errors.autoclose_delay);
} else {
fn_error(D, $this);
}
}
}, D.ajax);
D.ajax_request = $.ajax(o);
// Запомнить настройки
$this.data('arcticmodal', D);
},
// Инициализация
init: function(options) {
options = $.extend(true, {}, default_options, options);
if ($.isFunction(this)) {
if (options==undefined) {
$.error('jquery.arcticmodal: Uncorrect parameters');
return;
}
if (options.type=='') {
$.error('jquery.arcticmodal: Don\'t set parameter "type"');
return;
}
switch (options.type) {
case 'html':
if (options.content=='') {
$.error('jquery.arcticmodal: Don\'t set parameter "content"');
return
}
var c = options.content;
options.content = '';
return modal.init_el($(c), options);
break;
case 'ajax':
if (options.url=='') {
$.error('jquery.arcticmodal: Don\'t set parameter "url"');
return;
}
return modal.init_el($('<div />'), options);
break;
}
} else {
return this.each(function() {
modal.init_el($(this), $.extend(true, {}, options));
});
}
}
};
var actions = {
// Показать
show: function() {
var $this = modal.getParentEl(this);
if ($this===false) {
$.error('jquery.arcticmodal: Uncorrect call');
return;
}
var D = $this.data('arcticmodal');
// Добавить overlay и container
D.overlay.block.hide();
D.container.block.hide();
$('BODY').append(D.overlay.block);
$('BODY').append(D.container.block);
// Событие
D.beforeOpen(D, $this);
$this.trigger('beforeOpen');
// Wrap
if (D.wrap.css('overflow')!='hidden') {
D.wrap.data('arcticmodalOverflow', D.wrap.css('overflow'));
var w1 = D.wrap.outerWidth(true);
D.wrap.css('overflow', 'hidden');
var w2 = D.wrap.outerWidth(true);
if (w2!=w1)
D.wrap.css('marginRight', (w2 - w1) + 'px');
}
// Скрыть предыдущие оверлеи
modals.not($this).each(function() {
var d = $(this).data('arcticmodal');
d.overlay.block.hide();
});
// Показать
modal.transition(D.overlay.block, 'show', modals.length>1 ? {type: 'none'} : D.openEffect);
modal.transition(D.container.block, 'show', modals.length>1 ? {type: 'none'} : D.openEffect, function() {
D.afterOpen(D, $this);
$this.trigger('afterOpen');
});
return $this;
},
// Закрыть
close: function() {
if ($.isFunction(this)) {
modals.each(function() {
$(this).arcticmodal('close');
});
} else {
return this.each(function() {
var $this = modal.getParentEl(this);
if ($this===false) {
$.error('jquery.arcticmodal: Uncorrect call');
return;
}
var D = $this.data('arcticmodal');
// Событие перед закрытием
if (D.beforeClose(D, $this)===false) return;
$this.trigger('beforeClose');
// Показать предыдущие оверлеи
modals.not($this).last().each(function() {
var d = $(this).data('arcticmodal');
d.overlay.block.show();
});
modal.transition(D.overlay.block, 'hide', modals.length>1 ? {type: 'none'} : D.closeEffect);
modal.transition(D.container.block, 'hide', modals.length>1 ? {type: 'none'} : D.closeEffect, function() {
// Событие после закрытия
D.afterClose(D, $this);
$this.trigger('afterClose');
// Если не клонировали - вернём на место
if (!D.clone)
$('#arcticmodalReserve' + D.modalID).replaceWith(D.body.find('>*'));
D.overlay.block.remove();
D.container.block.remove();
$this.data('arcticmodal', null);
if (!$('.arcticmodal-container').length) {
if (D.wrap.data('arcticmodalOverflow'))
D.wrap.css('overflow', D.wrap.data('arcticmodalOverflow'));
D.wrap.css('marginRight', 0);
}
});
if (D.type=='ajax')
D.ajax_request.abort();
modals = modals.not($this);
});
}
},
// Установить опции по-умолчанию
setDefault: function(options) {
$.extend(true, default_options, options);
}
};
$(function() {
default_options.wrap = $((document.all && !document.querySelector) ? 'html' : 'body');
});
// Закрытие при нажатии Escape
$(document).bind('keyup.arcticmodal', function(e) {
var m = modals.last();
if (!m.length) return;
var D = m.data('arcticmodal');
if (D.closeOnEsc && (e.keyCode===27))
m.arcticmodal('close');
});
$.arcticmodal = $.fn.arcticmodal = function(method) {
if (actions[method]) {
return actions[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method==='object' || !method) {
return modal.init.apply(this, arguments);
} else {
$.error('jquery.arcticmodal: Method ' + method + ' does not exist');
}
};
})(jQuery);

8
mail_attachment_popup/static/src/css/jquery.arcticmodal.css

@ -1,8 +0,0 @@
.arcticmodal-overlay,
.arcticmodal-container { position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 1010; }
.arcticmodal-container { overflow: auto; margin: 0; padding: 0; border: 0; border-collapse: collapse; }
*:first-child+html .arcticmodal-container { height: 100% }
.arcticmodal-container_i { height: 100%; margin: 0 auto; }
.arcticmodal-container_i2 { padding: 24px; margin: 0; border: 0; vertical-align: middle; padding-top: 50px;}
.arcticmodal-error { padding: 20px; border-radius: 10px; background: #000; color: #fff; }
.arcticmodal-loading { width: 80px; height: 80px; border-radius: 10px; background: #000 url(/mail_attachment_popup/static/src/img/loading.gif) no-repeat 50% 50%; }

11
mail_attachment_popup/static/src/css/simple.css

@ -1,11 +0,0 @@
.box-modal {
position: relative;
padding: 16px;
background: #fff;
color: #3c3c3c;
font: 14px/18px Arial, "Helvetica CY", "Nimbus Sans L", sans-serif;
box-shadow: 0 0 0 6px rgba(153, 153, 153, .3);
border-radius: 6px;
}
.box-modal_close { position: absolute; right: -25px; top: -25px; font-size: 30px; line-height: 15px; color: #ffffff; cursor: pointer; }
.box-modal_close:hover { color: #B1B1B1; }

16
mail_attachment_popup/static/src/css/styles.css

@ -1,16 +0,0 @@
.g-hidden {
display: none;
}
.box-modal img {
max-width: 900px;
width: 100%;
}
.box-modal-li li {
list-style-type: none;
}
.box-modal-li {
padding-left: 0;
}
.o_attachment .o_image {
cursor: pointer;
}

BIN
mail_attachment_popup/static/src/img/loading.gif

Before

Width: 32  |  Height: 32  |  Size: 3.1 KiB

29
mail_attachment_popup/static/src/xml/mail_attachment_popup.xml

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<t t-extend="mail.Attachment">
<t t-jquery="div[t-att-title='attachment.name'] .o_image" t-operation="replace">
<t t-if="attachment.mimetype and attachment.mimetype.search('image/') !== -1">
<span class="m-dotted" t-attf-onclick="$('#ImageModal{{ attachment.id }}').arcticmodal()">
<div class="o_image" target="_blank" t-att-data-mimetype="attachment.mimetype" t-attf-data-src="/web/image/#{attachment.id}/100x80">
<span class='o_attachment_name'><t t-esc='attachment.name'/></span>
</div>
</span>
<div class="g-hidden">
<div class="box-modal" t-attf-id="ImageModal{{ attachment.id }}">
<div class="box-modal_close arcticmodal-close">X</div>
<img t-att-data-mimetype="attachment.mimetype" t-attf-src="/web/image/#{attachment.id}"></img>
<ul class="box-modal-li">
<li><span class='o_attachment_name'><t t-esc='attachment.name'/></span></li>
<li><span class='oe_download_original_img'><a t-att-href='attachment.url' target="_blank">Download</a></span></li>
</ul>
</div>
</div>
</t>
<t t-if="! (attachment.mimetype and attachment.mimetype.search('image/') !== -1)">
<a class="o_image" t-att-href='attachment.url' target="_blank" t-att-data-mimetype="attachment.mimetype" t-attf-data-src="/web/image/#{attachment.id}/100x80">
<span class='o_attachment_name'><t t-esc='attachment.name'/></span>
</a>
</t>
</t>
</t>
</template>

13
mail_attachment_popup/views/mail_attachment_popup_template.xml

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="mail attachment popup assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/mail_attachment_popup/static/src/css/jquery.arcticmodal.css"/>
<link rel="stylesheet" href="/mail_attachment_popup/static/src/css/simple.css"/>
<link rel="stylesheet" href="/mail_attachment_popup/static/src/css/styles.css"/>
<script type="text/javascript" src="/mail_attachment_popup/static/lib/js/jquery.arcticmodal.js"></script>
</xpath>
</template>
</data>
</openerp>

32
mail_base/README.rst

@ -1,5 +1,6 @@
Mail Base
=========
===========
Mail Base
===========
* makes built-in mail js features extendable. * makes built-in mail js features extendable.
* handles ``search_default_*`` parameters in context. * handles ``search_default_*`` parameters in context.
@ -10,19 +11,38 @@ One can say, that the module do this todo from `addons/mail/static/src/js/chat_m
// to do: move this to mail.utils // to do: move this to mail.utils
Note. Due to odoo restrictions, module makes mail initialization again. That is browser loads emoji and other chat data twice. This is the only way to make Mail feature extendable.
Credits
=======
Note. Due to odoo restrictions, module makes mail initialization again. That is browser loads emoji and other chat data twice. This is the only way to make Mail feature extendable.
Contributors
------------
* Pavel Romanchenko <apps@it-projects.info>
Sponsors
--------
* `IT-Projects LLC <https://it-projects.info>`__
Maintainers
-----------
* `IT-Projects LLC <https://it-projects.info>`__
To get a guaranteed support you are kindly requested to purchase the module at `odoo apps store <https://apps.odoo.com/apps/modules/11.0/mail_base/>`__.
Thank you for understanding!
`IT-Projects Team <https://www.it-projects.info/team>`__
Further information Further information
=================== ===================
Demo: http://runbot.it-projects.info/demo/mail-addons/10.0
Demo: http://runbot.it-projects.info/demo/mail-addons/11.0
.. HTML Description: https://apps.odoo.com/apps/modules/10.0/mail_base/
HTML Description: https://apps.odoo.com/apps/modules/11.0/mail_base/
Usage instructions: `<doc/index.rst>`_ Usage instructions: `<doc/index.rst>`_
Changelog: `<doc/changelog.rst>`_ Changelog: `<doc/changelog.rst>`_
Tested on Odoo 10.0 1be57f2825af4f3ade20a658c6f97f6cf93cc866
Tested on Odoo 11.0 ecbf7aa4714479229658d14cce28fa00376ed390

1
mail_base/__init__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from . import models from . import models
from . import controllers from . import controllers

3
mail_base/__manifest__.py

@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
{ {
"name": "Mail Base", "name": "Mail Base",
"summary": """Makes Mail extendable""", "summary": """Makes Mail extendable""",
"category": "Discuss", "category": "Discuss",
"images": [], "images": [],
"version": "10.0.1.0.5",
"version": "11.0.1.0.5",
"author": "IT-Projects LLC, Pavel Romanchenko", "author": "IT-Projects LLC, Pavel Romanchenko",
"support": "apps@it-projects.info", "support": "apps@it-projects.info",

1
mail_base/controllers/main.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from openerp.http import request from openerp.http import request
from openerp.addons.bus.controllers.main import BusController from openerp.addons.bus.controllers.main import BusController

20
mail_base/doc/index.rst

@ -1,4 +1,18 @@
Mail Base
=========
=========================
Mail Base
=========================
To use this module you need either install module that depends on it or create new module.
Installation
============
* `Install <https://odoo-development.readthedocs.io/en/latest/odoo/usage/install-module.html>`__ this module in a usual way
Configuration
=============
This module does not require special configuration.
Usage
=====
* To use this module you need either install module that depends on it or create new module.

11
mail_base/i18n/de.po

@ -4,14 +4,15 @@
# #
# Translators: # Translators:
# Dawid Runowski <dawrun@outlook.com>, 2019 # Dawid Runowski <dawrun@outlook.com>, 2019
# Ermin Trevisan <trevi@twanda.com>, 2019
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-05 23:11+0000\n"
"PO-Revision-Date: 2017-06-23 14:31+0000\n"
"Last-Translator: Dawid Runowski <dawrun@outlook.com>, 2019\n"
"POT-Creation-Date: 2018-05-05 23:09+0000\n"
"PO-Revision-Date: 2017-11-28 13:59+0000\n"
"Last-Translator: Ermin Trevisan <trevi@twanda.com>, 2019\n"
"Language-Team: German (https://www.transifex.com/it-projects-llc/teams/76080/" "Language-Team: German (https://www.transifex.com/it-projects-llc/teams/76080/"
"de/)\n" "de/)\n"
"Language: de\n" "Language: de\n"
@ -23,7 +24,7 @@ msgstr ""
#. module: mail_base #. module: mail_base
#: model:ir.model,name:mail_base.model_mail_compose_message #: model:ir.model,name:mail_base.model_mail_compose_message
msgid "Email composition wizard" msgid "Email composition wizard"
msgstr ""
msgstr "Assistent für die Email-Gestaltung"
#. module: mail_base #. module: mail_base
#: model:ir.model,name:mail_base.model_mail_message #: model:ir.model,name:mail_base.model_mail_message

8
mail_base/i18n/es.po

@ -6,10 +6,10 @@
# Randall Castro <rcastro@treintaycinco.com>, 2018 # Randall Castro <rcastro@treintaycinco.com>, 2018
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-19 16:49+0000\n"
"PO-Revision-Date: 2017-12-19 16:49+0000\n"
"POT-Creation-Date: 2018-04-21 23:07+0000\n"
"PO-Revision-Date: 2018-04-21 23:07+0000\n"
"Last-Translator: Randall Castro <rcastro@treintaycinco.com>, 2018\n" "Last-Translator: Randall Castro <rcastro@treintaycinco.com>, 2018\n"
"Language-Team: Spanish (https://www.transifex.com/it-projects-llc/" "Language-Team: Spanish (https://www.transifex.com/it-projects-llc/"
"teams/76080/es/)\n" "teams/76080/es/)\n"
@ -22,7 +22,7 @@ msgstr ""
#. module: mail_base #. module: mail_base
#: model:ir.model,name:mail_base.model_mail_compose_message #: model:ir.model,name:mail_base.model_mail_compose_message
msgid "Email composition wizard" msgid "Email composition wizard"
msgstr "Asistente para crear email"
msgstr "Asistente para composición de correo"
#. module: mail_base #. module: mail_base
#: model:ir.model,name:mail_base.model_mail_message #: model:ir.model,name:mail_base.model_mail_message

2
mail_base/i18n/mail_base.pot

@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"

10
mail_base/i18n/pt.po

@ -3,14 +3,14 @@
# * mail_base # * mail_base
# #
# Translators: # Translators:
# Translation Bot <i18n-bot@it-projects.info>, 2017
# Translation Bot <i18n-bot@it-projects.info>, 2018
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-15 13:31+0000\n"
"PO-Revision-Date: 2017-12-15 13:31+0000\n"
"Last-Translator: Translation Bot <i18n-bot@it-projects.info>, 2017\n"
"POT-Creation-Date: 2018-04-21 00:05+0000\n"
"PO-Revision-Date: 2018-04-21 00:05+0000\n"
"Last-Translator: Translation Bot <i18n-bot@it-projects.info>, 2018\n"
"Language-Team: Portuguese (https://www.transifex.com/it-projects-llc/" "Language-Team: Portuguese (https://www.transifex.com/it-projects-llc/"
"teams/76080/pt/)\n" "teams/76080/pt/)\n"
"Language: pt\n" "Language: pt\n"

10
mail_base/i18n/pt_BR.po

@ -3,14 +3,14 @@
# * mail_base # * mail_base
# #
# Translators: # Translators:
# Translation Bot <i18n-bot@it-projects.info>, 2017
# Translation Bot <i18n-bot@it-projects.info>, 2018
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-12-15 13:31+0000\n"
"PO-Revision-Date: 2017-12-15 13:31+0000\n"
"Last-Translator: Translation Bot <i18n-bot@it-projects.info>, 2017\n"
"POT-Creation-Date: 2018-04-21 00:05+0000\n"
"PO-Revision-Date: 2018-04-21 00:05+0000\n"
"Last-Translator: Translation Bot <i18n-bot@it-projects.info>, 2018\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/it-projects-" "Language-Team: Portuguese (Brazil) (https://www.transifex.com/it-projects-"
"llc/teams/76080/pt_BR/)\n" "llc/teams/76080/pt_BR/)\n"
"Language: pt_BR\n" "Language: pt_BR\n"

8
mail_base/i18n/sl.po

@ -8,10 +8,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-05 23:11+0000\n"
"PO-Revision-Date: 2017-06-23 14:31+0000\n"
"POT-Creation-Date: 2018-05-05 23:09+0000\n"
"PO-Revision-Date: 2017-11-28 13:59+0000\n"
"Last-Translator: Matjaz Mozetic <m.mozetic@matmoz.si>, 2019\n" "Last-Translator: Matjaz Mozetic <m.mozetic@matmoz.si>, 2019\n"
"Language-Team: Slovenian (https://www.transifex.com/it-projects-llc/" "Language-Team: Slovenian (https://www.transifex.com/it-projects-llc/"
"teams/76080/sl/)\n" "teams/76080/sl/)\n"
@ -25,7 +25,7 @@ msgstr ""
#. module: mail_base #. module: mail_base
#: model:ir.model,name:mail_base.model_mail_compose_message #: model:ir.model,name:mail_base.model_mail_compose_message
msgid "Email composition wizard" msgid "Email composition wizard"
msgstr "Čarovnik za sestavljanje e-pošte"
msgstr "Čarovnik za sestavljanje sporočil"
#. module: mail_base #. module: mail_base
#: model:ir.model,name:mail_base.model_mail_message #: model:ir.model,name:mail_base.model_mail_message

1
mail_base/models.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from openerp import api, models from openerp import api, models

1294
mail_base/static/lib/base.js
File diff suppressed because it is too large
View File

2
mail_base/tests/__init__.py

@ -0,0 +1,2 @@
from . import test_default

16
mail_base/tests/test_default.py

@ -0,0 +1,16 @@
import odoo.tests
@odoo.tests.common.at_install(False)
@odoo.tests.common.post_install(True)
class TestUi(odoo.tests.HttpCase):
def test_01_mail_base(self):
# wait till page loaded
code = """
setTimeout(function () {
console.log('ok');
}, 1000);
"""
link = '/web#action=%s' % self.ref('mail.mail_channel_action_client_chat')
self.phantom_js(link, code, "odoo.__DEBUG__.services['mail_base.base']", login="admin")

1
mail_check_immediately/__init__.py

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

1
mail_check_immediately/__manifest__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
{ {
'name': 'Check mail immediately', 'name': 'Check mail immediately',
'version': '1.0.1', 'version': '1.0.1',

1
mail_check_immediately/models.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import datetime import datetime
from openerp.tools.translate import _ from openerp.tools.translate import _

2
mail_check_immediately/static/description/index.html

@ -41,6 +41,8 @@
<li><a href="mailto:apps@it-projects.info">apps@it-projects.info <i class="fa fa-envelope-o"></i></a></li> <li><a href="mailto:apps@it-projects.info">apps@it-projects.info <i class="fa fa-envelope-o"></i></a></li>
<li><a href="https://www.it-projects.info/page/website.contactus " target="_blank"> <li><a href="https://www.it-projects.info/page/website.contactus " target="_blank">
https://www.it-projects.info/page/website.contactus <i class="fa fa-list-alt"></i></a></li> https://www.it-projects.info/page/website.contactus <i class="fa fa-list-alt"></i></a></li>
<li><a href="https://m.me/itprojectsllc" target="_blank">https://m.me/itprojectsllc <i class="fa fa-facebook-square"></i></a></li>
<li>skype@it-projects.info <i class="fa fa-skype"></i></li>
</ul> </ul>
</div> </div>
</div> </div>

1
mail_fix_553/__init__.py

@ -1,2 +1 @@
# -*- coding: utf-8 -*-
from . import mail_fix_553 from . import mail_fix_553

1
mail_fix_553/__manifest__.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
{ {
"name": "Fix mail error 553", "name": "Fix mail error 553",
"version": "0.3", "version": "0.3",

1
mail_fix_553/mail_fix_553.py

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
import base64 import base64
import logging import logging

49
mail_move_message/README.rst

@ -1,10 +1,49 @@
Mail relocation
===============
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: https://www.gnu.org/licenses/lgpl
:alt: License: LGPL-3
Demo: http://runbot.it-projects.info/demo/mail-addons/9.0
=================
Mail Relocation
=================
Description: https://www.odoo.com/apps/modules/9.0/mail_move_message/
The module allows to relocate messages between models
Credits
=======
Contributors
------------
* `Ivan Yelizariev <https://it-projects.info/team/yelizariev>`__
Sponsors
--------
* `IT-Projects LLC <https://it-projects.info>`__
Maintainers
-----------
* `IT-Projects LLC <https://it-projects.info>`__
To get a guaranteed support
you are kindly requested to purchase the module
at `odoo apps store <https://apps.odoo.com/apps/modules/11.0/mail_move_message/>`__.
Thank you for understanding!
`IT-Projects Team <https://www.it-projects.info/team>`__
Further information
===================
Demo: http://runbot.it-projects.info/demo/mail-addons/11.0
HTML Description: https://apps.odoo.com/apps/modules/11.0/mail_move_message/
Usage instructions: `<doc/index.rst>`_
Changelog: `<doc/changelog.rst>`_
Notifications on updates: `via Atom <https://github.com/it-projects-llc/mail-addons/commits/11.0/mail_move_message.atom>`_, `by Email <https://blogtrottr.com/?subscribe=https://github.com/it-projects-llc/mail-addons/commits/11.0/mail_move_message.atom>`_
Further information and discussion: http://yelizariev.github.io/odoo/module/2015/04/10/mail-relocation.html Further information and discussion: http://yelizariev.github.io/odoo/module/2015/04/10/mail-relocation.html
Tested on Odoo 8.0 d023c079ed86468436f25da613bf486a4a17d625
Tested on Odoo 11.0 e9454e79e27d0b85546132cbe00b391e974c66bf

3
mail_move_message/__init__.py

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import controllers from . import controllers
from . import mail_move_message_models from . import mail_move_message_models

16
mail_move_message/__manifest__.py

@ -1,7 +1,13 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Ildar Nasyrov <https://it-projects.info/team/iledarn>
# Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k>
# Copyright 2017 Lilia Salihova
# Copyright 2016-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{ {
'name': 'Mail relocation',
'version': '10.0.1.0.6',
'name': 'Mail Relocation',
'version': '11.0.1.0.7',
'author': 'IT-Projects LLC, Ivan Yelizariev, Pavel Romanchenko', 'author': 'IT-Projects LLC, Ivan Yelizariev, Pavel Romanchenko',
'license': 'LGPL-3', 'license': 'LGPL-3',
'category': 'Discuss', 'category': 'Discuss',
@ -10,7 +16,9 @@
'website': 'https://twitter.com/yelizariev', 'website': 'https://twitter.com/yelizariev',
'price': 100.00, 'price': 100.00,
'currency': 'EUR', 'currency': 'EUR',
'depends': ['mail_all', 'web_polymorphic_field'],
'depends': [
'mail_all',
],
'data': [ 'data': [
'mail_move_message_views.xml', 'mail_move_message_views.xml',
'data/mail_move_message_data.xml', 'data/mail_move_message_data.xml',

3
mail_move_message/controllers/__init__.py

@ -1,2 +1,3 @@
# -*- coding: utf-8 -*-
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import main from . import main

58
mail_move_message/controllers/main.py

@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
from odoo.addons.web.controllers.main import DataSet
from odoo.tools.translate import _
from odoo import http
# Copyright 2016 Ildar Nasyrov <https://it-projects.info/team/iledarn>
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo.http import request from odoo.http import request
from odoo.addons.bus.controllers.main import BusController from odoo.addons.bus.controllers.main import BusController
@ -17,52 +18,3 @@ class MailChatController(BusController):
channels.append((request.db, 'mail_move_message')) channels.append((request.db, 'mail_move_message'))
channels.append((request.db, 'mail_move_message.delete_message')) channels.append((request.db, 'mail_move_message.delete_message'))
return super(MailChatController, self)._poll(dbname, channels, last, options) return super(MailChatController, self)._poll(dbname, channels, last, options)
class DataSetCustom(DataSet):
def _extend_name(self, model, records):
Model = request.env[model]
fields = Model.fields_get()
contact_field = False
for n, f in fields.iteritems():
if f['type'] == 'many2one' and f['relation'] == 'res.partner':
contact_field = n
break
partner_info = {}
if contact_field:
partner_info = Model.browse([r[0] for r in records]).read([contact_field])
partner_info = dict([(p['id'], p[contact_field]) for p in partner_info])
res = []
for r in records:
if partner_info.get(r[0]):
res.append((r[0], _('%s [%s] ID %s') % (r[1], partner_info.get(r[0])[1], r[0])))
else:
res.append((r[0], _('%s ID %s') % (r[1], r[0])))
return res
@http.route('/web/dataset/call_kw/<model>/name_search', type='json', auth="user")
def name_search(self, model, method, args, kwargs):
context = kwargs.get('context')
if context and context.get('extended_name_with_contact'):
# add order by ID desc
Model = request.env[model]
search_args = list(kwargs.get('args') or [])
limit = int(kwargs.get('limit') or 100)
operator = kwargs.get('operator')
name = kwargs.get('name')
if Model._rec_name and (not name == '' and operator == 'ilike'):
search_args += [(Model._rec_name, operator, name)]
records = Model.search(search_args, limit=limit, order='id desc')
res = records.name_get()
return self._extend_name(model, res)
return self._call_kw(model, method, args, kwargs)
@http.route('/web/dataset/call_kw/<model>/name_get', type='json', auth="user")
def name_get(self, model, method, args, kwargs):
res = self._call_kw(model, method, args, kwargs)
context = kwargs.get('context')
if context and context.get('extended_name_with_contact'):
res = self._extend_name(model, res)
return res

10
mail_move_message/data/mail_move_message_data.xml

@ -1,9 +1,11 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<openerp>
<data noupdate="1">
<!--# Copyright 2016 Ildar Nasyrov <https://it-projects.info/team/iledarn>
# Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).-->
<odoo>
<record id="mail_relocation_models" model="ir.config_parameter"> <record id="mail_relocation_models" model="ir.config_parameter">
<field name="key">mail_relocation_models</field> <field name="key">mail_relocation_models</field>
<field name="value">crm.lead,project.task</field> <field name="value">crm.lead,project.task</field>
</record> </record>
</data>
</openerp>
</odoo>

8
mail_move_message/doc/changelog.rst

@ -1,7 +1,13 @@
`1.0.6`
`1.0.7`
------- -------
**FIX**: polling errors on heavy server load **FIX**: polling errors on heavy server load
`1.0.6`
-------
- FIX: Error related to *Create Partner* button on the mail move wizard form.
`1.0.5` `1.0.5`
------- -------

33
mail_move_message/doc/index.rst

@ -1,4 +1,35 @@
================= =================
Mail relocation
Mail Relocation
================= =================
Installation
============
* `Install <https://odoo-development.readthedocs.io/en/latest/odoo/usage/install-module.html>`__ this module in a usual way
Configuration
=============
* Open ``[[ Settings ]] >> Mail Relocation`` menu
* In **Model** field add models to be used for message relocation
* Check the box **[x] Move Followers** to move followers by default when relocation
Usage
=====
Move message
------------
* Open ``[[ Discuss ]] >> Inbox`` menu
* Click on icon of two cross arrows
* Select a record you need
* Click **Move**
RESULT: The message has been moved to the record selected.
Move to origin
--------------
* Open the record where the message was moved to
* Click on the two cross arrows icon highlighted as red
* Check the box **[x] Move to origin**
RESULT: The message has been returned back to the original record.

120
mail_move_message/i18n/mail_move_message.pot

@ -4,7 +4,7 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
@ -13,18 +13,6 @@ msgstr ""
"Content-Transfer-Encoding: \n" "Content-Transfer-Encoding: \n"
"Plural-Forms: \n" "Plural-Forms: \n"
#. module: mail_move_message
#: code:addons/mail_move_message/controllers/main.py:41
#, python-format
msgid "%s ID %s"
msgstr ""
#. module: mail_move_message
#: code:addons/mail_move_message/controllers/main.py:39
#, python-format
msgid "%s [%s] ID %s"
msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,help:mail_move_message.field_mail_move_message_wizard_move_followers #: model:ir.model.fields,help:mail_move_message.field_mail_move_message_wizard_move_followers
msgid "Add followers of current record to a new record.\n" msgid "Add followers of current record to a new record.\n"
@ -32,6 +20,11 @@ msgid "Add followers of current record to a new record.\n"
"You can change default value for this option at Settings/System Parameters" "You can change default value for this option at Settings/System Parameters"
msgstr "" msgstr ""
#. module: mail_move_message
#: model:ir.ui.view,arch_db:mail_move_message.view_mail_move_message_config_settings
msgid "Add models to be used for message relocation"
msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_compose_message_all_child_ids #: model:ir.model.fields,field_description:mail_move_message.field_mail_compose_message_all_child_ids
#: model:ir.model.fields,field_description:mail_move_message.field_mail_mail_all_child_ids #: model:ir.model.fields,field_description:mail_move_message.field_mail_mail_all_child_ids
@ -39,11 +32,6 @@ msgstr ""
msgid "All childs" msgid "All childs"
msgstr "" msgstr ""
#. module: mail_move_message
#: model:ir.ui.view,arch_db:mail_move_message.view_mail_move_message_config_settings
msgid "Apply"
msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_partner_id #: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_partner_id
msgid "Author" msgid "Author"
@ -54,19 +42,14 @@ msgstr ""
msgid "Can move" msgid "Can move"
msgstr "" msgstr ""
#. module: mail_move_message
#: model:ir.ui.view,arch_db:mail_move_message.view_mail_move_message_config_settings
msgid "Cancel"
msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.ui.view,arch_db:mail_move_message.view_wizard #: model:ir.ui.view,arch_db:mail_move_message.view_wizard
msgid "Close" msgid "Close"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.ui.view,arch_db:mail_move_message.view_mail_move_message_config_settings
msgid "Configure Mail Relocation"
#: model:ir.model,name:mail_move_message.model_res_partner
msgid "Contact"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
@ -75,21 +58,11 @@ msgid "Create Partner"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#. openerp-web
#: code:addons/mail_move_message/static/src/js/mail_move_message.js:125
#: model:ir.ui.view,arch_db:mail_move_message.view_wizard
#, python-format
msgid "Create new record"
msgstr ""
#. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_config_settings_create_uid
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_create_uid #: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_create_uid
msgid "Created by" msgid "Created by"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_config_settings_create_date
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_create_date #: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_create_date
msgid "Created on" msgid "Created on"
msgstr "" msgstr ""
@ -100,7 +73,6 @@ msgid "Delete message"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_config_settings_display_name
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_display_name #: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_display_name
msgid "Display Name" msgid "Display Name"
msgstr "" msgstr ""
@ -126,7 +98,6 @@ msgid "From"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_config_settings_id
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_id #: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_id
msgid "ID" msgid "ID"
msgstr "" msgstr ""
@ -144,19 +115,16 @@ msgid "Is moved"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_config_settings___last_update
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard___last_update #: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard___last_update
msgid "Last Modified on" msgid "Last Modified on"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_config_settings_write_uid
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_write_uid #: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_write_uid
msgid "Last Updated by" msgid "Last Updated by"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_config_settings_write_date
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_write_date #: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_write_date
msgid "Last Updated on" msgid "Last Updated on"
msgstr "" msgstr ""
@ -168,7 +136,7 @@ msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.actions.act_window,name:mail_move_message.action_mail_move_message_config #: model:ir.actions.act_window,name:mail_move_message.action_mail_move_message_config
#: model:ir.ui.menu,name:mail_move_message.menu_mail_move_message
#: model:ir.ui.view,arch_db:mail_move_message.view_mail_move_message_config_settings
msgid "Mail Relocation" msgid "Mail Relocation"
msgstr "" msgstr ""
@ -186,12 +154,12 @@ msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_message_email_from #: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_message_email_from
msgid "Message email from"
msgid "Message Email From"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_message_name_from #: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_message_name_from
msgid "Message name from"
msgid "Message Name From"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
@ -205,8 +173,7 @@ msgid "Model"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_config_settings_model_ids
#: model:ir.ui.view,arch_db:mail_move_message.view_mail_move_message_config_settings
#: model:ir.model.fields,field_description:mail_move_message.field_res_config_settings_model_ids
msgid "Models" msgid "Models"
msgstr "" msgstr ""
@ -221,8 +188,8 @@ msgid "Move message and submessages to original place"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_config_settings_move_followers
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_move_followers #: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_move_followers
#: model:ir.model.fields,field_description:mail_move_message.field_res_config_settings_move_followers
msgid "Move Followers" msgid "Move Followers"
msgstr "" msgstr ""
@ -233,7 +200,7 @@ msgstr ""
#. module: mail_move_message #. module: mail_move_message
#. openerp-web #. openerp-web
#: code:addons/mail_move_message/static/src/xml/mail_move_message_main.xml:6
#: code:addons/mail_move_message/static/src/xml/mail_move_message_main.xml:12
#, python-format #, python-format
msgid "Move to thread" msgid "Move to thread"
msgstr "" msgstr ""
@ -262,22 +229,11 @@ msgstr ""
msgid "Moved with" msgid "Moved with"
msgstr "" msgstr ""
#. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_message_to_read
#: model:ir.model.fields,help:mail_move_message.field_mail_move_message_wizard_message_to_read
msgid "Need Action"
msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.ui.view,arch_db:mail_move_message.view_wizard #: model:ir.ui.view,arch_db:mail_move_message.view_wizard
msgid "Open message" msgid "Open message"
msgstr "" msgstr ""
#. module: mail_move_message
#: model:ir.ui.view,arch_db:mail_move_message.view_mail_move_message_config_settings
msgid "Options"
msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_compose_message_moved_from_parent_id #: model:ir.model.fields,field_description:mail_move_message.field_mail_compose_message_moved_from_parent_id
#: model:ir.model.fields,field_description:mail_move_message.field_mail_mail_moved_from_parent_id #: model:ir.model.fields,field_description:mail_move_message.field_mail_mail_moved_from_parent_id
@ -286,15 +242,17 @@ msgid "Parent Message (Original)"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model,name:mail_move_message.model_res_partner
msgid "Partner"
#: code:addons/mail_move_message/mail_move_message_models.py:222
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_model_record
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_res_id
#, python-format
msgid "Record"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: code:addons/mail_move_message/mail_move_message_models.py:195
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_res_id
#: code:addons/mail_move_message/mail_move_message_models.py:204
#, python-format #, python-format
msgid "Record"
msgid "Record field is empty!"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
@ -313,7 +271,7 @@ msgstr ""
#. module: mail_move_message #. module: mail_move_message
#. openerp-web #. openerp-web
#: code:addons/mail_move_message/static/src/js/mail_move_message.js:27
#: code:addons/mail_move_message/static/src/js/mail_move_message.js:43
#, python-format #, python-format
msgid "Relocate Message" msgid "Relocate Message"
msgstr "" msgstr ""
@ -323,6 +281,17 @@ msgstr ""
msgid "Search by name" msgid "Search by name"
msgstr "" msgstr ""
#. module: mail_move_message
#: code:addons/mail_move_message/mail_move_message_models.py:204
#, python-format
msgid "Select a record for relocation first"
msgstr ""
#. module: mail_move_message
#: model:ir.model.fields,help:mail_move_message.field_mail_move_message_wizard_message_to_read
msgid "Service field shows that this message were unread when moved"
msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_message_subject #: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_message_subject
msgid "Subject" msgid "Subject"
@ -341,6 +310,18 @@ msgstr ""
msgid "Uid" msgid "Uid"
msgstr "" msgstr ""
#. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_move_message_wizard_message_to_read
msgid "Unread message"
msgstr ""
#. module: mail_move_message
#: model:ir.model.fields,field_description:mail_move_message.field_mail_compose_message_moved_as_unread
#: model:ir.model.fields,field_description:mail_move_message.field_mail_mail_moved_as_unread
#: model:ir.model.fields,field_description:mail_move_message.field_mail_message_moved_as_unread
msgid "Was Unread"
msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.ui.view,arch_db:mail_move_message.view_wizard #: model:ir.ui.view,arch_db:mail_move_message.view_wizard
msgid "You cannot move this message. It was already moved with a message bellow. Open one and apply changes there." msgid "You cannot move this message. It was already moved with a message bellow. Open one and apply changes there."
@ -353,19 +334,18 @@ msgstr ""
msgid "all childs, including subchilds" msgid "all childs, including subchilds"
msgstr "" msgstr ""
#. module: mail_move_message
#: model:ir.model,name:mail_move_message.model_mail_move_message_config_settings
msgid "mail_move_message.config.settings"
msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.model,name:mail_move_message.model_mail_move_message_wizard #: model:ir.model,name:mail_move_message.model_mail_move_message_wizard
msgid "mail_move_message.wizard" msgid "mail_move_message.wizard"
msgstr "" msgstr ""
#. module: mail_move_message #. module: mail_move_message
#: model:ir.ui.view,arch_db:mail_move_message.view_mail_move_message_config_settings
#: model:ir.ui.view,arch_db:mail_move_message.view_wizard #: model:ir.ui.view,arch_db:mail_move_message.view_wizard
msgid "or" msgid "or"
msgstr "" msgstr ""
#. module: mail_move_message
#: model:ir.model,name:mail_move_message.model_res_config_settings
msgid "res.config.settings"
msgstr ""

202
mail_move_message/mail_move_message_models.py

@ -1,20 +1,27 @@
# -*- coding: utf-8 -*-
from openerp import api
from openerp import fields
from openerp import models
from openerp.tools import email_split
from openerp.tools.translate import _
# Copyright 2016 Ildar Nasyrov <https://it-projects.info/team/iledarn>
# Copyright 2016-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2016 intero-chz <https://github.com/intero-chz>
# Copyright 2016 manawi <https://github.com/manawi>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo import api
from odoo import fields
from odoo import models
from odoo.tools import email_split
from odoo.tools.translate import _
from odoo import exceptions
class Wizard(models.TransientModel): class Wizard(models.TransientModel):
_name = 'mail_move_message.wizard' _name = 'mail_move_message.wizard'
@api.model
def _model_selection(self): def _model_selection(self):
selection = [] selection = []
config_parameters = self.env['ir.config_parameter'] config_parameters = self.env['ir.config_parameter']
model_names = config_parameters.get_param('mail_relocation_models')
model_names = config_parameters.sudo().get_param('mail_relocation_models')
model_names = model_names.split(',') if model_names else [] model_names = model_names.split(',') if model_names else []
if 'default_message_id' in self.env.context: if 'default_message_id' in self.env.context:
message = self.env['mail.message'].browse(self.env.context['default_message_id']) message = self.env['mail.message'].browse(self.env.context['default_message_id'])
if message.model and message.model not in model_names: if message.model and message.model not in model_names:
@ -23,16 +30,16 @@ class Wizard(models.TransientModel):
model_names.append(message.moved_from_model) model_names.append(message.moved_from_model)
if model_names: if model_names:
selection = [(m.model, m.display_name) for m in self.env['ir.model'].search([('model', 'in', model_names)])] selection = [(m.model, m.display_name) for m in self.env['ir.model'].search([('model', 'in', model_names)])]
return selection return selection
@api.model @api.model
def default_get(self, fields_list): def default_get(self, fields_list):
res = super(Wizard, self).default_get(fields_list) res = super(Wizard, self).default_get(fields_list)
model_fields = self.fields_get()
if model_fields['model']['selection']:
res['model'] = model_fields['model']['selection'] and model_fields['model']['selection'][0][0]
available_models = self._model_selection()
if len(available_models):
record = self.env[available_models[0][0]].search([], limit=1)
res['model_record'] = len(record) and (available_models[0][0] + ',' + str(record.id)) or False
if 'message_id' in res: if 'message_id' in res:
message = self.env['mail.message'].browse(res['message_id']) message = self.env['mail.message'].browse(res['message_id'])
@ -55,10 +62,9 @@ class Wizard(models.TransientModel):
res['res_id'] = res_id[0].id res['res_id'] = res_id[0].id
config_parameters = self.env['ir.config_parameter'] config_parameters = self.env['ir.config_parameter']
res['move_followers'] = config_parameters.get_param('mail_relocation_move_followers')
res['move_followers'] = config_parameters.sudo().get_param('mail_relocation_move_followers')
res['uid'] = self.env.uid res['uid'] = self.env.uid
return res return res
message_id = fields.Many2one('mail.message', string='Message') message_id = fields.Many2one('mail.message', string='Message')
@ -69,16 +75,19 @@ class Wizard(models.TransientModel):
message_moved_by_user_id = fields.Many2one('res.users', related='message_id.moved_by_user_id', string='Moved by', readonly=True) message_moved_by_user_id = fields.Many2one('res.users', related='message_id.moved_by_user_id', string='Moved by', readonly=True)
message_is_moved = fields.Boolean(string='Is Moved', related='message_id.is_moved', readonly=True) message_is_moved = fields.Boolean(string='Is Moved', related='message_id.is_moved', readonly=True)
parent_id = fields.Many2one('mail.message', string='Search by name', ) parent_id = fields.Many2one('mail.message', string='Search by name', )
model = fields.Selection(_model_selection, string='Model')
res_id = fields.Integer(string='Record')
can_move = fields.Boolean('Can move', compute='_compute_can_move')
model_record = fields.Reference(selection="_model_selection", string='Record')
model = fields.Char(compute="_compute_model_res_id", string='Model')
res_id = fields.Integer(compute="_compute_model_res_id", string='Record')
can_move = fields.Boolean('Can move', compute='_compute_get_can_move')
move_back = fields.Boolean('MOVE TO ORIGIN', help='Move message and submessages to original place') move_back = fields.Boolean('MOVE TO ORIGIN', help='Move message and submessages to original place')
partner_id = fields.Many2one('res.partner', string='Author') partner_id = fields.Many2one('res.partner', string='Author')
filter_by_partner = fields.Boolean('Filter Records by partner') filter_by_partner = fields.Boolean('Filter Records by partner')
message_email_from = fields.Char() message_email_from = fields.Char()
message_name_from = fields.Char() message_name_from = fields.Char()
# FIXME message_to_read should be True even if current message or any his childs are unread # FIXME message_to_read should be True even if current message or any his childs are unread
message_to_read = fields.Boolean(related='message_id.needaction')
message_to_read = fields.Boolean(compute='_compute_is_read', string="Unread message",
help="Service field shows that this message were unread when moved")
uid = fields.Integer() uid = fields.Integer()
move_followers = fields.Boolean( move_followers = fields.Boolean(
'Move Followers', 'Move Followers',
@ -86,24 +95,40 @@ class Wizard(models.TransientModel):
"You must use this option, if new record has restricted access.\n" "You must use this option, if new record has restricted access.\n"
"You can change default value for this option at Settings/System Parameters") "You can change default value for this option at Settings/System Parameters")
@api.multi
@api.depends('model_record')
def _compute_model_res_id(self):
for rec in self:
rec.model = rec.model_record and rec.model_record._name or False
rec.res_id = rec.model_record and rec.model_record.id or False
@api.depends('message_id') @api.depends('message_id')
@api.multi @api.multi
def _compute_can_move(self):
def _compute_get_can_move(self):
for r in self: for r in self:
r.get_can_move_one()
@api.multi
def _compute_is_read(self):
messages = self.env['mail.message'].sudo().browse(self.message_id.all_child_ids.ids + [self.message_id.id])
self.message_to_read = True in [m.needaction for m in messages]
@api.multi
def get_can_move_one(self):
self.ensure_one()
# message was not moved before OR message is a top message of previous move # message was not moved before OR message is a top message of previous move
r.can_move = not r.message_id.moved_by_message_id or r.message_id.moved_by_message_id.id == r.message_id.id
self.can_move = not self.message_id.moved_by_message_id or self.message_id.moved_by_message_id.id == self.message_id.id
@api.onchange('move_back') @api.onchange('move_back')
def on_change_move_back(self): def on_change_move_back(self):
if not self.move_back: if not self.move_back:
return return
self.parent_id = self.message_id.moved_from_parent_id self.parent_id = self.message_id.moved_from_parent_id
model = self.message_id.moved_from_model
if self.message_id.is_moved:
self.model = model
self.res_id = self.message_id.moved_from_res_id
message = self.message_id
if message.is_moved:
self.model_record = self.env[message.moved_from_model].browse(message.moved_from_res_id)
@api.onchange('parent_id', 'res_id', 'model')
@api.onchange('parent_id', 'model_record')
def update_move_back(self): def update_move_back(self):
model = self.message_id.moved_from_model model = self.message_id.moved_from_model
self.move_back = self.parent_id == self.message_id.moved_from_parent_id \ self.move_back = self.parent_id == self.message_id.moved_from_parent_id \
@ -125,7 +150,7 @@ class Wizard(models.TransientModel):
if self.model and self.filter_by_partner and self.partner_id: if self.model and self.filter_by_partner and self.partner_id:
fields = self.env[self.model].fields_get(False) fields = self.env[self.model].fields_get(False)
contact_field = False contact_field = False
for n, f in fields.iteritems():
for n, f in fields.items():
if f['type'] == 'many2one' and f['relation'] == 'res.partner': if f['type'] == 'many2one' and f['relation'] == 'res.partner':
contact_field = n contact_field = n
break break
@ -174,6 +199,9 @@ class Wizard(models.TransientModel):
@api.multi @api.multi
def move(self): def move(self):
for r in self:
if not r.model:
raise exceptions.except_orm(_('Record field is empty!'), _('Select a record for relocation first'))
for r in self: for r in self:
r.check_access() r.check_access()
if not r.parent_id or not (r.parent_id.model == r.model and if not r.parent_id or not (r.parent_id.model == r.model and
@ -181,15 +209,14 @@ class Wizard(models.TransientModel):
# link with the first message of record # link with the first message of record
parent = self.env['mail.message'].search([('model', '=', r.model), ('res_id', '=', r.res_id)], order='id', limit=1) parent = self.env['mail.message'].search([('model', '=', r.model), ('res_id', '=', r.res_id)], order='id', limit=1)
r.parent_id = parent.id or None r.parent_id = parent.id or None
r.message_id.move(r.parent_id.id, r.res_id, r.model, r.move_back, r.move_followers, r.message_to_read, r.partner_id)
r.message_id.move(r.parent_id.id, r.res_id, r.model, r.move_back, r.move_followers)
if not (r.model and r.res_id):
r.message_id.needaction = False
if r.model in ['mail.message', 'mail.channel', False]:
return { return {
'type': 'ir.actions.client',
'name': 'All messages',
'tag': 'reload',
'name': 'Chess game page',
'type': 'ir.actions.act_url',
'url': '/web',
'target': 'self',
} }
return { return {
'name': _('Record'), 'name': _('Record'),
@ -218,30 +245,6 @@ class Wizard(models.TransientModel):
self.message_id.unlink() self.message_id.unlink()
return {} return {}
@api.model
def create_partner(self, message_id, relation, partner_id, message_name_from, message_email_from):
model = self.env[relation]
message = self.env['mail.message'].browse(message_id)
if not partner_id and message_name_from:
partner_id = self.env['res.partner'].with_context({'update_message_author': True}).create({
'name': message_name_from,
'email': message_email_from
}).id
context = {'partner_id': partner_id}
if model._rec_name:
context.update({'default_%s' % model._rec_name: message.subject})
fields = model.fields_get()
contact_field = False
for n, f in fields.iteritems():
if f['type'] == 'many2one' and f['relation'] == 'res.partner':
contact_field = n
break
if contact_field:
context.update({'default_%s' % contact_field: partner_id})
return context
@api.multi @api.multi
def read_close(self): def read_close(self):
for r in self: for r in self:
@ -264,10 +267,11 @@ class MailMessage(models.Model):
moved_from_parent_id = fields.Many2one('mail.message', 'Parent Message (Original)', ondelete='set null') moved_from_parent_id = fields.Many2one('mail.message', 'Parent Message (Original)', ondelete='set null')
moved_by_message_id = fields.Many2one('mail.message', 'Moved by message', ondelete='set null', help='Top message, that initate moving this message') moved_by_message_id = fields.Many2one('mail.message', 'Moved by message', ondelete='set null', help='Top message, that initate moving this message')
moved_by_user_id = fields.Many2one('res.users', 'Moved by user', ondelete='set null') moved_by_user_id = fields.Many2one('res.users', 'Moved by user', ondelete='set null')
all_child_ids = fields.One2many('mail.message', string='All childs', compute='_compute_all_childs', help='all childs, including subchilds')
all_child_ids = fields.One2many('mail.message', string='All childs', compute='_compute_get_all_childs', help='all childs, including subchilds')
moved_as_unread = fields.Boolean('Was Unread', default=False)
@api.multi @api.multi
def _compute_all_childs(self, include_myself=True):
def _compute_get_all_childs(self, include_myself=True):
for r in self: for r in self:
r._compute_all_childs_one(include_myself=include_myself) r._compute_all_childs_one(include_myself=include_myself)
@ -296,18 +300,23 @@ class MailMessage(models.Model):
self.env[model].browse(ids).message_subscribe([f.partner_id.id], [s.id for s in f.subtype_ids]) self.env[model].browse(ids).message_subscribe([f.partner_id.id], [s.id for s in f.subtype_ids])
@api.multi @api.multi
def move(self, parent_id, res_id, model, move_back, move_followers=False):
def move(self, parent_id, res_id, model, move_back, move_followers=False, message_to_read=False, author=False):
for r in self: for r in self:
r.move_one(parent_id, res_id, model, move_back, move_followers=move_followers)
r.move_one(parent_id, res_id, model, move_back, move_followers=move_followers, message_to_read=message_to_read, author=author)
@api.multi @api.multi
def move_one(self, parent_id, res_id, model, move_back, move_followers=False):
def move_one(self, parent_id, res_id, model, move_back, move_followers=False, message_to_read=False, author=False):
self.ensure_one() self.ensure_one()
if parent_id == self.id: if parent_id == self.id:
# if for any reason method is called to move message with parent # if for any reason method is called to move message with parent
# equal to oneself, we need stop to prevent infinitive loop in # equal to oneself, we need stop to prevent infinitive loop in
# building message tree # building message tree
return return
if not self.author_id:
self.write({
'author_id': author.id,
})
vals = {} vals = {}
if move_back: if move_back:
# clear variables if we move everything back # clear variables if we move everything back
@ -318,6 +327,7 @@ class MailMessage(models.Model):
vals['moved_from_res_id'] = None vals['moved_from_res_id'] = None
vals['moved_from_model'] = None vals['moved_from_model'] = None
vals['moved_from_parent_id'] = None vals['moved_from_parent_id'] = None
vals['moved_as_unread'] = None
else: else:
vals['parent_id'] = parent_id vals['parent_id'] = parent_id
vals['res_id'] = res_id vals['res_id'] = res_id
@ -326,22 +336,34 @@ class MailMessage(models.Model):
vals['is_moved'] = True vals['is_moved'] = True
vals['moved_by_user_id'] = self.env.user.id vals['moved_by_user_id'] = self.env.user.id
vals['moved_by_message_id'] = self.id vals['moved_by_message_id'] = self.id
vals['moved_as_unread'] = message_to_read
# Update record_name in message # Update record_name in message
vals['record_name'] = self._get_record_name(vals) vals['record_name'] = self._get_record_name(vals)
# unread message remains unread after moving back to origin
if self.moved_as_unread and move_back:
notification = {
'mail_message_id': self.id,
'res_partner_id': self.env.user.partner_id.id,
'is_read': False,
}
self.write({
'notification_ids': [(0, 0, notification)],
})
for r in self.all_child_ids: for r in self.all_child_ids:
r_vals = vals.copy() r_vals = vals.copy()
if not r.is_moved: if not r.is_moved:
# moved_from_* variables contain not last, but original # moved_from_* variables contain not last, but original
# reference # reference
r_vals['moved_from_parent_id'] = r.parent_id.id
r_vals['moved_from_res_id'] = r.res_id
r_vals['moved_from_model'] = r.model
r_vals['moved_from_parent_id'] = r.parent_id.id or r.env.context.get('uid')
r_vals['moved_from_res_id'] = r.res_id or r.id
r_vals['moved_from_model'] = r.model or r._name
elif move_back: elif move_back:
r_vals['parent_id'] = r.moved_from_parent_id.id r_vals['parent_id'] = r.moved_from_parent_id.id
r_vals['res_id'] = r.moved_from_res_id r_vals['res_id'] = r.moved_from_res_id
r_vals['model'] = r.moved_from_model
r_vals['model'] = (r.moved_from_model and r.moved_from_model not in ['mail.message', 'mail.channel', False]) and r.moved_from_model
r_vals['record_name'] = r_vals['model'] and self.env[r.moved_from_model].browse(r.moved_from_res_id).name
if move_followers: if move_followers:
r.sudo().move_followers(r_vals.get('model'), r_vals.get('res_id')) r.sudo().move_followers(r_vals.get('model'), r_vals.get('res_id'))
@ -357,7 +379,7 @@ class MailMessage(models.Model):
'res_id': vals.get('res_id'), 'res_id': vals.get('res_id'),
'model': vals.get('model'), 'model': vals.get('model'),
'is_moved': vals['is_moved'], 'is_moved': vals['is_moved'],
'record_name': vals['record_name']
'record_name': 'record_name' in vals and vals['record_name'],
} }
self.env['bus.bus'].sendone((self._cr.dbname, 'mail_move_message'), notification) self.env['bus.bus'].sendone((self._cr.dbname, 'mail_move_message'), notification)
@ -386,34 +408,32 @@ class MailMessage(models.Model):
class MailMoveMessageConfiguration(models.TransientModel): class MailMoveMessageConfiguration(models.TransientModel):
_name = 'mail_move_message.config.settings'
_inherit = 'res.config.settings' _inherit = 'res.config.settings'
model_ids = fields.Many2many(comodel_name='ir.model', string='Models') model_ids = fields.Many2many(comodel_name='ir.model', string='Models')
move_followers = fields.Boolean('Move Followers') move_followers = fields.Boolean('Move Followers')
@api.model @api.model
def get_default_move_message_configs(self, fields):
config_parameters = self.env['ir.config_parameter']
model_obj = self.env['ir.model']
model_names = config_parameters.get_param('mail_relocation_models')
if not model_names:
return {}
def get_values(self):
res = super(MailMoveMessageConfiguration, self).get_values()
config_parameters = self.env["ir.config_parameter"].sudo()
model_names = config_parameters.sudo().get_param('mail_relocation_models')
model_names = model_names.split(',') model_names = model_names.split(',')
model_ids = model_obj.search([('model', 'in', model_names)])
return {
'model_ids': [m.id for m in model_ids],
'move_followers': config_parameters.get_param('mail_relocation_move_followers')
}
model_ids = self.env['ir.model'].sudo().search([('model', 'in', model_names)])
res.update(
model_ids=[m.id for m in model_ids],
move_followers=config_parameters.sudo().get_param('mail_relocation_move_followers'),
)
return res
@api.multi @api.multi
def set_move_message_configs(self):
config_parameters = self.env['ir.config_parameter']
model_names = ''
def set_values(self):
super(MailMoveMessageConfiguration, self).set_values()
config_parameters = self.env["ir.config_parameter"].sudo()
for record in self: for record in self:
model_names = ','.join([m.model for m in record.model_ids])
config_parameters.set_param('mail_relocation_models', model_names)
config_parameters.set_param('mail_relocation_move_followers', record.move_followers or '')
model_names = ','.join([x.model for x in record.model_ids])
config_parameters.set_param("mail_relocation_models", model_names or '')
config_parameters.set_param("mail_relocation_move_followers", record.move_followers or '')
class ResPartner(models.Model): class ResPartner(models.Model):
@ -436,3 +456,13 @@ class ResPartner(models.Model):
if messages: if messages:
messages.sudo().write({'author_id': res.id}) messages.sudo().write({'author_id': res.id})
return res return res
@api.model
def default_get(self, default_fields):
contextual_self = self
if 'mail_move_message' in self.env.context and self.env.context['mail_move_message']:
contextual_self = self.with_context(
default_name=self.env.context['message_name_from'] or '',
default_email=self.env.context['message_email_from'] or '',
)
return super(ResPartner, contextual_self).default_get(default_fields)

79
mail_move_message/mail_move_message_views.xml

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<openerp><data>
<!--# Copyright 2016 Ildar Nasyrov <https://it-projects.info/team/iledarn>
# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).-->
<odoo>
<template id="assets_backend" name="custom bar assets" inherit_id="web.assets_backend"> <template id="assets_backend" name="custom bar assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside"> <xpath expr="." position="inside">
@ -29,9 +34,11 @@
</group> </group>
<group attrs="{'invisible':[('can_move', '=', False)]}" colspan="2"> <group attrs="{'invisible':[('can_move', '=', False)]}" colspan="2">
<label for="model"/>
<label for="model_record"/>
<div> <div>
<field name="model" widget="polymorphic" polymorphic="res_id" class="oe_inline"/>
<field name="model_record" class="oe_inline"/>
<field name="model" invisible="1"/>
<field name="res_id" invisible="1"/>
</div> </div>
<label for="filter_by_partner"/> <label for="filter_by_partner"/>
<div> <div>
@ -39,12 +46,7 @@
<field name="partner_id" class="oe_inline"/> <field name="partner_id" class="oe_inline"/>
<button string="Create Partner" attrs="{'invisible':[('partner_id','!=',False)]}" <button string="Create Partner" attrs="{'invisible':[('partner_id','!=',False)]}"
class="oe_highlight oe_inline ml32" class="oe_highlight oe_inline ml32"
special="quick_create" field="partner_id" context="{'force_email':True,'default_email':message_email_from,'default_name':message_name_from, 'update_message_author':True}" />
</div>
<label for="res_id"/>
<div>
<field name="res_id" context="{'extended_name_with_contact':1}" widget="many2one" attrs="{'readonly': [('model','=',False)]}" class="oe_inline"/>
<button string="Create new record" name="create_record" type="object" class="oe_highlight oe_inline ml32" attrs="{'invisible':['|',('model','=',False)]}" special="quick_create" field="res_id" use_for_mail_move_message="True"/>
special="quick_create" model="res.partner" field="partner_id" context="{'force_email':True,'default_email':message_email_from,'default_name':message_name_from, 'update_message_author':True}" />
</div> </div>
<label for="move_back" attrs="{'invisible':[('message_is_moved','=',False)]}"/> <label for="move_back" attrs="{'invisible':[('message_is_moved','=',False)]}"/>
<div attrs="{'invisible':[('message_is_moved','=',False)]}"> <div attrs="{'invisible':[('message_is_moved','=',False)]}">
@ -86,39 +88,50 @@
</field> </field>
</record> </record>
<!-- Relocation config wizard -->
<record id="view_mail_move_message_config_settings" model="ir.ui.view">
<field name="name">relocation settings</field>
<field name="model">mail_move_message.config.settings</field>
<!-- Relocation config wizard -->
<record id="view_mail_move_message_config_settings" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="55"/>
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Configure Mail Relocation" class="oe_form_configuration">
<header>
<button string="Apply" type="object" name="execute" class="oe_highlight"/>
or
<button string="Cancel" type="object" name="cancel" class="oe_link"/>
</header>
<div name="general">
<separator string="Models"/>
<xpath expr="//div[hasclass('settings')]" position="inside">
<div class="app_settings_block" data-string="Mail Relocation" string="Mail Relocation" data-key="mail_move_message">
<h2>Mail Relocation</h2>
<div class="row mt16 o_settings_container">
<div class="col-xs-12 col-md-6 o_setting_box" id="crm_lead">
<div class="o_setting_left_pane">
</div>
<div class="o_setting_right_pane">
<label for="model_ids"/>
<div class="text-muted">
Add models to be used for message relocation
</div>
<field name="model_ids" widget="many2many_tags"/> <field name="model_ids" widget="many2many_tags"/>
<separator string="Options"/>
<label for="move_followers"/>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box" id="crm_lead">
<div class="o_setting_left_pane">
<field name="move_followers"/> <field name="move_followers"/>
</div> </div>
</form>
<div class="o_setting_right_pane">
<label for="move_followers"/>
</div>
</div>
</div>
</div>
</xpath>
</field> </field>
</record>
</record>
<record id="action_mail_move_message_config" model="ir.actions.act_window">
<record id="action_mail_move_message_config" model="ir.actions.act_window">
<field name="name">Mail Relocation</field> <field name="name">Mail Relocation</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">mail_move_message.config.settings</field>
<field name="res_model">res.config.settings</field>
<field name="view_id" ref="view_mail_move_message_config_settings"/> <field name="view_id" ref="view_mail_move_message_config_settings"/>
<field name="view_mode">form</field> <field name="view_mode">form</field>
<field name="target">inline</field> <field name="target">inline</field>
</record>
<!-- Add menu entry in Settings/Email -->
<menuitem name="Mail Relocation" id="menu_mail_move_message" parent="base.menu_email" sequence="99" action="action_mail_move_message_config"/>
<field name="context">{'module' : 'mail_move_message'}</field>
</record>
</data>
</openerp>
</odoo>

BIN
mail_move_message/static/description/delete-message.png

Before

Width: 1012  |  Height: 546  |  Size: 39 KiB

After

Width: 667  |  Height: 446  |  Size: 32 KiB

BIN
mail_move_message/static/description/icon.png

Before

Width: 149  |  Height: 149  |  Size: 1.5 KiB

After

Width: 100  |  Height: 100  |  Size: 2.1 KiB

BIN
mail_move_message/static/description/inbox-move.png

Before

Width: 1054  |  Height: 562  |  Size: 57 KiB

After

Width: 667  |  Height: 446  |  Size: 32 KiB

74
mail_move_message/static/description/index.html

@ -1,12 +1,12 @@
<section class="oe_container"> <section class="oe_container">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div class="oe_span12"> <div class="oe_span12">
<h2 class="oe_slogan">Mail relocation</h2>
<h2 class="oe_slogan">Mail Relocation</h2>
<h3 class="oe_slogan">Relocate customer's mails to a correct place (lead, task etc.)</h3> <h3 class="oe_slogan">Relocate customer's mails to a correct place (lead, task etc.)</h3>
</div> </div>
<div class="oe_span12"> <div class="oe_span12">
<p class="oe_mt32">
<div class="alert alert-success" style="padding:0.6em 0.6em; font-size: 120%;">
<p>
The module helps you to organise mails from customers. The module helps you to organise mails from customers.
</p> </p>
<p> <p>
@ -14,13 +14,14 @@
</p> </p>
</div> </div>
</div> </div>
</div>
</section> </section>
<section class="oe_container oe_dark"> <section class="oe_container oe_dark">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_span12 text-center">
<h2>Usage</h2> <h2>Usage</h2>
<p class="oe_mt32">
<p class="oe_mt32 text-center">
Click on an icon of two cross arrows. Click on an icon of two cross arrows.
</p> </p>
</div> </div>
@ -36,7 +37,7 @@
<section class="oe_container"> <section class="oe_container">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div class="oe_span12"> <div class="oe_span12">
<p class="oe_mt32">
<p class="oe_mt32 text-center">
Find a record you need and click on "Move" button. Find a record you need and click on "Move" button.
</p> </p>
</div> </div>
@ -52,7 +53,7 @@
<section class="oe_container oe_dark"> <section class="oe_container oe_dark">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div class="oe_span12"> <div class="oe_span12">
<p class="oe_mt32">
<p class="oe_mt32 text-center">
Done! You've attached mail and its child mails to the record. Done! You've attached mail and its child mails to the record.
</p> </p>
</div> </div>
@ -61,7 +62,7 @@
<div class="oe_demo oe_picture oe_screenshot"> <div class="oe_demo oe_picture oe_screenshot">
<img src="record1.png?3"/> <img src="record1.png?3"/>
</div> </div>
<p class="oe_mt32">
<p class="oe_mt32 text-center">
Scroll down... Moved mails are marked by highlighted icon. Scroll down... Moved mails are marked by highlighted icon.
</p> </p>
<div class="oe_demo oe_picture oe_screenshot"> <div class="oe_demo oe_picture oe_screenshot">
@ -74,16 +75,16 @@
<section class="oe_container"> <section class="oe_container">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div class="oe_span12"> <div class="oe_span12">
<p class="oe_mt32">
<p class="oe_mt32 text-center">
You could easily return mails back if you change your mind. You could easily return mails back if you change your mind.
</p> </p>
</div> </div>
<div class="oe_span12"> <div class="oe_span12">
<div class="oe_demo oe_picture oe_screenshot">
<div class="oe_demo oe_picture" style="margin-bottom: 4em;">
<img src="record-move-back.png?1"/> <img src="record-move-back.png?1"/>
</div> </div>
<p class="oe_mt32">
<p class="oe_mt32 text-center">
Further information and discussion: <a href="https://yelizariev.github.io/odoo/module/2015/04/10/mail-relocation.html">https://yelizariev.github.io/odoo/module/2015/04/10/mail-relocation.html</a> Further information and discussion: <a href="https://yelizariev.github.io/odoo/module/2015/04/10/mail-relocation.html">https://yelizariev.github.io/odoo/module/2015/04/10/mail-relocation.html</a>
</p> </p>
</div> </div>
@ -93,30 +94,71 @@
<section class="oe_container oe_dark"> <section class="oe_container oe_dark">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_span12 text-center">
<h2>Tips and tricks</h2> <h2>Tips and tricks</h2>
</div> </div>
<div class="oe_span12"> <div class="oe_span12">
<p class="oe_mt32"> <p class="oe_mt32">
The module can be used to delete a message (it's available for superuser only) The module can be used to delete a message (it's available for superuser only)
</p> </p>
<div class="oe_demo oe_picture oe_screenshot">
<div class="oe_demo oe_picture">
<img src="delete-message.png"/> <img src="delete-message.png"/>
</div> </div>
</div> </div>
</div> </div>
</section> </section>
<br/>
<section class="oe_container"> <section class="oe_container">
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_span8">
<h2>Need our service?</h2> <h2>Need our service?</h2>
<p class="oe_mt32">Contact us by <a href="mailto:apps@it-projects.info">email</a> or fill out <a href="https://www.it-projects.info/page/website.contactus " target="_blank">request form</a></p> <p class="oe_mt32">Contact us by <a href="mailto:apps@it-projects.info">email</a> or fill out <a href="https://www.it-projects.info/page/website.contactus " target="_blank">request form</a></p>
<ul> <ul>
<li><a href="mailto:apps@it-projects.info">apps@it-projects.info <i class="fa fa-envelope-o"></i></a></li> <li><a href="mailto:apps@it-projects.info">apps@it-projects.info <i class="fa fa-envelope-o"></i></a></li>
<li><a href="https://www.it-projects.info/page/website.contactus " target="_blank">
https://www.it-projects.info/page/website.contactus <i class="fa fa-list-alt"></i></a></li>
<li><a href="https://www.it-projects.info/page/website.contactus " target="_blank">https://www.it-projects.info/page/website.contactus <i class="fa fa-list-alt"></i></a></li>
<li><a href="https://m.me/itprojectsllc" target="_blank">https://m.me/itprojectsllc <i class="fa fa-facebook-square"></i></a></li>
<li>skype@it-projects.info <i class="fa fa-skype"></i></li>
</ul> </ul>
</div> </div>
<div class="oe_span4">
<div class="stamp" style="width:200px;">
<div style="margin-top: 15px;
position: relative;
font-family:'Vollkorn', serif;
font-size: 16px;
line-height: 25px;
text-transform: uppercase;
font-weight: bold;
color: #75526b;
border: 3px dashed #75526b;
float: left;
padding: 4px 12px;
-webkit-transform: rotate(6deg);
-o-transform: rotate(6deg);
-moz-transform: rotate(6deg);
-ms-transform: rotate(6deg);">
Tested on Odoo<br/>11.0 community
</div>
<div style="margin-top: 15px;
position: relative;
font-family:'Vollkorn', serif;
font-size: 16px;
line-height: 25px;
text-transform: uppercase;
font-weight: bold;
color: #75526b;
border: 3px dashed #75526b;
float: left;
padding: 4px 12px;
-webkit-transform: rotate(-7deg);
-o-transform: rotate(-7deg);
-moz-transform: rotate(-7deg);
-ms-transform: rotate(-7deg);">
Tested on Odoo<br/>11.0 enterprise
</div>
</div>
</div>
</div> </div>
</section> </section>

BIN
mail_move_message/static/description/record-move-back.png

Before

Width: 904  |  Height: 482  |  Size: 42 KiB

After

Width: 658  |  Height: 465  |  Size: 44 KiB

132
mail_move_message/static/src/js/mail_move_message.js

@ -1,15 +1,31 @@
/*Copyright 2016 Ildar Nasyrov <https://it-projects.info/team/iledarn>
# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2016 Pavel Romanchenko
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). */
odoo.define('mail_move_message.relocate', function (require) { odoo.define('mail_move_message.relocate', function (require) {
"use strict"; "use strict";
var bus = require('bus.bus').bus; var bus = require('bus.bus').bus;
var chat_manager = require('mail.chat_manager');
var base_obj = require('mail_base.base');
var chat_manager = require('mail_base.base').chat_manager;
var thread = require('mail.ChatThread'); var thread = require('mail.ChatThread');
var chatter = require('mail.Chatter'); var chatter = require('mail.Chatter');
var Model = require('web.Model');
var form_common = require('web.form_common');
var widgets = require('web.form_widgets');
var rpc = require('web.rpc');
var Basicmodel = require('web.BasicModel');
var view_dialogs = require('web.view_dialogs');
var field_utils_format = require('web.field_utils').format;
var BasicRenderer = require('web.BasicRenderer');
var core = require('web.core'); var core = require('web.core');
var form_widget = require('web.FormRenderer');
var session = require('web.Session');
var FormController = require('web.FormController');
var FormView = require('web.FormView');
var FormRenderer = require('web.FormRenderer');
var dialogs = require('web.view_dialogs');
var Dialog = require('web.Dialog');
var relational_fields = require('web.relational_fields');
var Widget = require('web.Widget');
var _t = core._t; var _t = core._t;
@ -31,9 +47,8 @@ odoo.define('mail_move_message.relocate', function (require) {
view_type: 'form', view_type: 'form',
views: [[false, 'form']], views: [[false, 'form']],
target: 'new', target: 'new',
context: {'default_message_id': message_id}
context: {'default_message_id': message_id},
}; };
this.do_action(action, { this.do_action(action, {
'on_close': function(){} 'on_close': function(){}
}); });
@ -44,12 +59,14 @@ odoo.define('mail_move_message.relocate', function (require) {
start: function() { start: function() {
var result = this._super.apply(this, arguments); var result = this._super.apply(this, arguments);
// For show wizard in the form // For show wizard in the form
this.thread.on('move_message', this, this.thread.on_move_message);
if (this.fields.thread && this.fields.thread.thread) {
var thread = this.fields.thread.thread;
thread.on('move_message', this, thread.on_move_message);
}
return $.when(result).done(function() {}); return $.when(result).done(function() {});
} }
}); });
var ChatAction = core.action_registry.get('mail.chat.instant_messaging'); var ChatAction = core.action_registry.get('mail.chat.instant_messaging');
ChatAction.include({ ChatAction.include({
start: function() { start: function() {
@ -60,20 +77,22 @@ odoo.define('mail_move_message.relocate', function (require) {
} }
}); });
base_obj.MailTools.include({
make_message: function(data){
var msg = this._super(data);
// override methods of chat manager
var chat_manager_super_make_message = chat_manager.make_message;
chat_manager.make_message = function(data){
var msg = chat_manager_super_make_message(data);
// Mark msg as moved after reload // Mark msg as moved after reload
msg.is_moved = data.is_moved || false; msg.is_moved = data.is_moved || false;
return msg; return msg;
},
on_notification: function(notifications){
this._super(notifications);
};
var chat_manager_super_on_notification = chat_manager.on_notification;
chat_manager.on_notification = function(notifications){
chat_manager_super_on_notification(notifications);
var self = this; var self = this;
_.each(notifications, function (notification) { _.each(notifications, function (notification) {
var model = notification[0][1]; var model = notification[0][1];
var message_id = notification[1].id; var message_id = notification[1].id;
var message = base_obj.chat_manager.get_message(message_id);
var message = chat_manager.get_message(message_id);
if (model === 'mail_move_message' && message) { if (model === 'mail_move_message' && message) {
message.res_id = notification[1].res_id; message.res_id = notification[1].res_id;
message.model = notification[1].model; message.model = notification[1].model;
@ -85,60 +104,53 @@ odoo.define('mail_move_message.relocate', function (require) {
// Call thread.on_update_message(message) // Call thread.on_update_message(message)
chat_manager.bus.trigger('update_message', message); chat_manager.bus.trigger('update_message', message);
} else if (model === 'mail_move_message.delete_message') { } else if (model === 'mail_move_message.delete_message') {
self.remove_from_cache(message, []);
_.each(message.channel_ids, function(ch){
self.remove_message_from_channel(ch, message);
})
chat_manager.bus.trigger('update_message', message); chat_manager.bus.trigger('update_message', message);
} }
}); });
};
Basicmodel.include({
applyDefaultValues: function (recordID, values, options) {
delete values.model
return this._super(recordID, values, options)
} }
}); });
widgets.WidgetButton.include({
on_click: function(){
if(this.node.attrs.special == 'quick_create'){
FormController.include({
_onButtonClicked: function(event){
if(event.data.attrs.special === 'quick_create' && event.data.attrs.field === 'partner_id'){
var self = this; var self = this;
var related_field = this.field_manager.fields[this.node.attrs.field];
var context_built = $.Deferred();
if(this.node.attrs.use_for_mail_move_message) {
var model = new Model(this.view.dataset.model);
var partner_id = self.field_manager.fields.partner_id.get_value();
var message_name_from = self.field_manager.fields.message_name_from.get_value();
var message_email_from = self.field_manager.fields.message_email_from.get_value();
context_built = model.call('create_partner', [
self.view.dataset.context.default_message_id,
related_field.field.relation,
partner_id,
message_name_from,
message_email_from
]);
}
else {
context_built.resolve(this.build_context());
}
$.when(context_built).pipe(function (context) {
if(self.node.attrs.use_for_mail_move_message) {
self.field_manager.fields.partner_id.set_value(context.partner_id);
}
var dialog = new form_common.FormViewDialog(self, {
res_model: related_field.field.relation,
res_id: false,
context: context,
title: _t("Create new record")
}).open();
dialog.on('closed', self, function () {
self.force_disabled = false;
self.check_disable();
});
dialog.on('create_completed', self, function(id) {
related_field.set_value(id);
if(self.field_manager.fields.filter_by_partner) {
self.field_manager.fields.filter_by_partner.set_value(true);
}
var field_data = event.data.record.data;
this.on_saved = function(record, bool) {
var values = [{
id: record.res_id,
display_name: record.data.display_name,
}];
};
var wid = self.initialState.fieldsInfo.form.partner_id.Widget;
var relField = new relational_fields.FieldMany2One(wid,
'partner_id',
self.initialState,
{
mode: 'edit',
viewType: 'form',
}); });
relField.getParent = function() {
// necessary for correct _trigger_up implementation in mixins.js
return self;
};
var wizard_popup = relField._searchCreatePopup("form", false, {
'message_name_from': field_data.message_name_from && field_data.message_name_from.split('@')[0],
'message_email_from': field_data.message_email_from,
'message_id': field_data.res_id,
'mail_move_message': 1,
}); });
}
else {
} else {
this._super.apply(this, arguments); this._super.apply(this, arguments);
} }
}
},
}); });
}); });

8
mail_move_message/static/src/xml/mail_move_message_main.xml

@ -1,7 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!--# Copyright 2016 Ildar Nasyrov <https://it-projects.info/team/iledarn>
# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2016 Pavel Romanchenko
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).-->
<template> <template>
<t t-extend="mail.ChatThread.Message"> <t t-extend="mail.ChatThread.Message">
<t t-jquery='p.o_mail_info>span>i:first-child' t-operation="before">
<t t-jquery='p.o_mail_info span:last-child i:first-child' t-operation="before">
<i t-if="!message.is_system_notification" t-att-class="'fa fa-exchange oe_move' + (message.is_moved ? ' oe_moved' : '')" <i t-if="!message.is_system_notification" t-att-class="'fa fa-exchange oe_move' + (message.is_moved ? ' oe_moved' : '')"
t-att-data-message-id="message.id" title="Move to thread"/> t-att-data-message-id="message.id" title="Move to thread"/>
</t> </t>

3
mail_move_message/tests/__init__.py

@ -0,0 +1,3 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import test_mail_move

52
mail_move_message/tests/test_mail_move.py

@ -0,0 +1,52 @@
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
import odoo.tests
from odoo.api import Environment
@odoo.tests.common.at_install(True)
@odoo.tests.common.post_install(True)
class TestUi(odoo.tests.HttpCase):
def test_create_new_partner_and_move_message(self):
env = Environment(self.registry.test_cr, self.uid, {})
# needed because tests are run before the module is marked as
# installed. In js web will only load qweb coming from modules
# that are returned by the backend in module_boot. Without
# this you end up with js, css but no qweb.
env['ir.module.module'].search([('name', '=', 'mail_move_message')], limit=1).state = 'installed'
self.registry.cursor().release()
# updating models, to be able relocate messages to a partner at_install
config_parameters = self.env["ir.config_parameter"].sudo()
config_parameters.set_param("mail_relocation_models", "crm.lead,project.task,res.partner")
code = """
var delayed_button_click = function(delay, button){
setTimeout(function(){
if (button.length) {
return button.click();
}
return console.log('error', 'There is no element with the next selector: ' + button.selector);
}, delay);
};
var delay = 1000;
var message = $('.o_thread_message_core:contains("virginie")');
var relocate = message.find('.o_thread_icons .fa-exchange');
delayed_button_click(delay, relocate);
// form is opened
var create_partner_button = $('button[special="quick_create"]');
delayed_button_click(delay, create_partner_button);
// partner creation wizard is opened
var save_button = $('.modal-content .btn-primary:contains("Save")');
delayed_button_click(delay, save_button);
var move_button = $('.btn-sm.oe_highlight:contains("Move")');
delayed_button_click(delay, move_button);
console.log('ok')
"""
self.phantom_js('/web', code, login="admin", ready="$('.o_thread_icons').length")

62
mail_multi_website/README.rst

@ -0,0 +1,62 @@
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: https://www.gnu.org/licenses/lgpl
:alt: License: LGPL-3
===========================================
Email Addresses and Templates per Website
===========================================
Mail-related stuff for multi-website support
* Makes following field in ``res.users`` website-dependent:
* ``email``
* ``signature``
* Makes following fields in ``mail.template`` website-dependent:
* ``body_html``
* ``mail_server_id``
* ``report_template``
* Overrides ``mail.template``'s ``render_template`` method to add ``website``
variable. It may cause incompatibility with other modules that redefine that
method too.
Credits
=======
Contributors
------------
* `Ivan Yelizariev <https://it-projects.info/team/yelizariev>`__
Sponsors
--------
* `e-thos SSII <http://www.e-thos.fr/>`__
Maintainers
-----------
* `IT-Projects LLC <https://it-projects.info>`__
To get a guaranteed support
you are kindly requested to purchase the module
at `odoo apps store <https://apps.odoo.com/apps/modules/11.0/mail_multi_website/>`__.
Thank you for understanding!
`IT-Projects Team <https://www.it-projects.info/team>`__
Further information
===================
Demo: http://runbot.it-projects.info/demo/mail-addons/11.0
HTML Description: https://apps.odoo.com/apps/modules/11.0/mail_multi_website/
Usage instructions: `<doc/index.rst>`_
Changelog: `<doc/changelog.rst>`_
Notifications on updates: `via Atom <https://github.com/it-projects-llc/mail-addons/commits/11.0/mail_multi_website.atom>`_, `by Email <https://blogtrottr.com/?subscribe=https://github.com/it-projects-llc/mail-addons/commits/11.0/mail_multi_website.atom>`_
Tested on Odoo 11.0 4d0a1330e05bd688265bea14df4ad12838f9f2d7

40
mail_multi_website/__init__.py

@ -0,0 +1,40 @@
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from . import models
from . import wizard
from .tests import test_mail_model
def post_init_hook(cr, registry):
from odoo import api, SUPERUSER_ID
env = api.Environment(cr, SUPERUSER_ID, {})
env.cr.execute("ALTER TABLE res_users ADD COLUMN email_multi_website VARCHAR")
# fill new email column with values from partner
for user in env['res.users'].with_context(active_test=False).search([]):
email = user.partner_id.email
if email:
user._force_default('email_multi_website', email)
def uninstall_hook(cr, registry):
from odoo import api, SUPERUSER_ID
env = api.Environment(cr, SUPERUSER_ID, {})
# remove properties
field_ids = [
env.ref('base.field_res_users_email').id,
env.ref('base.field_res_users_signature').id,
env.ref('mail.field_mail_template_body_html').id,
env.ref('mail.field_mail_template_mail_server_id').id,
env.ref('mail.field_mail_template_report_template').id,
]
env['ir.property'].search([('fields_id', 'in', field_ids)]).unlink()
# copy emails from partner to user
cr.execute("SELECT partner_id,email_multi_website FROM res_users")
for partner_id, default_email in cr.fetchall():
env['res.partner'].browse(partner_id).email = default_email

51
mail_multi_website/__manifest__.py

@ -0,0 +1,51 @@
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
{
"name": """Email Addresses and Templates per Website""",
"summary": """Use single Backend to manage several Websites""",
"category": "Discuss",
# "live_test_url": "http://apps.it-projects.info/shop/product/website-multi-company?version=11.0",
"images": ["images/main.jpg"],
"version": "11.0.1.0.0",
"application": False,
"author": "IT-Projects LLC, Ivan Yelizariev",
"support": "apps@it-projects.info",
"website": "https://it-projects.info/team/yelizariev",
"license": "LGPL-3",
"price": 230.00,
"currency": "EUR",
"depends": [
"ir_config_parameter_multi_company",
"web_website",
"mail",
],
"external_dependencies": {"python": [], "bin": []},
"data": [
"views/website_views.xml",
],
"demo": [
],
"qweb": [
],
"post_load": None,
"pre_init_hook": None,
"post_init_hook": "post_init_hook",
"uninstall_hook": "uninstall_hook",
"auto_install": False,
"installable": True,
# "demo_title": "Email Addresses per Website",
# "demo_addons": [
# ],
# "demo_addons_hidden": [
# ],
# "demo_url": "DEMO-URL",
# "demo_summary": "Use single Backend to manage several Websites",
# "demo_images": [
# "images/MAIN_IMAGE",
# ]
}

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

Loading…
Cancel
Save