From 6ac583c0f775475bcb9f62c9c10619970a3f6068 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Fri, 17 Aug 2012 13:19:36 +0200 Subject: [PATCH] [IMP] mail cleaning bzr revid: fp@tinyerp.com-20120817111936-2d33nlqlbvkjb374 --- .../account_accountant_data.xml | 2 +- .../account_voucher/account_voucher_data.xml | 2 +- addons/crm/crm_data.xml | 2 +- addons/event/event_data.xml | 2 +- addons/hr/hr_data.xml | 2 +- addons/hr_evaluation/hr_evaluation_data.xml | 2 +- addons/hr_expense/hr_expense_data.xml | 2 +- addons/hr_holidays/hr_holidays_data.xml | 2 +- addons/hr_recruitment/hr_recruitment_data.xml | 2 +- .../hr_timesheet_sheet_data.xml | 2 +- addons/mail/__init__.py | 2 +- addons/mail/data/mail_group_data.xml | 2 +- addons/mail/mail_followers.py | 9 ++++----- addons/mail/mail_message.py | 19 +++++++++++++++++-- addons/mail/mail_thread.py | 10 +++++----- addons/mail/static/src/js/mail.js | 2 +- addons/mrp/mrp_data.xml | 2 +- addons/point_of_sale/point_of_sale_data.xml | 2 +- addons/project/project_data.xml | 2 +- addons/project_gtd/project_gtd_data.xml | 2 +- addons/project_issue/project_issue_data.xml | 2 +- addons/purchase/purchase_data.xml | 2 +- addons/sale/sale_data.xml | 2 +- addons/stock/stock_data.xml | 2 +- 24 files changed, 47 insertions(+), 33 deletions(-) diff --git a/addons/account_accountant/account_accountant_data.xml b/addons/account_accountant/account_accountant_data.xml index b44b78c9257..d8adba25196 100644 --- a/addons/account_accountant/account_accountant_data.xml +++ b/addons/account_accountant/account_accountant_data.xml @@ -23,7 +23,7 @@ - + With OpenERP's accounting, you can get an instant access to all your financial data, setup your analytic accounting, forecast your taxes, control your budgets, easily create and send invoices, record bank statements, etc. diff --git a/addons/account_voucher/account_voucher_data.xml b/addons/account_voucher/account_voucher_data.xml index 4edbd95ab3d..b497f4ee20e 100644 --- a/addons/account_voucher/account_voucher_data.xml +++ b/addons/account_voucher/account_voucher_data.xml @@ -2,7 +2,7 @@ - + OpenERP's electronic invoicing allows to ease and fasten the creation of invoices and collection of customer payments. Invoices are created in a few clicks and your customers receive them by email. They can pay online and/or import them in their own system. diff --git a/addons/crm/crm_data.xml b/addons/crm/crm_data.xml index 119d76d1dae..52d779f4584 100644 --- a/addons/crm/crm_data.xml +++ b/addons/crm/crm_data.xml @@ -55,7 +55,7 @@ - + From the top menu Sales, you can: trace leads and opportunities, get accurate forecast on your sales pipeline, plan meetings and phonecalls, get realtime statistics and efficiently organize the communication with your prospects. diff --git a/addons/event/event_data.xml b/addons/event/event_data.xml index 8eb1fa09f65..83af2f35cfb 100644 --- a/addons/event/event_data.xml +++ b/addons/event/event_data.xml @@ -14,7 +14,7 @@ - + From the top menu Events, you can organize events, manage registrations, automate communication around your event and sell events through your quotations. diff --git a/addons/hr/hr_data.xml b/addons/hr/hr_data.xml index a3082896a6f..0f5bbdf2d26 100644 --- a/addons/hr/hr_data.xml +++ b/addons/hr/hr_data.xml @@ -2,7 +2,7 @@ - + Manage your human resources in OpenERP: employees and hierarchy, HR departments and jobs. diff --git a/addons/hr_evaluation/hr_evaluation_data.xml b/addons/hr_evaluation/hr_evaluation_data.xml index ab823aa9e4f..6f122e44e9b 100644 --- a/addons/hr_evaluation/hr_evaluation_data.xml +++ b/addons/hr_evaluation/hr_evaluation_data.xml @@ -14,7 +14,7 @@ 100 - + Create evaluations for your subordinates or manager. You can define a plan with several surveys, where you organize evaluation surveys related to the hierarchy levels. Evaluations filled by employees can exported as pdf files. diff --git a/addons/hr_expense/hr_expense_data.xml b/addons/hr_expense/hr_expense_data.xml index 285c9313218..d5123df7ee8 100644 --- a/addons/hr_expense/hr_expense_data.xml +++ b/addons/hr_expense/hr_expense_data.xml @@ -2,7 +2,7 @@ - + Manage your employee's expenses, with validations by employee manager and accountant, creation and payment of invoices. diff --git a/addons/hr_holidays/hr_holidays_data.xml b/addons/hr_holidays/hr_holidays_data.xml index d9a37767848..5c8e4922259 100644 --- a/addons/hr_holidays/hr_holidays_data.xml +++ b/addons/hr_holidays/hr_holidays_data.xml @@ -13,7 +13,7 @@ 100 - + Manage employee leaves from the top menu "Human Resources". Employees can create leave requests that are validated by their manager and/or HR people. Once validated, they are visible in the employee's calendar. HR people can define leave types and allocate off-days for employees. diff --git a/addons/hr_recruitment/hr_recruitment_data.xml b/addons/hr_recruitment/hr_recruitment_data.xml index 8dec740c15c..58a0595c857 100644 --- a/addons/hr_recruitment/hr_recruitment_data.xml +++ b/addons/hr_recruitment/hr_recruitment_data.xml @@ -2,7 +2,7 @@ - + Manage job positions and the recruitment process in your company. This module is integrated with the module Survey to help you to define interviews for different jobs. diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml index f121c1ec2ea..6ecb8c294e2 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_data.xml @@ -2,7 +2,7 @@ - + From the top menu "Human Resources", encode and validate timesheets and attendances. diff --git a/addons/mail/__init__.py b/addons/mail/__init__.py index cba9cfe1fe7..da517ee17ad 100644 --- a/addons/mail/__init__.py +++ b/addons/mail/__init__.py @@ -20,9 +20,9 @@ ############################################################################## import mail_alias +import mail_followers import mail_message import mail_mail -import mail_followers import mail_thread import mail_group import res_partner diff --git a/addons/mail/data/mail_group_data.xml b/addons/mail/data/mail_group_data.xml index 10a94fd42f5..a577007bc35 100644 --- a/addons/mail/data/mail_group_data.xml +++ b/addons/mail/data/mail_group_data.xml @@ -13,7 +13,7 @@ - + Your homepage is a summary of messages you received and key information about documents you follow. diff --git a/addons/mail/mail_followers.py b/addons/mail/mail_followers.py index dcace5c0344..54bf2a93225 100644 --- a/addons/mail/mail_followers.py +++ b/addons/mail/mail_followers.py @@ -45,9 +45,8 @@ class mail_followers(osv.Model): ondelete='cascade', required=True, select=1), } + class mail_notification(osv.Model): - """ mail_notification is a relational table modeling messages pushed to partners. - """ _name = 'mail.notification' _rec_name = 'partner_id' _log_access = False @@ -55,14 +54,14 @@ class mail_notification(osv.Model): _columns = { 'partner_id': fields.many2one('res.partner', string='Contact', ondelete='cascade', required=True, select=1), - 'message_id': fields.many2one('mail.message', string='Message', - ondelete='cascade', required=True, select=1), 'read': fields.boolean('Read'), + # this will be added in mail_message.py + #'message_id': fields.many2one('mail.message', string='Message', + # ondelete='cascade', required=True, select=1), } _defaults = { 'read': False, } - # FP Note: todo: check that we can not create a notification for # a message we can not read. # def create(self, ...) diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index 846ba739843..3d6d8bf76cc 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -45,7 +45,6 @@ def decode(text): if text: text = decode_header(text.replace('\r', '')) return ''.join([tools.ustr(x[0], x[1]) for x in text]) - class mail_message(osv.Model): """Model holding messages: system notification (replacing res.log notifications), comments (for OpenChatter feature). This model also @@ -112,9 +111,13 @@ class mail_message(osv.Model): 'message_id': fields.char('Message-Id', size=256, help='Message unique identifier', select=1, readonly=1), 'body': fields.html('Content', required=True), } + def _get_default_author(self, cr, uid, context={}): + return self.pool.get('res.users').browse(cr, uid, uid, context=context).partner_id.id + _defaults = { 'type': 'email', 'date': lambda *a: fields.datetime.now(), + 'author_id': _get_default_author } #------------------------------------------------------ @@ -174,7 +177,9 @@ class mail_message(osv.Model): notification_obj = self.pool.get('mail.notification') modobj = self.pool.get(values.get('model')) follower_notify = [] - for follower in modobj.message_follower_ids: + print values.get('res_id'), '**' + print modobj.browse(cr, uid, values.get('res_id'), context=context) + for follower in modobj.browse(cr, uid, values.get('res_id'), context=context).message_follower_ids: if follower.id <> uid: follower_notify.append(follower.id) self.pool.get('mail.notification').notify(cr, uid, follower_notify, newid, context=context) @@ -202,3 +207,13 @@ class mail_message(osv.Model): return super(mail_message, self).unlink(cr, uid, ids, context) +class mail_notification(osv.Model): + """ mail_notification is a relational table modeling messages pushed to partners. + """ + _inherit = 'mail.notification' + _columns = { + 'message_id': fields.many2one('mail.message', string='Message', + ondelete='cascade', required=True, select=1), + } + + diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 7f88ec2093a..c9fad981dcb 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -109,7 +109,7 @@ class mail_thread(osv.Model): _columns = { 'message_is_follower': fields.function(_get_is_follower, type='boolean', string='Is a Follower'), - 'message_follower_ids': fields.one2many('mail.subscription', 'res_id', + 'message_follower_ids': fields.many2many('res.partner', 'mail_subscription', 'res_id', 'partner_id', domain=lambda self: [('res_model','=',self._name)], string='Followers'), 'message_ids': fields.one2many('mail.message', 'res_id', @@ -749,7 +749,7 @@ class mail_thread(osv.Model): module instead of by the res.log mechanism. Please \ use the mail.thread OpenChatter API instead of the \ now deprecated res.log.") - self.message_post(cr, uid, [id], message, context=context) + self.message_post(cr, uid, id, message, context=context) def message_post(self, cr, uid, res_id, body, subject=False, mtype='notification', attachments=None, context=None, **kwargs): @@ -757,7 +757,7 @@ class mail_thread(osv.Model): context = context or {} attachments = attachments or {} if type(res_id) in (list, tuple): - res_is = res_id[0] + res_id = res_id[0] to_attach = [] for fname, fcontent in attachments: @@ -773,12 +773,12 @@ class mail_thread(osv.Model): value = kwargs value.update( { - 'res_model': self._name, + 'model': self._name, 'res_id': res_id, 'body': body, 'subject': subject, 'type': mtype, - 'attachment_ids': data_attach + 'attachment_ids': to_attach }) return self.pool.get('mail.message').create(cr, uid, value, context=context) diff --git a/addons/mail/static/src/js/mail.js b/addons/mail/static/src/js/mail.js index 16404b28594..580c71e30cb 100644 --- a/addons/mail/static/src/js/mail.js +++ b/addons/mail/static/src/js/mail.js @@ -778,7 +778,7 @@ openerp.mail = function(session) { var comment_node = this.$element.find('textarea'); var body_text = comment_node.val(); comment_node.val(''); - return this.ds.call('message_append_note', [[this.params.res_id], '', body_text, this.params.parent_id, 'comment', 'plain']).then( + return this.ds.call('message_post', [[this.params.res_id], body_text], {parent_id: this.params.parent_id, mtype: 'comment'}).then( this.proxy('init_comments')); }, diff --git a/addons/mrp/mrp_data.xml b/addons/mrp/mrp_data.xml index 520e4038d4b..d8d7d2063dc 100644 --- a/addons/mrp/mrp_data.xml +++ b/addons/mrp/mrp_data.xml @@ -2,7 +2,7 @@ - + Manage your manufacturing process in OpenERP by defining bill of materials (BoM), routings and work centers. This module supports complete integration and planification of stockable goods, consumable, and services. diff --git a/addons/point_of_sale/point_of_sale_data.xml b/addons/point_of_sale/point_of_sale_data.xml index 628b4191f97..33ea01a6f5e 100644 --- a/addons/point_of_sale/point_of_sale_data.xml +++ b/addons/point_of_sale/point_of_sale_data.xml @@ -24,7 +24,7 @@ - + Encode sale orders, register payments, compute money to return, create invoices, and manage refunds of former sales through a specific, web-based, touch-screen user interface. diff --git a/addons/project/project_data.xml b/addons/project/project_data.xml index 6c81b5be2e4..d661ad2b68c 100644 --- a/addons/project/project_data.xml +++ b/addons/project/project_data.xml @@ -85,7 +85,7 @@ - + Manage multi-level projects and tasks. You can delegate tasks, track the work done on tasks, and review your planning based on the entered data. diff --git a/addons/project_gtd/project_gtd_data.xml b/addons/project_gtd/project_gtd_data.xml index 2d588fc9c62..d46bc0fda14 100644 --- a/addons/project_gtd/project_gtd_data.xml +++ b/addons/project_gtd/project_gtd_data.xml @@ -26,7 +26,7 @@ - + Add todo items on project tasks, to help you organize your work. This module supports the methodology Getting Things Done (GTD), created by David Allen, and described in the book of the same name. diff --git a/addons/project_issue/project_issue_data.xml b/addons/project_issue/project_issue_data.xml index beee0b0021d..5df09b683ca 100644 --- a/addons/project_issue/project_issue_data.xml +++ b/addons/project_issue/project_issue_data.xml @@ -32,7 +32,7 @@ - + Manage the issues you might face in a project, like bugs in a system, client complaints or material breakdowns. You can record issues, assign them to some responsible person, and keep track of their status as they evolve over time. diff --git a/addons/purchase/purchase_data.xml b/addons/purchase/purchase_data.xml index 7b88f3705ed..802f415d01f 100644 --- a/addons/purchase/purchase_data.xml +++ b/addons/purchase/purchase_data.xml @@ -3,7 +3,7 @@ - + From the top menu Purchases, create purchase orders to buy products from your suppliers, encode supplier invoices and manage your payments. diff --git a/addons/sale/sale_data.xml b/addons/sale/sale_data.xml index 4acbd55eaaa..95d7b6d21e2 100644 --- a/addons/sale/sale_data.xml +++ b/addons/sale/sale_data.xml @@ -41,7 +41,7 @@ - + This modules allows you to create and send easily quotations and process your sales orders; from the delivery to the invoicing. diff --git a/addons/stock/stock_data.xml b/addons/stock/stock_data.xml index 9257f4cfb9b..282929ea6fb 100644 --- a/addons/stock/stock_data.xml +++ b/addons/stock/stock_data.xml @@ -2,7 +2,7 @@ - + Manage your product inventoy and stock locations. You can control your stock moves history and planning, perform stock valuation, and trace product lots upstream and downstream (based on serial numbers.)