Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

9.0 ah project #736

Open
wants to merge 64 commits into
base: 9.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
edcb4ac
Initial commit for Project migration
Aug 17, 2016
9a09ed0
[MIG] Changed and updated structure for v9 compatibility
Aug 17, 2016
728543b
Done state history, started task sequence
Aug 22, 2016
802b987
Migrated project_issue_contact and project_issue_day_count
Aug 24, 2016
5cb5954
Migrated project_task_state
Aug 25, 2016
ab2941a
Migrated project_issue_multi_task
Aug 25, 2016
f20e6ba
Migrated project_issue_priority and project_issue_stage
Aug 25, 2016
07560b2
Migrated project_issue_stage_history project_issue_type - the latter …
Aug 26, 2016
8364c92
Changed project_issue_type view menu
Aug 26, 2016
fcbf8f7
Major changes in project_task_color, added icons in other project mod…
Aug 30, 2016
9f2f679
The action on project_deadline_color works, the filter is not working…
Sep 2, 2016
3aa304e
Added comments to time reassignment
Sep 5, 2016
27df72e
Changes to project_scrum_method
Sep 12, 2016
f1789c9
Updates to project_scrum_method and project_scrum_work_type
Sep 14, 2016
e3def31
_columns to _fields api migration
Sep 14, 2016
62ca4a9
Task migration
Sep 16, 2016
c506b3b
Changes to scrum_work_type
Sep 16, 2016
cf7e942
Eliminated _fields because of view incompatibility
Sep 16, 2016
623260c
Scrum method & work type update
Sep 19, 2016
dc9510c
Scrum changes
luahir Sep 20, 2016
f8d8b37
Fixed 'related=' fields project_scrum_method
Sep 21, 2016
41fa6d7
type_id modification in Task
Sep 21, 2016
2ea42cc
Added project_timesheet dependency to project_scrum_method. Edited p_…
Sep 22, 2016
633a727
Minor tests to one2many relationships
Sep 26, 2016
5dcc869
Changed kanban views and scrum_method, work_type, state_history, task…
Sep 26, 2016
5d9f0d5
Changes to views and project_scrum_work_type dependencies
Sep 26, 2016
9d90edc
Changed project_scrum_work_type name to project_scrum_feature_work_es…
luahir Sep 27, 2016
cf53d71
Added p_i_approved and p_i_approval_invoice to start migration
luahir Sep 27, 2016
3a8abad
Changes to issue_approv* and prepaid_hours structures
luahir Sep 28, 2016
6f56167
Added dependency to project_deadline_color and fixed typos on mail_pr…
Sep 30, 2016
67e1670
Minor changes in project_issue_type - Many2one rel points nowhere
Sep 30, 2016
6be6e45
Finalized relationships between issue_type and subscription as well a…
Oct 3, 2016
b0d48dd
Changes to issue and work types, subscription dependencies and update…
Oct 3, 2016
b27dfc6
Minor changes to subscription_*
Oct 5, 2016
b6cad5e
Added comments to subscription classes, changed several classes
Oct 6, 2016
98afeaa
Added issue dependence
Oct 7, 2016
b4a2943
Minor changes due to design choices
Oct 10, 2016
4a704e9
Added invoice_currency to approval_invoice and started implementation…
Oct 19, 2016
cb052ef
Added description to approval
Oct 19, 2016
6106de3
Started primary functions in approval
Oct 20, 2016
af5512c
Modified subscription approval and create_proposed_hour_values
Oct 21, 2016
cdf5224
Changes to issue approval methods, invoice_type and feature
Oct 24, 2016
977680c
Finished methods in issue_approval, changed issue_type class
Oct 25, 2016
d60eaa2
New table format file for dynamic view. More work on issue approval m…
Oct 27, 2016
0a665ff
Corrected views
Oct 27, 2016
1b722c3
Changes to issue approval and prepaid_hours views
Oct 28, 2016
7e541cb
Changes to views and dependency
Oct 31, 2016
d0d19cc
More changes in issue_approval and issue views
Oct 31, 2016
21f4be9
issue_type feature_work_est prepaid_hours view changes
Nov 1, 2016
b693021
Changes in views, fixed write method in feature_work_est
Nov 2, 2016
9ff870e
Changes in view tags, added readme files
Nov 3, 2016
d7b89bf
Updated issue_type state_history approval and prepaid hours views
Nov 4, 2016
bdd8e8b
Changed issue_views, added prepaid_hours views
luahir Nov 7, 2016
6793d7f
Changes in issue views and method changes to use buttons
Nov 7, 2016
aedc423
Button and method modifications
Nov 8, 2016
f4840c5
[FIX] feature method and added TODO to approval view
luahir Nov 9, 2016
4bae0c5
Added proposal button
Nov 9, 2016
44782ba
Removed comment from approval
luahir Nov 10, 2016
fbd78d7
[FIX] methods that calculate proposal
Nov 10, 2016
93b778b
[FIX] Method name
Nov 10, 2016
8fe1f0b
Unique constraint on approved_lines
luahir Nov 11, 2016
3c05170
Fixed approval and values calculation
Nov 11, 2016
ca82bbd
Fixed PEP violations
Nov 11, 2016
e71d0d5
[MGR] - subscription_issue_approval_invoice partial migration
luahir Nov 16, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions mail_private_message/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

