diff --git a/mail_all/README.rst b/mail_all/README.rst index c2d7ab7..db6304b 100644 --- a/mail_all/README.rst +++ b/mail_all/README.rst @@ -9,8 +9,8 @@ Further information HTML Description: https://apps.odoo.com/apps/modules/8.0/mail_all/ -Usage instructions: ``_ +Usage instructions: ``__ -Changelog: ``_ +Changelog: ``__ Tested on Odoo 8.0 0af32f3f84bae07b11abb8538d02e35c7369a348 diff --git a/mail_all/__init__.py b/mail_all/__init__.py index 5305644..cde864b 100644 --- a/mail_all/__init__.py +++ b/mail_all/__init__.py @@ -1,3 +1,3 @@ # -*- coding: utf-8 -*- -from . import models \ No newline at end of file +from . import models diff --git a/mail_all/views/templates.xml b/mail_all/views/templates.xml index ed28747..451dece 100644 --- a/mail_all/views/templates.xml +++ b/mail_all/views/templates.xml @@ -28,5 +28,5 @@ - + diff --git a/mail_check_immediately/__init__.py b/mail_check_immediately/__init__.py index 89d26e2..a0fdc10 100644 --- a/mail_check_immediately/__init__.py +++ b/mail_check_immediately/__init__.py @@ -1,2 +1,2 @@ # -*- coding: utf-8 -*- -import models +from . import models diff --git a/mail_check_immediately/__openerp__.py b/mail_check_immediately/__openerp__.py index ba2c7bb..1d93c40 100644 --- a/mail_check_immediately/__openerp__.py +++ b/mail_check_immediately/__openerp__.py @@ -1,16 +1,17 @@ +# -*- coding: utf-8 -*- { - 'name' : 'Check mail immediately', - 'version' : '1.0.1', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Check mail immediately', + 'version': '1.0.1', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', "category": "Discuss", - 'website' : 'https://twitter.com/yelizariev', + 'website': 'https://twitter.com/yelizariev', 'price': 9.00, 'currency': 'EUR', - 'depends' : ['base', 'web', 'fetchmail', 'mail'], + 'depends': ['base', 'web', 'fetchmail', 'mail'], 'data': [ 'views.xml', - ], + ], 'qweb': [ "static/src/xml/main.xml", ], diff --git a/mail_check_immediately/models.py b/mail_check_immediately/models.py index 3306837..836bdb7 100644 --- a/mail_check_immediately/models.py +++ b/mail_check_immediately/models.py @@ -60,7 +60,6 @@ class FetchMailImmediately(models.AbstractModel): def run_fetchmail_manually(self): fetchmail_task = self.env.ref('fetchmail.ir_cron_mail_gateway_action') - fetchmail_task_id = fetchmail_task.id fetchmail_model = self.env['fetchmail.server'].sudo() fetchmail_task._try_lock() diff --git a/mail_check_immediately/static/src/js/main.js b/mail_check_immediately/static/src/js/main.js index 20b07bd..b9f31b2 100755 --- a/mail_check_immediately/static/src/js/main.js +++ b/mail_check_immediately/static/src/js/main.js @@ -10,7 +10,7 @@ openerp.mail_check_immediately = function(instance, local) { this.imm_model = new instance.web.Model('fetch_mail.imm'); this.events['click a.oe_fetch_new_mails'] = function(){ _this.run_fetchmail_manually(); - } + }; }, start: function() { @@ -22,7 +22,7 @@ openerp.mail_check_immediately = function(instance, local) { this.get_last_fetched_time(); this.get_time_loop = setInterval(function(){ - _this.get_last_fetched_time() + _this.get_last_fetched_time(); }, 30000); }, @@ -31,8 +31,8 @@ openerp.mail_check_immediately = function(instance, local) { var _this = this; this.imm_model.call('run_fetchmail_manually', {context: new instance.web.CompoundContext()}).then(function(){ - _this.get_last_fetched_time() - }) + _this.get_last_fetched_time(); + }); }, get_last_fetched_time: function(){ @@ -43,7 +43,7 @@ openerp.mail_check_immediately = function(instance, local) { value = $.timeago(res); value = value || 'undefined'; _this.$el.find('span.oe_view_manager_fetch_mail_imm_field').html(value); - }) + }); }, destroy: function(){ diff --git a/mail_delete_access_link/__init__.py b/mail_delete_access_link/__init__.py index bc7f5d6..e8e36b6 100644 --- a/mail_delete_access_link/__init__.py +++ b/mail_delete_access_link/__init__.py @@ -1 +1,2 @@ -import mail_delete_access_link +# -*- coding: utf-8 -*- +from . import mail_delete_access_link diff --git a/mail_delete_access_link/__openerp__.py b/mail_delete_access_link/__openerp__.py index a6895e5..b720f68 100644 --- a/mail_delete_access_link/__openerp__.py +++ b/mail_delete_access_link/__openerp__.py @@ -1,14 +1,14 @@ +# -*- coding: utf-8 -*- { - 'name' : 'Delete access link in email footer', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Delete access link in email footer', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', "category": "Discuss", - 'website' : 'https://twitter.com/yelizariev', + 'website': 'https://twitter.com/yelizariev', 'price': 9.00, 'currency': 'EUR', - 'depends' : ['mail'], - 'data':[ - ], + 'depends': ['mail'], + 'data': [], 'installable': True } diff --git a/mail_delete_access_link/mail_delete_access_link.py b/mail_delete_access_link/mail_delete_access_link.py index 4445a67..f070988 100644 --- a/mail_delete_access_link/mail_delete_access_link.py +++ b/mail_delete_access_link/mail_delete_access_link.py @@ -1,5 +1,6 @@ +# -*- coding: utf-8 -*- from openerp.osv import osv -from openerp import tools, SUPERUSER_ID + class mail_mail(osv.Model): _inherit = 'mail.mail' diff --git a/mail_delete_odoo_footer/__openerp__.py b/mail_delete_odoo_footer/__openerp__.py index f04034a..5b82d2e 100644 --- a/mail_delete_odoo_footer/__openerp__.py +++ b/mail_delete_odoo_footer/__openerp__.py @@ -1,12 +1,13 @@ +# -*- coding: utf-8 -*- { - 'name' : 'Delete Odoo footer in email', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Delete Odoo footer in email', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', "category": "Discuss", - 'website' : 'https://yelizariev.github.io', - 'depends' : ['mail_delete_access_link', 'mail_delete_sent_by_footer'], - 'data':[ - ], + 'website': 'https://yelizariev.github.io', + 'depends': ['mail_delete_access_link', 'mail_delete_sent_by_footer'], + 'data': [ + ], 'installable': True } diff --git a/mail_delete_sent_by_footer/__init__.py b/mail_delete_sent_by_footer/__init__.py index 6219218..86b3b75 100644 --- a/mail_delete_sent_by_footer/__init__.py +++ b/mail_delete_sent_by_footer/__init__.py @@ -1 +1,2 @@ -import mail_delete_sent_by_footer +# -*- coding: utf-8 -*- +from . import mail_delete_sent_by_footer diff --git a/mail_delete_sent_by_footer/__openerp__.py b/mail_delete_sent_by_footer/__openerp__.py index c19a290..a0a4fd8 100644 --- a/mail_delete_sent_by_footer/__openerp__.py +++ b/mail_delete_sent_by_footer/__openerp__.py @@ -1,14 +1,15 @@ +# -*- coding: utf-8 -*- { - 'name' : 'Delete "Sent by..." footer in email', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Delete "Sent by..." footer in email', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', - 'category' : 'Debranding', - 'website' : 'https://twitter.com/yelizariev', + 'category': 'Debranding', + 'website': 'https://twitter.com/yelizariev', 'price': 9.00, 'currency': 'EUR', - 'depends' : ['mail'], - 'data':[ - ], + 'depends': ['mail'], + 'data': [ + ], 'installable': True } diff --git a/mail_delete_sent_by_footer/mail_delete_sent_by_footer.py b/mail_delete_sent_by_footer/mail_delete_sent_by_footer.py index 41e03fb..cde3c93 100644 --- a/mail_delete_sent_by_footer/mail_delete_sent_by_footer.py +++ b/mail_delete_sent_by_footer/mail_delete_sent_by_footer.py @@ -1,6 +1,8 @@ +# -*- coding: utf-8 -*- from openerp.osv import osv from openerp import tools, SUPERUSER_ID + class mail_notification(osv.Model): _inherit = 'mail.notification' diff --git a/mail_fix_553/__init__.py b/mail_fix_553/__init__.py index c978833..e9ad948 100644 --- a/mail_fix_553/__init__.py +++ b/mail_fix_553/__init__.py @@ -1 +1,2 @@ -import mail_fix_553 +# -*- coding: utf-8 -*- +from . import mail_fix_553 diff --git a/mail_fix_553/__openerp__.py b/mail_fix_553/__openerp__.py index ae3e6e5..beba9e1 100644 --- a/mail_fix_553/__openerp__.py +++ b/mail_fix_553/__openerp__.py @@ -1,11 +1,12 @@ +# -*- coding: utf-8 -*- { - "name" : "Fix mail error 553", - "version" : "0.3", - "author" : "IT-Projects LLC, Ivan Yelizariev", + "name": "Fix mail error 553", + "version": "0.3", + "author": "IT-Projects LLC, Ivan Yelizariev", 'license': 'GPL-3', "category": "Discuss", - "website" : "https://yelizariev.github.io", - "depends" : ["base", "mail"], + "website": "https://yelizariev.github.io", + "depends": ["base", "mail"], "data": ["data.xml"], "installable": True } diff --git a/mail_fix_553/mail_fix_553.py b/mail_fix_553/mail_fix_553.py index 70af917..7352fd0 100644 --- a/mail_fix_553/mail_fix_553.py +++ b/mail_fix_553/mail_fix_553.py @@ -2,19 +2,18 @@ import base64 import logging +import re from email.utils import formataddr -from urlparse import urljoin -from openerp import api, tools +from openerp import tools from openerp import SUPERUSER_ID from openerp.addons.base.ir.ir_mail_server import MailDeliveryException -from openerp.osv import fields, osv +from openerp.osv import osv from openerp.tools.safe_eval import safe_eval as eval from openerp.tools.translate import _ _logger = logging.getLogger(__name__) -import re class mail_mail(osv.Model): _inherit = "mail.mail" @@ -41,10 +40,9 @@ class mail_mail(osv.Model): catchall_alias_name = self.pool['ir.config_parameter'].get_param(cr, uid, "mail.catchall.name_alias_from", context=context) catchall_domain = self.pool['ir.config_parameter'].get_param(cr, uid, "mail.catchall.domain", context=context) - correct_email_from = '@%s>?\s*$'%catchall_domain + correct_email_from = '@%s>?\s*$' % catchall_domain default_email_from = '%s@%s' % (catchall_alias, catchall_domain) - context = dict(context or {}) ir_mail_server = self.pool.get('ir.mail_server') ir_attachment = self.pool['ir.attachment'] @@ -64,8 +62,8 @@ class mail_mail(osv.Model): # soft/hard mem limits with temporary data. attachment_ids = [a.id for a in mail.attachment_ids] attachments = [(a['datas_fname'], base64.b64decode(a['datas'])) - for a in ir_attachment.read(cr, SUPERUSER_ID, attachment_ids, - ['datas_fname', 'datas'])] + for a in ir_attachment.read(cr, SUPERUSER_ID, attachment_ids, + ['datas_fname', 'datas'])] # specific behavior to customize the send email for notified partners email_list = [] @@ -106,7 +104,7 @@ class mail_mail(osv.Model): email_from = formataddr((catchall_alias_name, email_from)) msg = ir_mail_server.build_email( - email_from=email_from, # NEW STUFF + email_from=email_from, # NEW STUFF email_to=email.get('email_to'), subject=email.get('subject'), body=email.get('body'), @@ -122,8 +120,8 @@ class mail_mail(osv.Model): headers=headers) try: res = ir_mail_server.send_email(cr, uid, msg, - mail_server_id=mail.mail_server_id.id, - context=context) + mail_server_id=mail.mail_server_id.id, + context=context) except AssertionError as error: if error.message == ir_mail_server.NO_VALID_RECIPIENT: # No valid recipient found for this particular @@ -146,8 +144,8 @@ class mail_mail(osv.Model): except MemoryError: # prevent catching transient MemoryErrors, bubble up to notify user or abort cron job # instead of marking the mail as failed - _logger.exception('MemoryError while processing mail with ID %r and Msg-Id %r. '\ - 'Consider raising the --limit-memory-hard startup option', + _logger.exception('MemoryError while processing mail with ID %r and Msg-Id %r. ' + 'Consider raising the --limit-memory-hard startup option', mail.id, mail.message_id) raise except Exception as e: diff --git a/mail_fix_empty_body/__init__.py b/mail_fix_empty_body/__init__.py index bff786c..a0fdc10 100644 --- a/mail_fix_empty_body/__init__.py +++ b/mail_fix_empty_body/__init__.py @@ -1 +1,2 @@ -import models +# -*- coding: utf-8 -*- +from . import models diff --git a/mail_fix_empty_body/__openerp__.py b/mail_fix_empty_body/__openerp__.py index e5031f4..1eaea60 100644 --- a/mail_fix_empty_body/__openerp__.py +++ b/mail_fix_empty_body/__openerp__.py @@ -1,14 +1,15 @@ +# -*- coding: utf-8 -*- { - 'name' : 'Fix "False" in empty email body', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Fix "False" in empty email body', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', "category": "Discuss", - 'website' : 'https://twitter.com/yelizariev', + 'website': 'https://twitter.com/yelizariev', 'price': 9.00, 'currency': 'EUR', - 'depends' : ['mail'], - 'data':[ - ], + 'depends': ['mail'], + 'data': [ + ], 'installable': True } diff --git a/mail_fix_empty_body/models.py b/mail_fix_empty_body/models.py index 0d45e2d..4852923 100644 --- a/mail_fix_empty_body/models.py +++ b/mail_fix_empty_body/models.py @@ -1,4 +1,6 @@ -from openerp import api, models, fields, SUPERUSER_ID +# -*- coding: utf-8 -*- +from openerp import models + class mail_compose_message(models.TransientModel): _inherit = 'mail.compose.message' diff --git a/mail_fix_header_from/__init__.py b/mail_fix_header_from/__init__.py index bff786c..a0fdc10 100644 --- a/mail_fix_header_from/__init__.py +++ b/mail_fix_header_from/__init__.py @@ -1 +1,2 @@ -import models +# -*- coding: utf-8 -*- +from . import models diff --git a/mail_fix_header_from/__openerp__.py b/mail_fix_header_from/__openerp__.py index 2023021..4f7d439 100644 --- a/mail_fix_header_from/__openerp__.py +++ b/mail_fix_header_from/__openerp__.py @@ -1,16 +1,17 @@ +# -*- coding: utf-8 -*- { - "name" : "Fix non-ascii header 'from' (OBSOLETE)", - "version" : "0.3", - "author" : "IT-Projects LLC, Ivan Yelizariev", + "name": "Fix non-ascii header 'from' (OBSOLETE)", + "version": "0.3", + "author": "IT-Projects LLC, Ivan Yelizariev", 'license': 'GPL-3', "category": "Discuss", - "website" : "https://yelizariev.github.io", + "website": "https://yelizariev.github.io", "description": """ Obsolete in odoo 8.0 since Sep 10, 2014 https://github.com/odoo/odoo/commit/f2cf6ced17d3477b8858e3a8f955a42cc8a629ff . You can install this module, if you use older version. """, - "depends" : ["base"], - #"init_xml" : [], - #"update_xml" : [], - #"active": True, + "depends": ["base"], + # "init_xml" : [], + # "update_xml" : [], + # "active": True, "installable": True } diff --git a/mail_fix_header_from/models.py b/mail_fix_header_from/models.py index 83c8941..399fc3b 100644 --- a/mail_fix_header_from/models.py +++ b/mail_fix_header_from/models.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import re from openerp.addons.base.ir import ir_mail_server diff --git a/mail_move_message/__init__.py b/mail_move_message/__init__.py index f247113..9f91a71 100644 --- a/mail_move_message/__init__.py +++ b/mail_move_message/__init__.py @@ -1,2 +1,3 @@ -import controllers -import mail_move_message_models +# -*- coding: utf-8 -*- +from . import controllers +from . import mail_move_message_models diff --git a/mail_move_message/__openerp__.py b/mail_move_message/__openerp__.py index ff3c087..f4eaa95 100644 --- a/mail_move_message/__openerp__.py +++ b/mail_move_message/__openerp__.py @@ -1,18 +1,19 @@ +# -*- coding: utf-8 -*- { - 'name' : 'Mail relocation', - 'version' : '1.0.4', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Mail relocation', + 'version': '1.0.4', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', "category": "Discuss", - 'website' : 'https://twitter.com/yelizariev', + 'website': 'https://twitter.com/yelizariev', 'price': 100.00, 'currency': 'EUR', - 'depends' : ['mail', 'web_polymorphic_field'], + 'depends': ['mail', 'web_polymorphic_field'], 'images': ['images/inbox.png'], - 'data':[ + 'data': [ 'mail_move_message_views.xml', 'data/mail_move_message_data.xml', - ], + ], 'qweb': [ 'static/src/xml/mail_move_message_main.xml', ], diff --git a/mail_move_message/controllers/__init__.py b/mail_move_message/controllers/__init__.py index 039d971..757b12a 100644 --- a/mail_move_message/controllers/__init__.py +++ b/mail_move_message/controllers/__init__.py @@ -1 +1,2 @@ -import main \ No newline at end of file +# -*- coding: utf-8 -*- +from . import main diff --git a/mail_move_message/controllers/main.py b/mail_move_message/controllers/main.py index bef9074..0bfc2e5 100644 --- a/mail_move_message/controllers/main.py +++ b/mail_move_message/controllers/main.py @@ -1,8 +1,10 @@ +# -*- coding: utf-8 -*- from openerp.addons.web.controllers.main import DataSet from openerp.tools.translate import _ from openerp import http from openerp.http import request + class DataSetCustom(DataSet): def _extend_name(self, model, records): @@ -26,12 +28,11 @@ class DataSetCustom(DataSet): res.append((r[0], _('%s ID %s') % (r[1], r[0]))) return res - @http.route('/web/dataset/call_kw//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 + # add order by ID desc cr, uid = request.cr, request.uid Model = request.registry[model] search_args = list(kwargs.get('args') or []) diff --git a/mail_move_message/mail_move_message_models.py b/mail_move_message/mail_move_message_models.py index 0013e9e..dc66b74 100644 --- a/mail_move_message/mail_move_message_models.py +++ b/mail_move_message/mail_move_message_models.py @@ -1,8 +1,9 @@ -from lxml import etree +# -*- coding: utf-8 -*- from openerp import api, models, fields, SUPERUSER_ID from openerp.tools import email_split from openerp.tools.translate import _ + class wizard(models.TransientModel): _name = 'mail_move_message.wizard' @@ -34,7 +35,7 @@ class wizard(models.TransientModel): if 'message_id' in res: message = self.env['mail.message'].browse(res['message_id']) email_from = message.email_from - parts = email_split(email_from.replace(' ',',')) + parts = email_split(email_from.replace(' ', ',')) if parts: email = parts[0] name = email_from.find(email) != -1 and email_from[:email_from.index(email)].replace('"', '').replace('<', '').strip() or email_from @@ -51,7 +52,7 @@ class wizard(models.TransientModel): res['res_id'] = res_id and res_id[0].id config_parameters = self.env['ir.config_parameter'] - res['move_followers'] = config_parameters.get_param('mail_relocation_move_followers') + res['move_followers'] = config_parameters.get_param('mail_relocation_move_followers') res['uid'] = self.env.uid @@ -102,8 +103,8 @@ class wizard(models.TransientModel): def update_move_back(self): model = self.message_id.moved_from_model self.move_back = self.parent_id == self.message_id.moved_from_parent_id \ - and self.res_id == self.message_id.moved_from_res_id \ - and (self.model == model or (not self.model and not model)) + and self.res_id == self.message_id.moved_from_res_id \ + and (self.model == model or (not self.model and not model)) @api.onchange('parent_id') def on_change_parent_id(self): @@ -140,7 +141,7 @@ class wizard(models.TransientModel): operation = 'write' context = self._context - if not ( self.model and self.res_id ): + if not (self.model and self.res_id): return True model_obj = self.pool[self.model] mids = model_obj.exists(cr, uid, [self.res_id]) @@ -169,20 +170,20 @@ class wizard(models.TransientModel): for r in self: r.check_access() if not r.parent_id or not (r.parent_id.model == r.model and - r.parent_id.res_id == r.res_id): - #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) + r.parent_id.res_id == r.res_id): + # 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) 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) - if not ( r.model and r.res_id ): + if not (r.model and r.res_id): obj = self.pool.get('ir.model.data').get_object_reference(self._cr, SUPERUSER_ID, 'mail', 'mail_archivesfeeds')[1] return { - 'type' : 'ir.actions.client', - 'name' : 'Archive', - 'tag' : 'reload', - 'params' : {'menu_id': obj}, + 'type': 'ir.actions.client', + 'name': 'Archive', + 'tag': 'reload', + 'params': {'menu_id': obj}, } return { 'name': _('Record'), @@ -260,7 +261,7 @@ class mail_message(models.Model): fol_obj = self.env['mail.followers'] for message in self: followers = fol_obj.sudo().search([('res_model', '=', message.model), - ('res_id', '=', message.res_id)]) + ('res_id', '=', message.res_id)]) for f in followers: self.env[model].browse(ids).message_subscribe([f.partner_id.id], [s.id for s in f.subtype_ids]) @@ -315,7 +316,7 @@ class mail_message(models.Model): return [] if isinstance(ids, (long, int)): ids = [ids] - reads = self.read(cr, uid, ids, ['record_name','model', 'res_id'], context=context) + reads = self.read(cr, uid, ids, ['record_name', 'model', 'res_id'], context=context) res = [] for record in reads: name = record['record_name'] or '' @@ -372,11 +373,11 @@ class res_partner(models.Model): email_address = (vals['email'].replace('\\', '\\\\').replace('%', '\\%').replace('_', '\\_')) email_brackets = "<%s>" % email_address messages = mail_message_obj.search([ - '|', - ('email_from', '=ilike', email_address), - ('email_from', 'ilike', email_brackets), - ('author_id', '=', False) - ]) + '|', + ('email_from', '=ilike', email_address), + ('email_from', 'ilike', email_brackets), + ('author_id', '=', False) + ]) if messages: messages.sudo().write({'author_id': res.id}) return res diff --git a/mail_move_message/static/src/js/mail_move_message.js b/mail_move_message/static/src/js/mail_move_message.js index a655407..2d7a19f 100644 --- a/mail_move_message/static/src/js/mail_move_message.js +++ b/mail_move_message/static/src/js/mail_move_message.js @@ -7,13 +7,13 @@ openerp.mail_move_message = function (session) { mail.ThreadMessage.include({ bind_events: function(){ this._super.apply(this, arguments); - this.$('.oe_move').on('click', this.on_move_message) + this.$('.oe_move').on('click', this.on_move_message); }, on_move_message: function(event){ var self = this; var context = { 'default_message_id': this.id - } + }; var action = { name: _t('Relocate Message'), type: 'ir.actions.act_window', @@ -31,26 +31,26 @@ openerp.mail_move_message = function (session) { } }); } - }) + }); mail.MessageCommon.include({ init: function (parent, datasets, options) { this._super(parent, datasets, options); this.is_moved = datasets.is_moved || false; } - }) + }); session.web.form.WidgetButton.include({ on_click: function() { if(this.node.attrs.special == 'quick_create'){ var self = this; - var related_field = this.field_manager.fields[this.node.attrs['field']]; + 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 session.web.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(); + 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]); } @@ -59,7 +59,7 @@ openerp.mail_move_message = function (session) { } $.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']); + self.field_manager.fields.partner_id.set_value(context.partner_id); } var pop = new session.web.form.FormOpenPopup(this); pop.show_element( @@ -76,8 +76,8 @@ openerp.mail_move_message = function (session) { }); pop.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); + if(self.field_manager.fields.filter_by_partner) { + self.field_manager.fields.filter_by_partner.set_value(true); } }); }); @@ -88,4 +88,4 @@ openerp.mail_move_message = function (session) { }, }); -} \ No newline at end of file +}; \ No newline at end of file diff --git a/mail_outgoing/__init__.py b/mail_outgoing/__init__.py index 698570a..71fed50 100644 --- a/mail_outgoing/__init__.py +++ b/mail_outgoing/__init__.py @@ -1 +1,2 @@ -import mail_outgoing_models +# -*- coding: utf-8 -*- +from . import mail_outgoing_models diff --git a/mail_outgoing/__openerp__.py b/mail_outgoing/__openerp__.py index e86852e..5048884 100644 --- a/mail_outgoing/__openerp__.py +++ b/mail_outgoing/__openerp__.py @@ -1,20 +1,21 @@ +# -*- coding: utf-8 -*- { - 'name' : 'Outgoing mails menu', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Outgoing mails menu', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', "category": "Discuss", - 'website' : 'https://yelizariev.github.io', + 'website': 'https://yelizariev.github.io', 'description': """ Allows to check outgoing mails, i.e. failed or delayed. Tested on Odoo 8.0 ab7b5d7732a7c222a0aea45bd173742acd47242d """, - 'depends' : ['mail'], - 'data':[ + 'depends': ['mail'], + 'data': [ 'security/mail_outgoing.xml', 'security/ir.model.access.csv', 'mail_outgoing_views.xml', - ], + ], 'installable': True } diff --git a/mail_outgoing/mail_outgoing_models.py b/mail_outgoing/mail_outgoing_models.py index a823bbc..2a232dd 100644 --- a/mail_outgoing/mail_outgoing_models.py +++ b/mail_outgoing/mail_outgoing_models.py @@ -1,5 +1,7 @@ +# -*- coding: utf-8 -*- from openerp.osv import osv + class mail_message(osv.Model): _inherit = 'mail.message' @@ -13,10 +15,11 @@ class mail_message(osv.Model): return super(mail_message, self).check_access_rule(cr, uid, ids, operation, context) + class mail_mail(osv.Model): _name = 'mail.mail' _inherit = ['mail.mail', 'ir.needaction_mixin'] _needaction = True def _needaction_domain_get(self, cr, uid, context=None): - return [('state','in', ['outgoing', 'exception'])] + return [('state', 'in', ['outgoing', 'exception'])] diff --git a/mail_outgoing/mail_outgoing_views.xml b/mail_outgoing/mail_outgoing_views.xml index 9bc5d86..3b74479 100644 --- a/mail_outgoing/mail_outgoing_views.xml +++ b/mail_outgoing/mail_outgoing_views.xml @@ -1,7 +1,7 @@ - + Outgoing mail.mail @@ -10,8 +10,8 @@ {} -

