From 91d38b49316869f822fe136f034d4e0722643143 Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Mon, 18 Jan 2010 11:41:21 +0530 Subject: [PATCH 01/11] [IMP] project: getting projects in user prefrence bzr revid: mra@tinyerp.com-20100118061121-i3rdkxjmnksy1iug --- addons/project/project.py | 9 ++++----- addons/project/security/project_security.xml | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 555f4c65f4d..8bd78c1c80f 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -508,11 +508,10 @@ class message(osv.osv): message() def _project_get(self, cr, uid, context={}): - obj = self.pool.get('project.project') - ids = obj.search(cr, uid, []) - res = obj.read(cr, uid, ids, ['id','name'], context) - res = [(str(r['id']),r['name']) for r in res] - return res + cr.execute("""SELECT to_char(id, '99999'),name FROM project_project where manager=%s OR + id IN (SELECT project_id from project_user_rel where uid=%s)""" % (uid, uid)) + projects = cr.fetchall() + return projects class users(osv.osv): _inherit = 'res.users' diff --git a/addons/project/security/project_security.xml b/addons/project/security/project_security.xml index 064b9bec27a..6d862a8dbc6 100644 --- a/addons/project/security/project_security.xml +++ b/addons/project/security/project_security.xml @@ -44,7 +44,7 @@ - ['|',('project_id','=',False),('project_id','=',user.context_project_id)] + ['|',('project_id','=',False),('project_id','in',[user.context_project_id])] @@ -54,7 +54,7 @@ - ['|',('task_id.project_id','=',False),('task_id.project_id','=',user.context_project_id)] + ['|',('task_id.project_id','=',False),('task_id.project_id','in',[user.context_project_id])] @@ -64,7 +64,7 @@ - ['|',('id','=',False),('id','=',user.context_project_id)] + ['|',('id','=',False),('id','in',[user.context_project_id])] @@ -74,7 +74,7 @@ - ['|',('project_id','=',False),('project_id','=',user.context_project_id)] + ['|',('project_id','=',False),('project_id','in',[user.context_project_id])] From 6edcf308470c6016e0d8e2d665c7046084fd1233 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 18 Jan 2010 12:13:12 +0530 Subject: [PATCH 02/11] [FIX] Configuration form had irrelavent fields lp bug: https://launchpad.net/bugs/508007 fixed bzr revid: jvo@tinyerp.com-20100118064312-22fekp9rvwedklj3 --- addons/base_setup/base_setup_installer.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 @@ - + - - + + From d3b373174eea57fa917f8fd4899b214d98b47302 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 18 Jan 2010 12:29:08 +0530 Subject: [PATCH 03/11] [FIX] Project_messages : Field was missing in _columns lp bug: https://launchpad.net/bugs/508028 fixed bzr revid: jvo@tinyerp.com-20100118065908-r4yoq0b4fyka2kbx --- addons/project_messages/messages.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/project_messages/messages.py b/addons/project_messages/messages.py index dc505f9073f..422bdb3675c 100644 --- a/addons/project_messages/messages.py +++ b/addons/project_messages/messages.py @@ -28,6 +28,7 @@ class messages(osv.osv): logger = netsvc.Logger() _columns = { + 'from_id':fields.many2one('res.users', 'From', ondelete="CASCADE"), 'to_id':fields.many2one('res.users', 'To', ondelete="CASCADE"), 'project_id':fields.many2one('project.project', 'Project', required=True, ondelete="CASCADE"), From 2989254e134c0efd8265d710ce402e27bd1ea1c6 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Mon, 18 Jan 2010 12:31:27 +0530 Subject: [PATCH 04/11] [FIX]: crm(meeting): Fixed problem of unlink meeting bzr revid: rpa@openerp.co.in-20100118070127-2g95ip2g0jct4ssv --- addons/crm/crm_meeting.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py index 848b8d819fa..bd93721be59 100644 --- a/addons/crm/crm_meeting.py +++ b/addons/crm/crm_meeting.py @@ -369,11 +369,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={}): From c25b354ed78c5bf0d9ce67931eb52862580d8b5f Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 18 Jan 2010 12:38:57 +0530 Subject: [PATCH 05/11] [FIX] Account : Constraint message improved for better understanding to user. lp bug: https://launchpad.net/bugs/508626 fixed bzr revid: jvo@tinyerp.com-20100118070857-h1m3nboir7rwp8v6 --- addons/account/account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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() From b2a33878ded1f0ce281c20796e8a715f0955aead Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Mon, 18 Jan 2010 13:44:29 +0530 Subject: [PATCH 06/11] [FIX] crm : fix bug in phonecall bzr revid: hmo@tinyerp.com-20100118081429-2fvsofoqly7pue4b --- addons/crm/crm_phonecall.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py index 50db660e1f0..b9a2d198144 100644 --- a/addons/crm/crm_phonecall.py +++ b/addons/crm/crm_phonecall.py @@ -81,6 +81,11 @@ class crm_phonecall(osv.osv): 'date_closed': fields.datetime('Closed', readonly=True), 'opportunity_id':fields.many2one ('crm.opportunity', 'Opportunity'), } + def onchange_categ_id(self, cr, uid, ids, categ, context={}): + if not categ: + return {'value':{}} + cat = self.pool.get('crm.phonecall.categ').browse(cr, uid, categ, context).probability + return {'value':{'probability':cat}} crm_phonecall() From e329cc54e45c717a072711ac1e16ad852c10ed2c Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 18 Jan 2010 09:27:13 +0100 Subject: [PATCH 07/11] [fix] crm: forgotten AVAILABLE_PRIORITIES in crm_claims bzr revid: xmo@tinyerp.com-20100118082713-33ejv6xzxmqrlq20 --- addons/crm/crm_claim.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_claim.py b/addons/crm/crm_claim.py index 693e5aa1a22..9b7ede2748f 100644 --- a/addons/crm/crm_claim.py +++ b/addons/crm/crm_claim.py @@ -93,7 +93,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: From 321475b45a492da025b9315bea5abd13f01ef67c Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 18 Jan 2010 09:42:43 +0100 Subject: [PATCH 08/11] [fix] crm: forgotten AVAILABLE_PRIORITIES in crm_fundraising bzr revid: xmo@tinyerp.com-20100118084243-eev0ssj2r5bw6ipg --- addons/crm/crm_fundraising.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_fundraising.py b/addons/crm/crm_fundraising.py index 30c01d5de2f..367cebcaf8f 100644 --- a/addons/crm/crm_fundraising.py +++ b/addons/crm/crm_fundraising.py @@ -103,7 +103,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: From 67802352b616d1fcca14b253cff6948331377034 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 18 Jan 2010 14:18:59 +0530 Subject: [PATCH 09/11] [FIX/REF] Account : Dead code removed for fiscalyear.seq model lp bug: https://launchpad.net/bugs/507096 fixed bzr revid: jvo@tinyerp.com-20100118084859-r9snbzk05y2zfa86 --- addons/account/invoice.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) 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): From 7e731892b4c43b89c803b45d399cea69f707248d Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Mon, 18 Jan 2010 15:24:36 +0530 Subject: [PATCH 10/11] [IMP]: caldav, crm(meeting): Added functionality to edit recurrent meeting, and improvement to export recurrent events bzr revid: rpa@openerp.co.in-20100118095436-1emdl258bo8ljrbs --- addons/caldav/calendar.py | 14 +++- addons/crm/crm_meeting.py | 30 ++++--- addons/crm/crm_meeting_view.xml | 17 ++-- addons/crm/crm_meeting_wizard.xml | 9 ++- addons/crm/wizard/__init__.py | 1 + addons/crm/wizard/crm_meeting_edit_wizard.py | 85 ++++++++++++++++++++ 6 files changed, 136 insertions(+), 20 deletions(-) create mode 100644 addons/crm/wizard/crm_meeting_edit_wizard.py 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_meeting.py b/addons/crm/crm_meeting.py index bd93721be59..27d744c38d2 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_categ(osv.osv): _name = "crm.meeting.categ" @@ -66,8 +64,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, @@ -102,13 +99,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}} @@ -132,7 +129,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"), @@ -151,6 +147,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 = { @@ -175,7 +173,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 @@ -280,6 +278,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 = [] 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 @@ - + + + + +