diff --git a/addons/account/account.py b/addons/account/account.py index 31ad948360e..a95e6107a68 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1608,8 +1608,8 @@ class account_model_line(osv.osv): } _order = 'sequence' _sql_constraints = [ - ('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in model !'), - ('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in model !'), + ('credit_debit1', 'CHECK (credit*debit=0)', 'Wrong credit or debit value in model (Credit Or Debit Must Be "0")!'), + ('credit_debit2', 'CHECK (credit+debit>=0)', 'Wrong credit or debit value in model (Credit + Debit Must Be greater "0")!'), ] account_model_line() diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 87874c0a1b2..c2024c86eb3 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -29,17 +29,17 @@ from mx.DateTime import RelativeDateTime from tools import config from tools.translate import _ -class fiscalyear_seq(osv.osv): - _name = "fiscalyear.seq" - _description = "Maintains Invoice sequences with Fiscal Year" - _rec_name = 'fiscalyear_id' - _columns = { - 'journal_id': fields.many2one('account.journal', 'Journal'), - 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year',required=True), - 'sequence_id':fields.many2one('ir.sequence', 'Sequence',required=True), - } - -fiscalyear_seq() +#class fiscalyear_seq(osv.osv): +# _name = "fiscalyear.seq" +# _description = "Maintains Invoice sequences with Fiscal Year" +# _rec_name = 'fiscalyear_id' +# _columns = { +# 'journal_id': fields.many2one('account.journal', 'Journal'), +# 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year',required=True), +# 'sequence_id':fields.many2one('ir.sequence', 'Sequence',required=True), +# } +# +#fiscalyear_seq() class account_invoice(osv.osv): def _amount_all(self, cr, uid, ids, name, args, context=None): diff --git a/addons/account/security/ir.model.access.csv b/addons/account/security/ir.model.access.csv index 3d135317b71..bb7ffbae946 100644 --- a/addons/account/security/ir.model.access.csv +++ b/addons/account/security/ir.model.access.csv @@ -82,7 +82,6 @@ "access_account_fiscal_position","account.fiscal.position all","model_account_fiscal_position","base.group_user",1,0,0,0 "access_account_fiscal_position_tax","account.fiscal.position.tax all","model_account_fiscal_position_tax","base.group_user",1,0,0,0 "access_account_fiscal_position_account","account.fiscal.position all","model_account_fiscal_position_account","base.group_user",1,0,0,0 -"access_fiscalyear_seq","fiscalyear.seq","model_fiscalyear_seq","account.group_account_invoice",1,1,1,1 "access_account_fiscal_position_template","account.fiscal.position.template","model_account_fiscal_position_template","account.group_account_manager",1,1,1,1 "access_account_fiscal_position_tax_template","account.fiscal.position.tax.template","model_account_fiscal_position_tax_template","account.group_account_manager",1,1,1,1 "access_account_fiscal_position_account_template","account.fiscal.position.account.template","model_account_fiscal_position_account_template","account.group_account_manager",1,1,1,1 diff --git a/addons/base_setup/base_setup_installer.xml b/addons/base_setup/base_setup_installer.xml index b5735d7075b..b01e19a4a84 100644 --- a/addons/base_setup/base_setup_installer.xml +++ b/addons/base_setup/base_setup_installer.xml @@ -33,10 +33,10 @@ - + - - + + diff --git a/addons/caldav/calendar.py b/addons/caldav/calendar.py index 4371badf1ac..ec0a98d8af5 100644 --- a/addons/caldav/calendar.py +++ b/addons/caldav/calendar.py @@ -127,6 +127,16 @@ class CalDAV(object): if not model: continue uidval = common.openobjectid2uid(cr, data[map_field], model) + cr.execute('select id from %s where recurrent_uid=%s' + % (model.replace('.', '_'), data[map_field])) + r_ids = map(lambda x: x[0], cr.fetchall()) + if r_ids: + rdata = self.pool.get(model).read(cr, uid, r_ids) + rcal = self.export_ical(cr, uid, rdata, context=context) + for revents in rcal.contents['vevent']: + ical.contents['vevent'].append(revents) + if data.get('recurrent_uid', None): + uidval = common.openobjectid2uid(cr, data['recurrent_uid'], model) vevent.add('uid').value = uidval elif field == 'attendee' and data[map_field]: attendee_obj = self.pool.get('basic.calendar.attendee') @@ -236,7 +246,7 @@ class Event(CalDAV, osv.osv_memory): 'duration': None, # Use: O-1, Type: DURATION, Specifies a positive duration of time. 'dtend': None, # Use: O-1, Type: DATE-TIME, Specifies the date and time that a calendar component ends. } - def export_ical(self, cr, uid, datas, context={}): + def export_ical(self, cr, uid, datas, vobj='vevent', context={}): return super(Event, self).export_ical(cr, uid, datas, 'vevent', context=context) Event() @@ -279,7 +289,7 @@ class ToDo(CalDAV, osv.osv_memory): 'rrule': None, } - def export_ical(self, cr, uid, datas, context={}): + def export_ical(self, cr, uid, datas, vobj='vevent', context={}): return super(ToDo, self).export_ical(cr, uid, datas, 'vtodo', context=context) ToDo() diff --git a/addons/crm/crm_claim.py b/addons/crm/crm_claim.py index 5f278ba9dca..1577ff97799 100644 --- a/addons/crm/crm_claim.py +++ b/addons/crm/crm_claim.py @@ -56,7 +56,7 @@ class crm_claim(osv.osv): } _defaults = { - 'priority': lambda *a: AVAILABLE_PRIORITIES[2][0], + 'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0], } def onchange_categ_id(self, cr, uid, ids, categ, context={}): if not categ: diff --git a/addons/crm/crm_fundraising.py b/addons/crm/crm_fundraising.py index ba69b092df2..88832a57d71 100644 --- a/addons/crm/crm_fundraising.py +++ b/addons/crm/crm_fundraising.py @@ -65,7 +65,7 @@ class crm_fundraising(osv.osv): } _defaults = { - 'priority': lambda *a: AVAILABLE_PRIORITIES[2][0], + 'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0], } def onchange_categ_id(self, cr, uid, ids, categ, context={}): if not categ: diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py index fcf16d3ec25..2cb1adbd1f4 100644 --- a/addons/crm/crm_meeting.py +++ b/addons/crm/crm_meeting.py @@ -26,8 +26,6 @@ from osv import fields, osv from tools.translate import _ import base64 import re -import time -import tools class crm_meeting(osv.osv): @@ -53,8 +51,7 @@ class crm_meeting(osv.osv): 'transp': {'field': 'transparent', 'type': 'text'}, 'uid': {'field': 'id', 'type': 'text'}, 'url': {'field': 'caldav_url', 'type': 'text'}, - 'recurid': None, -# 'attach': {'field': 'attachment_ids', 'sub-field': 'datas', 'type': 'list'}, + 'recurrence-id': {'field': 'recurrent_id', 'type': 'datetime'}, 'attendee': {'field': 'attendee_ids', 'type': 'many2many', 'object': 'calendar.attendee'}, 'categories': {'field': 'categ_id', 'type': 'many2one', 'object': 'crm.meeting.categ'}, 'comment': None, @@ -89,13 +86,13 @@ class crm_meeting(osv.osv): where id=%s"% (end.strftime("%Y-%m-%d %H:%M:%S"), id)) return True - def onchange_rrule_type(self, cr, uid, ids, type, *args, **argv): - if type == 'none': + def onchange_rrule_type(self, cr, uid, ids, rtype, *args, **argv): + if rtype == 'none' or not rtype: return {'value': {'rrule': ''}} - if type == 'custom': + if rtype == 'custom': return {} rrule = self.pool.get('calendar.custom.rrule') - rrulestr = rrule.compute_rule_string(cr, uid, {'freq': type.upper(), \ + rrulestr = rrule.compute_rule_string(cr, uid, {'freq': rtype.upper(), \ 'interval': 1}) return {'value': {'rrule': rrulestr}} @@ -119,7 +116,6 @@ 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"), @@ -138,6 +134,8 @@ rule or repeating pattern for anexception to a recurrence set"), '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'), + 'recurrent_uid': fields.integer('Recurrent ID'), + 'recurrent_id': fields.datetime('Recurrent ID date'), } _defaults = { @@ -162,7 +160,7 @@ rule or repeating pattern for anexception to a recurrence set"), crm_data = self.read(cr, uid, ids) event_obj = self.pool.get('basic.calendar.event') event_obj.__attribute__.update(self.__attribute__) - ical = event_obj.export_ical(cr, uid, crm_data, {'model': self._name}) + ical = event_obj.export_ical(cr, uid, crm_data, context={'model': self._name}) cal_val = ical.serialize() cal_val = cal_val.replace('"', '').strip() return cal_val @@ -267,6 +265,18 @@ rule or repeating pattern for anexception to a recurrence set"), return ids and ids[0] or False return ids + def modify_this(self, cr, uid, ids, defaults, context=None, *args): + datas = self.read(cr, uid, ids[0], context=context) + date = datas.get('date') + defaults.update({ + 'recurrent_uid': common.caldav_id2real_id(datas['id']), + 'recurrent_id': defaults.get('date'), + 'rrule_type': 'none', + 'rrule': '' + }) + new_id = self.copy(cr, uid, ids[0], default=defaults, context=context) + return new_id + def search(self, cr, uid, args, offset=0, limit=100, order=None, context=None, count=False): args_without_date = [] @@ -356,11 +366,13 @@ rule or repeating pattern for anexception to a recurrence set"), else: ids = map(lambda x: common.caldav_id2real_id(x), ids) res = super(crm_meeting, self).unlink(cr, uid, common.caldav_id2real_id(ids)) - self.do_alarm_unlink(cr, uid, ids) + alarm_obj = self.pool.get('res.alarm') + alarm_obj.do_alarm_unlink(cr, uid, ids, self._name) 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) + alarm_obj = self.pool.get('res.alarm') + alarm_obj.do_alarm_unlink(cr, uid, ids, self._name) return res def create(self, cr, uid, vals, context={}): diff --git a/addons/crm/crm_meeting_view.xml b/addons/crm/crm_meeting_view.xml index 58b4051f38a..0f625fa1af7 100644 --- a/addons/crm/crm_meeting_view.xml +++ b/addons/crm/crm_meeting_view.xml @@ -23,7 +23,7 @@ - + @@ -46,8 +46,7 @@ context="{'model' : 'crm.meeting'}" colspan="2"/> - + @@ -63,7 +62,7 @@ - + @@ -76,9 +75,17 @@ - + + + + +