[IMP] add argument in email_send method of addons module.
bzr revid: ysa@tinyerp.com-20110209091848-tb1d9qcj9bz3iq2b
This commit is contained in:
parent
ab8194f033
commit
659900e4d5
|
@ -277,7 +277,7 @@ class account_followup_print_all(osv.osv_memory):
|
|||
msg = ''
|
||||
if dest:
|
||||
try:
|
||||
email_message_obj.email_send(src, dest, sub, body, model='account.followup.print.all')
|
||||
email_message_obj.email_send(cr, uid, src, dest, sub, body, model='account.followup.print.all')
|
||||
msg_sent += partner.name + '\n'
|
||||
except Exception, e:
|
||||
raise osv.except_osv('Error !', e )
|
||||
|
|
|
@ -24,7 +24,7 @@ from tools.translate import _
|
|||
from datetime import datetime
|
||||
from datetime import timedelta
|
||||
from tools.safe_eval import safe_eval
|
||||
import pooler
|
||||
import pooler
|
||||
import re
|
||||
import time
|
||||
import tools
|
||||
|
@ -39,7 +39,7 @@ class base_action_rule(osv.osv):
|
|||
|
||||
_name = 'base.action.rule'
|
||||
_description = 'Action Rules'
|
||||
|
||||
|
||||
def _state_get(self, cr, uid, context=None):
|
||||
""" Get State
|
||||
@param self: The object pointer
|
||||
|
@ -55,7 +55,7 @@ class base_action_rule(osv.osv):
|
|||
@param uid: the current user’s ID for security checks,
|
||||
@param context: A standard dictionary for contextual values """
|
||||
return [('', '')]
|
||||
|
||||
|
||||
def priority_get(self, cr, uid, context=None):
|
||||
""" Get Priority
|
||||
@param self: The object pointer
|
||||
|
@ -65,57 +65,57 @@ class base_action_rule(osv.osv):
|
|||
return [('', '')]
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Rule Name', size=64, required=True),
|
||||
'model_id': fields.many2one('ir.model', 'Object', required=True),
|
||||
'create_date': fields.datetime('Create Date', readonly=1),
|
||||
'name': fields.char('Rule Name', size=64, required=True),
|
||||
'model_id': fields.many2one('ir.model', 'Object', required=True),
|
||||
'create_date': fields.datetime('Create Date', readonly=1),
|
||||
'active': fields.boolean('Active', help="If the active field is set to False,\
|
||||
it will allow you to hide the rule without removing it."),
|
||||
it will allow you to hide the rule without removing it."),
|
||||
'sequence': fields.integer('Sequence', help="Gives the sequence order \
|
||||
when displaying a list of rules."),
|
||||
when displaying a list of rules."),
|
||||
'trg_date_type': fields.selection([
|
||||
('none', 'None'),
|
||||
('create', 'Creation Date'),
|
||||
('action_last', 'Last Action Date'),
|
||||
('date', 'Date'),
|
||||
('deadline', 'Deadline'),
|
||||
], 'Trigger Date', size=16),
|
||||
('none', 'None'),
|
||||
('create', 'Creation Date'),
|
||||
('action_last', 'Last Action Date'),
|
||||
('date', 'Date'),
|
||||
('deadline', 'Deadline'),
|
||||
], 'Trigger Date', size=16),
|
||||
'trg_date_range': fields.integer('Delay after trigger date', \
|
||||
help="Delay After Trigger Date,\
|
||||
specifies you can put a negative number. If you need a delay before the \
|
||||
trigger date, like sending a reminder 15 minutes before a meeting."),
|
||||
trigger date, like sending a reminder 15 minutes before a meeting."),
|
||||
'trg_date_range_type': fields.selection([('minutes', 'Minutes'), ('hour', 'Hours'), \
|
||||
('day', 'Days'), ('month', 'Months')], 'Delay type'),
|
||||
'trg_user_id': fields.many2one('res.users', 'Responsible'),
|
||||
'trg_partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'trg_partner_categ_id': fields.many2one('res.partner.category', 'Partner Category'),
|
||||
'trg_state_from': fields.selection(_state_get, 'State', size=16),
|
||||
'trg_state_to': fields.selection(_state_get, 'Button Pressed', size=16),
|
||||
('day', 'Days'), ('month', 'Months')], 'Delay type'),
|
||||
'trg_user_id': fields.many2one('res.users', 'Responsible'),
|
||||
'trg_partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'trg_partner_categ_id': fields.many2one('res.partner.category', 'Partner Category'),
|
||||
'trg_state_from': fields.selection(_state_get, 'State', size=16),
|
||||
'trg_state_to': fields.selection(_state_get, 'Button Pressed', size=16),
|
||||
|
||||
'act_method': fields.char('Call Object Method', size=64),
|
||||
'act_user_id': fields.many2one('res.users', 'Set Responsible to'),
|
||||
'act_state': fields.selection(_state_get, 'Set State to', size=16),
|
||||
'act_method': fields.char('Call Object Method', size=64),
|
||||
'act_user_id': fields.many2one('res.users', 'Set Responsible to'),
|
||||
'act_state': fields.selection(_state_get, 'Set State to', size=16),
|
||||
'act_email_cc': fields.char('Add Watchers (Cc)', size=250, help="\
|
||||
These people will receive a copy of the future communication between partner \
|
||||
and users by email"),
|
||||
and users by email"),
|
||||
'act_remind_partner': fields.boolean('Remind Partner', help="Check \
|
||||
this if you want the rule to send a reminder by email to the partner."),
|
||||
this if you want the rule to send a reminder by email to the partner."),
|
||||
'act_remind_user': fields.boolean('Remind Responsible', help="Check \
|
||||
this if you want the rule to send a reminder by email to the user."),
|
||||
'act_reply_to': fields.char('Reply-To', size=64),
|
||||
'act_remind_attach': fields.boolean('Remind with Attachment', help="Check this if you want that all documents attached to the object be attached to the reminder email sent."),
|
||||
this if you want the rule to send a reminder by email to the user."),
|
||||
'act_reply_to': fields.char('Reply-To', size=64),
|
||||
'act_remind_attach': fields.boolean('Remind with Attachment', help="Check this if you want that all documents attached to the object be attached to the reminder email sent."),
|
||||
'act_mail_to_user': fields.boolean('Mail to Responsible', help="Check\
|
||||
this if you want the rule to send an email to the responsible person."),
|
||||
'act_mail_to_watchers': fields.boolean('Mail to Watchers (CC)',
|
||||
this if you want the rule to send an email to the responsible person."),
|
||||
'act_mail_to_watchers': fields.boolean('Mail to Watchers (CC)',
|
||||
help="Check this if you want \
|
||||
the rule to mark CC(mail to any other person defined in actions)."),
|
||||
the rule to mark CC(mail to any other person defined in actions)."),
|
||||
'act_mail_to_email': fields.char('Mail to these Emails', size=128, \
|
||||
help="Email-id of the persons whom mail is to be sent"),
|
||||
'act_mail_body': fields.text('Mail body', help="Content of mail"),
|
||||
help="Email-id of the persons whom mail is to be sent"),
|
||||
'act_mail_body': fields.text('Mail body', help="Content of mail"),
|
||||
'regex_name': fields.char('Regex on Resource Name', size=128, help="Regular expression for matching name of the resource\
|
||||
\ne.g.: 'urgent.*' will search for records having name starting with the string 'urgent'\
|
||||
\nNote: This is case sensitive search."),
|
||||
'server_action_id': fields.many2one('ir.actions.server', 'Server Action', help="Describes the action name.\neg:on which object which action to be taken on basis of which condition"),
|
||||
'filter_id':fields.many2one('ir.filters', 'Filter', required=False),
|
||||
\nNote: This is case sensitive search."),
|
||||
'server_action_id': fields.many2one('ir.actions.server', 'Server Action', help="Describes the action name.\neg:on which object which action to be taken on basis of which condition"),
|
||||
'filter_id':fields.many2one('ir.filters', 'Filter', required=False),
|
||||
'act_email_from' : fields.char('Email From', size=64, required=False,
|
||||
help="Use a python expression to specify the right field on which one than we will use for the 'From' field of the header"),
|
||||
'act_email_to' : fields.char('Email To', size=64, required=False,
|
||||
|
@ -124,17 +124,17 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
|||
}
|
||||
|
||||
_defaults = {
|
||||
'active': lambda *a: True,
|
||||
'trg_date_type': lambda *a: 'none',
|
||||
'trg_date_range_type': lambda *a: 'day',
|
||||
'act_mail_to_user': lambda *a: 0,
|
||||
'act_remind_partner': lambda *a: 0,
|
||||
'act_remind_user': lambda *a: 0,
|
||||
'act_mail_to_watchers': lambda *a: 0,
|
||||
'active': lambda *a: True,
|
||||
'trg_date_type': lambda *a: 'none',
|
||||
'trg_date_range_type': lambda *a: 'day',
|
||||
'act_mail_to_user': lambda *a: 0,
|
||||
'act_remind_partner': lambda *a: 0,
|
||||
'act_remind_user': lambda *a: 0,
|
||||
'act_mail_to_watchers': lambda *a: 0,
|
||||
}
|
||||
|
||||
|
||||
_order = 'sequence'
|
||||
|
||||
|
||||
def onchange_model_id(self, cr, uid, ids, name):
|
||||
#This is not a good solution as it will affect the domain only on onchange
|
||||
res = {'domain':{'filter_id':[]}}
|
||||
|
@ -174,7 +174,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
|||
self.pre_action(cr, uid, [new_id], model, context=context)
|
||||
return new_id
|
||||
return make_call_old
|
||||
|
||||
|
||||
def _write(self, old_write, model, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
@ -202,9 +202,9 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
|||
return True
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
res_id = super(base_action_rule, self).create(cr, uid, vals, context=context)
|
||||
self._register_hook(cr, uid, [res_id], context=context)
|
||||
self._register_hook(cr, uid, [res_id], context=context)
|
||||
return res_id
|
||||
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
res = super(base_action_rule, self).write(cr, uid, ids, vals, context=context)
|
||||
self._register_hook(cr, uid, ids, context=context)
|
||||
|
@ -272,18 +272,18 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
|||
@param self: The object pointer """
|
||||
|
||||
data = {
|
||||
'object_id': obj.id,
|
||||
'object_subject': hasattr(obj, 'name') and obj.name or False,
|
||||
'object_date': hasattr(obj, 'date') and obj.date or False,
|
||||
'object_description': hasattr(obj, 'description') and obj.description or False,
|
||||
'object_user': hasattr(obj, 'user_id') and (obj.user_id and obj.user_id.name) or '/',
|
||||
'object_id': obj.id,
|
||||
'object_subject': hasattr(obj, 'name') and obj.name or False,
|
||||
'object_date': hasattr(obj, 'date') and obj.date or False,
|
||||
'object_description': hasattr(obj, 'description') and obj.description or False,
|
||||
'object_user': hasattr(obj, 'user_id') and (obj.user_id and obj.user_id.name) or '/',
|
||||
'object_user_email': hasattr(obj, 'user_id') and (obj.user_id and \
|
||||
obj.user_id.address_id and obj.user_id.address_id.email) or '/',
|
||||
obj.user_id.address_id and obj.user_id.address_id.email) or '/',
|
||||
'object_user_phone': hasattr(obj, 'user_id') and (obj.user_id and\
|
||||
obj.user_id.address_id and obj.user_id.address_id.phone) or '/',
|
||||
'partner': hasattr(obj, 'partner_id') and (obj.partner_id and obj.partner_id.name) or '/',
|
||||
obj.user_id.address_id and obj.user_id.address_id.phone) or '/',
|
||||
'partner': hasattr(obj, 'partner_id') and (obj.partner_id and obj.partner_id.name) or '/',
|
||||
'partner_email': hasattr(obj, 'partner_address_id') and (obj.partner_address_id and\
|
||||
obj.partner_address_id.email) or '/',
|
||||
obj.partner_address_id.email) or '/',
|
||||
}
|
||||
return self.format_body(body % data)
|
||||
|
||||
|
@ -313,9 +313,9 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
|||
emailfrom = tools.ustr(emailfrom)
|
||||
reply_to = emailfrom
|
||||
if not emailfrom:
|
||||
raise osv.except_osv(_('Error!'),
|
||||
raise osv.except_osv(_('Error!'),
|
||||
_("No E-Mail ID Found for your Company address!"))
|
||||
return email_message_obj.email_send(emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, openobject_id=str(obj.id))
|
||||
return email_message_obj.email_send(cr, uid, emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, openobject_id=str(obj.id))
|
||||
|
||||
|
||||
def do_check(self, cr, uid, action, obj, context=None):
|
||||
|
@ -326,7 +326,7 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
|||
@param context: A standard dictionary for contextual values """
|
||||
if context is None:
|
||||
context = {}
|
||||
ok = True
|
||||
ok = True
|
||||
if action.filter_id:
|
||||
if action.model_id.model == action.filter_id.model_id:
|
||||
context.update(eval(action.filter_id.context))
|
||||
|
@ -481,15 +481,15 @@ the rule to mark CC(mail to any other person defined in actions)."),
|
|||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_mail, 'Error: The mail is not well formated', ['act_mail_body']),
|
||||
(_check_mail, 'Error: The mail is not well formated', ['act_mail_body']),
|
||||
]
|
||||
|
||||
base_action_rule()
|
||||
|
||||
|
||||
class ir_cron(osv.osv):
|
||||
_inherit = 'ir.cron'
|
||||
|
||||
_inherit = 'ir.cron'
|
||||
|
||||
def _poolJobs(self, db_name, check=False):
|
||||
try:
|
||||
db = pooler.get_db(db_name)
|
||||
|
|
|
@ -411,7 +411,7 @@ property or property parameter."),
|
|||
cal = vobject.iCalendar()
|
||||
event = cal.add('vevent')
|
||||
if not event_obj.date_deadline or not event_obj.date:
|
||||
raise osv.except_osv(_('Warning !'),_("Couldn't Invite because date is not specified!"))
|
||||
raise osv.except_osv(_('Warning !'),_("Couldn't Invite because date is not specified!"))
|
||||
event.add('created').value = ics_datetime(time.strftime('%Y-%m-%d %H:%M:%S'))
|
||||
event.add('dtstart').value = ics_datetime(event_obj.date)
|
||||
event.add('dtend').value = ics_datetime(event_obj.date_deadline)
|
||||
|
@ -456,7 +456,7 @@ property or property parameter."),
|
|||
trigger.value = delta
|
||||
# Compute other details
|
||||
valarm.add('DESCRIPTION').value = alarm_data['name'] or 'OpenERP'
|
||||
|
||||
|
||||
for attendee in event_obj.attendee_ids:
|
||||
attendee_add = event.add('attendee')
|
||||
attendee_add.params['CUTYPE'] = [str(attendee.cutype)]
|
||||
|
@ -507,7 +507,7 @@ property or property parameter."),
|
|||
body = html_invitation % body_vals
|
||||
if mail_to and email_from:
|
||||
attach = self.get_ics_file(cr, uid, res_obj, context=context)
|
||||
email_message_obj.email_send(
|
||||
email_message_obj.email_send(cr, uid,
|
||||
email_from,
|
||||
mail_to,
|
||||
sub,
|
||||
|
@ -676,7 +676,7 @@ true, it will allow you to hide the event alarm information without removing it.
|
|||
new_res_alarm = alarm_ids[0]
|
||||
cr.execute('UPDATE %s ' % model_obj._table + \
|
||||
' SET base_calendar_alarm_id=%s, alarm_id=%s ' \
|
||||
' WHERE id=%s',
|
||||
' WHERE id=%s',
|
||||
(cal_alarm.id, new_res_alarm, data.id))
|
||||
|
||||
self.do_alarm_unlink(cr, uid, [data.id], model)
|
||||
|
@ -893,7 +893,7 @@ From:
|
|||
for att in alarm.attendee_ids:
|
||||
mail_to.append(att.user_id.address_id.email)
|
||||
if mail_to:
|
||||
email_message_obj.email_send(
|
||||
email_message_obj.email_send(cr, uid,
|
||||
tools.config.get('email_from', False),
|
||||
mail_to,
|
||||
sub,
|
||||
|
@ -970,7 +970,7 @@ class calendar_event(osv.osv):
|
|||
value['date_deadline'] = end.strftime("%Y-%m-%d %H:%M:%S")
|
||||
elif end_date and duration and not allday:
|
||||
# we have both, keep them synchronized:
|
||||
# set duration based on end_date (arbitrary decision: this avoid
|
||||
# set duration based on end_date (arbitrary decision: this avoid
|
||||
# getting dates like 06:31:48 instead of 06:32:00)
|
||||
end = datetime.strptime(end_date, "%Y-%m-%d %H:%M:%S")
|
||||
diff = end - start
|
||||
|
@ -1134,7 +1134,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=-1SU'),
|
||||
'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \
|
||||
('weekly', 'Weekly'), ('monthly', 'Monthly'), \
|
||||
('yearly', 'Yearly'),],
|
||||
('yearly', 'Yearly'),],
|
||||
'Recurrency', states={'done': [('readonly', True)]},
|
||||
help="Let the event automatically repeat at that interval"),
|
||||
'alarm_id': fields.many2one('res.alarm', 'Alarm', states={'done': [('readonly', True)]},
|
||||
|
@ -1152,7 +1152,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
('weekly', 'Weeks'),
|
||||
('monthly', 'Months'),
|
||||
('yearly', 'Years'), ], 'Frequency'),
|
||||
|
||||
|
||||
'end_type' : fields.selection([('forever', 'Forever'), ('count', 'Fix amout of times'), ('end_date','End date')], 'Way to end reccurency'),
|
||||
'interval': fields.integer('Repeat every', help="Repeat every (Days/Week/Month/Year)"),
|
||||
'count': fields.integer('Repeat', help="Repeat x times"),
|
||||
|
@ -1163,7 +1163,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
'fr': fields.boolean('Fri'),
|
||||
'sa': fields.boolean('Sat'),
|
||||
'su': fields.boolean('Sun'),
|
||||
'select1': fields.selection([('date', 'Date of month'),
|
||||
'select1': fields.selection([('date', 'Date of month'),
|
||||
('day', 'Day of month')], 'Option'),
|
||||
'day': fields.integer('Date of month'),
|
||||
'week_list': fields.selection([('MO', 'Monday'), ('TU', 'Tuesday'), \
|
||||
|
@ -1180,8 +1180,8 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
'allday': fields.boolean('All Day', states={'done': [('readonly', True)]}),
|
||||
'active': fields.boolean('Active', help="If the active field is set to \
|
||||
true, it will allow you to hide the event alarm information without removing it."),
|
||||
'recurrency': fields.boolean('Recurrent', help="Recurrent Meeting"),
|
||||
'edit_all': fields.boolean('Edit All', help="Edit all Occurrences of recurrent Meeting."),
|
||||
'recurrency': fields.boolean('Recurrent', help="Recurrent Meeting"),
|
||||
'edit_all': fields.boolean('Edit All', help="Edit all Occurrences of recurrent Meeting."),
|
||||
}
|
||||
def default_organizer(self, cr, uid, context=None):
|
||||
user_pool = self.pool.get('res.users')
|
||||
|
@ -1208,12 +1208,12 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
def onchange_edit_all(self, cr, uid, ids, rrule_type,edit_all, context=None):
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
|
||||
value = {}
|
||||
if edit_all and rrule_type:
|
||||
for id in ids:
|
||||
base_calendar_id2real_id(id)
|
||||
return value
|
||||
return value
|
||||
|
||||
def modify_all(self, cr, uid, event_ids, defaults, context=None, *args):
|
||||
"""
|
||||
|
@ -1346,7 +1346,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
freq=datas.get('rrule_type')
|
||||
if freq == 'none':
|
||||
return ''
|
||||
|
||||
|
||||
interval_srting = datas.get('interval') and (';INTERVAL=' + str(datas.get('interval'))) or ''
|
||||
|
||||
if freq == 'weekly':
|
||||
|
@ -1362,7 +1362,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
elif datas.get('select1')=='date':
|
||||
monthstring = ';BYMONTHDAY=' + str(datas.get('day'))
|
||||
|
||||
|
||||
|
||||
if datas.get('end_date'):
|
||||
datas['end_date'] = ''.join((re.compile('\d')).findall(datas.get('end_date'))) + 'T235959Z'
|
||||
enddate = (datas.get('count') and (';COUNT=' + str(datas.get('count'))) or '') +\
|
||||
|
@ -1407,7 +1407,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
|
||||
res = self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit)
|
||||
return res
|
||||
|
||||
|
||||
|
||||
def get_edit_all(self, cr, uid, id, vals=None):
|
||||
"""
|
||||
|
@ -1418,10 +1418,10 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
if(vals and 'edit_all' in vals): #we jsut check edit_all
|
||||
return vals['edit_all']
|
||||
else: #it's a recurrent event and edit_all is already check
|
||||
return meeting['recurrency'] and meeting['edit_all']
|
||||
return meeting['recurrency'] and meeting['edit_all']
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
|
||||
"""
|
||||
|
@ -1444,12 +1444,12 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
res = False
|
||||
for event_id in select:
|
||||
real_event_id = base_calendar_id2real_id(event_id)
|
||||
|
||||
|
||||
|
||||
if(self.get_edit_all(cr, uid, event_id, vals=vals)):
|
||||
event_id = real_event_id
|
||||
|
||||
|
||||
|
||||
|
||||
if len(str(event_id).split('-')) > 1:
|
||||
data = self.read(cr, uid, event_id, ['date', 'date_deadline', \
|
||||
'rrule', 'duration', 'exdate'])
|
||||
|
@ -1463,15 +1463,15 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
'edit_all': False,
|
||||
'recurrency' : False,
|
||||
})
|
||||
|
||||
|
||||
new_id = self.copy(cr, uid, real_event_id, default=data, context=context)
|
||||
|
||||
|
||||
date_new = event_id.split('-')[1]
|
||||
date_new = time.strftime("%Y%m%dT%H%M%S", \
|
||||
time.strptime(date_new, "%Y%m%d%H%M%S"))
|
||||
exdate = (data['exdate'] and (data['exdate'] + ',') or '') + date_new
|
||||
res = self.write(cr, uid, [real_event_id], {'exdate': exdate})
|
||||
|
||||
|
||||
context.update({'active_id': new_id, 'active_ids': [new_id]})
|
||||
continue
|
||||
if not real_event_id in new_ids:
|
||||
|
@ -1594,10 +1594,10 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
|
|||
res = False
|
||||
for event_datas in self.read(cr, uid, ids, ['date', 'rrule', 'exdate'], context=context):
|
||||
event_id = event_datas['id']
|
||||
|
||||
|
||||
if self.get_edit_all(cr, uid, event_id, vals=None):
|
||||
event_id = base_calendar_id2real_id(event_id)
|
||||
|
||||
|
||||
if isinstance(event_id, (int, long)):
|
||||
res = super(calendar_event, self).unlink(cr, uid, event_id, context=context)
|
||||
self.pool.get('res.alarm').do_alarm_unlink(cr, uid, [event_id], self._name)
|
||||
|
@ -1715,7 +1715,7 @@ class calendar_todo(osv.osv):
|
|||
@param args: list of tuples of form [(‘name_of_the_field’, ‘operator’, value), ...].
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
||||
|
||||
assert name == 'date'
|
||||
return self.write(cr, uid, id, { 'date_start': value }, context=context)
|
||||
|
||||
|
@ -1747,9 +1747,9 @@ class ir_attachment(osv.osv):
|
|||
for arg in args:
|
||||
args1.append(map(lambda x:str(x).split('-')[0], arg))
|
||||
return super(ir_attachment, self).search_count(cr, user, args1, context)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context:
|
||||
id = context.get('default_res_id', False)
|
||||
|
|
|
@ -481,7 +481,7 @@ class crm_case(object):
|
|||
|
||||
# Send an email
|
||||
subject = "Reminder: [%s] %s" % (str(case.id), case.name, )
|
||||
email_message_obj.email_send(
|
||||
email_message_obj.email_send(cr, uid,
|
||||
src,
|
||||
[dest],
|
||||
subject,
|
||||
|
|
|
@ -66,7 +66,7 @@ this if you want the rule to send an email to the partner."),
|
|||
if not emailfrom:
|
||||
raise osv.except_osv(_('Error!'),
|
||||
_("No E-Mail ID Found for your Company address!"))
|
||||
return email_message_obj.email_send(emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, openobject_id=str(obj.id))
|
||||
return email_message_obj.email_send(cr, uid, emailfrom, emails, name, body, model='base.action.rule', reply_to=reply_to, openobject_id=str(obj.id))
|
||||
|
||||
def do_check(self, cr, uid, action, obj, context=None):
|
||||
""" @param self: The object pointer
|
||||
|
|
|
@ -123,7 +123,7 @@ class crm_send_new_email(osv.osv_memory):
|
|||
if obj.html:
|
||||
subtype = 'html'
|
||||
|
||||
flag = email_message_obj.email_send(
|
||||
flag = email_message_obj.email_send(cr, uid,
|
||||
email_from,
|
||||
emails,
|
||||
obj.subject,
|
||||
|
|
|
@ -25,7 +25,7 @@ from tools.translate import _
|
|||
import tools
|
||||
import netsvc
|
||||
|
||||
#import time
|
||||
import time
|
||||
#import binascii
|
||||
#import email
|
||||
#from email.header import decode_header
|
||||
|
@ -236,8 +236,8 @@ class email_message(osv.osv):
|
|||
netsvc.LOG_ERROR,
|
||||
_("Error sending mail: %s") % e)
|
||||
|
||||
def email_send(cr, uid, email_from, email_to, subject, body, model=False, email_cc=None, email_bcc=None, reply_to=False, attach=None,
|
||||
openobject_id=False, debug=False, subtype='plain', x_headers={}, priority='3'):
|
||||
def email_send(self, cr, uid, email_from, email_to, subject, body, model=False, email_cc=None, email_bcc=None, reply_to=False, attach=None,
|
||||
openobject_id=False, debug=False, subtype='plain', x_headers={}, priority='3', context=None):
|
||||
attachment_obj = self.pool.get('ir.attachment')
|
||||
msg_vals = {
|
||||
'name': subject,
|
||||
|
@ -260,6 +260,7 @@ class email_message(osv.osv):
|
|||
}
|
||||
email_msg_id = self.create(cr, uid, msg_vals, context)
|
||||
if attach:
|
||||
attachment_ids = []
|
||||
for attachment in attach:
|
||||
attachment_data = {
|
||||
'name': (subject or '') + _(' (Email Attachment)'),
|
||||
|
@ -269,10 +270,9 @@ class email_message(osv.osv):
|
|||
'res_model':'email.message',
|
||||
'res_id': email_msg_id,
|
||||
}
|
||||
attachment_id = attachment_obj.create(cr, uid, attachment_data, context)
|
||||
if attachment_id:
|
||||
self.write(cr, uid, email_msg_id,
|
||||
{ 'attachments_ids':[(4, attachment_id)] }, context)
|
||||
attachment_ids.append(attachment_obj.create(cr, uid, attachment_data, context))
|
||||
self.write(cr, uid, email_msg_id,
|
||||
{ 'attachment_ids': [[6, 0, attachment_ids]] }, context)
|
||||
return True
|
||||
|
||||
def process_email_queue(self, cr, uid, ids=None, context=None):
|
||||
|
|
|
@ -544,7 +544,7 @@ class event_registration(osv.osv):
|
|||
subject = _('Auto Confirmation: [%s] %s') %(regestration.id, regestration.name)
|
||||
body = regestration.event_id.mail_confirm
|
||||
if subject or body:
|
||||
email_message_obj.email_send(src, email_to, subject, body, model='event.registration', email_cc=email_cc, openobject_id=regestration.id)
|
||||
email_message_obj.email_send(cr, uid, src, email_to, subject, body, model='event.registration', email_cc=email_cc, openobject_id=regestration.id)
|
||||
self.history(cr, uid, [regestration], subject, history = True, \
|
||||
email=email_to, details=body, \
|
||||
subjec=subject, email_from=src, \
|
||||
|
|
|
@ -229,7 +229,7 @@ class hr_evaluation(osv.osv):
|
|||
sub = phase.email_subject
|
||||
dest = [child.work_email]
|
||||
if dest:
|
||||
email_message_obj.email_send(evaluation.employee_id.work_email, dest, sub, body, model='hr_evaluation.evaluation')
|
||||
email_message_obj.email_send(cr, uid, evaluation.employee_id.work_email, dest, sub, body, model='hr_evaluation.evaluation')
|
||||
|
||||
self.write(cr, uid, ids, {'state':'wait'}, context=context)
|
||||
return True
|
||||
|
|
|
@ -35,7 +35,7 @@ class hr_evaluation_reminder(osv.osv_memory):
|
|||
current_interview = hr_evaluation_interview_obj.browse(cr, uid, evaluation_data.get('evaluation_id'))
|
||||
if current_interview.state == "waiting_answer" and current_interview.user_to_review_id.work_email :
|
||||
msg = " Hello %s, \n\n Kindly post your response for '%s' survey interview. \n\n Thanks," %(current_interview.user_to_review_id.name, current_interview.survey_id.title)
|
||||
email_message_obj.email_send(tools.config['email_from'], [current_interview.user_to_review_id.work_email],\
|
||||
email_message_obj.email_send(cr, uid, tools.config['email_from'], [current_interview.user_to_review_id.work_email],\
|
||||
'Reminder to fill up Survey', msg, model='hr.evaluation.reminder')
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ class project_task_close(osv.osv_memory):
|
|||
to_adr.append(data.manager_email)
|
||||
if data.partner_warn and data.partner_email:
|
||||
to_adr.append(data.partner_email)
|
||||
mail_id = email_message_obj.email_send(from_adr, to_adr, subject, tools.ustr(body), model='project.task.close', email_bcc=[from_adr])
|
||||
mail_id = email_message_obj.email_send(cr, uid, from_adr, to_adr, subject, tools.ustr(body), model='project.task.close', email_bcc=[from_adr])
|
||||
if not mail_id:
|
||||
raise osv.except_osv(_('Error'), _("Couldn't send mail! Check the email ids and smtp configuration settings"))
|
||||
return {}
|
||||
|
|
|
@ -326,7 +326,7 @@ class project_scrum_meeting(osv.osv):
|
|||
body += "\n"+ _('*Tasks since yesterday:')+ '\n_______________________%s' % (meeting_id.question_yesterday) + '\n' +_("*Task for Today:")+ '\n_______________________ %s\n' % (meeting_id.question_today )+ '\n' +_('*Blocks encountered:') +'\n_______________________ %s' % (meeting_id.question_blocks or _('No Blocks'))
|
||||
body += "\n\n"+_('Thank you')+",\n"+ user.name
|
||||
sub_name = meeting_id.name or _('Scrum Meeting of %s') % meeting_id.date
|
||||
flag = email_message_obj.email_send(user_email , [email], sub_name, body, model='project.scrum.meeting', reply_to=None, openobject_id=str(meeting_id.id))
|
||||
flag = email_message_obj.email_send(cr, uid, user_email , [email], sub_name, body, model='project.scrum.meeting', reply_to=None, openobject_id=str(meeting_id.id))
|
||||
if not flag:
|
||||
return False
|
||||
return True
|
||||
|
|
|
@ -101,8 +101,8 @@ class project_scrum_email(osv.osv_memory):
|
|||
if data.scrum_master_email == data.product_owner_email:
|
||||
data.product_owner_email = False
|
||||
if data.scrum_master_email:
|
||||
email_message_obj.email_send(user_email, [data.scrum_master_email], data.subject, body, model='project.scrum.email', reply_to=user_email)
|
||||
email_message_obj.email_send(cr, uid, user_email, [data.scrum_master_email], data.subject, body, model='project.scrum.email', reply_to=user_email)
|
||||
if data.product_owner_email:
|
||||
email_message_obj.email_send(user_email, [data.product_owner_email], data.subject, body, model='project.scrum.email', reply_to=user_email)
|
||||
email_message_obj.email_send(cr, uid, user_email, [data.product_owner_email], data.subject, body, model='project.scrum.email', reply_to=user_email)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
project_scrum_email()
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -429,7 +429,7 @@ class survey_question_wiz(osv.osv_memory):
|
|||
if user_email and resp_email:
|
||||
user_name = user_obj.browse(cr, uid, uid, context=context).name
|
||||
mail = "Hello " + survey_data.responsible_id.name + ",\n\n " + str(user_name) + " Give Response Of " + survey_data.title + " Survey.\n\n Thanks,"
|
||||
email_message_obj.email_send(user_email, [resp_email], "Survey Answer Of " + str(user_name) , mail, model='survey.question.wiz', attach = attachments)
|
||||
email_message_obj.email_send(cr, uid, user_email, [resp_email], "Survey Answer Of " + str(user_name) , mail, model='survey.question.wiz', attach = attachments)
|
||||
|
||||
xml_form = etree.Element('form', {'string': _('Complete Survey Answer')})
|
||||
etree.SubElement(xml_form, 'separator', {'string': 'Complete Survey', 'colspan': "4"})
|
||||
|
|
|
@ -152,7 +152,7 @@ class survey_send_invitation(osv.osv_memory):
|
|||
mail = record['mail']%{'login':addr.email, 'passwd':user.password, \
|
||||
'name' : addr.name}
|
||||
if record['send_mail_existing']:
|
||||
email_message_obj.email_send(record['mail_from'], [addr.email] , \
|
||||
email_message_obj.email_send(cr, uid, record['mail_from'], [addr.email] , \
|
||||
record['mail_subject_existing'] , mail, model='survey.send.invitation')
|
||||
existing+= "- %s (Login: %s, Password: %s)\n" % (user.name, addr.email, \
|
||||
user.password)
|
||||
|
@ -163,7 +163,7 @@ class survey_send_invitation(osv.osv_memory):
|
|||
mail = record['mail']%{'login': user_email.login, \
|
||||
'passwd': user_email.password, 'name': addr.name}
|
||||
if record['send_mail_existing']:
|
||||
email_message_obj.email_send(record['mail_from'], [addr.email],\
|
||||
email_message_obj.email_send(cr, uid, record['mail_from'], [addr.email],\
|
||||
record['mail_subject_existing'], mail, model='survey.send.invitation')
|
||||
res_user+= "- %s (Login: %s, Password: %s)\n" % \
|
||||
(user_email.name, user_email.login, user_email.password)
|
||||
|
@ -172,7 +172,7 @@ class survey_send_invitation(osv.osv_memory):
|
|||
out+= addr.email + ',' + passwd + '\n'
|
||||
mail= record['mail'] % {'login' : addr.email, 'passwd' : passwd, 'name' : addr.name}
|
||||
if record['send_mail']:
|
||||
ans = email_message_obj.email_send(record['mail_from'], [addr.email], \
|
||||
ans = email_message_obj.email_send(cr, uid, record['mail_from'], [addr.email], \
|
||||
record['mail_subject'], mail, model='survey.send.invitation', attach = attachments)
|
||||
|
||||
if ans:
|
||||
|
|
Loading…
Reference in New Issue