- Failed or delayed emails will be shown here. You will be able to retry failed emails and send delayed emails manually. +

+ Failed or delayed emails will be shown here. You will be able to retry failed emails and send delayed emails manually.

@@ -30,5 +30,5 @@ -
+
diff --git a/mail_outgoing/security/mail_outgoing.xml b/mail_outgoing/security/mail_outgoing.xml index b394494..75648c9 100644 --- a/mail_outgoing/security/mail_outgoing.xml +++ b/mail_outgoing/security/mail_outgoing.xml @@ -3,10 +3,10 @@ all_emails - Gets access to all emails. For example to check outgoing emails. - + Gets access to all emails. For example to check outgoing emails. + - + mail.mail: user [('author_id', '=', user.partner_id.id)] @@ -16,9 +16,9 @@ - + - + mail.mail: system [(1, '=', 1)] @@ -28,6 +28,6 @@ - - + + diff --git a/mail_partner_lang/__init__.py b/mail_partner_lang/__init__.py index bff786c..a0fdc10 100644 --- a/mail_partner_lang/__init__.py +++ b/mail_partner_lang/__init__.py @@ -1 +1,2 @@ -import models +# -*- coding: utf-8 -*- +from . import models diff --git a/mail_partner_lang/__openerp__.py b/mail_partner_lang/__openerp__.py index 5d04c95..b8b50ae 100644 --- a/mail_partner_lang/__openerp__.py +++ b/mail_partner_lang/__openerp__.py @@ -1,12 +1,13 @@ +# -*- coding: utf-8 -*- { - 'name' : 'Use partner language in mail', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Use partner language in mail', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', "category": "Discuss", - 'website' : 'https://yelizariev.github.io', + 'website': 'https://yelizariev.github.io', - 'depends' : ['mail'], - 'data':[], + 'depends': ['mail'], + 'data': [], 'installable': False, } diff --git a/mail_partner_lang/models.py b/mail_partner_lang/models.py index 1836778..ca95d19 100644 --- a/mail_partner_lang/models.py +++ b/mail_partner_lang/models.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from openerp.osv import osv,fields -from openerp import SUPERUSER_ID +from openerp.osv import osv + class mail_thread(osv.Model): _inherit = "mail.thread" @@ -37,7 +37,7 @@ class mail_thread(osv.Model): for browse_record in self.browse(cr, uid, ids, context=context): p = getattr(browse_record, 'partner_id', None) if p: - browse_record._context.update({'lang':p.lang}) + browse_record._context.update({'lang': p.lang}) initial = initial_values[browse_record.id] changes = set() @@ -53,12 +53,12 @@ class mail_thread(osv.Model): if record_value == initial_value and getattr(self._all_columns[col_name].column, 'track_visibility', None) == 'always': tracked_values[col_name] = dict(col_info=col_info['string'], - new_value=convert_for_display(record_value, col_info)) + new_value=convert_for_display(record_value, col_info)) elif record_value != initial_value and (record_value or initial_value): # because browse null != False if getattr(self._all_columns[col_name].column, 'track_visibility', None) in ['always', 'onchange']: tracked_values[col_name] = dict(col_info=col_info['string'], - old_value=convert_for_display(initial_value, col_info), - new_value=convert_for_display(record_value, col_info)) + old_value=convert_for_display(initial_value, col_info), + new_value=convert_for_display(record_value, col_info)) if col_name in tracked_fields: changes.add(col_name) if not changes: diff --git a/mail_recovery/README.rst b/mail_recovery/README.rst index 1cd5ee0..afc7325 100644 --- a/mail_recovery/README.rst +++ b/mail_recovery/README.rst @@ -18,7 +18,7 @@ Contributors Sponsors -------- -* `IT-Projects LLC `_ +* `IT-Projects LLC `__ Further information =================== @@ -27,8 +27,8 @@ Demo: http://runbot.it-projects.info/demo/mail-addons/8.0 HTML Description: https://apps.odoo.com/apps/modules/8.0/mail_recovery/ -Usage instructions: ``_ +Usage instructions: ``__ -Changelog: ``_ +Changelog: ``__ Tested on Odoo 8.0 17a130428516d9dd8105f90e8c9a65a0b4e8901b diff --git a/mail_recovery/__openerp__.py b/mail_recovery/__openerp__.py index 57728ff..a84772f 100644 --- a/mail_recovery/__openerp__.py +++ b/mail_recovery/__openerp__.py @@ -12,5 +12,5 @@ 'depends': ['mail'], 'data': [ 'data.xml', - ], + ], } diff --git a/mail_recovery/static/src/js/mail_recovery.js b/mail_recovery/static/src/js/mail_recovery.js index 3d52a4a..71ba5d7 100644 --- a/mail_recovery/static/src/js/mail_recovery.js +++ b/mail_recovery/static/src/js/mail_recovery.js @@ -11,14 +11,14 @@ openerp.mail_recovery = function (session) { on_focus_textarea: function(event) { var $input = $(event.target); if (!$input.val()) { - $input.val(window.localStorage['message_storage']); + $input.val(window.localStorage.message_storage); } }, on_keyup_textarea: function(event) { - window.localStorage['message_storage'] = $(event.target).val(); + window.localStorage.message_storage = $(event.target).val(); }, on_message_post: function (event) { - window.localStorage['message_storage'] = ''; + window.localStorage.message_storage = ''; return this._super(event); }, }); diff --git a/mail_sent/__init__.py b/mail_sent/__init__.py index bff786c..a0fdc10 100644 --- a/mail_sent/__init__.py +++ b/mail_sent/__init__.py @@ -1 +1,2 @@ -import models +# -*- coding: utf-8 -*- +from . import models diff --git a/mail_sent/__openerp__.py b/mail_sent/__openerp__.py index f92d3ed..1c35267 100644 --- a/mail_sent/__openerp__.py +++ b/mail_sent/__openerp__.py @@ -1,15 +1,16 @@ +# -*- coding: utf-8 -*- { - 'name' : 'Sentbox', - 'version' : '1.0.2', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Sentbox', + 'version': '1.0.2', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', - 'category' : 'Discuss', - 'website' : 'https://twitter.com/yelizariev', + 'category': 'Discuss', + 'website': 'https://twitter.com/yelizariev', 'price': 40.00, 'currency': 'EUR', - 'depends' : ['mail'], - 'data':[ + 'depends': ['mail'], + 'data': [ 'views.xml', - ], + ], 'installable': True } diff --git a/mail_sent/models.py b/mail_sent/models.py index 38c82e9..ca2c456 100644 --- a/mail_sent/models.py +++ b/mail_sent/models.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from openerp import api, models, fields @@ -25,4 +26,3 @@ class mail_compose_message(models.TransientModel): _inherit = 'mail.compose.message' sent = fields.Boolean('Sent', help='dummy field to fix inherit error') - diff --git a/mail_sent/views.xml b/mail_sent/views.xml index 804d323..052499d 100644 --- a/mail_sent/views.xml +++ b/mail_sent/views.xml @@ -34,5 +34,5 @@ - + diff --git a/mail_todo_custom/static/src/js/mail_todo_custom.js b/mail_todo_custom/static/src/js/mail_todo_custom.js index 4d45c0b..983b856 100644 --- a/mail_todo_custom/static/src/js/mail_todo_custom.js +++ b/mail_todo_custom/static/src/js/mail_todo_custom.js @@ -41,4 +41,4 @@ openerp.mail_todo_custom = function(session) { }, }); -} \ No newline at end of file +}; \ No newline at end of file diff --git a/mail_wall_custom/__init__.py b/mail_wall_custom/__init__.py index bff786c..a0fdc10 100644 --- a/mail_wall_custom/__init__.py +++ b/mail_wall_custom/__init__.py @@ -1 +1,2 @@ -import models +# -*- coding: utf-8 -*- +from . import models diff --git a/mail_wall_custom/__openerp__.py b/mail_wall_custom/__openerp__.py index e2151de..c3236ca 100644 --- a/mail_wall_custom/__openerp__.py +++ b/mail_wall_custom/__openerp__.py @@ -1,25 +1,26 @@ +# -*- coding: utf-8 -*- { - 'name' : 'Custom mail wall', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Custom mail wall', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', - 'category' : 'Custom', - 'website' : 'https://yelizariev.github.io', - 'depends' : ['gamification', - 'gamification_extra', - 'hr', - 'sale', - 'sales_team', - 'crm', - 'calendar', - 'project', - 'mail_wall_widgets', - 'sale_mediation_custom', - 'access_custom', - ], - 'data':[ + 'category': 'Custom', + 'website': 'https://yelizariev.github.io', + 'depends': ['gamification', + 'gamification_extra', + 'hr', + 'sale', + 'sales_team', + 'crm', + 'calendar', + 'project', + 'mail_wall_widgets', + 'sale_mediation_custom', + 'access_custom', + ], + 'data': [ 'views.xml', 'data.xml', - ], + ], 'installable': True, } diff --git a/mail_wall_custom/data.xml b/mail_wall_custom/data.xml index c6878f0..756717a 100644 --- a/mail_wall_custom/data.xml +++ b/mail_wall_custom/data.xml @@ -2,136 +2,136 @@ - Average payment time - - - days - avg - progress - - - - lower - [('user_id','=', user.id),('state','in', ['done'])] - + Average payment time + + + days + avg + progress + + + + lower + [('user_id','=', user.id),('state','in', ['done'])] + - Average payment time [ALL] - - - days - avg - progress - - - - lower - [('state','in', ['done'])] - + Average payment time [ALL] + + + days + avg + progress + + + + lower + [('state','in', ['done'])] + - Average deal time - - - days - avg - progress - - - - lower - [('user_id','=', user.id), ('sales_funnel_type', 'in', ['won']), ('date_closed', '!=', False)] - + Average deal time + + + days + avg + progress + + + + lower + [('user_id','=', user.id), ('sales_funnel_type', 'in', ['won']), ('date_closed', '!=', False)] + - Average deal time [ALL] - - - days - avg - progress - - - - lower - [('sales_funnel_type', 'in', ['won']), ('date_closed', '!=', False)] - + Average deal time [ALL] + + + days + avg + progress + + + + lower + [('sales_funnel_type', 'in', ['won']), ('date_closed', '!=', False)] + - Oldest lead - - - days - max - progress - lower - [('user_id','=', user.id), ('sales_funnel_type', '=', 'lead')] - - - + Oldest lead + + + days + max + progress + lower + [('user_id','=', user.id), ('sales_funnel_type', '=', 'lead')] + + + - Oldest lead [ALL] - - - days - max - progress - lower - [('sales_funnel_type', '=', 'lead')] - - - + Oldest lead [ALL] + + + days + max + progress + lower + [('sales_funnel_type', '=', 'lead')] + + + - Oldest Opportunity - - - days - max - progress - lower - [('user_id','=', user.id), '|', ('sales_funnel_type', '=', 'quotation'),('sales_funnel_type', '=', 'negotiation')] - - - + Oldest Opportunity + + + days + max + progress + lower + [('user_id','=', user.id), '|', ('sales_funnel_type', '=', 'quotation'),('sales_funnel_type', '=', 'negotiation')] + + + - Oldest Opportunity [ALL] - - - days - max - progress - lower - ['|', ('sales_funnel_type', '=', 'quotation'),('sales_funnel_type', '=', 'negotiation')] - - - + Oldest Opportunity [ALL] + + + days + max + progress + lower + ['|', ('sales_funnel_type', '=', 'quotation'),('sales_funnel_type', '=', 'negotiation')] + + + - Personal comission - - - python - progress - higher - [('state','!=','cancel'),('user_id','=',user.id),('type','=','out_invoice')] - - + Personal comission + + + python + progress + higher + [('state','!=','cancel'),('user_id','=',user.id),('type','=','out_invoice')] + + - + personal_comission = object.user_id.employee_ids and object.user_id.employee_ids[0].personal_comission or 0.0 result = object.sum * personal_comission / 100.0 - + - Team bonus - Monthly team bonus - - python - progress - higher - [('state','!=','cancel'),('section_id','=',user.default_section_id.id),('type','=','out_invoice')] - - + Team bonus + Monthly team bonus + + python + progress + higher + [('state','!=','cancel'),('section_id','=',user.default_section_id.id),('type','=','out_invoice')] + + - - + - + dashboard_accountant - Shows dashboard to accountant - + Shows dashboard to accountant + dashboard_sales_managment - Shows sales management dashboard - + Shows sales management dashboard + dashboard_managment - Shows management dashboard. It includes: sales management + accountant dashboard + EXTRA - - + Shows management dashboard. It includes: sales management + accountant dashboard + EXTRA + + dashboard_sales_person - Shows dashboard to salesperson - + Shows dashboard to salesperson + dashboard_admin - Shows admin dashboard - + Shows admin dashboard + - - Outstanding sale orders - - [('user_id', '=', user.id),('state', 'in', ['progress', 'manual'])] - - - ${record.partner_id.name}, ${record.date_order}]]> - - list - 10 - - + + Outstanding sale orders + + [('user_id', '=', user.id),('state', 'in', ['progress', 'manual'])] + + + ${record.partner_id.name}, ${record.date_order}]]> + + list + 10 + + - - Outstanding sale orders [ALL] - - [('state', 'in', ['progress', 'manual'])] - - - ${record.partner_id.name}, ${record.date_order}]]> - - list - 10 - - + + Outstanding sale orders [ALL] + + [('state', 'in', ['progress', 'manual'])] + + + ${record.partner_id.name}, ${record.date_order}]]> + + list + 10 + + - - Sent invoices [ALL] - - [('type', 'in', ['out_invoice']),('state','in',['open'])] - - - ${record.partner_id.name}, ${record.date_invoice}]]> - - list - 10 - - + + Sent invoices [ALL] + + [('type', 'in', ['out_invoice']),('state','in',['open'])] + + + ${record.partner_id.name}, ${record.date_invoice}]]> + + list + 10 + + - - Received invoices [ALL] - - [('type', 'in', ['in_invoice']),('state','in',['open'])] - - - ${record.partner_id.name}, ${record.date_invoice}]]> - - list - 10 - - + + Received invoices [ALL] + + [('type', 'in', ['in_invoice']),('state','in',['open'])] + + + ${record.partner_id.name}, ${record.date_invoice}]]> + + list + 10 + + - - Task deadlines - - [('user_id', '=', user.id),('date_deadline','!=',False)] - ${record.project_id and record.project_id.name or 'NO PROJECT'}, ${record.date_deadline}]]> - - - - list - 10 - priority DESC - - - - Task deadlines [ALL] - - [('date_deadline','!=',False)] - ${record.project_id and record.project_id.name or 'NO PROJECT'}, ${record.date_deadline}]]> - - - - list - 10 - priority DESC - - + + Task deadlines + + [('user_id', '=', user.id),('date_deadline','!=',False)] + ${record.project_id and record.project_id.name or 'NO PROJECT'}, ${record.date_deadline}]]> + + + + list + 10 + priority DESC + + + + Task deadlines [ALL] + + [('date_deadline','!=',False)] + ${record.project_id and record.project_id.name or 'NO PROJECT'}, ${record.date_deadline}]]> + + + + list + 10 + priority DESC + + - - Next action - - [('user_id', '=', user.id), '|',('date_action','!=',False),('title_action', '!=', False)] - ${record.date_action} - ${record.title_action}]]> - - - - - - list - 10 - priority DESC,probability DESC,planned_revenue DESC - - - - Next action [ALL] - - ['|',('date_action','!=',False),('title_action', '!=', False)] - ${record.date_action} - ${record.title_action}]]> - - - - - - list - 10 - priority DESC,probability DESC,planned_revenue DESC - - + + Next action + + [('user_id', '=', user.id), '|',('date_action','!=',False),('title_action', '!=', False)] + ${record.date_action} - ${record.title_action}]]> + + + + + + list + 10 + priority DESC,probability DESC,planned_revenue DESC + + + + Next action [ALL] + + ['|',('date_action','!=',False),('title_action', '!=', False)] + ${record.date_action} - ${record.title_action}]]> + + + + + + list + 10 + priority DESC,probability DESC,planned_revenue DESC + + - - Calls - - [('user_id', '=', user.id),('state', 'not in', ['cancel'])] - ${record.partner_id.name}, ${record.date}]]> - - - - list - 10 - date DESC - - - - Calls [ALL] - - [('state', 'not in', ['cancel'])] - ${record.partner_id.name}, ${record.date}]]> - - - - list - 10 - date DESC - - + + Calls + + [('user_id', '=', user.id),('state', 'not in', ['cancel'])] + ${record.partner_id.name}, ${record.date}]]> + + + + list + 10 + date DESC + + + + Calls [ALL] + + [('state', 'not in', ['cancel'])] + ${record.partner_id.name}, ${record.date}]]> + + + + list + 10 + date DESC + + - - Meetings - - [('partner_ids', 'in', [user.partner_id.id])] - - - - - list - 10 - start_datetime DESC - - + + Meetings + + [('partner_ids', 'in', [user.partner_id.id])] + + + + + list + 10 + start_datetime DESC + + - - Meetings [ALL] - - [] - - - - - - - list - 10 - start_datetime DESC - - + + Meetings [ALL] + + [] + + + + + + + list + 10 + start_datetime DESC + + - - Conversion Rate - - [('user_id','=', user.id), ('sales_funnel_type', 'in', ['won', 'lost'])] - - funnel - - - - [('sales_funnel_type', 'in', ['won'])] - - - - Conversion Rate [ALL] - - [('sales_funnel_type', 'in', ['won', 'lost'])] - - funnel - - - - [('sales_funnel_type', 'in', ['won'])] - - + + Conversion Rate + + [('user_id','=', user.id), ('sales_funnel_type', 'in', ['won', 'lost'])] + + funnel + + + + [('sales_funnel_type', 'in', ['won'])] + + + + Conversion Rate [ALL] + + [('sales_funnel_type', 'in', ['won', 'lost'])] + + funnel + + + + [('sales_funnel_type', 'in', ['won'])] + + - - Sales contributed - - [('state', 'in', ['done'])] - [('user_id','=', user.id), ('state', 'in', ['done'])] - - slice - - - - + + Sales contributed + + [('state', 'in', ['done'])] + [('user_id','=', user.id), ('state', 'in', ['done'])] + + slice + + + + - + Average deal time + + + + + progress + higher + + + + +--> + diff --git a/mail_wall_custom/models.py b/mail_wall_custom/models.py index 0d8b14f..6400844 100644 --- a/mail_wall_custom/models.py +++ b/mail_wall_custom/models.py @@ -1,5 +1,7 @@ -from openerp import api,models,fields -from openerp.osv import fields as old_fields +# -*- coding: utf-8 -*- +from openerp import fields +from openerp import models + class hr_employee(models.Model): _inherit = 'hr.employee' diff --git a/mail_wall_custom/views.xml b/mail_wall_custom/views.xml index 3cee23b..243523f 100644 --- a/mail_wall_custom/views.xml +++ b/mail_wall_custom/views.xml @@ -4,17 +4,17 @@ hr.employee.form hr.employee - + - - - - - - - - - - + + + + + + + + + + diff --git a/mail_wall_menu/__init__.py b/mail_wall_menu/__init__.py index bff786c..a0fdc10 100644 --- a/mail_wall_menu/__init__.py +++ b/mail_wall_menu/__init__.py @@ -1 +1,2 @@ -import models +# -*- coding: utf-8 -*- +from . import models diff --git a/mail_wall_menu/__openerp__.py b/mail_wall_menu/__openerp__.py index 30d798e..1215e68 100644 --- a/mail_wall_menu/__openerp__.py +++ b/mail_wall_menu/__openerp__.py @@ -1,18 +1,19 @@ +# -*- coding: utf-8 -*- { - 'name' : 'Menu for widgets at Messaging section', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Menu for widgets at Messaging section', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', "category": "Discuss", - 'website' : 'https://yelizariev.github.io', + 'website': 'https://yelizariev.github.io', 'description': """ Module creates special menu at Messaging section to show only gamification-like blocks there. Tested on Odoo 8.0 ab7b5d7732a7c222a0aea45bd173742acd47242d """, - 'depends' : ['mail'], - 'data':[ + 'depends': ['mail'], + 'data': [ 'mail_wall_menu_views.xml', - ], + ], 'installable': True } diff --git a/mail_wall_menu/mail_wall_menu_views.xml b/mail_wall_menu/mail_wall_menu_views.xml index 7966bbe..51965e2 100644 --- a/mail_wall_menu/mail_wall_menu_views.xml +++ b/mail_wall_menu/mail_wall_menu_views.xml @@ -1,13 +1,13 @@ - + @@ -29,5 +29,5 @@ - + diff --git a/mail_wall_menu/models.py b/mail_wall_menu/models.py index d7d73c9..e69de29 100644 --- a/mail_wall_menu/models.py +++ b/mail_wall_menu/models.py @@ -1 +0,0 @@ -from openerp import api,models,fields diff --git a/mail_wall_widgets/__init__.py b/mail_wall_widgets/__init__.py index bff786c..a0fdc10 100644 --- a/mail_wall_widgets/__init__.py +++ b/mail_wall_widgets/__init__.py @@ -1 +1,2 @@ -import models +# -*- coding: utf-8 -*- +from . import models diff --git a/mail_wall_widgets/__openerp__.py b/mail_wall_widgets/__openerp__.py index ff6e779..44075f8 100644 --- a/mail_wall_widgets/__openerp__.py +++ b/mail_wall_widgets/__openerp__.py @@ -1,20 +1,21 @@ +# -*- coding: utf-8 -*- { - 'name' : 'Extra Widgets for mail wall', - 'version' : '1.0.0', - 'author' : 'IT-Projects LLC, Ivan Yelizariev', + 'name': 'Extra Widgets for mail wall', + 'version': '1.0.0', + 'author': 'IT-Projects LLC, Ivan Yelizariev', 'license': 'GPL-3', - 'category' : 'Custom', - 'website' : 'https://yelizariev.github.io', + 'category': 'Custom', + 'website': 'https://yelizariev.github.io', 'description': """ Tested on odoo 8.0 ab7b5d7732a7c222a0aea45bd173742acd47242d """, - 'depends' : ['mail','gamification'], - 'data':[ + 'depends': ['mail', 'gamification'], + 'data': [ 'views.xml', - #'data.xml', + # 'data.xml', 'security/ir.model.access.csv', - ], + ], 'qweb': ['static/src/xml/main.xml'], 'installable': True, } diff --git a/mail_wall_widgets/models.py b/mail_wall_widgets/models.py index 1f8f600..c2ee4f0 100644 --- a/mail_wall_widgets/models.py +++ b/mail_wall_widgets/models.py @@ -1,4 +1,5 @@ -from openerp.osv import osv,fields as old_fields +# -*- coding: utf-8 -*- +from openerp.osv import fields as old_fields from openerp import api, models, fields, tools from openerp.tools.safe_eval import safe_eval try: @@ -15,6 +16,7 @@ from datetime import date, datetime, timedelta from openerp.tools import DEFAULT_SERVER_DATE_FORMAT from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT + class mail_wall_widgets_widget(models.Model): _name = 'mail.wall.widgets.widget' _order = "sequence, id" @@ -25,10 +27,10 @@ class mail_wall_widgets_widget(models.Model): ('list', 'List'), ('funnel', 'Funnel'), ('slice', 'Slice'), - #('', ''), - #('', ''), - #('', ''), - #('', ''), + # ('', ''), + # ('', ''), + # ('', ''), + # ('', ''), ], help=''' Slice - use "domain" for total and "won_domain" for target '''), @@ -39,19 +41,19 @@ Slice - use "domain" for total and "won_domain" for target 'limit': old_fields.integer('Limit', help='Limit count of records to show'), 'order': old_fields.char('Order', help='Order of records to show'), 'value_field_id': old_fields.many2one('ir.model.fields', - string='Value field', - help='The field containing the value of record'), + string='Value field', + help='The field containing the value of record'), 'stage_field_id': old_fields.many2one('ir.model.fields', - string='Stage field', - help='Field to split records in funnel. It can be selection type or many2one (the later should have "sequence" field)'), - #'stage_field_domain': old_fields.many2one('ir.model.fields', + string='Stage field', + help='Field to split records in funnel. It can be selection type or many2one (the later should have "sequence" field)'), + # 'stage_field_domain': old_fields.many2one('ir.model.fields', # string='Stage field domain', # help='(for many2one stage_field_id) Domain to find stage objects'), 'won_domain': old_fields.char('Won domain', - help='Domain to find won objects'), + help='Domain to find won objects'), 'field_date_id': old_fields.many2one('ir.model.fields', - string='Date Field', - help='The date to use for the time period evaluated'), + string='Date Field', + help='The date to use for the time period evaluated'), 'start_date': old_fields.date('Start Date'), 'end_date': old_fields.date('End Date'), # no start and end = always active 'content': old_fields.char('Line template', help='Mako template to show content'), @@ -95,10 +97,11 @@ Slice - use "domain" for total and "won_domain" for target if self.agenda: today = date.today() tomorrow = today + timedelta(days=1) + def r2date(r): d = getattr(r, field_date_name) if d: - d = datetime.strptime(d, self.field_date_id.ttype=='date' and DEFAULT_SERVER_DATE_FORMAT or DEFAULT_SERVER_DATETIME_FORMAT) + d = datetime.strptime(d, self.field_date_id.ttype == 'date' and DEFAULT_SERVER_DATE_FORMAT or DEFAULT_SERVER_DATETIME_FORMAT) d = d.date() else: d = date.today() @@ -140,10 +143,10 @@ Slice - use "domain" for total and "won_domain" for target }) for r in obj.search(domain, limit=self.limit, order=self.order): mako = mako_template_env.from_string(tools.ustr(self.content)) - content = mako.render({'record':r}) + content = mako.render({'record': r}) r_json = { 'id': r.id, - #'fields': dict( (f,getattr(r,f)) for f in fields), + # 'fields': dict( (f,getattr(r,f)) for f in fields), 'display_mode': 'progress', 'state': 'inprogress', 'completeness': 0, @@ -161,26 +164,26 @@ Slice - use "domain" for total and "won_domain" for target for g in groups: del g['test'] elif self.type == 'funnel': - stage_ids = [] # [key] + stage_ids = [] # [key] for group in obj.read_group(domain, [], [self.stage_field_id.name]): key = group[self.stage_field_id.name] if isinstance(key, (list, tuple)): key = key[0] stage_ids.append(key) - stages = [] # [{'name':Name, 'id': key}] + stages = [] # [{'name':Name, 'id': key}] if self.stage_field_id.ttype == 'selection': - d = dict (self.stage_field_id.selection) - stages = [ {'id':id, 'name':d[id]} for id in stage_ids ] - else: # many2one + d = dict(self.stage_field_id.selection) + stages = [{'id': id, 'name': d[id]} for id in stage_ids] + else: # many2one stage_model = self.stage_field_id.relation for r in self.env[stage_model].browse(stage_ids): - stages.append({'id': r.id, 'name':r.name_get()[0][1]}) + stages.append({'id': r.id, 'name': r.name_get()[0][1]}) value_field_name = self.value_field_id.name for stage in stages: d = copy.copy(domain) - d.append( (self.stage_field_id.name, '=', stage['id']) ) + d.append((self.stage_field_id.name, '=', stage['id'])) result = obj.read_group(d, [value_field_name], []) stage['closed_value'] = result and result[0][value_field_name] or 0.0 stage['domain'] = str(d) @@ -189,7 +192,7 @@ Slice - use "domain" for total and "won_domain" for target d = domain + won_domain result = obj.read_group(domain, [value_field_name], []) won = {'name': _('Won'), - 'id':'__won__', + 'id': '__won__', 'closed_value': result and result[0][value_field_name] or 0.0 } stages.append(won) @@ -200,7 +203,7 @@ Slice - use "domain" for total and "won_domain" for target total_value = stages[0]['abs_value'] precision = self.precision for s in stages: - s['rel_value'] = round(100*s['abs_value']/total_value/precision)*precision if total_value else 100 + s['rel_value'] = round(100 * s['abs_value'] / total_value / precision) * precision if total_value else 100 # dummy fields s['display_mode'] = 'progress' s['monetary'] = 1 @@ -210,7 +213,7 @@ Slice - use "domain" for total and "won_domain" for target res['conversion_rate'] = stages[-1]['rel_value'] elif self.type == 'slice': value_field_name = self.value_field_id.name - for f,d in [('total', domain), ('won', won_domain)]: + for f, d in [('total', domain), ('won', won_domain)]: result = obj.read_group(d, [value_field_name], []) res[f] = result and result[0][value_field_name] or 0.0 @@ -219,12 +222,13 @@ Slice - use "domain" for total and "won_domain" for target precision = self.precision total_value = res['total'] - res['slice'] = round(100*res['won']/res['total']/precision)*precision if res['total'] else 100 + res['slice'] = round(100 * res['won'] / res['total'] / precision) * precision if res['total'] else 100 # dummy fields res['display_mode'] = 'progress' res['monetary'] = self.value_field_monetary return res + class mail_wall_widgets_cache(models.Model): _name = 'mail.wall.widgets.cache' @@ -233,6 +237,7 @@ class mail_wall_widgets_cache(models.Model): res_model = fields.Integer('Resource Model') user_id = fields.Many2one('res.users') + class res_users(models.Model): _inherit = 'res.users' @@ -258,7 +263,7 @@ class res_users(models.Model): domain = [('group_ids', 'in', user.groups_id.ids), ('active', '=', True)] for widget in self.env[model].search(domain, order='sequence'): if widget.cache: - #TODO + # TODO continue res.append({ 'model': model, @@ -268,7 +273,7 @@ class res_users(models.Model): }) return res - #def get_challenge_suggestions(self, cr, uid, context=None): + # def get_challenge_suggestions(self, cr, uid, context=None): # """Return the list of challenges suggested to the user""" # challenge_info = [] # challenge_obj = self.pool.get('mail_wall_widgets.challenge') diff --git a/mail_wall_widgets/static/src/js/main.js b/mail_wall_widgets/static/src/js/main.js index ac91048..d7ca39c 100644 --- a/mail_wall_widgets/static/src/js/main.js +++ b/mail_wall_widgets/static/src/js/main.js @@ -8,13 +8,13 @@ openerp.mail_wall_widgets = function(instance) { var self = this; this._super(parent, action); this.deferred = $.Deferred(); - self.money_df = $.Deferred() + self.money_df = $.Deferred(); self.money_df.resolve(); - self.money_cache = {} + self.money_cache = {}; //$(document).off('keydown.klistener'); this.widget_templates = { 'mail.wall.widgets.widget': "mail_wall_widgets.Widget" - } + }; }, events: { 'click .oe_open_record': function(event){ @@ -27,7 +27,7 @@ openerp.mail_wall_widgets = function(instance) { 'target': 'current', 'views': [[false, 'form'],[false, 'list']], 'domain': $t.parent().parent().attr('data-domain'), - }) + }); }, 'click .oe_open_record_list': function(event){ var $t = $(event.currentTarget); @@ -38,7 +38,7 @@ openerp.mail_wall_widgets = function(instance) { 'target': 'current', 'views': [[false, 'list'],[false, 'form']], 'domain': $t.parent().attr('data-domain'), - }) + }); }, 'click .oe_open_record_list_funnel': function(event){ var $t = $(event.currentTarget); @@ -49,7 +49,7 @@ openerp.mail_wall_widgets = function(instance) { 'target': 'current', 'views': [[false, 'list'],[false, 'form']], 'domain': $t.attr('data-domain'), - }) + }); }, }, start: function() { @@ -97,18 +97,18 @@ openerp.mail_wall_widgets = function(instance) { self.money_df = self.money_df.then(function(){ var callback = function(){ - money_field.set({'currency_info': self.money_cache[currency_id]}) - } + money_field.set({'currency_info': self.money_cache[currency_id]}); + }; if (self.money_cache[currency_id]){ callback(); return; } - var req = new instance.web.Model("res.currency").query(["symbol", "position"]).filter([["id", "=", currency_id]]).first() + var req = new instance.web.Model("res.currency").query(["symbol", "position"]).filter([["id", "=", currency_id]]).first(); return req.then(function(res){ self.money_cache[currency_id] = res; callback(); - }) - }) + }); + }); }); }, render_float_fields: function(item) { @@ -123,8 +123,8 @@ openerp.mail_wall_widgets = function(instance) { if (precision && precision<1) digits[1] = ($(this).attr('data-precision') || '0.01').slice(2).indexOf('1')+1; - value = instance.web.format_value(parseFloat(value), {type: "float", digits: digits}, '') - $(this).text(value) + value = instance.web.format_value(parseFloat(value), {type: "float", digits: digits}, ''); + $(this).text(value); }); }, render_user_avatars: function(item) { diff --git a/mail_wall_widgets/static/src/xml/main.xml b/mail_wall_widgets/static/src/xml/main.xml index c9de717..b387fbf 100644 --- a/mail_wall_widgets/static/src/xml/main.xml +++ b/mail_wall_widgets/static/src/xml/main.xml @@ -13,10 +13,10 @@
-
-
- -
+
+
+ +
@@ -27,17 +27,17 @@
- -
No records
-
-
+ +
No records
+
+
-
+
-
- More... -
-
+
+ More... +
+
@@ -57,7 +57,7 @@
- +
diff --git a/mail_wall_widgets/views.xml b/mail_wall_widgets/views.xml index 2c2c4e8..b0e4344 100644 --- a/mail_wall_widgets/views.xml +++ b/mail_wall_widgets/views.xml @@ -1,14 +1,14 @@ - + - + Widgets mail.wall.widgets.widget @@ -47,7 +47,7 @@ - +