Vincent Hatakeyama
6 years ago
902 changed files with 19622 additions and 5445 deletions
-
1.travis.yml
-
17README.md
-
22base_search_mail_content/i18n/am.po
-
25base_search_mail_content/i18n/ar.po
-
52base_search_mail_content/i18n/base_search_mail_content.pot
-
22base_search_mail_content/i18n/bg.po
-
25base_search_mail_content/i18n/bs.po
-
22base_search_mail_content/i18n/ca.po
-
22base_search_mail_content/i18n/cs.po
-
22base_search_mail_content/i18n/da.po
-
22base_search_mail_content/i18n/de.po
-
25base_search_mail_content/i18n/el_GR.po
-
25base_search_mail_content/i18n/en_GB.po
-
2base_search_mail_content/i18n/es.po
-
25base_search_mail_content/i18n/es_CR.po
-
25base_search_mail_content/i18n/es_EC.po
-
25base_search_mail_content/i18n/es_MX.po
-
25base_search_mail_content/i18n/es_VE.po
-
22base_search_mail_content/i18n/et.po
-
22base_search_mail_content/i18n/eu.po
-
22base_search_mail_content/i18n/fi.po
-
22base_search_mail_content/i18n/fr.po
-
25base_search_mail_content/i18n/fr_CA.po
-
25base_search_mail_content/i18n/fr_CH.po
-
22base_search_mail_content/i18n/gl.po
-
25base_search_mail_content/i18n/hr.po
-
28base_search_mail_content/i18n/hr_HR.po
-
22base_search_mail_content/i18n/hu.po
-
22base_search_mail_content/i18n/it.po
-
22base_search_mail_content/i18n/ja.po
-
25base_search_mail_content/i18n/lt.po
-
25base_search_mail_content/i18n/lv.po
-
22base_search_mail_content/i18n/mk.po
-
22base_search_mail_content/i18n/mn.po
-
25base_search_mail_content/i18n/nb.po
-
25base_search_mail_content/i18n/nb_NO.po
-
22base_search_mail_content/i18n/nl.po
-
25base_search_mail_content/i18n/nl_BE.po
-
25base_search_mail_content/i18n/pl.po
-
22base_search_mail_content/i18n/pt.po
-
25base_search_mail_content/i18n/pt_BR.po
-
25base_search_mail_content/i18n/pt_PT.po
-
25base_search_mail_content/i18n/ro.po
-
26base_search_mail_content/i18n/ru.po
-
22base_search_mail_content/i18n/sk.po
-
25base_search_mail_content/i18n/sl.po
-
28base_search_mail_content/i18n/sr@latin.po
-
22base_search_mail_content/i18n/sv.po
-
22base_search_mail_content/i18n/th.po
-
22base_search_mail_content/i18n/tr.po
-
25base_search_mail_content/i18n/tr_TR.po
-
22base_search_mail_content/i18n/vi.po
-
25base_search_mail_content/i18n/zh_CN.po
-
25base_search_mail_content/i18n/zh_TW.po
-
52bus_presence_override/README.rst
-
6bus_presence_override/__init__.py
-
24bus_presence_override/__manifest__.py
-
5bus_presence_override/controllers/__init__.py
-
21bus_presence_override/controllers/main.py
-
77bus_presence_override/i18n/bus_presence_override.pot
-
7bus_presence_override/models/__init__.py
-
88bus_presence_override/models/bus_presence.py
-
21bus_presence_override/models/res_partner.py
-
21bus_presence_override/models/res_users.py
-
BINbus_presence_override/static/description/icon.png
-
106bus_presence_override/static/src/js/bus_presence_systray.js
-
21bus_presence_override/static/src/less/bus_presence_systray.less
-
38bus_presence_override/static/src/xml/bus_presence_systray.xml
-
7bus_presence_override/status_constants.py
-
7bus_presence_override/tests/__init__.py
-
28bus_presence_override/tests/bus_setup.py
-
120bus_presence_override/tests/test_bus_presence.py
-
27bus_presence_override/tests/test_res_partner.py
-
28bus_presence_override/tests/test_res_users.py
-
16bus_presence_override/views/assets.xml
-
2email_template_qweb/i18n/de.po
-
65email_template_qweb/i18n/email_template_qweb.pot
-
2email_template_qweb/i18n/es.po
-
10email_template_qweb/i18n/es_MX.po
-
2email_template_qweb/i18n/fr.po
-
5email_template_qweb/i18n/hr.po
-
2email_template_qweb/i18n/it.po
-
5email_template_qweb/i18n/nl_NL.po
-
5email_template_qweb/i18n/pt_BR.po
-
10email_template_qweb/i18n/zh_CN.po
-
2mail_as_letter/i18n/ca.po
-
2mail_as_letter/i18n/de.po
-
2mail_as_letter/i18n/es.po
-
5mail_as_letter/i18n/es_CO.po
-
2mail_as_letter/i18n/fr.po
-
5mail_as_letter/i18n/hr.po
-
2mail_as_letter/i18n/it.po
-
51mail_as_letter/i18n/mail_as_letter.pot
-
5mail_as_letter/i18n/nl_NL.po
-
5mail_as_letter/i18n/pt_BR.po
-
5mail_as_letter/i18n/sl.po
-
5mail_as_letter/i18n/zh_CN.po
-
5mail_attach_existing_attachment/i18n/ca.po
-
2mail_attach_existing_attachment/i18n/de.po
-
2mail_attach_existing_attachment/i18n/es.po
@ -0,0 +1,52 @@ |
|||||
|
# Translation of Odoo Server. |
||||
|
# This file contains the translation of the following modules: |
||||
|
# * base_search_mail_content |
||||
|
# |
||||
|
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: base_search_mail_content |
||||
|
#: model:ir.ui.view,arch_db:base_search_mail_content.trgm_index_view_form |
||||
|
#: model:ir.ui.view,arch_db:base_search_mail_content.trgm_index_view_tree |
||||
|
msgid "\"You can either select a field of type 'text', 'char' or 'html'.\"" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: base_search_mail_content |
||||
|
#: model:ir.model,name:base_search_mail_content.model_mail_thread |
||||
|
msgid "Email Thread" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: base_search_mail_content |
||||
|
#: model:ir.model.fields,field_description:base_search_mail_content.field_event_event_message_content |
||||
|
#: model:ir.model.fields,field_description:base_search_mail_content.field_event_registration_message_content |
||||
|
#: model:ir.model.fields,field_description:base_search_mail_content.field_mail_channel_message_content |
||||
|
#: model:ir.model.fields,field_description:base_search_mail_content.field_mail_mass_mailing_contact_message_content |
||||
|
#: model:ir.model.fields,field_description:base_search_mail_content.field_mail_test_message_content |
||||
|
#: model:ir.model.fields,field_description:base_search_mail_content.field_mail_thread_message_content |
||||
|
#: model:ir.model.fields,field_description:base_search_mail_content.field_mail_unsubscription_message_content |
||||
|
#: model:ir.model.fields,field_description:base_search_mail_content.field_res_partner_message_content |
||||
|
#: model:ir.model.fields,field_description:base_search_mail_content.field_res_users_message_content |
||||
|
msgid "Message Content" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: base_search_mail_content |
||||
|
#: model:ir.model.fields,help:base_search_mail_content.field_event_event_message_content |
||||
|
#: model:ir.model.fields,help:base_search_mail_content.field_event_registration_message_content |
||||
|
#: model:ir.model.fields,help:base_search_mail_content.field_mail_channel_message_content |
||||
|
#: model:ir.model.fields,help:base_search_mail_content.field_mail_mass_mailing_contact_message_content |
||||
|
#: model:ir.model.fields,help:base_search_mail_content.field_mail_test_message_content |
||||
|
#: model:ir.model.fields,help:base_search_mail_content.field_mail_thread_message_content |
||||
|
#: model:ir.model.fields,help:base_search_mail_content.field_mail_unsubscription_message_content |
||||
|
#: model:ir.model.fields,help:base_search_mail_content.field_res_partner_message_content |
||||
|
#: model:ir.model.fields,help:base_search_mail_content.field_res_users_message_content |
||||
|
msgid "Message content, to be used only in searches" |
||||
|
msgstr "" |
||||
|
|
@ -0,0 +1,52 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg |
||||
|
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
===================== |
||||
|
Bus Presence Override |
||||
|
===================== |
||||
|
|
||||
|
This module adds the ability for users to define their Online, Away, or Offline status |
||||
|
manually instead of the system calculating it. |
||||
|
|
||||
|
Away and disconnection timers are still in effect. |
||||
|
|
||||
|
Usage |
||||
|
===== |
||||
|
|
||||
|
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas |
||||
|
:alt: Try me on Runbot |
||||
|
:target: https://runbot.odoo-community.org/runbot/205/10.0 |
||||
|
|
||||
|
Known Issues / Roadmap |
||||
|
====================== |
||||
|
|
||||
|
Bug Tracker |
||||
|
=========== |
||||
|
|
||||
|
Bugs are tracked on `GitHub Issues |
||||
|
<https://github.com/OCA/social/issues>`_. In case of trouble, please |
||||
|
check there if your issue has already been reported. If you spotted it first, |
||||
|
help us smash it by providing detailed and welcomed feedback. |
||||
|
|
||||
|
Credits |
||||
|
======= |
||||
|
|
||||
|
Images |
||||
|
------ |
||||
|
|
||||
|
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. |
||||
|
|
||||
|
Contributors |
||||
|
------------ |
||||
|
|
||||
|
* Brett Wood <bwood@laslabs.com> |
||||
|
|
||||
|
Maintainer |
||||
|
---------- |
||||
|
|
||||
|
.. image:: https://odoo-community.org/logo.png |
||||
|
:alt: Odoo Community Association |
||||
|
:target: https://odoo-community.org |
||||
|
|
||||
|
This module is maintained by the OCA. |
@ -0,0 +1,6 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
from . import controllers |
||||
|
from . import models |
@ -0,0 +1,24 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
{ |
||||
|
"name": "Bus Presence Override", |
||||
|
"summary": "Adds user-defined im status (online, away, offline).", |
||||
|
"version": "10.0.1.0.0", |
||||
|
"category": "Social", |
||||
|
"website": "https://github.com/OCA/social", |
||||
|
"author": "LasLabs, Odoo Community Association (OCA)", |
||||
|
"license": "LGPL-3", |
||||
|
"application": False, |
||||
|
"installable": True, |
||||
|
"depends": [ |
||||
|
"mail", |
||||
|
], |
||||
|
"data": [ |
||||
|
"views/assets.xml", |
||||
|
], |
||||
|
"qweb": [ |
||||
|
"static/src/xml/bus_presence_systray.xml", |
||||
|
], |
||||
|
} |
@ -0,0 +1,5 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
from . import main |
@ -0,0 +1,21 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
from odoo.http import request |
||||
|
from odoo.addons.bus.controllers.main import BusController |
||||
|
|
||||
|
|
||||
|
class BusController(BusController): |
||||
|
|
||||
|
def _poll(self, dbname, channels, last, options): |
||||
|
if request.uid: |
||||
|
partner = request.env.user.partner_id |
||||
|
if 'bus_presence_partner_ids' in options: |
||||
|
options['bus_presence_partner_ids'].append(partner.id) |
||||
|
else: |
||||
|
options['bus_presence_partner_ids'] = [partner.id] |
||||
|
|
||||
|
return super(BusController, self)._poll( |
||||
|
dbname, channels, last, options, |
||||
|
) |
@ -0,0 +1,77 @@ |
|||||
|
# Translation of Odoo Server. |
||||
|
# This file contains the translation of the following modules: |
||||
|
# * bus_presence_override |
||||
|
# |
||||
|
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: bus_presence_override |
||||
|
#. openerp-web |
||||
|
#: code:addons/bus_presence_override/static/src/xml/bus_presence_systray.xml:24 |
||||
|
#: selection:bus.presence,status_realtime:0 |
||||
|
#, python-format |
||||
|
msgid "Away" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: bus_presence_override |
||||
|
#. openerp-web |
||||
|
#: code:addons/bus_presence_override/static/src/xml/bus_presence_systray.xml:30 |
||||
|
#: selection:bus.presence,status_realtime:0 |
||||
|
#, python-format |
||||
|
msgid "Offline" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: bus_presence_override |
||||
|
#. openerp-web |
||||
|
#: code:addons/bus_presence_override/static/src/xml/bus_presence_systray.xml:18 |
||||
|
#: selection:bus.presence,status_realtime:0 |
||||
|
#, python-format |
||||
|
msgid "Online" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: bus_presence_override |
||||
|
#: model:ir.model,name:bus_presence_override.model_res_partner |
||||
|
#: model:ir.model.fields,field_description:bus_presence_override.field_bus_presence_partner_id |
||||
|
msgid "Partner" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: bus_presence_override |
||||
|
#: model:ir.model.fields,help:bus_presence_override.field_bus_presence_partner_id |
||||
|
msgid "Partner-related data of the user" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: bus_presence_override |
||||
|
#: model:ir.model.fields,field_description:bus_presence_override.field_bus_presence_status_realtime |
||||
|
msgid "Realtime IM Status" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: bus_presence_override |
||||
|
#. openerp-web |
||||
|
#: code:addons/bus_presence_override/static/src/xml/bus_presence_systray.xml:14 |
||||
|
#, python-format |
||||
|
msgid "Status" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: bus_presence_override |
||||
|
#: model:ir.model.fields,help:bus_presence_override.field_bus_presence_status_realtime |
||||
|
msgid "Status that is affected by disconnection and away timers. Used to override the bus.presence status field in _get_partners_statuses or _get_users_statuses if the timers have been reached. If wanting to change the user status, write directly to the status field." |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: bus_presence_override |
||||
|
#: model:ir.model,name:bus_presence_override.model_bus_presence |
||||
|
msgid "User Presence" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: bus_presence_override |
||||
|
#: model:ir.model,name:bus_presence_override.model_res_users |
||||
|
msgid "Users" |
||||
|
msgstr "" |
||||
|
|
@ -0,0 +1,7 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
from . import bus_presence |
||||
|
from . import res_partner |
||||
|
from . import res_users |
@ -0,0 +1,88 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
from datetime import datetime |
||||
|
|
||||
|
from odoo import api, fields, models |
||||
|
from odoo.addons.bus.models.bus_presence import AWAY_TIMER, DISCONNECTION_TIMER |
||||
|
|
||||
|
from ..status_constants import ONLINE, AWAY, OFFLINE |
||||
|
|
||||
|
|
||||
|
class BusPresence(models.Model): |
||||
|
|
||||
|
_inherit = 'bus.presence' |
||||
|
|
||||
|
status_realtime = fields.Selection( |
||||
|
selection=[ |
||||
|
(ONLINE, 'Online'), |
||||
|
(AWAY, 'Away'), |
||||
|
(OFFLINE, 'Offline') |
||||
|
], |
||||
|
string='Realtime IM Status', |
||||
|
compute='_compute_status_realtime', |
||||
|
help='Status that is affected by disconnection ' |
||||
|
'and away timers. Used to override the bus.presence ' |
||||
|
'status field in _get_partners_statuses or ' |
||||
|
'_get_users_statuses if the timers have been reached. ' |
||||
|
'If wanting to change the user status, write ' |
||||
|
'directly to the status field.', |
||||
|
) |
||||
|
partner_id = fields.Many2one( |
||||
|
string='Partner', |
||||
|
related='user_id.partner_id', |
||||
|
comodel_name='res.partner', |
||||
|
) |
||||
|
|
||||
|
@api.multi |
||||
|
def _get_partners_statuses(self): |
||||
|
self._status_check_disconnection_and_away_timers() |
||||
|
return {rec.partner_id.id: rec.status for rec in self} |
||||
|
|
||||
|
@api.multi |
||||
|
def _get_users_statuses(self): |
||||
|
self._status_check_disconnection_and_away_timers() |
||||
|
return {rec.user_id.id: rec.status for rec in self} |
||||
|
|
||||
|
@api.multi |
||||
|
def _status_check_disconnection_and_away_timers(self): |
||||
|
""" Overrides user-defined status if timers reached """ |
||||
|
for record in self: |
||||
|
|
||||
|
status_realtime = record.status_realtime |
||||
|
status_stored = record.status |
||||
|
|
||||
|
conditions = ( |
||||
|
status_realtime == OFFLINE, |
||||
|
status_realtime == AWAY and status_stored == ONLINE, |
||||
|
) |
||||
|
|
||||
|
if any(conditions): |
||||
|
record.status = status_realtime |
||||
|
|
||||
|
@api.multi |
||||
|
def _compute_status_realtime(self): |
||||
|
|
||||
|
now_dt = datetime.now() |
||||
|
|
||||
|
for record in self: |
||||
|
|
||||
|
last_poll = fields.Datetime.from_string( |
||||
|
record.last_poll |
||||
|
) |
||||
|
last_presence = fields.Datetime.from_string( |
||||
|
record.last_presence |
||||
|
) |
||||
|
|
||||
|
last_poll_s = (now_dt - last_poll).total_seconds() |
||||
|
last_presence_s = (now_dt - last_presence).total_seconds() |
||||
|
|
||||
|
if last_poll_s > DISCONNECTION_TIMER: |
||||
|
record.status_realtime = OFFLINE |
||||
|
|
||||
|
elif last_presence_s > AWAY_TIMER: |
||||
|
record.status_realtime = AWAY |
||||
|
|
||||
|
else: |
||||
|
record.status_realtime = ONLINE |
@ -0,0 +1,21 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
from odoo import api, models |
||||
|
|
||||
|
from ..status_constants import OFFLINE |
||||
|
|
||||
|
|
||||
|
class ResPartner(models.Model): |
||||
|
|
||||
|
_inherit = 'res.partner' |
||||
|
|
||||
|
@api.multi |
||||
|
def _compute_im_status(self): |
||||
|
bus_recs = self.env['bus.presence'].search([ |
||||
|
('partner_id', 'in', self.ids), |
||||
|
]) |
||||
|
statuses = bus_recs._get_partners_statuses() |
||||
|
for record in self: |
||||
|
record.im_status = statuses.get(record.id, OFFLINE) |
@ -0,0 +1,21 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
from odoo import api, models |
||||
|
|
||||
|
from ..status_constants import OFFLINE |
||||
|
|
||||
|
|
||||
|
class ResUsers(models.Model): |
||||
|
|
||||
|
_inherit = 'res.users' |
||||
|
|
||||
|
@api.multi |
||||
|
def _compute_im_status(self): |
||||
|
bus_recs = self.env['bus.presence'].search([ |
||||
|
('user_id', 'in', self.ids), |
||||
|
]) |
||||
|
statuses = bus_recs._get_users_statuses() |
||||
|
for record in self: |
||||
|
record.im_status = statuses.get(record.id, OFFLINE) |
After Width: 128 | Height: 128 | Size: 9.2 KiB |
@ -0,0 +1,106 @@ |
|||||
|
/* Copyright 2017 LasLabs Inc. |
||||
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
|
||||
|
|
||||
|
odoo.define('bus_presence_systray', function (require) { |
||||
|
"use strict"; |
||||
|
|
||||
|
var Bus = require('bus.bus').bus; |
||||
|
var DataModel = require('web.DataModel'); |
||||
|
var Session = require('web.session'); |
||||
|
var SystrayMenu = require('web.SystrayMenu'); |
||||
|
var Widget = require('web.Widget'); |
||||
|
var Qweb = require('web.core').qweb; |
||||
|
var LocalStorage = require('web.local_storage'); |
||||
|
|
||||
|
function on(type, listener) { |
||||
|
if (window.addEventListener) { |
||||
|
window.addEventListener(type, listener); |
||||
|
} else { |
||||
|
// IE8
|
||||
|
window.attachEvent('on' + type, listener); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
var BusPresenceSystray = Widget.extend({ |
||||
|
template: 'bus_presence_systray', |
||||
|
events: { |
||||
|
'click .o-user-status-select': 'onClickUserStatusSelect', |
||||
|
}, |
||||
|
init: function() { |
||||
|
this._super.apply(this, arguments); |
||||
|
this.resPartnerMod = new DataModel('res.partner'); |
||||
|
this.busPresenceMod = new DataModel('bus.presence'); |
||||
|
Bus.on('notification', this, _.throttle(this.notificationsUpdateCurrentUserStatus.bind(this), 100, {leading: false})); |
||||
|
on('storage', this.onStorage.bind(this)); |
||||
|
}, |
||||
|
start: function () { |
||||
|
this.startDetermineUserStatus(); |
||||
|
Bus.start_polling(); |
||||
|
return this._super(); |
||||
|
}, |
||||
|
startDetermineUserStatus: function () { |
||||
|
if (Bus.is_master === true) { |
||||
|
this.writeBusPresenceStatus('online'); |
||||
|
this.updateUserStatusIcon('online'); |
||||
|
LocalStorage.setItem('user.partner_im_status', 'online'); |
||||
|
} else { |
||||
|
var statusVal = LocalStorage.getItem('user.partner_im_status'); |
||||
|
this.updateUserStatusIcon(statusVal); |
||||
|
} |
||||
|
}, |
||||
|
onStorage: function (event) { |
||||
|
if (event.key === 'user.partner_im_status') { |
||||
|
this.updateUserStatusIcon(event.newValue); |
||||
|
} |
||||
|
}, |
||||
|
notificationsUpdateCurrentUserStatus: function (notifications) { |
||||
|
_.each(notifications, $.proxy( |
||||
|
function (notification) { |
||||
|
var model = notification[0][1]; |
||||
|
var partnerId = notification[1].id; |
||||
|
if (model === 'bus.presence' && partnerId === Session.partner_id) { |
||||
|
var status = notification[1].im_status; |
||||
|
this.updateUserStatusIcon(status); |
||||
|
LocalStorage.setItem('user.partner_im_status', status); |
||||
|
} |
||||
|
}, this) |
||||
|
); |
||||
|
}, |
||||
|
queryUpdateCurrentUserStatus: function () { |
||||
|
this.resPartnerMod.query(['im_status']) |
||||
|
.filter([['id', '=', Session.partner_id]]) |
||||
|
.first() |
||||
|
.then($.proxy( |
||||
|
function (result) { |
||||
|
this.updateUserStatusIcon(result.im_status); |
||||
|
LocalStorage.setItem('user.partner_im_status', status); |
||||
|
}, this) |
||||
|
); |
||||
|
}, |
||||
|
updateUserStatusIcon: function (status) { |
||||
|
var options = {'status': status}; |
||||
|
var $icon = this.$('.o-user-systray-status'); |
||||
|
$icon.empty().append($(Qweb.render('mail.chat.UserStatus', options))); |
||||
|
}, |
||||
|
onClickUserStatusSelect: function (event) { |
||||
|
var status = $(event.currentTarget).attr('name'); |
||||
|
this.updateUserStatusIcon(status); |
||||
|
this.writeBusPresenceStatus(status); |
||||
|
LocalStorage.setItem('user.partner_im_status', status); |
||||
|
}, |
||||
|
writeBusPresenceStatus: function (status) { |
||||
|
this.busPresenceMod.query(['id']) |
||||
|
.filter([['partner_id', '=', Session.partner_id]]) |
||||
|
.first() |
||||
|
.then($.proxy( |
||||
|
function (result) { |
||||
|
this.busPresenceMod.call('write', [[result.id], {'status': status}]); |
||||
|
}, this) |
||||
|
); |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
|
SystrayMenu.Items.push(BusPresenceSystray); |
||||
|
|
||||
|
}); |
||||
|
|
@ -0,0 +1,21 @@ |
|||||
|
/* Copyright 2017 LasLabs Inc. |
||||
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */ |
||||
|
|
||||
|
.o-user-systray-status { |
||||
|
i { |
||||
|
margin-top: 2px; |
||||
|
&:hover { |
||||
|
color: @gray-lighter; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
.o-user-presence-dropdown { |
||||
|
min-width: 85px; |
||||
|
.o-user-status-select { |
||||
|
margin-top: 2px; |
||||
|
padding: 4px 8px; |
||||
|
width: 100%; |
||||
|
display: block; |
||||
|
font-size: 13px; |
||||
|
} |
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<!-- Copyright 2017 LasLabs Inc. |
||||
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). --> |
||||
|
|
||||
|
<templates> |
||||
|
|
||||
|
<t t-name="bus_presence_systray"> |
||||
|
<li class="o_mail_navbar_item"> |
||||
|
<a title="Status" |
||||
|
class="dropdown-toggle o-user-systray-status" |
||||
|
data-toggle="dropdown" |
||||
|
aria-expanded="false" |
||||
|
href="#" |
||||
|
/> |
||||
|
<ul class="dropdown-menu o-user-presence-dropdown" role="menu"> |
||||
|
<li> |
||||
|
<a name="online" class="o-user-status-select" href="#"> |
||||
|
<i t-attf-class="o_mail_user_status o_user_online fa fa-circle" /> |
||||
|
Online |
||||
|
</a> |
||||
|
</li> |
||||
|
<li> |
||||
|
<a name="away" class="o-user-status-select" href="#"> |
||||
|
<i class="o_mail_user_status o_user_idle fa fa-circle" /> |
||||
|
Away |
||||
|
</a> |
||||
|
</li> |
||||
|
<li> |
||||
|
<a name="offline" class="o-user-status-select" href="#"> |
||||
|
<i class="o_mail_user_status fa fa-circle-o" /> |
||||
|
Offline |
||||
|
</a> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</li> |
||||
|
</t> |
||||
|
|
||||
|
</templates> |
@ -0,0 +1,7 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
ONLINE = 'online' |
||||
|
AWAY = 'away' |
||||
|
OFFLINE = 'offline' |
@ -0,0 +1,7 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
from . import test_bus_presence |
||||
|
from . import test_res_partner |
||||
|
from . import test_res_users |
@ -0,0 +1,28 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
from odoo.tests.common import TransactionCase |
||||
|
|
||||
|
|
||||
|
class BusSetup(TransactionCase): |
||||
|
|
||||
|
def setUp(self): |
||||
|
super(BusSetup, self).setUp() |
||||
|
self.u_admin = self.env.ref('base.user_root') |
||||
|
self.p_admin = self.u_admin.partner_id |
||||
|
|
||||
|
self.u_demo = self.env.ref('base.user_demo') |
||||
|
self.p_demo = self.u_demo.partner_id |
||||
|
|
||||
|
self.pres_admin = self._get_bus_presence(self.u_admin) |
||||
|
self.pres_demo = self._get_bus_presence(self.u_demo) |
||||
|
|
||||
|
# AWAY_TIMER = 55 seconds |
||||
|
# DISCONNECTION_TIMER = 1800 seconds (30 minutes) |
||||
|
|
||||
|
def _get_bus_presence(self, user): |
||||
|
pres = self.env['bus.presence'].search([('user_id', '=', user.id)]) |
||||
|
if not pres: |
||||
|
pres = self.env['bus.presence'].create({'user_id': user.id}) |
||||
|
return pres |
@ -0,0 +1,120 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
from mock import patch |
||||
|
|
||||
|
from .bus_setup import BusSetup |
||||
|
from ..status_constants import ONLINE, AWAY, OFFLINE |
||||
|
|
||||
|
AWAY_TIMER = 'odoo.addons.bus_presence_override.models.' \ |
||||
|
'bus_presence.AWAY_TIMER' |
||||
|
|
||||
|
DISCONNECTION_TIMER = 'odoo.addons.bus_presence_override.models.' \ |
||||
|
'bus_presence.DISCONNECTION_TIMER' |
||||
|
|
||||
|
|
||||
|
class TestBusPresence(BusSetup): |
||||
|
|
||||
|
@patch(AWAY_TIMER, 10000000) |
||||
|
@patch(DISCONNECTION_TIMER, 10000000) |
||||
|
def test_compute_status_realtime_online(self): |
||||
|
""" It should be computed to online """ |
||||
|
self.assertEquals( |
||||
|
self.pres_admin.status_realtime, |
||||
|
ONLINE, |
||||
|
) |
||||
|
|
||||
|
@patch(AWAY_TIMER, 10000000) |
||||
|
@patch(DISCONNECTION_TIMER, 0) |
||||
|
def test_compute_status_realtime_offline(self): |
||||
|
""" It should be computed to offline """ |
||||
|
self.assertEquals( |
||||
|
self.pres_admin.status_realtime, |
||||
|
OFFLINE, |
||||
|
) |
||||
|
|
||||
|
@patch(AWAY_TIMER, 0) |
||||
|
@patch(DISCONNECTION_TIMER, 10000000) |
||||
|
def test_compute_status_realtime_away(self): |
||||
|
""" It should be computed to away """ |
||||
|
self.assertEquals( |
||||
|
self.pres_admin.status_realtime, |
||||
|
AWAY, |
||||
|
) |
||||
|
|
||||
|
@patch(AWAY_TIMER, 0) |
||||
|
@patch(DISCONNECTION_TIMER, 0) |
||||
|
def test_compute_status_realtime_both(self): |
||||
|
""" It should be computed to offline even though away as well """ |
||||
|
self.assertEquals( |
||||
|
self.pres_admin.status_realtime, |
||||
|
OFFLINE, |
||||
|
) |
||||
|
|
||||
|
@patch(AWAY_TIMER, 0) |
||||
|
@patch(DISCONNECTION_TIMER, 0) |
||||
|
def test_status_check_timers_offline(self): |
||||
|
""" It should be changed to offline from online """ |
||||
|
self.pres_admin.status = ONLINE |
||||
|
self.assertEquals( |
||||
|
self.pres_admin.status, |
||||
|
ONLINE, |
||||
|
) |
||||
|
self.pres_admin._status_check_disconnection_and_away_timers() |
||||
|
self.assertEquals( |
||||
|
self.pres_admin.status, |
||||
|
OFFLINE, |
||||
|
) |
||||
|
|
||||
|
@patch(AWAY_TIMER, 0) |
||||
|
@patch(DISCONNECTION_TIMER, 10000000) |
||||
|
def test_status_check_timers_away(self): |
||||
|
""" It should be changed to away from online """ |
||||
|
self.pres_admin.status = ONLINE |
||||
|
self.assertEquals( |
||||
|
self.pres_admin.status, |
||||
|
ONLINE, |
||||
|
) |
||||
|
self.pres_admin._status_check_disconnection_and_away_timers() |
||||
|
self.assertEquals( |
||||
|
self.pres_admin.status, |
||||
|
AWAY, |
||||
|
) |
||||
|
|
||||
|
@patch(AWAY_TIMER, 0) |
||||
|
@patch(DISCONNECTION_TIMER, 10000000) |
||||
|
def test_status_check_timers_unchanged(self): |
||||
|
""" It should remain at offline even if status_realtime away """ |
||||
|
self.pres_admin.status = OFFLINE |
||||
|
self.assertEquals( |
||||
|
self.pres_admin.status, |
||||
|
OFFLINE, |
||||
|
) |
||||
|
self.pres_admin._status_check_disconnection_and_away_timers() |
||||
|
self.assertEquals( |
||||
|
self.pres_admin.status, |
||||
|
OFFLINE, |
||||
|
) |
||||
|
|
||||
|
def test_get_partners_im_statuses(self): |
||||
|
""" It should include demo and admin partner statuses """ |
||||
|
recs = self.env['bus.presence'].search([( |
||||
|
'partner_id', 'in', [self.p_admin.id, self.p_demo.id])] |
||||
|
) |
||||
|
statuses = recs._get_partners_statuses() |
||||
|
self.assertIn( |
||||
|
self.p_admin.id, |
||||
|
statuses, |
||||
|
) |
||||
|
|
||||
|
def test_get_users_im_statuses(self): |
||||
|
""" It should include demo and admin user statuses """ |
||||
|
recs = self.env['bus.presence'].search([( |
||||
|
'user_id', 'in', [self.u_admin.id, self.u_demo.id])] |
||||
|
) |
||||
|
statuses = recs._get_users_statuses() |
||||
|
self.assertIn( |
||||
|
self.u_admin.id, |
||||
|
statuses, |
||||
|
) |
@ -0,0 +1,27 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
from mock import patch |
||||
|
|
||||
|
from .bus_setup import BusSetup |
||||
|
from ..status_constants import ONLINE |
||||
|
|
||||
|
AWAY_TIMER = 'odoo.addons.bus_presence_override.models.' \ |
||||
|
'bus_presence.AWAY_TIMER' |
||||
|
|
||||
|
DISCONNECTION_TIMER = 'odoo.addons.bus_presence_override.models.' \ |
||||
|
'bus_presence.DISCONNECTION_TIMER' |
||||
|
|
||||
|
|
||||
|
class TestResPartner(BusSetup): |
||||
|
|
||||
|
@patch(AWAY_TIMER, 10000000) |
||||
|
@patch(DISCONNECTION_TIMER, 10000000) |
||||
|
def test_compute_im_status_online(self): |
||||
|
""" It should be computed to online """ |
||||
|
self.pres_admin.status = ONLINE |
||||
|
self.assertEquals( |
||||
|
self.p_admin.im_status, |
||||
|
ONLINE, |
||||
|
) |
@ -0,0 +1,28 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Copyright 2017 LasLabs Inc. |
||||
|
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
||||
|
|
||||
|
from mock import patch |
||||
|
|
||||
|
from .bus_setup import BusSetup |
||||
|
from ..status_constants import ONLINE |
||||
|
|
||||
|
|
||||
|
AWAY_TIMER = 'odoo.addons.bus_presence_override.models.' \ |
||||
|
'bus_presence.AWAY_TIMER' |
||||
|
|
||||
|
DISCONNECTION_TIMER = 'odoo.addons.bus_presence_override.models.' \ |
||||
|
'bus_presence.DISCONNECTION_TIMER' |
||||
|
|
||||
|
|
||||
|
class TestResUsers(BusSetup): |
||||
|
|
||||
|
@patch(AWAY_TIMER, 10000000) |
||||
|
@patch(DISCONNECTION_TIMER, 10000000) |
||||
|
def test_compute_im_status_online(self): |
||||
|
""" It should be computed to online """ |
||||
|
self.pres_admin.status = ONLINE |
||||
|
self.assertEquals( |
||||
|
self.u_admin.im_status, |
||||
|
ONLINE, |
||||
|
) |
@ -0,0 +1,16 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<!-- Copyright 2017 LasLabs Inc. |
||||
|
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). --> |
||||
|
|
||||
|
<odoo> |
||||
|
|
||||
|
<template id="assets_backend" name="Bus Presence Override Assets" inherit_id="web.assets_backend"> |
||||
|
<xpath expr="." position="inside"> |
||||
|
<link rel="stylesheet" href="/bus_presence_override/static/src/less/bus_presence_systray.less"/> |
||||
|
<script type="text/javascript" |
||||
|
src="/bus_presence_override/static/src/js/bus_presence_systray.js" |
||||
|
/> |
||||
|
</xpath> |
||||
|
</template> |
||||
|
|
||||
|
</odoo> |
@ -0,0 +1,65 @@ |
|||||
|
# Translation of Odoo Server. |
||||
|
# This file contains the translation of the following modules: |
||||
|
# * email_template_qweb |
||||
|
# |
||||
|
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: email_template_qweb |
||||
|
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview_body_type |
||||
|
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template_body_type |
||||
|
msgid "Body templating engine" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: email_template_qweb |
||||
|
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview_body_view_id |
||||
|
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template_body_view_id |
||||
|
msgid "Body view" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: email_template_qweb |
||||
|
#: model:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1 |
||||
|
msgid "Dear" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: email_template_qweb |
||||
|
#: model:ir.model,name:email_template_qweb.model_mail_template |
||||
|
msgid "Email Templates" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: email_template_qweb |
||||
|
#: selection:email_template.preview,body_type:0 |
||||
|
#: selection:mail.template,body_type:0 |
||||
|
msgid "Jinja2" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: email_template_qweb |
||||
|
#: selection:email_template.preview,body_type:0 |
||||
|
#: selection:mail.template,body_type:0 |
||||
|
msgid "QWeb" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: email_template_qweb |
||||
|
#: model:mail.template,subject:email_template_qweb.email_template_demo1 |
||||
|
msgid "QWeb demo email" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: email_template_qweb |
||||
|
#: model:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1 |
||||
|
msgid "This is an email template using qweb." |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: email_template_qweb |
||||
|
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview_body_view_arch |
||||
|
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template_body_view_arch |
||||
|
msgid "View Architecture" |
||||
|
msgstr "" |
||||
|
|
@ -0,0 +1,51 @@ |
|||||
|
# Translation of Odoo Server. |
||||
|
# This file contains the translation of the following modules: |
||||
|
# * mail_as_letter |
||||
|
# |
||||
|
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_as_letter |
||||
|
#: model:ir.ui.view,arch_db:mail_as_letter.mail_compose_message_form_view |
||||
|
msgid "Download Letter" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: mail_as_letter |
||||
|
#: model:ir.model,name:mail_as_letter.model_mail_compose_message |
||||
|
msgid "Email composition wizard" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: mail_as_letter |
||||
|
#: model:ir.model.fields,field_description:mail_as_letter.field_mail_compose_message_partner_count |
||||
|
msgid "Number of partners" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: mail_as_letter |
||||
|
#: model:ir.ui.view,arch_db:mail_as_letter.mail_compose_message_form_view |
||||
|
msgid "Save as a PDF file" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: mail_as_letter |
||||
|
#: model:ir.ui.view,arch_db:mail_as_letter.mail_print |
||||
|
msgid "Subject :" |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: mail_as_letter |
||||
|
#: code:addons/mail_as_letter/wizards/mail_compose_message.py:31 |
||||
|
#, python-format |
||||
|
msgid "There must be only one recipient." |
||||
|
msgstr "" |
||||
|
|
||||
|
#. module: mail_as_letter |
||||
|
#: model:ir.actions.report.xml,name:mail_as_letter.qweb_mail_pdf_export |
||||
|
msgid "mail_as_letter" |
||||
|
msgstr "" |
||||
|
|
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue