commit
cc867794cb
|
@ -415,7 +415,7 @@ class account_invoice(osv.osv):
|
|||
def onchange_currency_id(self, cr, uid, ids, curr_id, company_id):
|
||||
if curr_id:
|
||||
currency = self.pool.get('res.currency').browse(cr, uid, curr_id)
|
||||
if currency.company_id != company_id:
|
||||
if currency.company_id.id != company_id:
|
||||
raise osv.except_osv(_('Configration Error !'),
|
||||
_('Can not select currency that is not related to current company.\nPlease select accordingly !.'))
|
||||
return {}
|
||||
|
|
|
@ -161,12 +161,12 @@ class CalDAV(object):
|
|||
if cal_data.name.lower() == 'attendee':
|
||||
attendee = self.pool.get('basic.calendar.attendee')
|
||||
att_data.append(attendee.import_ical(cr, uid, cal_data))
|
||||
self.ical_set(cal_data.name.lower(), cal_data.value, 'value')
|
||||
self.ical_set(cal_data.name.lower(), att_data, 'value')
|
||||
continue
|
||||
if cal_data.name.lower() == 'valarm':
|
||||
alarm = self.pool.get('basic.calendar.alarm')
|
||||
vals = alarm.import_ical(cr, uid, cal_data)
|
||||
self.ical_set(cal_data.name.lower(), cal_data.value, 'value')
|
||||
self.ical_set(cal_data.name.lower(), vals, 'value')
|
||||
continue
|
||||
if cal_data.name.lower() in self.__attribute__:
|
||||
self.ical_set(cal_data.name.lower(), cal_data.value, 'value')
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
##############################################################################
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from osv import fields, osv
|
||||
from service import web_services
|
||||
from tools.translate import _
|
||||
|
@ -32,7 +32,7 @@ months = {
|
|||
5:"May", 6:"June", 7:"July", 8:"August", 9:"September", \
|
||||
10:"October", 11:"November", 12:"December"}
|
||||
|
||||
def caldav_id2real_id(caldav_id = None, with_date=False):
|
||||
def caldav_id2real_id(caldav_id=None, with_date=False):
|
||||
if caldav_id and isinstance(caldav_id, (str, unicode)):
|
||||
res = caldav_id.split('-')
|
||||
if len(res) >= 2:
|
||||
|
@ -135,24 +135,30 @@ class calendar_attendee(osv.osv):
|
|||
fromdata = map(get_delegate_data, attdata.del_from_user_ids)
|
||||
result[id][name] = ', '.join(fromdata)
|
||||
if name == 'event_date':
|
||||
# TO fix date for project task
|
||||
if attdata.ref:
|
||||
model, res_id = tuple(attdata.ref.split(','))
|
||||
model_obj = self.pool.get(model)
|
||||
obj = model_obj.read(cr, uid, res_id, ['date'])[0]
|
||||
result[id][name] = obj['date']
|
||||
result[id][name] = None#obj['date']
|
||||
else:
|
||||
result[id][name] = None
|
||||
if name == 'event_end_date':
|
||||
if attdata.ref:
|
||||
model, res_id = tuple(attdata.ref.split(','))
|
||||
model_obj = self.pool.get(model)
|
||||
obj = model_obj.read(cr, uid, res_id, ['date_deadline'])[0]
|
||||
result[id][name] = obj['date_deadline']
|
||||
|
||||
else:
|
||||
result[id][name] = None
|
||||
if name == 'sent_by_uid':
|
||||
if attdata.ref:
|
||||
model, res_id = tuple(attdata.ref.split(','))
|
||||
model_obj = self.pool.get(model)
|
||||
obj = model_obj.read(cr, uid, res_id, ['user_id'])[0]
|
||||
result[id][name] = obj['user_id']
|
||||
else:
|
||||
result[id][name] = uid
|
||||
return result
|
||||
|
||||
def _links_get(self, cr, uid, context={}):
|
||||
|
@ -319,11 +325,11 @@ or contains the text to be used for display"""),
|
|||
if event_date:
|
||||
dtstart = datetime.strptime(vals['event_date'], "%Y-%m-%d %H:%M:%S")
|
||||
if vals['trigger_interval'] == 'days':
|
||||
delta = datetime.timedelta(days=vals['trigger_duration'])
|
||||
delta = timedelta(days=vals['trigger_duration'])
|
||||
if vals['trigger_interval'] == 'hours':
|
||||
delta = datetime.timedelta(hours=vals['trigger_duration'])
|
||||
delta = timedelta(hours=vals['trigger_duration'])
|
||||
if vals['trigger_interval'] == 'minutes':
|
||||
delta = datetime.timedelta(minutes=vals['trigger_duration'])
|
||||
delta = timedelta(minutes=vals['trigger_duration'])
|
||||
trigger_date = dtstart + (vals['trigger_occurs'] == 'after' and delta or -delta)
|
||||
vals['trigger_date'] = trigger_date
|
||||
res = super(calendar_alarm, self).create(cr, uid, vals, context)
|
||||
|
|
|
@ -223,11 +223,33 @@ class crm_case(osv.osv):
|
|||
else:
|
||||
res[case.id] = False
|
||||
return res
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context={}):
|
||||
if not default: default = {}
|
||||
default.update( {'state':'draft', 'id':False, 'history_line':[],'log_ids':[]})
|
||||
default.update( {'state':'draft', 'id':False})
|
||||
return super(crm_case, self).copy(cr, uid, id, default, context)
|
||||
|
||||
def _get_log_ids(self, cr, uid, ids, field_names, arg, context={}):
|
||||
result = {}
|
||||
history_obj = False
|
||||
model_obj = self.pool.get('ir.model')
|
||||
if 'history_line' in field_names:
|
||||
history_obj = self.pool.get('crm.case.history')
|
||||
name = 'history_line'
|
||||
if 'log_ids' in field_names:
|
||||
history_obj = self.pool.get('crm.case.log')
|
||||
name = 'log_ids'
|
||||
if not history_obj:
|
||||
return result
|
||||
for case in self.browse(cr, uid, ids, context):
|
||||
model_ids = model_obj.search(cr, uid, [('model','=',case._name)])
|
||||
history_ids = history_obj.search(cr, uid, [('model_id','=',model_ids[0]),('res_id','=',case.id)])
|
||||
if history_ids:
|
||||
result[case.id] = {name:history_ids}
|
||||
else:
|
||||
result[case.id] = {name:[]}
|
||||
return result
|
||||
|
||||
_columns = {
|
||||
'id': fields.integer('ID', readonly=True),
|
||||
'name': fields.char('Description',size=64,required=True),
|
||||
|
@ -245,8 +267,8 @@ class crm_case(osv.osv):
|
|||
'create_date': fields.datetime('Created' ,readonly=True),
|
||||
'date_deadline': fields.datetime('Deadline'),
|
||||
'user_id': fields.many2one('res.users', 'Responsible'),
|
||||
'history_line': fields.one2many('crm.case.history', 'case_id', 'Communication', readonly=1),
|
||||
'log_ids': fields.one2many('crm.case.log', 'case_id', 'Logs History', readonly=1),
|
||||
'history_line': fields.function(_get_log_ids, method=True, type='one2many', multi="history_line", relation="crm.case.history", string="Communication"),
|
||||
'log_ids': fields.function(_get_log_ids, method=True, type='one2many', multi="log_ids", relation="crm.case.log", string="Logs History"),
|
||||
'state': fields.selection(AVAILABLE_STATES, 'State', size=16, readonly=True,
|
||||
help='The state is set to \'Draft\', when a case is created.\
|
||||
\nIf the case is in progress the state is set to \'Open\'.\
|
||||
|
@ -495,32 +517,17 @@ class crm_case(osv.osv):
|
|||
}
|
||||
return self.format_body(body % data)
|
||||
|
||||
def email_send(self, cr, uid, case, emails, body, context={}):
|
||||
body = self.format_mail(case, body)
|
||||
if case.user_id and case.user_id.address_id and case.user_id.address_id.email:
|
||||
emailfrom = case.user_id.address_id.email
|
||||
else:
|
||||
emailfrom = case.section_id.reply_to
|
||||
name = '[%d] %s' % (case.id, case.name.encode('utf8'))
|
||||
reply_to = case.section_id.reply_to or False
|
||||
if reply_to: reply_to = reply_to.encode('utf8')
|
||||
if not emailfrom:
|
||||
raise osv.except_osv(_('Error!'),
|
||||
_("No E-Mail ID Found for your Company address or missing reply address in section!"))
|
||||
tools.email_send(emailfrom, emails, name, body, reply_to=reply_to, tinycrm=str(case.id))
|
||||
return True
|
||||
|
||||
|
||||
def __history(self, cr, uid, cases, keyword, history=False, email=False, details=None, context={}):
|
||||
|
||||
model_obj = self.pool.get('ir.model')
|
||||
for case in cases:
|
||||
model_ids = model_obj.search(cr, uid, [('model','=',case._name)])
|
||||
data = {
|
||||
'name': keyword,
|
||||
'som': case.som.id,
|
||||
'canal_id': case.canal_id.id,
|
||||
'name': keyword,
|
||||
'user_id': uid,
|
||||
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'case_id': case.id,
|
||||
'model_id' : model_ids and model_ids[0] or False,
|
||||
'res_id': case.id,
|
||||
'section_id': case.section_id.id
|
||||
}
|
||||
obj = self.pool.get('crm.case.log')
|
||||
|
@ -530,7 +537,7 @@ class crm_case(osv.osv):
|
|||
data['email'] = email or \
|
||||
(case.user_id and case.user_id.address_id and \
|
||||
case.user_id.address_id.email) or False
|
||||
obj.create(cr, uid, data, context)
|
||||
res = obj.create(cr, uid, data, context)
|
||||
return True
|
||||
_history = __history
|
||||
|
||||
|
@ -590,8 +597,8 @@ class crm_case(osv.osv):
|
|||
|
||||
def add_reply(self, cursor, user, ids, context=None):
|
||||
for case in self.browse(cursor, user, ids, context=context):
|
||||
if case.history_line:
|
||||
description = case.history_line[0].description
|
||||
if case.email_last:
|
||||
description = email_last
|
||||
self.write(cursor, user, case.id, {
|
||||
'description': '> ' + description.replace('\n','\n> '),
|
||||
}, context=context)
|
||||
|
@ -740,7 +747,8 @@ class crm_case_log(osv.osv):
|
|||
'canal_id': fields.many2one('res.partner.canal', 'Channel'),
|
||||
'section_id': fields.many2one('crm.case.section', 'Section'),
|
||||
'user_id': fields.many2one('res.users', 'User Responsible', readonly=True),
|
||||
'case_id': fields.many2one('crm.case', 'Case', required=True, ondelete='cascade')
|
||||
'model_id': fields.many2one('ir.model', "Model"),
|
||||
'res_id': fields.integer('Resource ID'),
|
||||
}
|
||||
_defaults = {
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
|
@ -754,9 +762,9 @@ class crm_case_history(osv.osv):
|
|||
_inherits = {'crm.case.log':"log_id"}
|
||||
|
||||
def create(self, cr, user, vals, context=None):
|
||||
if vals.has_key('case_id') and vals['case_id']:
|
||||
case_obj = self.pool.get('crm.case')
|
||||
cases = case_obj.browse(cr, user, [vals['case_id']])
|
||||
if vals.has_key('res_id') and vals['res_id']:
|
||||
case_obj = self.pool.get(vals['model_id'])
|
||||
cases = case_obj.browse(cr, user, [vals['res_id']])
|
||||
case_obj._action(cr, user, cases, '')
|
||||
return super(crm_case_history, self).create(cr, user, vals, context)
|
||||
|
||||
|
@ -845,4 +853,3 @@ users()
|
|||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -44,13 +44,15 @@ class crm_cases(osv.osv):
|
|||
'email_from': msg['From'],
|
||||
'email_cc': msg['Cc'],
|
||||
'user_id': False,
|
||||
'description': msg_body['body'],
|
||||
'history_line': [(0, 0, {'description': msg_body['body'], 'email': msg['From'] })],
|
||||
'description': msg_body['body'],
|
||||
}
|
||||
res = mailgate_obj.partner_get(cr, uid, msg['From'])
|
||||
if res:
|
||||
data.update(res)
|
||||
return self.create(cr, uid, data)
|
||||
res = self.create(cr, uid, data)
|
||||
cases = self.browse(cr, uid, [res])
|
||||
self.__history(cr, uid, cases, _('Receive'), history=True, email=msg['From'])
|
||||
return res
|
||||
|
||||
def msg_update(self, cr, uid, ids, msg, data={}, default_act='pending'):
|
||||
mailgate_obj = self.pool.get('mail.gateway')
|
||||
|
|
|
@ -113,9 +113,16 @@ class crm_meeting(osv.osv):
|
|||
return {'value': {'rrule': rrulestr}}
|
||||
|
||||
_columns = {
|
||||
'id': fields.integer('ID', readonly=True),
|
||||
'name': fields.char('Description', size=64, required=True),
|
||||
'section_id': fields.many2one('crm.case.section', 'Section', select=True, help='Section to which Case belongs to. Define Responsible user and Email \
|
||||
account for mail gateway.'),
|
||||
'priority': fields.selection([('5','Lowest'),
|
||||
('4','Low'),
|
||||
('3','Normal'),
|
||||
('2','High'),
|
||||
('1','Highest')
|
||||
], 'Priority'),
|
||||
'date': fields.datetime('Date'),
|
||||
'date_deadline': fields.datetime('Deadline'),
|
||||
'duration': fields.function(_get_duration, method=True, \
|
||||
|
@ -125,6 +132,7 @@ account for mail gateway.'),
|
|||
help='Category related to the section.Subdivide the CRM cases \
|
||||
independently or section-wise.'),
|
||||
'description': fields.text('Your action'),
|
||||
'user_id': fields.many2one('res.users', 'Responsible'),
|
||||
'class': fields.selection([('public', 'Public'), ('private', 'Private'), \
|
||||
('confidential', 'Confidential')], 'Mark as'),
|
||||
'location': fields.char('Location', size=264, help="Location of Meeting"),
|
||||
|
@ -140,7 +148,7 @@ rule or repeating pattern for anexception to a recurrence set"),
|
|||
'rrule_type': fields.selection([('none', 'None'), ('daily', 'Daily'), \
|
||||
('weekly', 'Weekly'), ('monthly', 'Monthly'), \
|
||||
('yearly', 'Yearly'), ('custom', 'Custom')], 'Recurrency'),
|
||||
'attendee_ids': fields.many2many('calendar.attendee', 'crm_attendee_rel', 'case_id', 'attendee_id', 'Attendees'),
|
||||
'attendee_ids': fields.many2many('calendar.attendee', 'crm_attendee_rel', 'case_id', 'attendee_id', 'Attendees'),
|
||||
'alarm_id': fields.many2one('res.alarm', 'Alarm'),
|
||||
'caldav_alarm_id': fields.many2one('calendar.alarm', 'Alarm'),
|
||||
}
|
||||
|
@ -156,8 +164,8 @@ rule or repeating pattern for anexception to a recurrence set"),
|
|||
model_id = model_obj.search(cr, uid, [('model', '=', self._name)])[0]
|
||||
|
||||
for meeting in self.browse(cr, uid, ids):
|
||||
self.do_alarm_unlink(cr, uid, [meeting.id])
|
||||
basic_alarm = meeting.alarm_id
|
||||
self.do_alarm_unlink(cr, uid, [meeting.id])
|
||||
if basic_alarm:
|
||||
vals = {
|
||||
'action': 'display',
|
||||
|
@ -177,8 +185,8 @@ rule or repeating pattern for anexception to a recurrence set"),
|
|||
'user_id': uid
|
||||
}
|
||||
alarm_id = alarm_obj.create(cr, uid, vals)
|
||||
cr.execute('Update crm_meeting set caldav_alarm_id=%s \
|
||||
where id=%s' % (alarm_id, meeting.id))
|
||||
cr.execute('Update crm_meeting set caldav_alarm_id=%s, \
|
||||
alarm_id=%s where id=%s' % (alarm_id, basic_alarm.id, meeting.id))
|
||||
cr.commit()
|
||||
return True
|
||||
|
||||
|
@ -221,6 +229,14 @@ rule or repeating pattern for anexception to a recurrence set"),
|
|||
file_content = base64.decodestring(data)
|
||||
event_obj = self.pool.get('basic.calendar.event')
|
||||
event_obj.__attribute__.update(self.__attribute__)
|
||||
|
||||
attendee_obj = self.pool.get('basic.calendar.attendee')
|
||||
attendee = self.pool.get('calendar.attendee')
|
||||
attendee_obj.__attribute__.update(attendee.__attribute__)
|
||||
|
||||
alarm_obj = self.pool.get('basic.calendar.alarm')
|
||||
alarm = self.pool.get('calendar.alarm')
|
||||
alarm_obj.__attribute__.update(alarm.__attribute__)
|
||||
|
||||
vals = event_obj.import_ical(cr, uid, file_content)
|
||||
ids = []
|
||||
|
@ -337,10 +353,9 @@ rule or repeating pattern for anexception to a recurrence set"),
|
|||
id = common.caldav_id2real_id(id)
|
||||
if not id in new_ids:
|
||||
new_ids.append(id)
|
||||
if 'case_id' in vals:
|
||||
vals['case_id'] = common.caldav_id2real_id(vals['case_id'])
|
||||
res = super(crm_meeting, self).write(cr, uid, new_ids, vals, context=context)
|
||||
self.do_alarm_create(cr, uid, new_ids)
|
||||
if vals.get('alarm_id'):
|
||||
self.do_alarm_create(cr, uid, new_ids)
|
||||
return res
|
||||
|
||||
def browse(self, cr, uid, ids, context=None, list_class=None, fields_process={}):
|
||||
|
@ -399,13 +414,12 @@ rule or repeating pattern for anexception to a recurrence set"),
|
|||
res = super(crm_meeting, self).unlink(cr, uid, common.caldav_id2real_id(ids))
|
||||
self.do_alarm_unlink(cr, uid, ids)
|
||||
else:
|
||||
ids = map(lambda x: common.caldav_id2real_id(x), ids)
|
||||
res = super(crm_meeting, self).unlink(cr, uid, ids)
|
||||
self.do_alarm_unlink(cr, uid, ids)
|
||||
return res
|
||||
|
||||
def create(self, cr, uid, vals, context={}):
|
||||
if 'case_id' in vals:
|
||||
vals['case_id'] = common.caldav_id2real_id(vals['case_id'])
|
||||
res = super(crm_meeting, self).create(cr, uid, vals, context)
|
||||
self.do_alarm_create(cr, uid, [res])
|
||||
return res
|
||||
|
@ -430,59 +444,6 @@ rule or repeating pattern for anexception to a recurrence set"),
|
|||
|
||||
crm_meeting()
|
||||
|
||||
|
||||
class crm_meeting_generic_wizard(osv.osv_memory):
|
||||
_name = 'crm.meeting.generic_wizard'
|
||||
|
||||
_columns = {
|
||||
'section_id': fields.many2one('crm.case.section', 'Section', required=False),
|
||||
'user_id': fields.many2one('res.users', 'Responsible'),
|
||||
}
|
||||
|
||||
def _get_default_section(self, cr, uid, context):
|
||||
case_id = context.get('active_id', False)
|
||||
if not case_id:
|
||||
return False
|
||||
case_obj = self.pool.get('crm.meeting')
|
||||
case = case_obj.read(cr, uid, case_id, ['state', 'section_id'])
|
||||
if case['state'] in ('done'):
|
||||
raise osv.except_osv(_('Error !'), _('You can not assign Closed Case.'))
|
||||
return case['section_id']
|
||||
|
||||
|
||||
_defaults = {
|
||||
'section_id': _get_default_section
|
||||
}
|
||||
|
||||
def action_create(self, cr, uid, ids, context=None):
|
||||
case_obj = self.pool.get('crm.meeting')
|
||||
case_id = context.get('active_id', [])
|
||||
res = self.read(cr, uid, ids)[0]
|
||||
case = case_obj.browse(cr, uid, case_id)
|
||||
if case.state in ('done'):
|
||||
raise osv.except_osv(_('Error !'), _('You can not assign Closed Case.'))
|
||||
new_case_id = case_obj.copy(cr, uid, case_id, default= {
|
||||
'section_id': res.get('section_id', False),
|
||||
'user_id': res.get('user_id', False),
|
||||
'case_id': case.inherit_case_id.id
|
||||
}, context=context)
|
||||
case_obj.case_close(cr, uid, [case_id])
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_meetings_filter')
|
||||
search_view = data_obj.read(cr, uid, result, ['res_id'])
|
||||
new_case = case_obj.read(cr, uid, new_case_id, ['id'])
|
||||
value = {
|
||||
'name': _('Meetings'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'calendar, tree, form',
|
||||
'res_model': 'crm.meeting',
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': search_view['res_id']
|
||||
}
|
||||
return value
|
||||
|
||||
crm_meeting_generic_wizard()
|
||||
|
||||
class res_users(osv.osv):
|
||||
_inherit = 'res.users'
|
||||
def _get_user_avail(self, cr, uid, ids, context=None):
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<record model="crm.case.section" id="section_support1">
|
||||
<field name="name">Meetings</field>
|
||||
<field name="code">Mtngs</field>
|
||||
<field name="code">Mtngs</field>
|
||||
</record>
|
||||
<!-- CASE CATEGORY(categ_id) -->
|
||||
|
||||
|
|
|
@ -5,34 +5,6 @@
|
|||
# Meetings
|
||||
# ------------------------------------------------------
|
||||
|
||||
<record model="ir.ui.view" id="crm_meeting_generic_wizard">
|
||||
<field name="name">crm.meeting.generic_wizard.form</field>
|
||||
<field name="model">crm.meeting.generic_wizard</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Generic Wizard">
|
||||
<group col="2">
|
||||
<field name="section_id" select="1" widget="selection"/>
|
||||
<field name="user_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="2">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" name="action_create" string="Assign" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="crm_meeting_generic_wizard_act" model="ir.actions.act_window">
|
||||
<field name="name">Meeting Generic Wizard</field>
|
||||
<field name="res_model">crm.meeting.generic_wizard</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="crm_meeting_generic_wizard"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_form_view_meet">
|
||||
<field name="name">CRM - Meetings Form</field>
|
||||
<field name="model">crm.meeting</field>
|
||||
|
@ -124,7 +96,6 @@
|
|||
<field name="section_id" widget="selection"/>
|
||||
<field name="priority"/>
|
||||
<field name="categ_id"/>
|
||||
<field name="category2_id" string="Type"/>
|
||||
<field name="user_id"/>
|
||||
<field name="state"/>
|
||||
<button name="case_open" string="Confirm Meeting" states="draft,cancel,pending" type="object" icon="terp-crm"/>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
</record>
|
||||
|
||||
<record id="crm_meeting_rule" model="ir.rule">
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','=',user.context_section_id)]</field>
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','in',[user.context_section_id])]</field>
|
||||
<field name="rule_group" ref="crm_meeting_rule_group"/>
|
||||
</record>
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
<field name="global" eval="True"/>
|
||||
</record>
|
||||
<record id="crm_claim_rule" model="ir.rule">
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','=',user.context_section_id)]</field>
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','in',[user.context_section_id])]</field>
|
||||
<field name="rule_group" ref="crm_claim_rule_group"/>
|
||||
</record>
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
|||
<field name="global" eval="True"/>
|
||||
</record>
|
||||
<record id="crm_fundraising_rule" model="ir.rule">
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','=',user.context_section_id)]</field>
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','in',[user.context_section_id])]</field>
|
||||
<field name="rule_group" ref="crm_fundraising_rule_group"/>
|
||||
</record>
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
|||
<field name="global" eval="True"/>
|
||||
</record>
|
||||
<record id="crm_helpdesk_rule" model="ir.rule">
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','=',user.context_section_id)]</field>
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','in',[user.context_section_id])]</field>
|
||||
<field name="rule_group" ref="crm_helpdesk_rule_group"/>
|
||||
</record>
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
|||
<field name="global" eval="True"/>
|
||||
</record>
|
||||
<record id="crm_leads_rule" model="ir.rule">
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','=',user.context_section_id)]</field>
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','in',[user.context_section_id])]</field>
|
||||
<field name="rule_group" ref="crm_leads_rule_group"/>
|
||||
</record>
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
|||
<field name="global" eval="True"/>
|
||||
</record>
|
||||
<record id="crm_opportunities_rule" model="ir.rule">
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','=',user.context_section_id)]</field>
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','in',[user.context_section_id])]</field>
|
||||
<field name="rule_group" ref="crm_opportunities_rule_group"/>
|
||||
</record>
|
||||
|
||||
|
@ -93,7 +93,7 @@
|
|||
<field name="global" eval="True"/>
|
||||
</record>
|
||||
<record id="crm_phone_calls_rule" model="ir.rule">
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','=',user.context_section_id)]</field>
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','in',[user.context_section_id])]</field>
|
||||
<field name="rule_group" ref="crm_phone_calls_rule_group"/>
|
||||
</record>
|
||||
|
||||
|
@ -104,7 +104,7 @@
|
|||
<field name="global" eval="True"/>
|
||||
</record>
|
||||
<record id="crm_case_rule" model="ir.rule">
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','=',user.context_section_id)]</field>
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','in',[user.context_section_id])]</field>
|
||||
<field name="rule_group" ref="crm_case_rule_group"/>
|
||||
</record>
|
||||
</data>
|
||||
|
|
|
@ -31,69 +31,82 @@ class project_task(osv.osv):
|
|||
_inherit = "project.task"
|
||||
|
||||
_columns = {
|
||||
'class': fields.selection([('PUBLIC', 'PUBLIC'), ('PRIVATE', 'PRIVATE'), \
|
||||
('CONFIDENTIAL', 'CONFIDENTIAL')], 'Privacy'),
|
||||
'location' : fields.char('Location', size=264, help="Gives Location of Task"),
|
||||
'rrule' : fields.char('Recurrent Rule', size=352),
|
||||
'exdate' : fields.text('Exception Date/Times', help="This property defines the list\
|
||||
of date/time exceptions for arecurring calendar component."),
|
||||
'exrule' : fields.char('Exception Rule', size=352, help="defines a rule or repeating pattern\
|
||||
for anexception to a recurrence set"),
|
||||
'attendee_ids': fields.many2many('crm.caldav.attendee', 'task_attendee_rel', 'case_id', \
|
||||
'attendee_id', 'Attendees'),
|
||||
'alarm_id': fields.many2one('crm.caldav.alarm', 'Reminder'),
|
||||
'caldav_url': fields.char('Caldav URL', size=34),
|
||||
'class': fields.selection([('public', 'Public'), ('private', 'Private'), \
|
||||
('confidential', 'Confidential')], 'Mark as'),
|
||||
'location': fields.char('Location', size=264, help="Location of Task"),
|
||||
'exdate': fields.text('Exception Date/Times', help="This property \
|
||||
defines the list of date/time exceptions for arecurring calendar component."),
|
||||
'exrule': fields.char('Exception Rule', size=352, help="defines a rule\
|
||||
or repeating pattern for anexception to a recurrence set"),
|
||||
'attendee_ids': fields.many2many('calendar.attendee', 'task_attendee_rel', 'task_id', 'attendee_id', 'Attendees'),
|
||||
'caldav_url': fields.char('Calendar URL', size=34),
|
||||
'rrule': fields.char('Recurrent Rule', size=124),
|
||||
'rrule_type': fields.selection([('none', 'None'), ('daily', 'Daily'), \
|
||||
('weekly', 'Weekly'), ('monthly', 'Monthly'), \
|
||||
('yearly', 'Yearly'), ('custom', 'Custom')], 'Recurrency'),
|
||||
'alarm_id': fields.many2one('res.alarm', 'Alarm'),
|
||||
'caldav_alarm_id': fields.many2one('calendar.alarm', 'Alarm'),
|
||||
}
|
||||
|
||||
|
||||
__attribute__ = {
|
||||
'class': {'field': 'class', 'type': 'text'},
|
||||
'completed': {'field': 'date_close', 'type': 'datetime'},
|
||||
# 'created': {'field': 'field', 'type': 'text'},
|
||||
# 'created': {'field': 'field', 'type': 'text'},
|
||||
'description': {'field': 'description', 'type': 'text'},
|
||||
# 'dtstamp': {'field': 'field', 'type': 'text'},
|
||||
# 'dtstamp': {'field': 'field', 'type': 'text'},
|
||||
'dtstart': {'field': 'date_start', 'type': 'datetime'},
|
||||
'duration': {'field': 'planned_hours', 'type': 'timedelta'},
|
||||
'due': {'field': 'date_deadline', 'type': 'datetime'},
|
||||
# 'geo': {'field': 'field', 'type': 'text'},
|
||||
# 'last-mod ': {'field': 'field', 'type': 'text'},
|
||||
'location': {'field': 'location', 'type': 'text'}, # To add
|
||||
# 'geo': {'field': 'field', 'type': 'text'},
|
||||
# 'last-mod ': {'field': 'field', 'type': 'text'},
|
||||
'location': {'field': 'location', 'type': 'text'},
|
||||
'organizer': {'field': 'partner_id', 'type': 'many2one', 'object': 'res.partner'},
|
||||
'percent': {'field': 'progress_rate', 'type': 'int'},
|
||||
'priority': {'field': 'priority', 'type': 'text'},
|
||||
# 'recurid': {'field': 'field', 'type': 'text'},
|
||||
# 'recurid': {'field': 'field', 'type': 'text'},
|
||||
'seq': {'field': 'sequence', 'type': 'text'},
|
||||
'status': {'field': 'state', 'type': 'selection', 'mapping': {'NEEDS-ACTION': 'draft', \
|
||||
'COMPLETED': 'done', 'IN-PROCESS': 'open', \
|
||||
'CANCELLED': 'cancelled'}},
|
||||
'status': {'field': 'state', 'type': 'selection', \
|
||||
'mapping': {'needs-action': 'draft', \
|
||||
'completed': 'done', 'in-process': 'open', \
|
||||
'cancelled': 'cancelled'}},
|
||||
'summary': {'field': 'name', 'type': 'text'},
|
||||
'uid': {'field': 'id', 'type': 'int'},
|
||||
'url': {'field': 'caldav_url', 'type': 'text'}, # To add
|
||||
# 'attach': {'field': 'field', 'type': 'text'},
|
||||
'attendee': {'field': 'attendee_ids', 'type': 'many2many', 'object': 'crm.caldav.attendee'},
|
||||
# 'categories': {'field': 'type', 'type': 'text'}, # Needs review
|
||||
'url': {'field': 'caldav_url', 'type': 'text'},
|
||||
# 'attach': {'field': 'field', 'type': 'text'},
|
||||
'attendee': {'field': 'attendee_ids', 'type': 'many2many', 'object': 'calendar.attendee'},
|
||||
'comment': {'field': 'notes', 'type': 'text'},
|
||||
# 'contact': {'field': 'field', 'type': 'text'},
|
||||
'exdate' : {'field':'exdate', 'type':'datetime'},
|
||||
'exrule' : {'field':'exrule', 'type':'text'},
|
||||
# 'rstatus': {'field': 'field', 'type': 'text'},
|
||||
# 'related': {'field': 'field', 'type': 'text'},
|
||||
# 'resources': {'field': 'field', 'type': 'text'},
|
||||
# 'rdate': {'field': 'field', 'type': 'text'},
|
||||
# 'contact': {'field': 'field', 'type': 'text'},
|
||||
'exdate': {'field':'exdate', 'type':'datetime'},
|
||||
'exrule': {'field':'exrule', 'type':'text'},
|
||||
# 'rstatus': {'field': 'field', 'type': 'text'},
|
||||
# 'related': {'field': 'field', 'type': 'text'},
|
||||
# 'resources': {'field': 'field', 'type': 'text'},
|
||||
# 'rdate': {'field': 'field', 'type': 'text'},
|
||||
'rrule': {'field': 'rrule', 'type': 'text'},
|
||||
'valarm' : {'field':'alarm_id', 'type':'many2one', 'object' : 'crm.caldav.alarm'},
|
||||
'valarm': {'field':'caldav_alarm_id', 'type':'many2one', 'object': 'calendar.alarm'},
|
||||
}
|
||||
|
||||
def onchange_rrule_type(self, cr, uid, ids, type, *args, **argv):
|
||||
if type == 'none':
|
||||
return {'value': {'rrule': ''}}
|
||||
if type == 'custom':
|
||||
return {}
|
||||
rrule = self.pool.get('calendar.custom.rrule')
|
||||
rrulestr = rrule.compute_rule_string(cr, uid, {'freq': type.upper(), \
|
||||
'interval': 1})
|
||||
return {'value': {'rrule': rrulestr}}
|
||||
|
||||
def import_cal(self, cr, uid, data, context={}):
|
||||
file_content = base64.decodestring(data)
|
||||
todo_obj = self.pool.get('caldav.todo')
|
||||
todo_obj = self.pool.get('basic.calendar.todo')
|
||||
todo_obj.__attribute__.update(self.__attribute__)
|
||||
|
||||
attendee_obj = self.pool.get('caldav.attendee')
|
||||
crm_attendee = self.pool.get('crm.caldav.attendee')
|
||||
|
||||
attendee_obj = self.pool.get('basic.calendar.attendee')
|
||||
crm_attendee = self.pool.get('calendar.attendee')
|
||||
attendee_obj.__attribute__.update(crm_attendee.__attribute__)
|
||||
|
||||
alarm_obj = self.pool.get('caldav.alarm')
|
||||
crm_alarm = self.pool.get('crm.caldav.alarm')
|
||||
|
||||
alarm_obj = self.pool.get('basic.calendar.alarm')
|
||||
crm_alarm = self.pool.get('calendar.alarm')
|
||||
alarm_obj.__attribute__.update(crm_alarm.__attribute__)
|
||||
|
||||
vals = todo_obj.import_ical(cr, uid, file_content)
|
||||
|
@ -107,89 +120,159 @@ class project_task(osv.osv):
|
|||
plan = (diff.seconds/float(86400) + diff.days) * obj_tm.factor
|
||||
val['planned_hours'] = plan
|
||||
else:
|
||||
# Converts timedelta into Project time unit
|
||||
val['planned_hours'] = (val['planned_hours'].seconds/float(86400) + \
|
||||
val['planned_hours'].days) * obj_tm.factor
|
||||
|
||||
is_exists = common.uid2openobjectid(cr, val['id'], self._name )
|
||||
# Converts timedelta into hours
|
||||
hours = (val['planned_hours'].seconds / float(3600)) + \
|
||||
(val['planned_hours'].days * 24)
|
||||
val['planned_hours'] = hours
|
||||
is_exists = common.uid2openobjectid(cr, val['id'], self._name)
|
||||
val.pop('id')
|
||||
if is_exists:
|
||||
self.write(cr, uid, [is_exists], val)
|
||||
else:
|
||||
case_id = self.create(cr, uid, val)
|
||||
task_id = self.create(cr, uid, val)
|
||||
return {'count': len(vals)}
|
||||
|
||||
|
||||
def export_cal(self, cr, uid, ids, context={}):
|
||||
task_data = self.read(cr, uid, ids, [], context ={'read': True})
|
||||
todo_obj = self.pool.get('caldav.todo')
|
||||
task_datas = self.read(cr, uid, ids, [], context ={'read': True})
|
||||
tasks = []
|
||||
for task in task_datas:
|
||||
if task.get('planned_hours', None) and task.get('date_deadline', None):
|
||||
task.pop('planned_hours')
|
||||
tasks.append(task)
|
||||
todo_obj = self.pool.get('basic.calendar.todo')
|
||||
todo_obj.__attribute__.update(self.__attribute__)
|
||||
|
||||
attendee_obj = self.pool.get('caldav.attendee')
|
||||
attendee = self.pool.get('crm.caldav.attendee')
|
||||
|
||||
attendee_obj = self.pool.get('basic.calendar.attendee')
|
||||
attendee = self.pool.get('calendar.attendee')
|
||||
attendee_obj.__attribute__.update(attendee.__attribute__)
|
||||
|
||||
alarm_obj = self.pool.get('caldav.alarm')
|
||||
alarm = self.pool.get('crm.caldav.alarm')
|
||||
|
||||
alarm_obj = self.pool.get('basic.calendar.alarm')
|
||||
alarm = self.pool.get('calendar.alarm')
|
||||
alarm_obj.__attribute__.update(alarm.__attribute__)
|
||||
|
||||
ical = todo_obj.export_ical(cr, uid, task_data, {'model': 'project.task'})
|
||||
|
||||
ical = todo_obj.export_ical(cr, uid, tasks, {'model': 'project.task'})
|
||||
caendar_val = ical.serialize()
|
||||
caendar_val = caendar_val.replace('"', '').strip()
|
||||
return caendar_val
|
||||
|
||||
def read(self, cr, uid, ids, fields=None, context={}, load='_classic_read'):
|
||||
""" logic for recurrent event
|
||||
example : 123-20091111170822"""
|
||||
if context and context.has_key('read'):
|
||||
return super(project_task, self).read(cr, uid, ids, fields=fields, context=context, \
|
||||
load=load)
|
||||
if not type(ids) == list :
|
||||
# Called from code
|
||||
return super(project_task, self).read(cr, uid, common.caldevIDs2readIDs(ids), \
|
||||
fields=fields, context=context, load=load)
|
||||
def get_recurrent_ids(self, cr, uid, select, base_start_date, base_until_date, limit=100):
|
||||
if not limit:
|
||||
limit = 100
|
||||
if isinstance(select, (str, int, long)):
|
||||
ids = [select]
|
||||
else:
|
||||
ids = map(lambda x:common.caldevIDs2readIDs(x), ids)
|
||||
ids = select
|
||||
result = []
|
||||
if ids and (base_start_date or base_until_date):
|
||||
cr.execute("select t.id, t.rrule, t.date_start, t.exdate \
|
||||
from project_task t\
|
||||
where t.id in ("+ ','.join(map(lambda x: str(x), ids))+")")
|
||||
|
||||
count = 0
|
||||
for data in cr.dictfetchall():
|
||||
start_date = base_start_date and datetime.strptime(base_start_date, "%Y-%m-%d") or False
|
||||
until_date = base_until_date and datetime.strptime(base_until_date, "%Y-%m-%d") or False
|
||||
if count > limit:
|
||||
break
|
||||
event_date = datetime.strptime(data['date_start'], "%Y-%m-%d %H:%M:%S")
|
||||
if start_date and start_date <= event_date:
|
||||
start_date = event_date
|
||||
if not data['rrule']:
|
||||
if start_date and event_date < start_date:
|
||||
continue
|
||||
if until_date and event_date > until_date:
|
||||
continue
|
||||
idval = common.real_id2caldav_id(data['id'], data['date_start'])
|
||||
result.append(idval)
|
||||
count += 1
|
||||
else:
|
||||
exdate = data['exdate'] and data['exdate'].split(',') or []
|
||||
event_obj = self.pool.get('basic.calendar.event')
|
||||
rrule_str = data['rrule']
|
||||
new_rrule_str = []
|
||||
rrule_until_date = False
|
||||
is_until = False
|
||||
for rule in rrule_str.split(';'):
|
||||
name, value = rule.split('=')
|
||||
if name == "UNTIL":
|
||||
is_until = True
|
||||
value = parser.parse(value)
|
||||
rrule_until_date = parser.parse(value.strftime("%Y-%m-%d"))
|
||||
if until_date and until_date >= rrule_until_date:
|
||||
until_date = rrule_until_date
|
||||
if until_date:
|
||||
value = until_date.strftime("%Y%m%d%H%M%S")
|
||||
new_rule = '%s=%s' % (name, value)
|
||||
new_rrule_str.append(new_rule)
|
||||
if not is_until and until_date:
|
||||
value = until_date.strftime("%Y%m%d%H%M%S")
|
||||
name = "UNTIL"
|
||||
new_rule = '%s=%s' % (name, value)
|
||||
new_rrule_str.append(new_rule)
|
||||
new_rrule_str = ';'.join(new_rrule_str)
|
||||
start_date = datetime.strptime(data['date_start'], "%Y-%m-%d %H:%M:%S")
|
||||
rdates = event_obj.get_recurrent_dates(str(new_rrule_str), exdate, start_date)
|
||||
for rdate in rdates:
|
||||
r_date = datetime.strptime(rdate, "%Y-%m-%d %H:%M:%S")
|
||||
if start_date and r_date < start_date:
|
||||
continue
|
||||
if until_date and r_date > until_date:
|
||||
continue
|
||||
idval = common.real_id2caldav_id(data['id'], rdate)
|
||||
result.append(idval)
|
||||
count += 1
|
||||
if result:
|
||||
ids = result
|
||||
if isinstance(select, (str, int, long)):
|
||||
return ids and ids[0] or False
|
||||
return ids
|
||||
|
||||
def search(self, cr, uid, args, offset=0, limit=100, order=None,
|
||||
context=None, count=False):
|
||||
args_without_date = []
|
||||
start_date = False
|
||||
until_date = False
|
||||
for arg in args:
|
||||
if arg[0] not in ('date_start', unicode('date_start')):
|
||||
args_without_date.append(arg)
|
||||
else:
|
||||
if arg[1] in ('>', '>='):
|
||||
start_date = arg[2]
|
||||
elif arg[1] in ('<', '<='):
|
||||
until_date = arg[2]
|
||||
res = super(project_task, self).search(cr, uid, args_without_date, offset,
|
||||
limit, order, context, count)
|
||||
return self.get_recurrent_ids(cr, uid, res, start_date, until_date, limit)
|
||||
|
||||
def read(self, cr, uid, ids, fields=None, context={}, load='_classic_read'):
|
||||
if isinstance(ids, (str, int, long)):
|
||||
select = [ids]
|
||||
else:
|
||||
select = ids
|
||||
select = map(lambda x: (x, common.caldav_id2real_id(x)), select)
|
||||
result = []
|
||||
if fields and 'date_start' not in fields:
|
||||
fields.append('date_start')
|
||||
if not ids:
|
||||
return []
|
||||
result = []
|
||||
for read_id in ids:
|
||||
res = super(project_task, self).read(cr, uid, read_id, fields=fields, context=context, load=load)
|
||||
cr.execute("""select id, rrule, date_start, exdate \
|
||||
from project_task where id = %s""" % read_id)
|
||||
data = cr.dictfetchall()[0]
|
||||
if not data['rrule']:
|
||||
strdate = ''.join((re.compile('\d')).findall(data['date_start']))
|
||||
idval = str(common.caldevIDs2readIDs(data['id'])) + '-' + strdate
|
||||
data['id'] = idval
|
||||
res.update(data)
|
||||
result.append(res)
|
||||
else:
|
||||
exdate = data['exdate'] and data['exdate'].split(',') or []
|
||||
event_obj = self.pool.get('caldav.event')
|
||||
rdates = event_obj.get_recurrent_dates(str(data['rrule']), exdate, data['date_start'])[:10]
|
||||
for rdate in rdates:
|
||||
val = res.copy()
|
||||
idval = (re.compile('\d')).findall(rdate)
|
||||
val['date_start'] = rdate
|
||||
id = str(res['id']).split('-')[0]
|
||||
val['id'] = id + '-' + ''.join(idval)
|
||||
val1 = val.copy()
|
||||
result.append(val1)
|
||||
for caldav_id, real_id in select:
|
||||
res = super(project_task, self).read(cr, uid, real_id, fields=fields, context=context, load=load)
|
||||
ls = common.caldav_id2real_id(caldav_id, with_date=True)
|
||||
if not isinstance(ls, (str, int, long)) and len(ls) >= 2:
|
||||
res['date_start'] = ls[1]
|
||||
res['id'] = caldav_id
|
||||
|
||||
result.append(res)
|
||||
if isinstance(ids, (str, int, long)):
|
||||
return result and result[0] or False
|
||||
return result
|
||||
|
||||
def search(self, cr, uid, args, offset=0, limit=None, order=None,
|
||||
context=None, count=False):
|
||||
res = super(project_task, self).search(cr, uid, args, offset,
|
||||
limit, order, context, count)
|
||||
return res
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
|
||||
if isinstance(ids, (str, int, long)):
|
||||
select = [ids]
|
||||
else:
|
||||
select = ids
|
||||
new_ids = []
|
||||
for id in ids:
|
||||
id = common.caldevIDs2readIDs(id)
|
||||
for id in select:
|
||||
id = common.caldav_id2real_id(id)
|
||||
if not id in new_ids:
|
||||
new_ids.append(id)
|
||||
res = super(project_task, self).write(cr, uid, new_ids, vals, context=context)
|
||||
|
@ -199,39 +282,34 @@ class project_task(osv.osv):
|
|||
if isinstance(ids, (str, int, long)):
|
||||
select = [ids]
|
||||
else:
|
||||
select = ids
|
||||
select = map(lambda x:common.caldevIDs2readIDs(x), select)
|
||||
res = super(project_task, self).browse(cr, uid, select, context, list_class, fields_process)
|
||||
select = ids
|
||||
select = map(lambda x:common.caldav_id2real_id(x), select)
|
||||
res = super(project_task, self).browse(cr, uid, select, context, list_class, fields_process)
|
||||
if isinstance(ids, (str, int, long)):
|
||||
return res and res[0] or False
|
||||
return res
|
||||
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context={}):
|
||||
return super(project_task, self).copy(cr, uid, common.caldevIDs2readIDs(id), default, context)
|
||||
return super(project_task, self).copy(cr, uid, common.caldav_id2real_id(id), default, context)
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
for id in ids:
|
||||
if len(str(id).split('-')) > 1:
|
||||
date_new = time.strftime("%Y-%m-%d %H:%M:%S", \
|
||||
time.strptime(str(str(id).split('-')[1]), "%Y%m%d%H%M%S"))
|
||||
for record in self.read(cr, uid, [common.caldevIDs2readIDs(id)], \
|
||||
['date', 'rrule', 'exdate']):
|
||||
for record in self.read(cr, uid, [common.caldav_id2real_id(id)], \
|
||||
['date_start', 'rrule', 'exdate']):
|
||||
if record['rrule']:
|
||||
exdate = (record['exdate'] and (record['exdate'] + ',' ) or '') + \
|
||||
exdate = (record['exdate'] and (record['exdate'] + ',') or '') + \
|
||||
''.join((re.compile('\d')).findall(date_new)) + 'Z'
|
||||
if record['date_start'] == date_new:
|
||||
self.write(cr, uid, [common.caldevIDs2readIDs(id)], {'exdate' : exdate})
|
||||
self.write(cr, uid, [common.caldav_id2real_id(id)], {'exdate': exdate})
|
||||
else:
|
||||
ids = map(lambda x:common.caldevIDs2readIDs(x), ids)
|
||||
ids = map(lambda x:common.caldav_id2real_id(x), ids)
|
||||
return super(project_task, self).unlink(cr, uid, ids)
|
||||
else:
|
||||
return super(project_task, self).unlink(cr, uid, ids)
|
||||
|
||||
def create(self, cr, uid, vals, context={}):
|
||||
if 'case_id' in vals:
|
||||
vals['case_id'] = common.caldevIDs2readIDs(vals['case_id'])
|
||||
return super(project_task, self).create(cr, uid, vals, context)
|
||||
project_task()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -21,27 +21,90 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<notebook position="inside">
|
||||
<page string="Calendar Properties">
|
||||
<field name="class"/>
|
||||
<field name="caldav_url" widget="url"/>
|
||||
<field name="location"/>
|
||||
<field name="alarm_id"/>
|
||||
<newline/>
|
||||
<field name="rrule" colspan="2"/>
|
||||
<button string="Change RRule" name="97"
|
||||
icon="gtk-save-as" type="action" colspan="2"
|
||||
context="{'model' : 'project.task'}"/>
|
||||
<field name="exrule" colspan="4"/>
|
||||
<separator string="Exception Dates" colspan="4"/>
|
||||
<field name="exdate" nolabel="1" colspan="4"/>
|
||||
</page>
|
||||
<page string="Attendee Details">
|
||||
<separator string="Attendee" colspan="4"/>
|
||||
<field name="attendee_ids" colspan="4" nolabel="1"/>
|
||||
<page string="Assignees Detail">
|
||||
<button string="Assign Task"
|
||||
name="%(caldav.action_view_calendar_invite_attendee_wizard)d"
|
||||
icon="terp-partner" type="action"
|
||||
context="{'model' : 'project.task'}" colspan="2"/>
|
||||
<field name="attendee_ids" colspan="4"
|
||||
nolabel="1" widget="one2many" mode="tree,form">
|
||||
<tree string="Assignees details"
|
||||
editable="top">
|
||||
<field name="email" />
|
||||
<field name="role" select="1" />
|
||||
<field name="state" />
|
||||
</tree>
|
||||
<form string="Assignees details">
|
||||
<notebook colspan="4">
|
||||
<page string="Details">
|
||||
<field name="email" />
|
||||
<field name="rsvp" select="1" />
|
||||
<field name="cutype" select="1" />
|
||||
<field name="role" select="1" />
|
||||
<separator colspan="4"
|
||||
string="" />
|
||||
<field name="state" />
|
||||
</page>
|
||||
<page string="Other">
|
||||
<field name="user_id"
|
||||
select="1" />
|
||||
<field name="partner_address_id"
|
||||
select="1" />
|
||||
<newline />
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</page>
|
||||
</notebook>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_project_caldav_task_form1" model="ir.ui.view">
|
||||
<field name="name">project.task.caldav.form1</field>
|
||||
<field name="model">project.task</field>
|
||||
<field name="inherit_id" ref="project.view_task_form2"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="sequence" position="after">
|
||||
<field name="class" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_project_caldav_task_form2" model="ir.ui.view">
|
||||
<field name="name">project.task.caldav.form2</field>
|
||||
<field name="model">project.task</field>
|
||||
<field name="inherit_id" ref="project.view_task_form2" />
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="date_close" position="after">
|
||||
<group colspan="2" col="3">
|
||||
<field name="rrule_type" string="Recurrency"
|
||||
on_change="onchange_rrule_type(rrule_type)" colspan="1" />
|
||||
<button string="Custom" name="101"
|
||||
icon="gtk-save-as" type="action"
|
||||
context="{'model' : 'project.task'}"
|
||||
attrs="{'readonly': [('rrule_type','!=','custom')]}" />
|
||||
</group>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_project_caldav_task_form3" model="ir.ui.view">
|
||||
<field name="name">project.task.caldav.form3</field>
|
||||
<field name="model">project.task</field>
|
||||
<field name="inherit_id" ref="project.view_task_form2" />
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_id" position="after">
|
||||
<field name="location" colspan="2" />
|
||||
<field name="alarm_id" string="Reminder" widget="selection" />
|
||||
<field name="caldav_url" widget="url" />
|
||||
<field name="rrule" invisible="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -30,7 +30,7 @@ class sale_order(osv.osv):
|
|||
|
||||
def _get_section(self, cr, uid, context):
|
||||
user = self.pool.get('res.users').browse(cr,uid,uid,context=context)
|
||||
return user.context_section_id
|
||||
return int(user.context_section_id)
|
||||
|
||||
_defaults = {
|
||||
'section_id':_get_section
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
</record>
|
||||
<record model="ir.rule" id="sale_order_comp_rule">
|
||||
<field name="rule_group" ref="sale_order_crm_rule_group"/>
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','=',user.context_section_id)]</field>
|
||||
<field name="domain_force">['|',('section_id','=',False),('section_id','in',[user.context_section_id])]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.rule.group" id="sale_order_line_crm_rule_group">
|
||||
|
@ -19,7 +19,7 @@
|
|||
</record>
|
||||
<record model="ir.rule" id="sale_order_line_comp_rule">
|
||||
<field name="rule_group" ref="sale_order_line_crm_rule_group"/>
|
||||
<field name="domain_force">['|',('order_id.section_id','=',False),('order_id.section_id','=',user.context_section_id)]</field>
|
||||
<field name="domain_force">['|',('order_id.section_id','=',False),('order_id.section_id','in',[user.context_section_id])]</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue