Files
odoo_source/addons/calendar/models/res_partner.py
T
Géry Debongnie 905e01921f [REF] web, *: redesign all JS views
This commit introduce a full redesign of all JS views.  We started
basically from scratch.  The goal was to unify all the various views
under a common framework, to make them testable, to make then usable in
different conditions (in studio, or in the frontend), and to make our
lives easier.

Some important points are:
- we introduced new coding guidelines (camelCase, 80 chars width, ...)
- we have a brand new testing framework (still QUnit based)
- kanban view moved to the web addon
- calendar view (formerly web_calender) moved to web as well
- the tree view was removed
- all new code should be documented

We hope that this code is the start of a new era for the Odoo web
client, we want to have a high quality codebase, well documented, well
tested, well designed.

Work done by the framework team: mostly aab, ged, chm, dmo, qsm
2017-04-11 19:44:38 +02:00

41 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from odoo import api, fields, models
from odoo.addons.calendar.models.calendar import get_real_ids
class Partner(models.Model):
_inherit = 'res.partner'
calendar_last_notif_ack = fields.Datetime('Last notification marked as read from base Calendar')
@api.multi
def get_attendee_detail(self, meeting_id):
""" Return a list of tuple (id, name, status)
Used by base_calendar.js : Many2ManyAttendee
"""
datas = []
meeting = None
if meeting_id:
meeting = self.env['calendar.event'].browse(get_real_ids(meeting_id))
for partner in self:
data = partner.name_get()[0]
data = [data[0], data[1], False, partner.color]
if meeting:
for attendee in meeting.attendee_ids:
if attendee.partner_id.id == partner.id:
data[2] = attendee.state
datas.append(data)
return datas
@api.model
def _set_calendar_last_notif_ack(self):
partner = self.env['res.users'].browse(self.env.uid).partner_id
partner.write({'calendar_last_notif_ack': datetime.now()})
return