[MERGE]: Merge with lp:openobject-addons
bzr revid: mma@tinyerp.com-20121008133114-skk7hnn2lbq8io2h
This commit is contained in:
commit
fb0fdad5ba
|
@ -1360,6 +1360,7 @@ class account_invoice_line(osv.osv):
|
|||
_columns = {
|
||||
'name': fields.text('Description', required=True),
|
||||
'origin': fields.char('Source', size=256, help="Reference of the document that produced this invoice."),
|
||||
'sequence': fields.integer('Sequence', help="Gives the sequence of this line when displaying the invoice."),
|
||||
'invoice_id': fields.many2one('account.invoice', 'Invoice Reference', ondelete='cascade', select=True),
|
||||
'uos_id': fields.many2one('product.uom', 'Unit of Measure', ondelete='set null'),
|
||||
'product_id': fields.many2one('product.product', 'Product', ondelete='set null'),
|
||||
|
|
|
@ -6,7 +6,12 @@
|
|||
<field name="model">account.invoice.confirm</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Confirm Draft Invoices" version="7.0">
|
||||
<separator string="Confirm Draft Invoices"/>
|
||||
<p class="oe_grey">
|
||||
Once draft invoices are confirmed, you will not be able
|
||||
to modify them. The invoices will receive a unique
|
||||
number and journal items will be created in your chart
|
||||
of accounts.
|
||||
</p>
|
||||
<footer>
|
||||
<button string="Confirm Invoices" name="invoice_confirm" type="object" default_focus="1" class="oe_highlight"/>
|
||||
or
|
||||
|
@ -27,7 +32,6 @@
|
|||
<field name="model">account.invoice.cancel</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Cancel Selected Invoices" version="7.0">
|
||||
<separator string="Cancel Selected Invoices"/>
|
||||
<footer>
|
||||
<button string="Cancel Invoices" name="invoice_cancel" type="object" default_focus="1" class="oe_highlight"/>
|
||||
or
|
||||
|
|
|
@ -39,11 +39,11 @@ months = {
|
|||
|
||||
def get_recurrent_dates(rrulestring, exdate, startdate=None, exrule=None):
|
||||
"""
|
||||
Get recurrent dates based on Rule string considering exdate and start date
|
||||
@param rrulestring: Rulestring
|
||||
@param exdate: List of exception dates for rrule
|
||||
@param startdate: Startdate for computing recurrent dates
|
||||
@return: List of Recurrent dates
|
||||
Get recurrent dates based on Rule string considering exdate and start date.
|
||||
@param rrulestring: rulestring
|
||||
@param exdate: list of exception dates for rrule
|
||||
@param startdate: startdate for computing recurrent dates
|
||||
@return: list of Recurrent dates
|
||||
"""
|
||||
def todate(date):
|
||||
val = parser.parse(''.join((re.compile('\d')).findall(date)))
|
||||
|
@ -67,11 +67,12 @@ def get_recurrent_dates(rrulestring, exdate, startdate=None, exrule=None):
|
|||
|
||||
def base_calendar_id2real_id(base_calendar_id=None, with_date=False):
|
||||
"""
|
||||
This function converts virtual event id into real id of actual event
|
||||
@param base_calendar_id: Id of calendar
|
||||
@param with_date: If value passed to this param it will return dates based on value of withdate + base_calendar_id
|
||||
Convert a "virtual/recurring event id" (type string) into a real event id (type int).
|
||||
E.g. virtual/recurring event id is 4-20091201100000, so it will return 4.
|
||||
@param base_calendar_id: id of calendar
|
||||
@param with_date: if a value is passed to this param it will return dates based on value of withdate + base_calendar_id
|
||||
@return: real event id
|
||||
"""
|
||||
|
||||
if base_calendar_id and isinstance(base_calendar_id, (str, unicode)):
|
||||
res = base_calendar_id.split('-')
|
||||
|
||||
|
@ -89,12 +90,13 @@ def base_calendar_id2real_id(base_calendar_id=None, with_date=False):
|
|||
|
||||
def real_id2base_calendar_id(real_id, recurrent_date):
|
||||
"""
|
||||
Convert real id of record into virtual id using recurrent_date
|
||||
e.g. real id is 1 and recurrent_date is 01-12-2009 10:00:00 then it will return
|
||||
1-20091201100000
|
||||
@return: real id with recurrent date.
|
||||
Convert a real event id (type int) into a "virtual/recurring event id" (type string).
|
||||
E.g. real event id is 1 and recurrent_date is set to 01-12-2009 10:00:00, so
|
||||
it will return 1-20091201100000.
|
||||
@param real_id: real event id
|
||||
@param recurrent_date: real event recurrent date
|
||||
@return: string containing the real id and the recurrent date
|
||||
"""
|
||||
|
||||
if real_id and recurrent_date:
|
||||
recurrent_date = time.strftime("%Y%m%d%H%M%S", \
|
||||
time.strptime(recurrent_date, "%Y-%m-%d %H:%M:%S"))
|
||||
|
@ -104,10 +106,10 @@ def real_id2base_calendar_id(real_id, recurrent_date):
|
|||
def _links_get(self, cr, uid, context=None):
|
||||
"""
|
||||
Get request link.
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return: list of dictionary which contain object and name and id.
|
||||
@param cr: the current row, from the database cursor
|
||||
@param uid: the current user's ID for security checks
|
||||
@param context: a standard dictionary for contextual values
|
||||
@return: list of dictionary which contain object and name and id
|
||||
"""
|
||||
obj = self.pool.get('res.request.link')
|
||||
ids = obj.search(cr, uid, [])
|
||||
|
@ -216,9 +218,9 @@ class calendar_attendee(osv.osv):
|
|||
|
||||
def _get_address(self, name=None, email=None):
|
||||
"""
|
||||
Gives email information in ical CAL-ADDRESS type format
|
||||
@param name: Name for CAL-ADDRESS value
|
||||
@param email: Email address for CAL-ADDRESS value
|
||||
Gives email information in ical CAL-ADDRESS type format.
|
||||
@param name: name for CAL-ADDRESS value
|
||||
@param email: email address for CAL-ADDRESS value
|
||||
"""
|
||||
if name and email:
|
||||
name += ':'
|
||||
|
@ -226,13 +228,13 @@ class calendar_attendee(osv.osv):
|
|||
|
||||
def _compute_data(self, cr, uid, ids, name, arg, context=None):
|
||||
"""
|
||||
Compute data on function fields for attendee values .
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of calendar attendee’s IDs.
|
||||
@param name: name of field.
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return: Dictionary of form {id: {'field Name': value'}}.
|
||||
Compute data on function fields for attendee values.
|
||||
@param cr: the current row, from the database cursor
|
||||
@param uid: the current user's ID for security checks
|
||||
@param ids: list of calendar attendee's IDs
|
||||
@param name: name of field
|
||||
@param context: a standard dictionary for contextual values
|
||||
@return: dictionary of form {id: {'field Name': value'}}
|
||||
"""
|
||||
name = name[0]
|
||||
result = {}
|
||||
|
@ -297,10 +299,10 @@ class calendar_attendee(osv.osv):
|
|||
def _links_get(self, cr, uid, context=None):
|
||||
"""
|
||||
Get request link for ref field in calendar attendee.
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param cr: the current row, from the database cursor
|
||||
@param uid: the current user's id for security checks
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return: list of dictionary which contain object and name and id.
|
||||
@return: list of dictionary which contain object and name and id
|
||||
"""
|
||||
obj = self.pool.get('res.request.link')
|
||||
ids = obj.search(cr, uid, [])
|
||||
|
@ -310,10 +312,10 @@ class calendar_attendee(osv.osv):
|
|||
def _lang_get(self, cr, uid, context=None):
|
||||
"""
|
||||
Get language for language selection field.
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return: list of dictionary which contain code and name and id.
|
||||
@param cr: the current row, from the database cursor
|
||||
@param uid: the current user's id for security checks
|
||||
@param context: a standard dictionary for contextual values
|
||||
@return: list of dictionary which contain code and name and id
|
||||
"""
|
||||
obj = self.pool.get('res.lang')
|
||||
ids = obj.search(cr, uid, [])
|
||||
|
@ -375,7 +377,6 @@ property or property parameter."),
|
|||
'ref': fields.reference('Event Ref', selection=_links_get, size=128),
|
||||
'availability': fields.selection([('free', 'Free'), ('busy', 'Busy')], 'Free/Busy', readonly="True"),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'state': 'needs-action',
|
||||
'role': 'req-participant',
|
||||
|
@ -388,12 +389,12 @@ property or property parameter."),
|
|||
|
||||
def get_ics_file(self, cr, uid, event_obj, context=None):
|
||||
"""
|
||||
Returns iCalendar file for the event invitation
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param event_obj: Event object (browse record)
|
||||
@param context: A standard dictionary for contextual values
|
||||
Returns iCalendar file for the event invitation.
|
||||
@param self: the object pointer
|
||||
@param cr: the current row, from the database cursor
|
||||
@param uid: the current user's id for security checks
|
||||
@param event_obj: event object (browse record)
|
||||
@param context: a standard dictionary for contextual values
|
||||
@return: .ics file content
|
||||
"""
|
||||
res = None
|
||||
|
@ -471,7 +472,7 @@ property or property parameter."),
|
|||
def _send_mail(self, cr, uid, ids, mail_to, email_from=tools.config.get('email_from', False), context=None):
|
||||
"""
|
||||
Send mail for event invitation to event attendees.
|
||||
@param email_from: Email address for user sending the mail
|
||||
@param email_from: email address for user sending the mail
|
||||
@return: True
|
||||
"""
|
||||
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.name
|
||||
|
@ -517,11 +518,11 @@ property or property parameter."),
|
|||
def onchange_user_id(self, cr, uid, ids, user_id, *args, **argv):
|
||||
"""
|
||||
Make entry on email and availbility on change of user_id field.
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of calendar attendee’s IDs.
|
||||
@param user_id: Changed value of User id
|
||||
@return: dictionary of value. which put value in email and availability fields.
|
||||
@param cr: the current row, from the database cursor
|
||||
@param uid: the current user's ID for security checks
|
||||
@param ids: list of calendar attendee's IDs
|
||||
@param user_id: changed value of User id
|
||||
@return: dictionary of values which put value in email and availability fields
|
||||
"""
|
||||
|
||||
if not user_id:
|
||||
|
@ -531,24 +532,25 @@ property or property parameter."),
|
|||
return {'value': {'email': user.email, 'availability':user.availability}}
|
||||
|
||||
def do_tentative(self, cr, uid, ids, context=None, *args):
|
||||
""" Makes event invitation as Tentative
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of calendar attendee’s IDs
|
||||
@param *args: Get Tupple value
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
Makes event invitation as Tentative.
|
||||
@param self: the object pointer
|
||||
@param cr: the current row, from the database cursor
|
||||
@param uid: the current user's ID for security checks
|
||||
@param ids: list of calendar attendee's IDs
|
||||
@param *args: get Tupple value
|
||||
@param context: a standard dictionary for contextual values
|
||||
"""
|
||||
return self.write(cr, uid, ids, {'state': 'tentative'}, context)
|
||||
|
||||
def do_accept(self, cr, uid, ids, context=None, *args):
|
||||
"""
|
||||
Update state of invitation as Accepted and
|
||||
if the invited user is other then event user it will make a copy of this event for invited user
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of calendar attendee’s IDs.
|
||||
@param context: A standard dictionary for contextual values
|
||||
Update state of invitation as Accepted and if the invited user is other
|
||||
then event user it will make a copy of this event for invited user.
|
||||
@param cr: the current row, from the database cursor
|
||||
@param uid: the current user's ID for security checks
|
||||
@param ids: list of calendar attendee's IDs
|
||||
@param context: a standard dictionary for contextual values
|
||||
@return: True
|
||||
"""
|
||||
if context is None:
|
||||
|
@ -564,25 +566,28 @@ property or property parameter."),
|
|||
return True
|
||||
|
||||
def do_decline(self, cr, uid, ids, context=None, *args):
|
||||
""" Marks event invitation as Declined
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of calendar attendee’s IDs
|
||||
@param *args: Get Tupple value
|
||||
@param context: A standard dictionary for contextual values """
|
||||
"""
|
||||
Marks event invitation as Declined.
|
||||
@param self: the object pointer
|
||||
@param cr: the current row, from the database cursor
|
||||
@param uid: the current user's ID for security checks
|
||||
@param ids: list of calendar attendee's IDs
|
||||
@param *args: get Tupple value
|
||||
@param context: a standard dictionary for contextual values
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
return self.write(cr, uid, ids, {'state': 'declined'}, context)
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
""" Overrides orm create method.
|
||||
"""
|
||||
Overrides orm create method.
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param vals: Get Values
|
||||
@param context: A standard dictionary for contextual values """
|
||||
|
||||
@param cr: the current row, from the database cursor
|
||||
@param uid: the current user's ID for security checks
|
||||
@param vals: get Values
|
||||
@param context: a standard dictionary for contextual values
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
if not vals.get("email") and vals.get("cn"):
|
||||
|
@ -592,6 +597,7 @@ property or property parameter."),
|
|||
vals['cn'] = vals.get("cn")
|
||||
res = super(calendar_attendee, self).create(cr, uid, vals, context)
|
||||
return res
|
||||
|
||||
calendar_attendee()
|
||||
|
||||
class res_alarm(osv.osv):
|
||||
|
@ -630,8 +636,8 @@ true, it will allow you to hide the event alarm information without removing it.
|
|||
"""
|
||||
Create Alarm for event.
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of res alarm’s IDs.
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param ids: List of res alarm's IDs.
|
||||
@param model: Model name.
|
||||
@param date: Event date
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
@ -704,8 +710,8 @@ true, it will allow you to hide the event alarm information without removing it.
|
|||
"""
|
||||
Delete alarm specified in ids
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of res alarm’s IDs.
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param ids: List of res alarm's IDs.
|
||||
@param model: Model name for which alarm is to be cleared.
|
||||
@return: True
|
||||
"""
|
||||
|
@ -715,12 +721,12 @@ true, it will allow you to hide the event alarm information without removing it.
|
|||
ir_obj = self.pool.get('ir.model')
|
||||
model_id = ir_obj.search(cr, uid, [('model', '=', model)])[0]
|
||||
model_obj = self.pool.get(model)
|
||||
for datas in model_obj.browse(cr, uid, ids, context=context):
|
||||
alarm_ids = alarm_obj.search(cr, uid, [('model_id', '=', model_id), ('res_id', '=', datas.id)])
|
||||
for data in model_obj.browse(cr, uid, ids, context=context):
|
||||
alarm_ids = alarm_obj.search(cr, uid, [('model_id', '=', model_id), ('res_id', '=', data.id)])
|
||||
if alarm_ids:
|
||||
alarm_obj.unlink(cr, uid, alarm_ids)
|
||||
cr.execute('Update %s set base_calendar_alarm_id=NULL, alarm_id=NULL\
|
||||
where id=%%s' % model_obj._table,(datas.id,))
|
||||
where id=%%s' % model_obj._table,(data.id,))
|
||||
return True
|
||||
|
||||
res_alarm()
|
||||
|
@ -773,7 +779,7 @@ class calendar_alarm(osv.osv):
|
|||
Overrides orm create method.
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param vals: dictionary of fields value.{‘name_of_the_field’: value, ...}
|
||||
@param vals: dictionary of fields value.{'name_of_the_field': value, ...}
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return: new record id for calendar_alarm.
|
||||
"""
|
||||
|
@ -798,8 +804,8 @@ class calendar_alarm(osv.osv):
|
|||
"""Scheduler for event reminder
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of calendar alarm’s IDs.
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param ids: List of calendar alarm's IDs.
|
||||
@param use_new_cursor: False or the dbname
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
@ -891,8 +897,8 @@ class calendar_event(osv.osv):
|
|||
"""Returns duration and/or end date based on values passed
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of calendar event’s IDs.
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param ids: List of calendar event's IDs.
|
||||
@param start_date: Starting date
|
||||
@param duration: Duration between start date and end date
|
||||
@param end_date: Ending Datee
|
||||
|
@ -967,14 +973,14 @@ class calendar_event(osv.osv):
|
|||
if not isinstance(ids, list):
|
||||
ids = [ids]
|
||||
|
||||
for datas in self.read(cr, uid, ids, ['id','byday','recurrency', 'month_list','end_date', 'rrule_type', 'select1', 'interval', 'count', 'end_type', 'mo', 'tu', 'we', 'th', 'fr', 'sa', 'su', 'exrule', 'day', 'week_list' ], context=context):
|
||||
event = datas['id']
|
||||
if datas.get('interval', 0) < 0:
|
||||
for data in self.read(cr, uid, ids, ['id','byday','recurrency', 'month_list','end_date', 'rrule_type', 'select1', 'interval', 'count', 'end_type', 'mo', 'tu', 'we', 'th', 'fr', 'sa', 'su', 'exrule', 'day', 'week_list' ], context=context):
|
||||
event = data['id']
|
||||
if data.get('interval', 0) < 0:
|
||||
raise osv.except_osv(_('Warning!'), _('Interval cannot be negative.'))
|
||||
if datas.get('count', 0) <= 0:
|
||||
if data.get('count', 0) <= 0:
|
||||
raise osv.except_osv(_('Warning!'), _('Count cannot be negative or 0.'))
|
||||
if datas['recurrency']:
|
||||
result[event] = self.compute_rule_string(datas)
|
||||
if data['recurrency']:
|
||||
result[event] = self.compute_rule_string(data)
|
||||
else:
|
||||
result[event] = ""
|
||||
return result
|
||||
|
@ -990,7 +996,6 @@ class calendar_event(osv.osv):
|
|||
super(calendar_event, obj).write(cr, uid, ids, data, context=context)
|
||||
return True
|
||||
|
||||
|
||||
_columns = {
|
||||
'id': fields.integer('ID', readonly=True),
|
||||
'sequence': fields.integer('Sequence'),
|
||||
|
@ -1006,21 +1011,24 @@ class calendar_event(osv.osv):
|
|||
'show_as': fields.selection([('free', 'Free'), ('busy', 'Busy')], \
|
||||
'Show Time as', states={'done': [('readonly', True)]}),
|
||||
'base_calendar_url': fields.char('Caldav URL', size=264),
|
||||
'state': fields.selection([('tentative', 'Tentative'),
|
||||
('cancelled', 'Cancelled'),
|
||||
('confirmed', 'Confirmed'),
|
||||
], 'Status', readonly=True),
|
||||
'state': fields.selection([
|
||||
('tentative', 'Tentative'),
|
||||
('cancelled', 'Cancelled'),
|
||||
('confirmed', 'Confirmed'),
|
||||
], 'Status', readonly=True),
|
||||
'exdate': fields.text('Exception Date/Times', help="This property \
|
||||
defines the list of date/time exceptions for a recurring calendar component."),
|
||||
'exrule': fields.char('Exception Rule', size=352, help="Defines a \
|
||||
rule or repeating pattern of time to exclude from the recurring rule."),
|
||||
'rrule': fields.function(_get_rulestring, type='char', size=124, \
|
||||
fnct_inv=_rrule_write, store=True, string='Recurrent Rule'),
|
||||
'rrule_type': fields.selection([('none', ''), ('daily', 'Day(s)'), \
|
||||
('weekly', 'Week(s)'), ('monthly', 'Month(s)'), \
|
||||
('yearly', 'Year(s)'),],
|
||||
'Recurrency', states={'done': [('readonly', True)]},
|
||||
help="Let the event automatically repeat at that interval"),
|
||||
'rrule_type': fields.selection([
|
||||
('daily', 'Day(s)'),
|
||||
('weekly', 'Week(s)'),
|
||||
('monthly', 'Month(s)'),
|
||||
('yearly', 'Year(s)')
|
||||
], 'Recurrency', states={'done': [('readonly', True)]},
|
||||
help="Let the event automatically repeat at that interval"),
|
||||
'alarm_id': fields.many2one('res.alarm', 'Reminder', states={'done': [('readonly', True)]},
|
||||
help="Set an alarm at this time, before the event occurs" ),
|
||||
'base_calendar_alarm_id': fields.many2one('calendar.alarm', 'Alarm'),
|
||||
|
@ -1028,7 +1036,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
'recurrent_id': fields.datetime('Recurrent ID date'),
|
||||
'vtimezone': fields.selection(_tz_get, size=64, string='Timezone'),
|
||||
'user_id': fields.many2one('res.users', 'Responsible', states={'done': [('readonly', True)]}),
|
||||
'organizer': fields.char("Organizer", size=256, states={'done': [('readonly', True)]}), # Map with Organizer Attribure of VEvent.
|
||||
'organizer': fields.char("Organizer", size=256, states={'done': [('readonly', True)]}), # Map with organizer attribute of VEvent.
|
||||
'organizer_id': fields.many2one('res.users', 'Organizer', states={'done': [('readonly', True)]}),
|
||||
'end_type' : fields.selection([('count', 'Number of repetitions'), ('end_date','End date')], 'Recurrence Termination'),
|
||||
'interval': fields.integer('Repeat Every', help="Repeat every (Days/Week/Month/Year)"),
|
||||
|
@ -1043,13 +1051,21 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
'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'), \
|
||||
('WE', 'Wednesday'), ('TH', 'Thursday'), \
|
||||
('FR', 'Friday'), ('SA', 'Saturday'), \
|
||||
('SU', 'Sunday')], 'Weekday'),
|
||||
'byday': fields.selection([('1', 'First'), ('2', 'Second'), \
|
||||
('3', 'Third'), ('4', 'Fourth'), \
|
||||
('5', 'Fifth'), ('-1', 'Last')], 'By day'),
|
||||
'week_list': fields.selection([
|
||||
('MO', 'Monday'),
|
||||
('TU', 'Tuesday'),
|
||||
('WE', 'Wednesday'),
|
||||
('TH', 'Thursday'),
|
||||
('FR', 'Friday'),
|
||||
('SA', 'Saturday'),
|
||||
('SU', 'Sunday')], 'Weekday'),
|
||||
'byday': fields.selection([
|
||||
('1', 'First'),
|
||||
('2', 'Second'),
|
||||
('3', 'Third'),
|
||||
('4', 'Fourth'),
|
||||
('5', 'Fifth'),
|
||||
('-1', 'Last')], 'By day'),
|
||||
'month_list': fields.selection(months.items(), 'Month'),
|
||||
'end_date': fields.date('Repeat Until'),
|
||||
'attendee_ids': fields.many2many('calendar.attendee', 'event_attendee_rel', \
|
||||
|
@ -1101,9 +1117,9 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
return res
|
||||
|
||||
_defaults = {
|
||||
'end_type' : 'count',
|
||||
'count' : 1,
|
||||
'rrule_type' : 'none',
|
||||
'end_type': 'count',
|
||||
'count': 1,
|
||||
'rrule_type': False,
|
||||
'state': 'tentative',
|
||||
'class': 'public',
|
||||
'show_as': 'busy',
|
||||
|
@ -1113,7 +1129,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
'user_id': lambda self, cr, uid, ctx: uid,
|
||||
'organizer': default_organizer,
|
||||
}
|
||||
|
||||
|
||||
def _check_closing_date(self, cr, uid, ids, context=None):
|
||||
for event in self.browse(cr, uid, ids, context=context):
|
||||
if event.date_deadline < event.date:
|
||||
|
@ -1129,7 +1145,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
This method gives ids of dates that comes between start date and end date of calendar views
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param limit: The Number of Results to Return """
|
||||
if not context:
|
||||
context = {}
|
||||
|
@ -1140,7 +1156,8 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
result.append(data['id'])
|
||||
continue
|
||||
event_date = datetime.strptime(data['date'], "%Y-%m-%d %H:%M:%S")
|
||||
# To check: If the start date is replace by event date .. the event date will be changed by that of calendar code
|
||||
|
||||
# TOCHECK: the start date should be replaced by event date; the event date will be changed by that of calendar code
|
||||
|
||||
if not data['rrule']:
|
||||
continue
|
||||
|
@ -1186,45 +1203,46 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
ids = list(set(result))
|
||||
return ids
|
||||
|
||||
def compute_rule_string(self, datas):
|
||||
def compute_rule_string(self, data):
|
||||
"""
|
||||
Compute rule string according to value type RECUR of iCalendar from the values given.
|
||||
@param self: the object pointer
|
||||
@param datas: dictionary of freq and interval value.
|
||||
@param data: dictionary of freq and interval value
|
||||
@return: string containing recurring rule (empty if no rule)
|
||||
"""
|
||||
def get_week_string(freq, datas):
|
||||
def get_week_string(freq, data):
|
||||
weekdays = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su']
|
||||
if freq == 'weekly':
|
||||
byday = map(lambda x: x.upper(), filter(lambda x: datas.get(x) and x in weekdays, datas))
|
||||
byday = map(lambda x: x.upper(), filter(lambda x: data.get(x) and x in weekdays, data))
|
||||
if byday:
|
||||
return ';BYDAY=' + ','.join(byday)
|
||||
return ''
|
||||
|
||||
def get_month_string(freq, datas):
|
||||
def get_month_string(freq, data):
|
||||
if freq == 'monthly':
|
||||
if datas.get('select1')=='date' and (datas.get('day') < 1 or datas.get('day') > 31):
|
||||
if data.get('select1')=='date' and (data.get('day') < 1 or data.get('day') > 31):
|
||||
raise osv.except_osv(_('Error!'), ("Please select a proper day of the month."))
|
||||
|
||||
if datas.get('select1')=='day':
|
||||
return ';BYDAY=' + datas.get('byday') + datas.get('week_list')
|
||||
elif datas.get('select1')=='date':
|
||||
return ';BYMONTHDAY=' + str(datas.get('day'))
|
||||
if data.get('select1')=='day':
|
||||
return ';BYDAY=' + data.get('byday') + data.get('week_list')
|
||||
elif data.get('select1')=='date':
|
||||
return ';BYMONTHDAY=' + str(data.get('day'))
|
||||
return ''
|
||||
|
||||
def get_end_date(datas):
|
||||
if datas.get('end_date'):
|
||||
datas['end_date_new'] = ''.join((re.compile('\d')).findall(datas.get('end_date'))) + 'T235959Z'
|
||||
def get_end_date(data):
|
||||
if data.get('end_date'):
|
||||
data['end_date_new'] = ''.join((re.compile('\d')).findall(data.get('end_date'))) + 'T235959Z'
|
||||
|
||||
return (datas.get('end_type') == 'count' and (';COUNT=' + str(datas.get('count'))) or '') +\
|
||||
((datas.get('end_date_new') and datas.get('end_type') == 'end_date' and (';UNTIL=' + datas.get('end_date_new'))) or '')
|
||||
return (data.get('end_type') == 'count' and (';COUNT=' + str(data.get('count'))) or '') +\
|
||||
((data.get('end_date_new') and data.get('end_type') == 'end_date' and (';UNTIL=' + data.get('end_date_new'))) or '')
|
||||
|
||||
freq=datas.get('rrule_type')
|
||||
if freq == 'none':
|
||||
return ''
|
||||
freq = data.get('rrule_type', False)
|
||||
res = ''
|
||||
if freq:
|
||||
interval_srting = data.get('interval') and (';INTERVAL=' + str(data.get('interval'))) or ''
|
||||
res = 'FREQ=' + freq.upper() + get_week_string(freq, data) + interval_srting + get_end_date(data) + get_month_string(freq, data)
|
||||
|
||||
interval_srting = datas.get('interval') and (';INTERVAL=' + str(datas.get('interval'))) or ''
|
||||
|
||||
return 'FREQ=' + freq.upper() + get_week_string(freq, datas) + interval_srting + get_end_date(datas) + get_month_string(freq, datas)
|
||||
return res
|
||||
|
||||
def _get_empty_rrule_data(self):
|
||||
return {
|
||||
|
@ -1248,19 +1266,6 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
'week_list' : False
|
||||
}
|
||||
|
||||
#def _write_rrule(self, cr, uid, ids, field_value, rule_date=False, context=None):
|
||||
# data = self._get_empty_rrule_data()
|
||||
#
|
||||
# if field_value:
|
||||
# data['recurrency'] = True
|
||||
# for event in self.browse(cr, uid, ids, context=context):
|
||||
# rdate = rule_date or event.date
|
||||
# update_data = self._parse_rrule(field_value, dict(data), rdate)
|
||||
# data.update(update_data)
|
||||
# #parse_rrule
|
||||
# self.write(cr, uid, event.id, data, context=context)
|
||||
|
||||
|
||||
def _parse_rrule(self, rule, data, date_start):
|
||||
day_list = ['mo', 'tu', 'we', 'th', 'fr', 'sa', 'su']
|
||||
rrule_type = ['yearly', 'monthly', 'weekly', 'daily']
|
||||
|
@ -1278,7 +1283,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
if i in r._byweekday:
|
||||
data[day_list[i]] = True
|
||||
data['rrule_type'] = 'weekly'
|
||||
#repeat monthly bynweekday ((weekday, weeknumber), )
|
||||
#repeat monthly by nweekday ((weekday, weeknumber), )
|
||||
if r._bynweekday:
|
||||
data['week_list'] = day_list[r._bynweekday[0][0]].upper()
|
||||
data['byday'] = r._bynweekday[0][1]
|
||||
|
@ -1290,7 +1295,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
data['select1'] = 'date'
|
||||
data['rrule_type'] = 'monthly'
|
||||
|
||||
#yearly but for openerp it's monthly, take same information as monthly but interval is 12 times
|
||||
#repeat yearly but for openerp it's monthly, take same information as monthly but interval is 12 times
|
||||
if r._bymonth:
|
||||
data['interval'] = data['interval'] * 12
|
||||
|
||||
|
@ -1363,7 +1368,6 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
except Exception:
|
||||
return True
|
||||
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
|
||||
context = context or {}
|
||||
if isinstance(ids, (str, int, long)):
|
||||
|
@ -1384,14 +1388,14 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
data = self.read(cr, uid, event_id, ['date', 'date_deadline', \
|
||||
'rrule', 'duration', 'exdate'])
|
||||
if data.get('rrule'):
|
||||
data.update(vals)
|
||||
data.update({
|
||||
'recurrent_uid': real_event_id,
|
||||
'recurrent_id': data.get('date'),
|
||||
'rrule_type': 'none',
|
||||
'rrule': '',
|
||||
'recurrency' : False,
|
||||
})
|
||||
data.update(
|
||||
vals,
|
||||
recurrent_uid=real_event_id,
|
||||
recurrent_id=data.get('date'),
|
||||
rrule_type=False,
|
||||
rrule='',
|
||||
recurrency=False,
|
||||
)
|
||||
|
||||
new_id = self.copy(cr, uid, real_event_id, default=data, context=context)
|
||||
|
||||
|
@ -1435,7 +1439,6 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
return res
|
||||
|
||||
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
|
||||
# FIXME This whole id mangling has to go!
|
||||
if context is None:
|
||||
context = {}
|
||||
fields2 = fields and fields[:] or None
|
||||
|
@ -1445,10 +1448,12 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
if fields and (f not in fields):
|
||||
fields2.append(f)
|
||||
|
||||
# FIXME This whole id mangling has to go!
|
||||
if isinstance(ids, (str, int, long)):
|
||||
select = [ids]
|
||||
else:
|
||||
select = ids
|
||||
|
||||
select = map(lambda x: (x, base_calendar_id2real_id(x)), select)
|
||||
result = []
|
||||
|
||||
|
@ -1477,7 +1482,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
if f not in ('id','date','date_deadline','duration','user_id','state'):
|
||||
if isinstance(r[f], list):
|
||||
r[f] = []
|
||||
else:
|
||||
else:
|
||||
r[f] = False
|
||||
if f=='name':
|
||||
r[f] = _('Busy')
|
||||
|
@ -1525,7 +1530,6 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
self.unlink_events(cr, uid, ids, context=context)
|
||||
return res
|
||||
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
@ -1543,7 +1547,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
""" Makes event invitation as Tentative
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param ids: List of Event IDs
|
||||
@param *args: Get Tupple value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
@ -1554,7 +1558,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
""" Makes event invitation as Tentative
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param ids: List of Event IDs
|
||||
@param *args: Get Tupple value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
@ -1565,7 +1569,7 @@ rule or repeating pattern of time to exclude from the recurring rule."),
|
|||
""" Makes event invitation as Tentative
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param ids: List of Event IDs
|
||||
@param *args: Get Tupple value
|
||||
@param context: A standard dictionary for contextual values
|
||||
|
@ -1586,9 +1590,9 @@ class calendar_todo(osv.osv):
|
|||
Get Date
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param ids: List of calendar todo's IDs.
|
||||
@param args: list of tuples of form [(‘name_of_the_field’, ‘operator’, value), ...].
|
||||
@param args: list of tuples of form [(‘name_of_the_field', ‘operator', value), ...].
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
||||
|
@ -1602,10 +1606,10 @@ class calendar_todo(osv.osv):
|
|||
Set Date
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param id: calendar's ID.
|
||||
@param value: Get Value
|
||||
@param args: list of tuples of form [(‘name_of_the_field’, ‘operator’, value), ...].
|
||||
@param args: list of tuples of form [('name_of_the_field', 'operator', value), ...].
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
||||
|
@ -1633,7 +1637,7 @@ class ir_values(osv.osv):
|
|||
Set IR Values
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param model: Get The Model
|
||||
"""
|
||||
|
||||
|
@ -1652,7 +1656,7 @@ class ir_values(osv.osv):
|
|||
Get IR Values
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param model: Get The Model
|
||||
"""
|
||||
if context is None:
|
||||
|
@ -1678,8 +1682,8 @@ class ir_model(osv.osv):
|
|||
Overrides orm read method.
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of IR Model’s IDs.
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param ids: List of IR Model's IDs.
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
new_ids = isinstance(ids, (str, int, long)) and [ids] or ids
|
||||
|
@ -1696,24 +1700,24 @@ ir_model()
|
|||
|
||||
class virtual_report_spool(web_services.report_spool):
|
||||
|
||||
def exp_report(self, db, uid, object, ids, datas=None, context=None):
|
||||
def exp_report(self, db, uid, object, ids, data=None, context=None):
|
||||
"""
|
||||
Export Report
|
||||
@param self: The object pointer
|
||||
@param db: get the current database,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
||||
if object == 'printscreen.list':
|
||||
return super(virtual_report_spool, self).exp_report(db, uid, \
|
||||
object, ids, datas, context)
|
||||
object, ids, data, context)
|
||||
new_ids = []
|
||||
for id in ids:
|
||||
new_ids.append(base_calendar_id2real_id(id))
|
||||
if datas.get('id', False):
|
||||
datas['id'] = base_calendar_id2real_id(datas['id'])
|
||||
return super(virtual_report_spool, self).exp_report(db, uid, object, new_ids, datas, context)
|
||||
if data.get('id', False):
|
||||
data['id'] = base_calendar_id2real_id(data['id'])
|
||||
return super(virtual_report_spool, self).exp_report(db, uid, object, new_ids, data, context)
|
||||
|
||||
virtual_report_spool()
|
||||
|
||||
|
@ -1725,8 +1729,8 @@ class res_users(osv.osv):
|
|||
Get User Availability
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of res user’s IDs.
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param ids: List of res user's IDs.
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
||||
|
@ -1755,8 +1759,8 @@ class res_users(osv.osv):
|
|||
Get User Availability Function
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of res user’s IDs.
|
||||
@param uid: the current user's ID for security checks,
|
||||
@param ids: List of res user's IDs.
|
||||
@param context: A standard dictionary for contextual values
|
||||
"""
|
||||
|
||||
|
@ -1770,5 +1774,4 @@ class res_users(osv.osv):
|
|||
|
||||
res_users()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- Attendee form view-->
|
||||
|
||||
<!-- Attendee form view -->
|
||||
<record id="base_calendar_attendee_form_view" model="ir.ui.view">
|
||||
<field name="name">calendar.attendee.form</field>
|
||||
<field name="model">calendar.attendee</field>
|
||||
|
@ -55,8 +54,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Attendee tree view-->
|
||||
|
||||
<!-- Attendee tree view -->
|
||||
<record id="base_calendar_attendee_tree_view" model="ir.ui.view">
|
||||
<field name="name">calendar.attendee.tree</field>
|
||||
<field name="model">calendar.attendee</field>
|
||||
|
@ -73,8 +71,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Attendee search view-->
|
||||
|
||||
<!-- Attendee search view -->
|
||||
<record id="base_calendar_attendee_search_view" model="ir.ui.view">
|
||||
<field name="name">calendar.attendee.search</field>
|
||||
<field name="model">calendar.attendee</field>
|
||||
|
@ -110,18 +107,16 @@
|
|||
<field name="context">{'default_sent_by_uid': uid}</field>
|
||||
</record>
|
||||
|
||||
<!-- Calenadar's menu -->
|
||||
<!-- Calendar's menu -->
|
||||
<menuitem id="base.menu_calendar_configuration" name="Calendar"
|
||||
parent="base.menu_base_config" sequence="50" groups="base.group_no_one"/>
|
||||
|
||||
<!-- Invitation menu -->
|
||||
|
||||
<menuitem id="menu_attendee_invitations"
|
||||
parent="base.menu_calendar_configuration"
|
||||
sequence="10" action="action_view_attendee_form"/>
|
||||
|
||||
<!-- ALARM FORM VIEW-->
|
||||
|
||||
<!-- Alarm form view -->
|
||||
<record id="res_alarm_form_view" model="ir.ui.view">
|
||||
<field name="name">res.alarm.form</field>
|
||||
<field name="model">res.alarm</field>
|
||||
|
@ -140,8 +135,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- ALARM TREE VIEW-->
|
||||
|
||||
<!-- Alarm list view -->
|
||||
<record id="res_alarm_tree_view" model="ir.ui.view">
|
||||
<field name="name">res.alarm.tree</field>
|
||||
<field name="model">res.alarm</field>
|
||||
|
@ -171,15 +165,13 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Menu for Alarms-->
|
||||
|
||||
<!-- Alarms menu -->
|
||||
<menuitem id="menu_crm_meeting_avail_alarm"
|
||||
groups="base.group_no_one"
|
||||
action="base_calendar.action_res_alarm_view"
|
||||
parent="base.menu_calendar_configuration" sequence="5"/>
|
||||
|
||||
<!-- Event Form View-->
|
||||
|
||||
<!-- Event form view -->
|
||||
<record model="ir.ui.view" id="event_form_view">
|
||||
<field name="name">Event Form</field>
|
||||
<field name="model">calendar.event</field>
|
||||
|
@ -334,8 +326,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Event Tree View -->
|
||||
|
||||
<!-- Event list view -->
|
||||
<record model="ir.ui.view" id="event_tree_view">
|
||||
<field name="name">Event Tree</field>
|
||||
<field name="model">calendar.event</field>
|
||||
|
@ -352,8 +343,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Event Calendar View -->
|
||||
|
||||
<!-- Event calendar view -->
|
||||
<record model="ir.ui.view" id="event_calendar_view">
|
||||
<field name="name">Events Calendar</field>
|
||||
<field name="model">calendar.event</field>
|
||||
|
@ -367,8 +357,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Event Search View-->
|
||||
|
||||
<!-- Event search view -->
|
||||
<record id="view_calendar_event_filter" model="ir.ui.view">
|
||||
<field name="name">Calendar Events Search</field>
|
||||
<field name="model">calendar.event</field>
|
||||
|
@ -393,8 +382,7 @@
|
|||
</record>
|
||||
|
||||
|
||||
<!-- Event action -->
|
||||
|
||||
<!-- Event action -->
|
||||
<record id="action_view_event" model="ir.actions.act_window">
|
||||
<field name="name">Events</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
|
@ -404,8 +392,7 @@
|
|||
<field name="search_view_id" ref="view_calendar_event_filter"/>
|
||||
</record>
|
||||
|
||||
<!-- Event menu -->
|
||||
|
||||
<!-- Event menu -->
|
||||
<menuitem id="menu_events"
|
||||
name="Events" parent="base.menu_calendar_configuration"
|
||||
sequence="15" action="action_view_event"/>
|
||||
|
|
|
@ -43,14 +43,14 @@ class crm_meeting(base_state, osv.Model):
|
|||
_name = 'crm.meeting'
|
||||
_description = "Meeting"
|
||||
_order = "id desc"
|
||||
_inherit = ["calendar.event", "mail.thread", 'ir.needaction_mixin']
|
||||
_inherit = ["calendar.event", "mail.thread", "ir.needaction_mixin"]
|
||||
_columns = {
|
||||
# base_state required fields
|
||||
'create_date': fields.datetime('Creation Date', readonly=True),
|
||||
'write_date': fields.datetime('Write Date', readonly=True),
|
||||
'date_open': fields.datetime('Confirmed', readonly=True),
|
||||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
'partner_ids': fields.many2many('res.partner', 'crm_meeting_partner_rel', 'meeting_id','partner_id',
|
||||
'partner_ids': fields.many2many('res.partner', 'crm_meeting_partner_rel', 'meeting_id', 'partner_id',
|
||||
string='Attendees', states={'done': [('readonly', True)]}),
|
||||
'state': fields.selection(
|
||||
[('draft', 'Unconfirmed'), ('open', 'Confirmed')],
|
||||
|
@ -115,5 +115,3 @@ class crm_meeting(base_state, osv.Model):
|
|||
|
||||
def case_close_send_note(self, cr, uid, ids, context=None):
|
||||
return self.message_post(cr, uid, ids, body=_("Meeting <b>completed</b>."), context=context)
|
||||
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
<record id="action_crm_meeting_read" model="ir.values">
|
||||
<field name="name">action_crm_meeting_read</field>
|
||||
<field name="action_id" ref="actions_server_crm_meeting_read"/>
|
||||
<field name="value" eval="'ir.actions.server,' + str(ref('actions_server_crm_meeting_read'))" />
|
||||
<field name="value" eval="'ir.actions.server,' + str(ref('actions_server_crm_meeting_read'))"/>
|
||||
<field name="key">action</field>
|
||||
<field name="model_id" ref="model_crm_meeting" />
|
||||
<field name="model_id" ref="model_crm_meeting"/>
|
||||
<field name="model">crm.meeting</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
</record>
|
||||
|
@ -33,9 +33,9 @@
|
|||
<record id="action_crm_meeting_unread" model="ir.values">
|
||||
<field name="name">action_crm_meeting_unread</field>
|
||||
<field name="action_id" ref="actions_server_crm_meeting_unread"/>
|
||||
<field name="value" eval="'ir.actions.server,' + str(ref('actions_server_crm_meeting_unread'))" />
|
||||
<field name="value" eval="'ir.actions.server,' + str(ref('actions_server_crm_meeting_unread'))"/>
|
||||
<field name="key">action</field>
|
||||
<field name="model_id" ref="model_crm_meeting" />
|
||||
<field name="model_id" ref="model_crm_meeting"/>
|
||||
<field name="model">crm.meeting</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
</record>
|
||||
|
@ -73,7 +73,7 @@
|
|||
<sheet>
|
||||
<div class="oe_title">
|
||||
<div class="oe_edit_only">
|
||||
<label for="name"/>
|
||||
<label for="name"/>
|
||||
</div>
|
||||
<h1>
|
||||
<field name="name"/>
|
||||
|
@ -116,9 +116,49 @@
|
|||
</page>
|
||||
<page string="Options">
|
||||
<group>
|
||||
<group>
|
||||
<field name="recurrency"
|
||||
attrs="{'readonly': [('recurrent_uid','!=',False)]}"/>
|
||||
<group col="1">
|
||||
<group>
|
||||
<field name="recurrency"
|
||||
attrs="{'readonly': [('recurrent_uid','!=',False)]}"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('recurrency','=',False)]}">
|
||||
<label for="interval"/>
|
||||
<div>
|
||||
<field name="interval" attrs="{'required': [('recurrency','==',True)]}" class="oe_inline"/>
|
||||
<field name="rrule_type" attrs="{'required': [('recurrency','==',True)]}" class="oe_inline"/>
|
||||
</div>
|
||||
<label string="Until" for="end_type"/>
|
||||
<div>
|
||||
<field name="end_type" attrs="{'required': [('recurrency','==',True)]}" class="oe_inline"/>
|
||||
<field name="count" attrs="{'invisible': [('end_type', '!=', 'count')], 'required': [('recurrency','==',True)]}" class="oe_inline"/>
|
||||
<field name="end_date" attrs="{'invisible': [('end_type', '!=', 'end_date')], 'required': [('end_type', '=', 'end_date')]}" class="oe_inline"/>
|
||||
</div>
|
||||
<label string="Select Weekdays" attrs="{'invisible' :[('rrule_type','not in', ['weekly'])]}"/>
|
||||
<group col="2" colspan="1" name="weekdays" attrs="{'invisible' :[('rrule_type','not in', ['weekly'])]}">
|
||||
<field name="mo"/>
|
||||
<field name="tu"/>
|
||||
<field name="we"/>
|
||||
<field name="th"/>
|
||||
<field name="fr"/>
|
||||
<field name="sa"/>
|
||||
<field name="su"/>
|
||||
</group>
|
||||
|
||||
<label string="Day of Month"
|
||||
attrs="{'invisible': [('rrule_type','!=','monthly')]}"/>
|
||||
|
||||
<div attrs="{'invisible': [('rrule_type','!=','monthly')]}">
|
||||
<field name="select1"/>
|
||||
<field name="day"
|
||||
attrs="{'required': [('select1','=','date'), ('rrule_type','=','monthly')],
|
||||
'invisible': [('select1','=','day')]}"/>
|
||||
<field name="byday" string="The"
|
||||
attrs="{'required': [('select1','=','day'), ('rrule_type','=','monthly')], 'invisible': [('select1','=','date')]}"/>
|
||||
<field name="week_list" nolabel="1"
|
||||
attrs="{'required': [('select1','=','day'), ('rrule_type','=','monthly')], 'invisible': [('select1','=','date')]}"/>
|
||||
</div>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<field name="alarm_id" widget="selection" groups="base.group_no_one"/>
|
||||
|
@ -128,44 +168,6 @@
|
|||
<field name="recurrent_id" invisible="1"/>
|
||||
<field name="recurrent_uid" invisible="1"/>
|
||||
</group>
|
||||
<group attrs="{'invisible': [('recurrency','=',False)]}">
|
||||
<label for="interval"/>
|
||||
<div>
|
||||
<field name="interval" class="oe_inline"/>
|
||||
<field name="rrule_type" class="oe_inline"/>
|
||||
</div>
|
||||
<label string="Until" for="end_type"/>
|
||||
<div>
|
||||
<field name="end_type" class="oe_inline"/>
|
||||
<field name="count" attrs="{'invisible' : [('end_type', '!=', 'count')] }" class="oe_inline"/>
|
||||
<field name="end_date" attrs="{'invisible' : [('end_type', '!=', 'end_date')], 'required': [('end_type', '=', 'end_date')]}" class="oe_inline"/>
|
||||
</div>
|
||||
<label string="Select Weekdays" attrs="{'invisible' :[('rrule_type','not in', ['weekly'])]}"/>
|
||||
<group col="2" colspan="1" name="weekdays" attrs="{'invisible' :[('rrule_type','not in', ['weekly'])]}">
|
||||
<field name="mo" />
|
||||
<field name="tu" />
|
||||
<field name="we" />
|
||||
<field name="th" />
|
||||
<field name="fr" />
|
||||
<field name="sa" />
|
||||
<field name="su" />
|
||||
</group>
|
||||
|
||||
<label string="Day of Month"
|
||||
attrs="{'invisible' : [('rrule_type','!=','monthly')]}"/>
|
||||
|
||||
<div attrs="{'invisible' : [('rrule_type','!=','monthly')]}">
|
||||
<field name="select1" />
|
||||
<field name="day"
|
||||
attrs="{'required' : [('select1','=','date'), ('rrule_type','=','monthly')],
|
||||
'invisible' : [('select1','=','day')]}" />
|
||||
<field name="byday" string="The"
|
||||
attrs="{'required' : [('select1','=','day'), ('rrule_type','=','monthly')], 'invisible' : [('select1','=','date')]}" />
|
||||
<field name="week_list" nolabel="1"
|
||||
attrs="{'required' : [('select1','=','day'), ('rrule_type','=','monthly')], 'invisible' : [('select1','=','date')]}" />
|
||||
</div>
|
||||
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<!--
|
||||
|
@ -178,12 +180,11 @@
|
|||
<tree string="Invitation details" editable="top">
|
||||
<field name="partner_id"/>
|
||||
<field name="email" string="Mail To"/>
|
||||
<field name="state" />
|
||||
<field name="state"/>
|
||||
<button name="do_tentative"
|
||||
states="needs-action,declined,accepted"
|
||||
string="Uncertain" type="object"
|
||||
icon="terp-crm"
|
||||
/>
|
||||
icon="terp-crm"/>
|
||||
<button name="do_accept" string="Accept"
|
||||
states="needs-action,tentative,declined"
|
||||
type="object" icon="gtk-apply"/>
|
||||
|
@ -195,21 +196,21 @@
|
|||
<header>
|
||||
<button name="do_tentative" type="object"
|
||||
states="needs-action,declined,accepted"
|
||||
string="Uncertain" />
|
||||
string="Uncertain"/>
|
||||
<button name="do_accept" type="object"
|
||||
states="needs-action,tentative,declined"
|
||||
string="Accept" />
|
||||
string="Accept"/>
|
||||
<button name="do_decline" type="object"
|
||||
states="needs-action,tentative,accepted"
|
||||
string="Decline" />
|
||||
string="Decline"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,open,done"/>
|
||||
</header>
|
||||
<group>
|
||||
<group>
|
||||
<field name="email" />
|
||||
<field name="rsvp" />
|
||||
<field name="cutype" />
|
||||
<field name="role" />
|
||||
<field name="email"/>
|
||||
<field name="rsvp"/>
|
||||
<field name="cutype"/>
|
||||
<field name="role"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="partner_id"/>
|
||||
|
@ -237,11 +238,11 @@
|
|||
<field name="model">crm.meeting</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Meetings" fonts="bold:message_unread==True">
|
||||
<field name="name" string="Subject" />
|
||||
<field name="name" string="Subject"/>
|
||||
<field name="user_id"/>
|
||||
<field name="date"/>
|
||||
<field name="state" invisible="True"/>
|
||||
<field name="duration" />
|
||||
<field name="duration"/>
|
||||
<field name="message_unread" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
@ -299,7 +300,7 @@
|
|||
<field name="context">{"calendar_default_user_id": uid}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to schedule a new meeting.
|
||||
Click to schedule a new meeting.
|
||||
</p><p>
|
||||
The calendar is shared between employees and fully integrated with
|
||||
other applications such as the employee holidays or the business
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
duration: 2.5
|
||||
location: OpenERP S.A.
|
||||
name: Technical Presentation
|
||||
rrule_type: none
|
||||
-
|
||||
-
|
||||
Now I will set recurrence for this event to occur monday and friday of week
|
||||
-
|
||||
!python {model: calendar.event}: |
|
||||
|
@ -39,10 +38,9 @@
|
|||
description: 'All day technical test '
|
||||
location: School
|
||||
name: All day test event
|
||||
rrule_type: none
|
||||
-
|
||||
In order to check reminder I will first create reminder
|
||||
-
|
||||
-
|
||||
!record {model: res.alarm, id: res_alarm_daybeforeeventstarts0}:
|
||||
name: 1 Day before event starts
|
||||
trigger_duration: 1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
|
||||
<record id="act_event_list_register_event" model="ir.actions.act_window">
|
||||
<field name="res_model">event.registration</field>
|
||||
<field name="view_type">form</field>
|
||||
|
|
|
@ -33,6 +33,7 @@ import report
|
|||
import wizard
|
||||
import res_config
|
||||
import mail_group_menu
|
||||
import update
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -13,6 +13,20 @@
|
|||
<field eval="'()'" name="args"/>
|
||||
</record>
|
||||
|
||||
<record id="ir_cron_module_update_notification" model="ir.cron">
|
||||
<field name="name">Update Notification</field>
|
||||
<field eval="True" name="active" />
|
||||
<field name="user_id" ref="base.user_root" />
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">weeks</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field eval="False" name="doall" />
|
||||
<field eval="'ir.module.module'" name="model" />
|
||||
<field eval="'update_notification'" name="function" />
|
||||
<field eval="'(None,)'" name="args" />
|
||||
<field name="priority">1000</field>
|
||||
</record>
|
||||
|
||||
<record id="mt_comment" model="mail.message.subtype">
|
||||
<field name="name">comment</field>
|
||||
</record>
|
||||
|
|
|
@ -504,7 +504,7 @@ class mail_message(osv.Model):
|
|||
if not values.get('message_id') and values.get('res_id') and values.get('model'):
|
||||
values['message_id'] = tools.generate_tracking_message_id('%(model)s-%(res_id)s' % values)
|
||||
newid = super(mail_message, self).create(cr, uid, values, context)
|
||||
self._notify(cr, 1, newid, context=context)
|
||||
self._notify(cr, SUPERUSER_ID, newid, context=context)
|
||||
return newid
|
||||
|
||||
def read(self, cr, uid, ids, fields=None, context=None, load='_classic_read'):
|
||||
|
|
|
@ -149,7 +149,6 @@ openerp_mail_followers = function(session, mail) {
|
|||
var self = this;
|
||||
var node_user_list = this.$('ul.oe_mail_followers_display').empty();
|
||||
this.$('div.oe_mail_recthread_followers h4').html(this.options.title + (records.length>=5 ? ' (' + records.length + ')' : '') );
|
||||
console.log(records);
|
||||
for(var i=0; i<records.length&&i<5; i++) {
|
||||
var record=records[i];
|
||||
record.avatar_url = mail.ChatterUtils.get_image(self.session, 'res.partner', 'image_small', record.id);
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
import logging
|
||||
import sys
|
||||
import urllib
|
||||
import urllib2
|
||||
|
||||
import pooler
|
||||
import release
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
from tools.safe_eval import safe_eval
|
||||
from tools.config import config
|
||||
from tools import misc
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
"""
|
||||
Time interval that will be used to determine up to which date we will
|
||||
check the logs to see if a message we just received was already logged.
|
||||
@type: datetime.timedelta
|
||||
"""
|
||||
_PREVIOUS_LOG_CHECK = datetime.timedelta(days=365)
|
||||
|
||||
def get_sys_logs(cr, uid):
|
||||
"""
|
||||
Utility method to send a publisher warranty get logs messages.
|
||||
"""
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
|
||||
dbuuid = pool.get('ir.config_parameter').get_param(cr, uid, 'database.uuid')
|
||||
db_create_date = pool.get('ir.config_parameter').get_param(cr, uid, 'database.create_date')
|
||||
limit_date = datetime.datetime.now()
|
||||
limit_date = limit_date - datetime.timedelta(15)
|
||||
limit_date_str = limit_date.strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
nbr_users = pool.get("res.users").search(cr, uid, [], count=True)
|
||||
nbr_active_users = pool.get("res.users").search(cr, uid, [("date", ">=", limit_date_str)], count=True)
|
||||
nbr_share_users = False
|
||||
nbr_active_share_users = False
|
||||
if "share" in pool.get("res.users")._all_columns:
|
||||
nbr_share_users = pool.get("res.users").search(cr, uid, [("share", "=", True)], count=True)
|
||||
nbr_active_share_users = pool.get("res.users").search(cr, uid, [("share", "=", True), ("date", ">=", limit_date_str)], count=True)
|
||||
user = pool.get("res.users").browse(cr, uid, uid)
|
||||
msg = {
|
||||
"dbuuid": dbuuid,
|
||||
"nbr_users": nbr_users,
|
||||
"nbr_active_users": nbr_active_users,
|
||||
"nbr_share_users": nbr_share_users,
|
||||
"nbr_active_share_users": nbr_active_share_users,
|
||||
"dbname": cr.dbname,
|
||||
"db_create_date": db_create_date,
|
||||
"version": release.version,
|
||||
"language": user.lang,
|
||||
}
|
||||
msg.update(pool.get("res.company").read(cr,uid,[1],["name","email","phone"])[0])
|
||||
|
||||
add_arg = {"timeout":30} if sys.version_info >= (2,6) else {}
|
||||
arguments = {'arg0': msg, "action": "update",}
|
||||
arguments_raw = urllib.urlencode(arguments)
|
||||
|
||||
url = config.get("publisher_warranty_url")
|
||||
uo = urllib2.urlopen(url, arguments_raw, **add_arg)
|
||||
result = {}
|
||||
try:
|
||||
submit_result = uo.read()
|
||||
result = safe_eval(submit_result)
|
||||
finally:
|
||||
uo.close()
|
||||
return result
|
||||
|
||||
class publisher_warranty_contract(osv.osv):
|
||||
_name = "publisher_warranty.contract"
|
||||
|
||||
def update_notification(self, cr, uid, ids, cron_mode=True, context=None):
|
||||
"""
|
||||
Send a message to OpenERP's publisher warranty server to check the
|
||||
validity of the contracts, get notifications, etc...
|
||||
|
||||
@param cron_mode: If true, catch all exceptions (appropriate for usage in a cron).
|
||||
@type cron_mode: boolean
|
||||
"""
|
||||
try:
|
||||
try:
|
||||
result = get_sys_logs(cr, uid)
|
||||
except Exception:
|
||||
if cron_mode: # we don't want to see any stack trace in cron
|
||||
return False
|
||||
_logger.debug("Exception while sending a get logs messages", exc_info=1)
|
||||
raise osv.except_osv(_("Error"), _("Error during communication with the publisher warranty server."))
|
||||
limit_date = (datetime.datetime.now() - _PREVIOUS_LOG_CHECK).strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
# old behavior based on res.log; now on mail.message, that is not necessarily installed
|
||||
proxy = self.pool.get('mail.message')
|
||||
|
||||
model, res_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'mail', 'group_all_employees')
|
||||
|
||||
for message in result["messages"]:
|
||||
values = {
|
||||
'body' : message,
|
||||
'model' : 'mail.group',
|
||||
'res_id' : res_id,
|
||||
'user_id' : False,
|
||||
}
|
||||
proxy.create(cr, uid, values, context=context)
|
||||
except Exception:
|
||||
if cron_mode:
|
||||
return False # we don't want to see any stack trace in cron
|
||||
else:
|
||||
raise
|
||||
return True
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -6,7 +6,6 @@ instance.web.ViewManager.include({
|
|||
var self = this;
|
||||
var _super = this._super();
|
||||
this.process_help = this.action ? this.action.help : '';
|
||||
self.process_help = $(this.process_help).text();
|
||||
if(this.action) {
|
||||
this.process_model = this.action.res_model;
|
||||
} else {
|
||||
|
@ -240,9 +239,7 @@ instance.web.ViewManager.include({
|
|||
title: _t('Process')
|
||||
});
|
||||
var form_controller = pop.view_form;
|
||||
pop.on_write_completed.add_last(function() {
|
||||
self.initialize_process_view();
|
||||
});
|
||||
pop.on('on_write_complete', self, self.initialize_process_view);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -793,6 +793,7 @@ class sale_order_line(osv.osv):
|
|||
_('There is no Fiscal Position defined or Income category account defined for default properties of Product categories.'))
|
||||
res = {
|
||||
'name': line.name,
|
||||
'sequence': line.sequence,
|
||||
'origin': line.order_id.name,
|
||||
'account_id': account_id,
|
||||
'price_unit': pu,
|
||||
|
|
Loading…
Reference in New Issue