From bbdac458fdbd5ece78fc674767177f91b045e4bc Mon Sep 17 00:00:00 2001 From: "YSA (Openerp)" Date: Fri, 4 Feb 2011 11:48:19 +0530 Subject: [IMP] call email_send method of email.message object insted of tools. bzr revid: ysa@tinyerp.com-20110204061819-bb3p94bs7og680je --- addons/share/wizard/share_wizard.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'addons/share/wizard/share_wizard.py') diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py index 48243c57dda..af0758b5c21 100644 --- a/addons/share/wizard/share_wizard.py +++ b/addons/share/wizard/share_wizard.py @@ -171,7 +171,7 @@ class share_create(osv.osv_memory): during recursion @param suffix: optional suffix to append to the field path to reach the main object """ - + if relation_fields is None: relation_fields = [] local_rel_fields = [] @@ -222,7 +222,7 @@ class share_create(osv.osv_memory): """ model_access_obj = self.pool.get('ir.model.access') user_obj = self.pool.get('res.users') - target_model_ids = [x[1].id for x in fields_relations] + target_model_ids = [x[1].id for x in fields_relations] perms_to_add = (mode == 'readonly') and READ_ONLY_ACCESS or FULL_ACCESS current_user = user_obj.browse(cr, uid, uid, context=context) @@ -296,7 +296,7 @@ class share_create(osv.osv_memory): related_domain = [] for element in domain: if domain_expr._is_leaf(element): - left, operator, right = element + left, operator, right = element left = '%s.%s'%(rel_field, left) element = left, operator, right related_domain.append(element) @@ -368,7 +368,7 @@ class share_create(osv.osv_memory): user_obj.write(cr, 1, user_ids, { 'groups_id': [(4,group_id)], }) - self._setup_action_and_shortcut(cr, uid, wizard_data, user_ids, + self._setup_action_and_shortcut(cr, uid, wizard_data, user_ids, (wizard_data.user_type == 'new'), context=context) @@ -388,7 +388,7 @@ class share_create(osv.osv_memory): obj0, obj1, obj2, obj3 = self._get_relationship_classes(cr, uid, model, context=context) mode = wizard_data.access_mode - # Add access to [obj0] and [obj1] according to chosen mode + # Add access to [obj0] and [obj1] according to chosen mode self._add_access_rights_for_share_group(cr, uid, group_id, mode, obj0, context=context) self._add_access_rights_for_share_group(cr, uid, group_id, mode, obj1, context=context) @@ -399,18 +399,18 @@ class share_create(osv.osv_memory): # IR.RULES # A. On [obj0]: 1 rule with domain of shared action - # B. For each model in [obj1]: 1 rule in the form: + # B. For each model in [obj1]: 1 rule in the form: # many2one_rel.domain_of_obj0 # where many2one_rel is the many2one used in the definition of the # one2many, and domain_of_obj0 is the sharing domain - # For example if [obj0] is project.project with a domain of + # For example if [obj0] is project.project with a domain of # ['id', 'in', [1,2]] - # then we will have project.task in [obj1] and we need to create this + # then we will have project.task in [obj1] and we need to create this # ir.rule on project.task: # ['project_id.id', 'in', [1,2]] - # C. And on [obj0], [obj1], [obj2], [obj3]: add all rules from all groups of - # the user that is sharing - # (Warning: rules must be copied instead of linked if they contain a reference + # C. And on [obj0], [obj1], [obj2], [obj3]: add all rules from all groups of + # the user that is sharing + # (Warning: rules must be copied instead of linked if they contain a reference # to uid, and it must be replaced correctly) rule_obj = self.pool.get('ir.rule') # A. @@ -443,6 +443,7 @@ class share_create(osv.osv_memory): } def send_emails(self, cr, uid, ids, context=None): + email_message_obj = self.pool.get('email.message') user = self.pool.get('res.users').browse(cr, uid, uid, context=context) if not user.user_email: raise osv.except_osv(_('Email required'), _('The current user must have an email address configured in User Preferences to be able to send outgoing emails.')) @@ -462,11 +463,12 @@ class share_create(osv.osv_memory): body += _("This additional data has been automatically added to your current access.\n") body += _("You may use your existing login and password to view it. As a reminder, your login is %s.\n") % result_line.login - if not tools.email_send( + if not email_message_obj.email_send( user.user_email, [email_to], subject, - body): + body, + model='share.wizard'): self.__logger.warning('Failed to send sharing email from %s to %s', user.user_email, email_to) return {'type': 'ir.actions.act_window_close'} share_create() -- cgit v1.2.3 From 5140ae0d981a008d127b14bd00b7fe4af6bcbf01 Mon Sep 17 00:00:00 2001 From: "YSA (Openerp)" Date: Fri, 4 Feb 2011 11:59:34 +0530 Subject: [IMP] add email module depedancy in related module. bzr revid: ysa@tinyerp.com-20110204062934-yf8in8dzu15vdmeh --- addons/share/wizard/share_wizard.py | 1 - 1 file changed, 1 deletion(-) (limited to 'addons/share/wizard/share_wizard.py') diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py index af0758b5c21..4dc1898a3ea 100644 --- a/addons/share/wizard/share_wizard.py +++ b/addons/share/wizard/share_wizard.py @@ -22,7 +22,6 @@ import logging import random import time -import tools from osv import osv, fields from osv.expression import expression from tools.translate import _ -- cgit v1.2.3 From 659900e4d5c256dedf78c13d227d9afab379499e Mon Sep 17 00:00:00 2001 From: "Yogesh (OpenERP)" Date: Wed, 9 Feb 2011 14:48:48 +0530 Subject: [IMP] add argument in email_send method of addons module. bzr revid: ysa@tinyerp.com-20110209091848-tb1d9qcj9bz3iq2b --- addons/share/wizard/share_wizard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/share/wizard/share_wizard.py') diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py index 4dc1898a3ea..02cbda31a1e 100644 --- a/addons/share/wizard/share_wizard.py +++ b/addons/share/wizard/share_wizard.py @@ -462,7 +462,7 @@ class share_create(osv.osv_memory): body += _("This additional data has been automatically added to your current access.\n") body += _("You may use your existing login and password to view it. As a reminder, your login is %s.\n") % result_line.login - if not email_message_obj.email_send( + if not email_message_obj.email_send(cr, uid, user.user_email, [email_to], subject, -- cgit v1.2.3 From 2fe7c51e361ade79eef9af67f11a96a5fc24b035 Mon Sep 17 00:00:00 2001 From: "Rifakat Haradwala (Open ERP)" Date: Mon, 21 Mar 2011 19:01:56 +0530 Subject: [REM] email.smtp_server: removed email.smtp_server and did changes in email module bzr revid: rha@tinyerp.com-20110321133156-y57yw6sekshnw9ns --- addons/share/wizard/share_wizard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/share/wizard/share_wizard.py') diff --git a/addons/share/wizard/share_wizard.py b/addons/share/wizard/share_wizard.py index 02cbda31a1e..32b1b51d598 100644 --- a/addons/share/wizard/share_wizard.py +++ b/addons/share/wizard/share_wizard.py @@ -462,7 +462,7 @@ class share_create(osv.osv_memory): body += _("This additional data has been automatically added to your current access.\n") body += _("You may use your existing login and password to view it. As a reminder, your login is %s.\n") % result_line.login - if not email_message_obj.email_send(cr, uid, + if not email_message_obj.schedule_with_attach(cr, uid, user.user_email, [email_to], subject, -- cgit v1.2.3