Hi, I'm trying to enhance your appointment's module by inherit calendar.event instead of re-create a calendar.
The main goal is to get native event recurrence and attendee's functionality, or maybe I'm wrong with doing that and I need to create my recurrence code in appointments? (not sure ahah)
I'm pretty new in odoo development but I made the whole part I think.
There's an error when I'm trying to create an appointment saying that :
## Logging vals var of medical.appointment create func :
2016-05-30 16:06:47,050 6644 DEBUG erp-cdm-virgin openerp.addons.medical.models.medical_appointment: {'message_follower_ids': False, 'consultations': 2, 'categ_ids': [[6, False, []]], 'we': False, 'month_by': 'date', 'allday': False, 'byday': False, 'duration': 0.0, 'final_date': False, 'message_ids': False, 'user_id': 1, 'start': '2016-05-30 16:06:41', 'tu': False, 'recurrency': False, 'week_list': False, 'show_as': 'busy', 'attendee_ids': [], 'state': 'confirm', 'location': False, 'th': False, 'partner_ids': [[6, False, [3]]], 'physician_id': 2, 'start_date': None, 'start_datetime': '2016-05-30 16:06:41', 'recurrent_id_date': False, 'description': False, 'appointment_date': '2016-05-30 00:00:00', 'stop_date': None, 'stop': '2016-05-30 16:06:45', 'stop_datetime': '2016-05-30 16:06:45', 'fr': False, 'alarm_ids': [[6, False, []]], 'class': 'public', 'day': 0, 'count': 1, 'end_type': 'count', 'name': 'Testing', 'mo': False, 'interval': 1, 'su': False, 'patient_id': 1, 'recurrent_id': 0, 'sa': False, 'rrule_type': False}
2016-05-30 16:06:47,191 6644 ERROR erp-cdm-virgin openerp.sql_db: bad query: INSERT INTO "calendar_attendee" ("id", "event_id", "access_token", "state", "partner_id", "email", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval('calendar_attendee_id_seq'), 1, 'c663559e27fe46c9bca7d94b8bb83aa2', 'accepted', 3, '[email protected]', 1, 1, (now() at time zone 'UTC'), (now() at time zone 'UTC')) RETURNING id
# The three errors are below
Traceback (most recent call last):
File "/home/maxime/Projects/agile/dev/OCB/openerp/sql_db.py", line 234, in execute
res = self._obj.execute(query, params)
IntegrityError: insert or update on table "calendar_attendee" violates foreign key constraint "calendar_attendee_event_id_fkey"
DETAIL: Key (event_id)=(1) is not present in table "calendar_event".
2016-05-30 16:06:47,192 6644 DEBUG erp-cdm-virgin openerp.service.model: IntegrityError
Traceback (most recent call last):
File "/home/maxime/Projects/agile/dev/OCB/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/home/maxime/Projects/agile/dev/OCB/openerp/http.py", line 309, in checked_call
return self.endpoint(*a, **kw)
File "/home/maxime/Projects/agile/dev/OCB/openerp/http.py", line 805, in __call__
return self.method(*args, **kw)
File "/home/maxime/Projects/agile/dev/OCB/openerp/http.py", line 405, in response_wrap
response = f(*args, **kw)
File "/home/maxime/Projects/agile/dev/OCB/addons/web/controllers/main.py", line 944, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/home/maxime/Projects/agile/dev/OCB/addons/web/controllers/main.py", line 936, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/home/maxime/Projects/agile/dev/OCB/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/home/maxime/Projects/agile/dev/medicagile-master/medical_appointment_invoice/models/medical_appointment.py", line 60, in create
res = super(appointment, self).create(cr, uid, values, context=context)
File "/home/maxime/Projects/agile/dev/OCB/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/home/maxime/Projects/agile/dev/OCB/addons/calendar/calendar.py", line 1646, in create
self.create_attendees(cr, uid, [res], context=context)
File "/home/maxime/Projects/agile/dev/OCB/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/home/maxime/Projects/agile/dev/OCB/addons/calendar/calendar.py", line 1112, in create_attendees
att_id = self.pool['calendar.attendee'].create(cr, uid, values, context=context)
File "/home/maxime/Projects/agile/dev/OCB/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/home/maxime/Projects/agile/dev/OCB/addons/calendar/calendar.py", line 288, in create
res = super(calendar_attendee, self).create(cr, uid, vals, context=context)
File "/home/maxime/Projects/agile/dev/OCB/openerp/api.py", line 268, in wrapper
return old_api(self, *args, **kwargs)
File "/home/maxime/Projects/agile/dev/OCB/openerp/api.py", line 372, in old_api
result = method(recs, *args, **kwargs)
File "/home/maxime/Projects/agile/dev/OCB/openerp/models.py", line 4094, in create
record = self.browse(self._create(old_vals))
File "/home/maxime/Projects/agile/dev/OCB/openerp/api.py", line 266, in wrapper
return new_api(self, *args, **kwargs)
File "/home/maxime/Projects/agile/dev/OCB/openerp/api.py", line 508, in new_api
result = method(self._model, cr, uid, *args, **old_kwargs)
File "/home/maxime/Projects/agile/dev/OCB/openerp/models.py", line 4232, in _create
tuple([u[2] for u in updates if len(u) > 2])
File "/home/maxime/Projects/agile/dev/OCB/openerp/sql_db.py", line 158, in wrapper
return f(self, *args, **kwargs)
File "/home/maxime/Projects/agile/dev/OCB/openerp/sql_db.py", line 234, in execute
res = self._obj.execute(query, params)
IntegrityError: insert or update on table "calendar_attendee" violates foreign key constraint "calendar_attendee_event_id_fkey"
DETAIL: Key (event_id)=(1) is not present in table "calendar_event".
2016-05-30 16:06:47,195 6644 ERROR erp-cdm-virgin openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/home/maxime/Projects/agile/dev/OCB/openerp/http.py", line 539, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/maxime/Projects/agile/dev/OCB/openerp/http.py", line 576, in dispatch
result = self._call_function(**self.params)
File "/home/maxime/Projects/agile/dev/OCB/openerp/http.py", line 312, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/maxime/Projects/agile/dev/OCB/openerp/service/model.py", line 154, in wrapper
raise openerp.osv.orm.except_orm(_('Integrity Error'), msg)
except_orm: (u"Erreur d'int\xe9grit\xe9", u"L'op\xe9ration n'a pas pu \xeatre termin\xe9e, probablement \xe0 la suite d'une :\n- suppression : vous essayez de supprimer un enregistrement auquel d'autres enregistrements font r\xe9f\xe9rence\n- cr\xe9ation/modification : un champ requis n'est pas correctement rempli\n\n[objet r\xe9f\xe9renc\xe9 : Event - calendar.event]")
Thanks for your good work.