====================
Mail Private Message
====================

Features

* Private messages visible to employees only.
* Disable notifications to followers.

Credits
=======

Contributors
------------

* Glen Sojo <[email protected]>
* Lesmed Gutiérrez <[email protected]>
* Antonio Hidalgo <[email protected]>


Maintainer
----------

.. image:: https://avatars0.githubusercontent.com/u/7594691?v=3&s=200
:alt: ClearCorp
:target: http://clearcorp.cr

This module is maintained by ClearCorp.
6 changes: 6 additions & 0 deletions mail_private_message/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 ClearCorp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import models
import wizard
24 changes: 24 additions & 0 deletions mail_private_message/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# © 2016 ClearCorp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
'name': 'Mail Private Message',
'version': '9.0.1.0',
'category': 'Mail',
'sequence': 10,
'summary': """Private messages and notifications""",
'author': 'ClearCorp',
'website': 'http://clearcorp.cr',
'installable': True,
'auto_install': False,
'application': False,
'license': 'AGPL-3',
'depends': ['mail', 'base'],
'data': [
'views/assets_backend.xml',
'wizard/mail_compose_view.xml',
'security/mail_private_message_security.xml',
],
'qweb': ['static/src/xml/mail.xml'],
}
48 changes: 48 additions & 0 deletions mail_private_message/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_private_message
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-02-18 15:51+0000\n"
"PO-Revision-Date: 2016-02-18 15:51+0000\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_private_message
#: field:mail.compose.message,privacity:0
#: field:mail.message,privacity:0
msgid "Privacity"
msgstr "Privacidad"

#. module: mail_private_message
#: selection:mail.compose.message,privacity:0
#: selection:mail.message,privacity:0
msgid "Private"
msgstr "Privado"

#. module: mail_private_message
#: selection:mail.compose.message,privacity:0
#: selection:mail.message,privacity:0
msgid "Public"
msgstr "Público"

#. module: mail_private_message
#. openerp-web
#: code:addons/mail_private_message/static/src/xml/mail.xml:15
#, python-format
msgid "Send"
msgstr "Enviar"

#. module: mail_private_message
#. openerp-web
#: code:addons/mail_private_message/static/src/xml/mail.xml:9
#, python-format
msgid "Send as private"
msgstr "Enviar como privado"
48 changes: 48 additions & 0 deletions mail_private_message/i18n/mail_private_message.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mail_private_message
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-02-18 15:51+0000\n"
"PO-Revision-Date: 2016-02-18 15:51+0000\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_private_message
#: field:mail.compose.message,privacity:0
#: field:mail.message,privacity:0
msgid "Privacity"
msgstr ""

#. module: mail_private_message
#: selection:mail.compose.message,privacity:0
#: selection:mail.message,privacity:0
msgid "Private"
msgstr ""

#. module: mail_private_message
#: selection:mail.compose.message,privacity:0
#: selection:mail.message,privacity:0
msgid "Public"
msgstr ""

#. module: mail_private_message
#. openerp-web
#: code:addons/mail_private_message/static/src/xml/mail.xml:15
#, python-format
msgid "Send"
msgstr ""

#. module: mail_private_message
#. openerp-web
#: code:addons/mail_private_message/static/src/xml/mail.xml:9
#, python-format
msgid "Send as private"
msgstr ""
6 changes: 6 additions & 0 deletions mail_private_message/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 ClearCorp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import notification
import message
90 changes: 90 additions & 0 deletions mail_private_message/models/message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# -*- coding: utf-8 -*-
# © 2016 ClearCorp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, fields, api


class MailMessage(models.Model):

_inherit = 'mail.message'

privacy = fields.Selection(
[('private', 'Private'), ('public', 'Public')],
'Privacy', default='public')

@api.model
def _notify(self, newid, force_send=False, user_signature=True):

message = self.sudo().browse(newid)

if message.privacy != 'private':
return super(MailMessage, self)._notify(
newid, force_send=force_send, user_signature=user_signature)

notification_obj = self.env['mail.notification']
partner_obj = self.env['res.partner']
user_obj = self.pool.get('res.users')
partners_to_notify = set([])

# all followers of the mail.message document have to be added
# as partners and notified if a subtype is defined
# (otherwise: log message)
if message.subtype_id and message.model and message.res_id:
fol_obj = self.env['mail.followers']
# browse as SUPERUSER because rules could
# restrict the search results
fol_ids = fol_obj.sudo().search([
('res_model', '=', message.model),
('res_id', '=', message.res_id)])
partners_to_notify |= set(
fo.partner_id.id for fo in fol_ids
if message.subtype_id.id in [st.id for st in fo.subtype_ids]
)

# remove current user from notified partners, unless the message
# is written on her own wall
if message.subtype_id and message.author_id and \
message.model == 'res.partner' and \
message.res_id == message.author_id.id:
partners_to_notify |= message.author_id.id
elif message.author_id:
partners_to_notify -= message.author_id.id

# all partner_ids of mail.message have to be notified
# regardless of the above (even the author if explicitly added!)
if message.partner_ids:
partners_to_notify |= set([p.id for p in message.partner_ids])

clean_partners = []
# clean partners to notify only internal users
for partner in partner_obj.browse(list(partners_to_notify)):
for user in partner.user_ids:
if user_obj.has_group(self._cr, user.id, 'base.group_user'):
clean_partners.append(partner.id)

# notify
notification_obj._notify(
newid, partners_to_notify=clean_partners,
force_send=force_send, user_signature=user_signature
)
message.refresh()

# An error appears when a user receives a notification without
# notifying the parent message -> add a read notification for
# the parent
if message.parent_id:
# all notified_partner_ids of the mail.message have
# to be notified of the parented messages
partners_to_parent_notify = set(
message.notified_partner_ids).difference(
message.parent_id.notified_partner_ids)
for partner in partners_to_parent_notify:
for user in partner.user_ids:
if user.has_group('base.group_user'):
notification_obj.create({
'message_id': message.parent_id.id,
'partner_id': partner.id,
'is_read': True,
})
return True
36 changes: 36 additions & 0 deletions mail_private_message/models/notification.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -*- coding: utf-8 -*-
# © 2016 ClearCorp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, api


class Notification(models.Model):
# The mail.notification class was eliminated in v9. The candidates for this
# functionality are found in res_partner, mail_channel and mail_message.
# Run new message functions to find out what is used.
_inherit = 'mail.notification'

@api.model
def _notify(self, message_id, partners_to_notify=None,
force_send=False, user_signature=True):
if 'notify' in self.env.context and not self.env.context['notify']:
partner_obj = self.env['res.partner']
message = self.env['mail.message'].browse(message_id)
partners_to_notify = self.env.context.get('partners_to_notify', [])
if message.privacy == 'private':
user_obj = self.pool.get('res.users')
clean_partners = []
# clean partners to notify only internal users
for partner in partner_obj.browse(partners_to_notify):
for user in partner.user_ids:
if user_obj.has_group(
self._cr, user.id, 'base.group_user'):
clean_partners.append(partner.id)
partners_to_notify = clean_partners
else:
partners_to_notify = self.env.context.get('partners_to_notify',
partners_to_notify)
return super(Notification, self)._notify(
message_id, partners_to_notify=partners_to_notify,
force_send=force_send, user_signature=user_signature)
11 changes: 11 additions & 0 deletions mail_private_message/security/mail_private_message_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="rule_portal_public_msg" model="ir.rule">
<field name="name">Portal Public Messages</field>
<field name="model_id" ref="model_mail_message"/>
<field name="domain_force">[('privacy', '=', 'public')]</field>
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
</record>
</data>
</openerp>
Binary file added mail_private_message/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions mail_private_message/static/src/js/mail.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
openerp.mail_private_message = function(session) {

session.mail.ThreadComposeMessage.include({
bind_events: function () {
var self = this;
this.$('.oe_post_private').on('click', self.on_message_post_private);
this._super();
},

on_message_post_private: function (event) {
var self = this;
if (self.flag_post) {
return;
}
if (this.do_check_attachment_upload() && (this.attachment_ids.length || this.$('textarea').val().match(/\S+/))) {
self.flag_post = true;
if (this.is_log) {
this.do_send_message_post([], this.is_log);
}
else {
this.check_recipient_partners().done(function (partner_ids) {
self.do_send_message_post_private(partner_ids, self.is_log);
});
}
}
},

do_send_message_post_private: function (partner_ids, log) {
var self = this;
var values = {
'body': this.$('textarea').val(),
'subject': false,
'parent_id': this.context.default_parent_id,
'attachment_ids': _.map(this.attachment_ids, function (file) {return file.id;}),
'partner_ids': partner_ids,
'context': _.extend(this.parent_thread.context, {
'mail_post_autofollow': true,
'mail_post_autofollow_partner_ids': partner_ids,
}),
'type': 'comment',
'content_subtype': 'plaintext',
'privacy': 'private',
};
if (log) {
values['subtype'] = false;
}
else {
values['subtype'] = 'mail.mt_comment';
}
this.parent_thread.ds_thread._model.call('message_post', [this.context.default_res_id], values).done(function (message_id) {
var thread = self.parent_thread;
var root = thread == self.options.root_thread;
if (self.options.display_indented_thread < self.thread_level && thread.parent_message) {
var thread = thread.parent_message.parent_thread;
}
// create object and attach to the thread object
thread.message_fetch([["id", "=", message_id]], false, [message_id], function (arg, data) {
var message = thread.create_message_object( data.slice(-1)[0] );
// insert the message on dom
thread.insert_message( message, root ? undefined : self.$el, root );
});
self.on_cancel();
self.flag_post = false;
});
},
});
}
Loading