[MIG] calendar: migration to new API
Migration of all python code, mostly withtout chagnes. And adapting xml files to guidelines. On calendar.py, some changes have been perform to make the migration works : - `_compute` method has been split into `_compute_dates`, `_compute_attendee` and `_compute_display_time`. - remove unused method `onchange_partner_ids`, `check_partners_email` - make `compute_rule_string` use a cache record instead of a value dict to avoid crashes - remove `new_invitation_token` method, and make it a default value on attendee creation - add a default value on `day` field, otherwise the "Please select a proper day of the month" exception is raised during the onchange
This commit is contained in:
@@ -1,2 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import main
|
||||
import bus
|
||||
|
||||
@@ -1,42 +1,44 @@
|
||||
import json
|
||||
import openerp
|
||||
import openerp.http as http
|
||||
from openerp.http import request
|
||||
import openerp.addons.web.controllers.main as webmain
|
||||
import json
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import werkzeug
|
||||
|
||||
from odoo.api import Environment
|
||||
import odoo.http as http
|
||||
|
||||
from odoo.http import request
|
||||
from odoo import SUPERUSER_ID
|
||||
from odoo import registry as registry_get
|
||||
|
||||
|
||||
class meeting_invitation(http.Controller):
|
||||
class CalendarController(http.Controller):
|
||||
|
||||
@http.route('/calendar/meeting/accept', type='http', auth="calendar")
|
||||
def accept(self, db, token, action, id, **kwargs):
|
||||
registry = openerp.modules.registry.RegistryManager.get(db)
|
||||
attendee_pool = registry.get('calendar.attendee')
|
||||
registry = registry_get(db)
|
||||
with registry.cursor() as cr:
|
||||
attendee_id = attendee_pool.search(cr, openerp.SUPERUSER_ID, [('access_token', '=', token), ('state', '!=', 'accepted')])
|
||||
if attendee_id:
|
||||
attendee_pool.do_accept(cr, openerp.SUPERUSER_ID, attendee_id)
|
||||
env = Environment(cr, SUPERUSER_ID, {})
|
||||
attendee = env['calendar.attendee'].search([('access_token', '=', token), ('state', '!=', 'accepted')])
|
||||
if attendee:
|
||||
attendee.do_accept()
|
||||
return self.view(db, token, action, id, view='form')
|
||||
|
||||
@http.route('/calendar/meeting/decline', type='http', auth="calendar")
|
||||
def declined(self, db, token, action, id):
|
||||
registry = openerp.modules.registry.RegistryManager.get(db)
|
||||
attendee_pool = registry.get('calendar.attendee')
|
||||
registry = registry_get(db)
|
||||
with registry.cursor() as cr:
|
||||
attendee_id = attendee_pool.search(cr, openerp.SUPERUSER_ID, [('access_token', '=', token), ('state', '!=', 'declined')])
|
||||
if attendee_id:
|
||||
attendee_pool.do_decline(cr, openerp.SUPERUSER_ID, attendee_id)
|
||||
env = Environment(cr, SUPERUSER_ID, {})
|
||||
attendee = env['calendar.attendee'].search([('access_token', '=', token), ('state', '!=', 'declined')])
|
||||
if attendee:
|
||||
attendee.do_decline()
|
||||
return self.view(db, token, action, id, view='form')
|
||||
|
||||
@http.route('/calendar/meeting/view', type='http', auth="calendar")
|
||||
def view(self, db, token, action, id, view='calendar'):
|
||||
registry = openerp.modules.registry.RegistryManager.get(db)
|
||||
registry = registry_get(db)
|
||||
with registry.cursor() as cr:
|
||||
# Since we are in auth=none, create an env with SUPERUSER_ID
|
||||
env = Environment(cr, openerp.SUPERUSER_ID, {})
|
||||
env = Environment(cr, SUPERUSER_ID, {})
|
||||
attendee = env['calendar.attendee'].search([('access_token', '=', token)])
|
||||
timezone = attendee.partner_id.tz
|
||||
event = env['calendar.event'].with_context(tz=timezone).browse(int(id))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<!-- Scheduler for Event Alarm-->
|
||||
<record forcecreate="True" id="ir_cron_scheduler_alarm" model="ir.cron">
|
||||
@@ -15,4 +15,4 @@
|
||||
<!--<field eval="'(False,)'" name="args" />-->
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
|
||||
|
||||
<!-- Expense-related subtypes for messaging / Chatter -->
|
||||
<record id="calendar.subtype_invitation" model="mail.message.subtype">
|
||||
<field name="name">Invitation</field>
|
||||
@@ -9,66 +9,66 @@
|
||||
<field name="description" eval="False"/>
|
||||
<field name="default" eval="False"/>
|
||||
</record>
|
||||
<record model="calendar.alarm" id="alarm_notif_1">
|
||||
<record id="alarm_notif_1" model="calendar.alarm">
|
||||
<field name="name">15 Minute(s)</field>
|
||||
<field name="duration" eval="15" />
|
||||
<field name="interval">minutes</field>
|
||||
<field name="type">notification</field>
|
||||
</record>
|
||||
<record model="calendar.alarm" id="alarm_notif_2">
|
||||
<field name="type">notification</field>
|
||||
</record>
|
||||
<record id="alarm_notif_2" model="calendar.alarm">
|
||||
<field name="name">30 Minute(s)</field>
|
||||
<field name="duration" eval="30" />
|
||||
<field name="interval">minutes</field>
|
||||
<field name="type">notification</field>
|
||||
</record>
|
||||
<record model="calendar.alarm" id="alarm_notif_3">
|
||||
<field name="type">notification</field>
|
||||
</record>
|
||||
<record id="alarm_notif_3" model="calendar.alarm">
|
||||
<field name="name">1 Hour(s)</field>
|
||||
<field name="duration" eval="1" />
|
||||
<field name="interval">hours</field>
|
||||
<field name="type">notification</field>
|
||||
</record>
|
||||
<record model="calendar.alarm" id="alarm_notif_4">
|
||||
<field name="type">notification</field>
|
||||
</record>
|
||||
<record id="alarm_notif_4" model="calendar.alarm">
|
||||
<field name="name">2 Hour(s)</field>
|
||||
<field name="duration" eval="2" />
|
||||
<field name="interval">hours</field>
|
||||
<field name="type">notification</field>
|
||||
</record>
|
||||
<record model="calendar.alarm" id="alarm_notif_5">
|
||||
<field name="type">notification</field>
|
||||
</record>
|
||||
<record id="alarm_notif_5" model="calendar.alarm">
|
||||
<field name="name">1 Day(s)</field>
|
||||
<field name="duration" eval="1" />
|
||||
<field name="interval">days</field>
|
||||
<field name="type">notification</field>
|
||||
</record>
|
||||
<record model="calendar.alarm" id="alarm_mail_1">
|
||||
<field name="type">notification</field>
|
||||
</record>
|
||||
<record id="alarm_mail_1" model="calendar.alarm">
|
||||
<field name="name">2~3 Hour(s) mail</field>
|
||||
<field name="duration" eval="3" />
|
||||
<field name="interval">hours</field>
|
||||
<field name="type">email</field>
|
||||
</record>
|
||||
<record model="calendar.alarm" id="alarm_mail_2">
|
||||
<field name="type">email</field>
|
||||
</record>
|
||||
<record id="alarm_mail_2" model="calendar.alarm">
|
||||
<field name="name">5~6 Hour(s) mail</field>
|
||||
<field name="duration" eval="6" />
|
||||
<field name="interval">hours</field>
|
||||
<field name="type">email</field>
|
||||
</record>
|
||||
|
||||
<record model="calendar.event.type" id="categ_meet1">
|
||||
<field name="type">email</field>
|
||||
</record>
|
||||
|
||||
<record id="categ_meet1" model="calendar.event.type">
|
||||
<field name="name">Customer Meeting</field>
|
||||
</record>
|
||||
|
||||
<record model="calendar.event.type" id="categ_meet2">
|
||||
<record id="categ_meet2" model="calendar.event.type">
|
||||
<field name="name">Internal Meeting</field>
|
||||
</record>
|
||||
|
||||
<record model="calendar.event.type" id="categ_meet3">
|
||||
<record id="categ_meet3" model="calendar.event.type">
|
||||
<field name="name">Off-site Meeting</field>
|
||||
</record>
|
||||
|
||||
<record model="calendar.event.type" id="categ_meet4">
|
||||
<record id="categ_meet4" model="calendar.event.type">
|
||||
<field name="name">Open Discussion</field>
|
||||
</record>
|
||||
|
||||
<record model="calendar.event.type" id="categ_meet5">
|
||||
<record id="categ_meet5" model="calendar.event.type">
|
||||
<field name="name">Feedback Meeting</field>
|
||||
</record>
|
||||
|
||||
@@ -114,7 +114,7 @@
|
||||
<p style="font-size: 20px; text-align: center;">Invitation to <strong>${object.event_id.name}</strong></p>
|
||||
<p>
|
||||
<strong>Dear ${object.cn}</strong>,<br />
|
||||
${object.event_id.user_id.partner_id.name} invited you for the ${object.event_id.name} meeting of ${object.event_id.user_id.company_id.name}.</p>
|
||||
${object.event_id.user_id.partner_id.name} invited you for the ${object.event_id.name} meeting of ${object.event_id.user_id.company_id.name}.</p>
|
||||
<table style="margin-top: 20px;"><tr>
|
||||
<td>
|
||||
<div style="border-top-left-radius:3px;border-top-right-radius:3px;font-size:12px;border-collapse:separate;text-align:center;font-weight:bold;color:#ffffff;width:130px;min-height: 18px;background:#a24689;padding-top: 4px;">
|
||||
@@ -162,7 +162,7 @@
|
||||
</table>
|
||||
</div>]]></field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="calendar_template_meeting_changedate" model="mail.template">
|
||||
<field name="name">Calendar: Date updated</field>
|
||||
<field name="email_from">${object.event_id.user_id.email or ''}</field>
|
||||
@@ -206,7 +206,7 @@
|
||||
<p>
|
||||
<strong>Dear ${object.cn}</strong>,<br />
|
||||
The date of the meeting has been upated. The meeting ${object.event_id.name} created by ${object.event_id.user_id.partner_id.name} is now scheduled for ${object.event_id.get_display_time_tz(tz=object.partner_id.tz)}.
|
||||
</p>
|
||||
</p>
|
||||
<table style="margin-top: 20px;"><tr>
|
||||
<td>
|
||||
<div style="border-top-left-radius:3px;border-top-right-radius:3px;font-size:12px;border-collapse:separate;text-align:center;font-weight:bold;color:#ffffff;width:130px;min-height: 18px;background:#a24689;padding-top: 4px;">
|
||||
@@ -298,7 +298,7 @@
|
||||
<p>
|
||||
<strong>Dear ${object.cn}</strong>,<br />
|
||||
This is a reminder for the below event :
|
||||
</p>
|
||||
</p>
|
||||
<table style="margin-top: 20px;"><tr>
|
||||
<td>
|
||||
<div style="border-top-left-radius:3px;border-top-right-radius:3px;font-size:12px;border-collapse:separate;text-align:center;font-weight:bold;color:#ffffff;width:130px;min-height: 18px;background:#a24689;padding-top: 4px;">
|
||||
@@ -347,4 +347,4 @@
|
||||
</div>]]></field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -1,113 +1,110 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<!--
|
||||
((((((((((( Demo Cases )))))))))))
|
||||
-->
|
||||
|
||||
<!--For Meetings -->
|
||||
<record id="cal_contact_1" model="calendar.contacts">
|
||||
<field eval="1" name="active"/>
|
||||
<record id="cal_contact_1" model="calendar.contacts">
|
||||
<field name="active" eval="True"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
<field name="partner_id" ref="base.res_partner_1"/>
|
||||
</record>
|
||||
|
||||
<record id="cal_contact_2" model="calendar.contacts">
|
||||
<field eval="1" name="active"/>
|
||||
<field name="active" eval="True"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="partner_id" ref="base.partner_demo"/>
|
||||
<field name="partner_id" ref="base.partner_demo"/>
|
||||
</record>
|
||||
|
||||
<record id="calendar_event_1" model="calendar.event">
|
||||
<field eval="1" name="active"/>
|
||||
<field name="active" eval="True"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="partner_ids" eval="[(6,0,[ref('base.res_partner_1')])]"/>
|
||||
<field name="name">Follow-up for Project proposal</field>
|
||||
<field name="description">Meeting to discuss project plan and hash out the details of implementation.</field>
|
||||
<field eval="time.strftime('%Y-%m-03 10:20:00')" name="start"/>
|
||||
<field name="start" eval="time.strftime('%Y-%m-03 10:20:00')"/>
|
||||
<field name="categ_ids" eval="[(6,0,[ref('categ_meet1')])]"/>
|
||||
<field eval="time.strftime('%Y-%m-03 16:30:00')" name="stop"/>
|
||||
<field eval="6.3" name="duration"/>
|
||||
<field eval="0" name="allday"/>
|
||||
<field name="stop" eval="time.strftime('%Y-%m-03 16:30:00')"/>
|
||||
<field name="duration" eval="6.3"/>
|
||||
<field name="allday" eval="False"/>
|
||||
<field name="state">open</field>
|
||||
</record>
|
||||
|
||||
<record id="calendar_event_2" model="calendar.event">
|
||||
<field eval="1" name="active"/>
|
||||
<field name="active" eval="True"/>
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
<field name="partner_ids" eval="[(6,0,[ref('base.partner_root'),ref('base.res_partner_4'),ref('base.res_partner_3')])]"/>
|
||||
<field name="name">Initial discussion</field>
|
||||
<field name="description">Discussion with partner for product.</field>
|
||||
<field name="categ_ids" eval="[(6,0,[ref('categ_meet3')])]"/>
|
||||
<field eval="time.strftime('%Y-%m-05 12:00:00')" name="start"/>
|
||||
<field eval="time.strftime('%Y-%m-05 19:00:00')" name="stop"/>
|
||||
<field eval="0" name="allday"/>
|
||||
<field eval="7.0" name="duration"/>
|
||||
<field name="start" eval="time.strftime('%Y-%m-05 12:00:00')"/>
|
||||
<field name="stop" eval="time.strftime('%Y-%m-05 19:00:00')"/>
|
||||
<field name="allday" eval="False"/>
|
||||
<field name="duration" eval="7.0"/>
|
||||
<field name="state">draft</field>
|
||||
</record>
|
||||
|
||||
<record id="calendar_event_3" model="calendar.event">
|
||||
<field eval="1" name="active"/>
|
||||
<field name="active" eval="True"/>
|
||||
<field name="partner_ids" eval="[(6,0,[ref('base.partner_root')])]"/>
|
||||
<field name="name">Pricing Discussion</field>
|
||||
<field name="description">Internal meeting for discussion for new pricing for product and services.</field>
|
||||
<field name="categ_ids" eval="[(6,0,[ref('categ_meet1'), ref('categ_meet2')])]"/>
|
||||
<field eval="time.strftime('%Y-%m-12 15:55:05')" name="start"/>
|
||||
<field eval="time.strftime('%Y-%m-12 18:55:05')" name="stop"/>
|
||||
<field eval="3.0" name="duration"/>
|
||||
<field eval="0" name="allday"/>
|
||||
<field name="start" eval="time.strftime('%Y-%m-12 15:55:05')"/>
|
||||
<field name="stop" eval="time.strftime('%Y-%m-12 18:55:05')"/>
|
||||
<field name="duration" eval="3.0"/>
|
||||
<field name="allday" eval="False"/>
|
||||
<field name="state">open</field>
|
||||
</record>
|
||||
|
||||
<record id="calendar_event_4" model="calendar.event">
|
||||
<field eval="1" name="active"/>
|
||||
<field name="active" eval="True"/>
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
<field name="partner_ids" eval="[(6,0,[ref('base.partner_demo'),ref('base.res_partner_1')])]"/>
|
||||
<field name="name">Requirements review</field>
|
||||
<field name="categ_ids" eval="[(6,0,[ref('categ_meet3')])]"/>
|
||||
<field eval="time.strftime('%Y-%m-20 8:00:00')" name="start"/>
|
||||
<field eval="time.strftime('%Y-%m-20 10:30:00')" name="stop"/>
|
||||
<field eval="2.5" name="duration"/>
|
||||
<field eval="0" name="allday"/>
|
||||
<field name="start" eval="time.strftime('%Y-%m-20 8:00:00')"/>
|
||||
<field name="stop" eval="time.strftime('%Y-%m-20 10:30:00')"/>
|
||||
<field name="duration" eval="2.5"/>
|
||||
<field name="allday" eval="False"/>
|
||||
<field name="state">open</field>
|
||||
</record>
|
||||
|
||||
<record id="calendar_event_5" model="calendar.event">
|
||||
<field eval="1" name="active"/>
|
||||
<field name="active" eval="True"/>
|
||||
<field name="partner_ids" eval="[(6,0,[ref('base.partner_root'),ref('base.res_partner_12')])]"/>
|
||||
<field name="name">Changes in Designing</field>
|
||||
<field name="categ_ids" eval="[(6,0,[ref('categ_meet1')])]"/>
|
||||
<field eval="time.strftime('%Y-%m-22')" name="start"/>
|
||||
<field eval="time.strftime('%Y-%m-22')" name="stop"/>
|
||||
<field eval="1" name="allday"/>
|
||||
<field name="start" eval="time.strftime('%Y-%m-22')"/>
|
||||
<field name="stop" eval="time.strftime('%Y-%m-22')"/>
|
||||
<field name="allday" eval="True"/>
|
||||
<field name="state">open</field>
|
||||
</record>
|
||||
|
||||
<record id="calendar_event_6" model="calendar.event">
|
||||
<field eval="1" name="active"/>
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
<field name="active" eval="True"/>
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
<field name="partner_ids" eval="[(6,0,[ref('base.partner_root'),ref('base.res_partner_4'),ref('base.res_partner_1'),ref('base.res_partner_12')])]"/>
|
||||
<field name="name">Presentation for new Services</field>
|
||||
<field name="categ_ids" eval="[(6,0,[ref('categ_meet1'), ref('categ_meet2')])]"/>
|
||||
<field eval="time.strftime('%Y-%m-18 2:00:00')" name="start"/>
|
||||
<field eval="time.strftime('%Y-%m-18 10:30:00')" name="stop"/>
|
||||
<field eval="8.5" name="duration"/>
|
||||
<field eval="0" name="allday"/>
|
||||
<field name="start" eval="time.strftime('%Y-%m-18 2:00:00')"/>
|
||||
<field name="stop" eval="time.strftime('%Y-%m-18 10:30:00')"/>
|
||||
<field name="duration" eval="8.5"/>
|
||||
<field name="allday" eval="False"/>
|
||||
<field name="state">draft</field>
|
||||
</record>
|
||||
|
||||
<record id="calendar_event_7" model="calendar.event">
|
||||
<field eval="1" name="active"/>
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
<field name="active" eval="True"/>
|
||||
<field name="user_id" ref="base.user_demo"/>
|
||||
<field name="partner_ids" eval="[(6,0,[ref('base.res_partner_4')])]"/>
|
||||
<field name="name">Presentation of the new Calendar</field>
|
||||
<field name="categ_ids" eval="[(6,0,[ref('categ_meet1'), ref('categ_meet2')])]"/>
|
||||
<field eval="time.strftime('%Y-%m-16')" name="start"/>
|
||||
<field eval="time.strftime('%Y-%m-16')" name="stop"/>
|
||||
<field eval="8.5" name="duration"/>
|
||||
<field eval="1" name="allday"/>
|
||||
<field name="start" eval="time.strftime('%Y-%m-16')"/>
|
||||
<field name="stop" eval="time.strftime('%Y-%m-16')"/>
|
||||
<field name="duration" eval="8.5"/>
|
||||
<field name="allday" eval="True"/>
|
||||
<field name="state">draft</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
+780
-933
File diff suppressed because it is too large
Load Diff
@@ -1,29 +1,28 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from openerp.osv import osv
|
||||
from odoo import api, models
|
||||
|
||||
from odoo.addons.calendar.models.calendar import get_real_ids
|
||||
|
||||
|
||||
class ir_attachment(osv.Model):
|
||||
class Attachment(models.Model):
|
||||
|
||||
_inherit = "ir.attachment"
|
||||
|
||||
def search(self, cr, uid, args, offset=0, limit=0, order=None, context=None, count=False):
|
||||
'''
|
||||
convert the search on real ids in the case it was asked on virtual ids, then call super()
|
||||
'''
|
||||
@api.model
|
||||
def search(self, args, offset=0, limit=0, order=None, count=False):
|
||||
""" Convert the search on real ids in the case it was asked on virtual ids, then call super() """
|
||||
args = list(args)
|
||||
if any([leaf for leaf in args if leaf[0] == "res_model" and leaf[2] == 'calendar.event']):
|
||||
if any([leaf for leaf in args if leaf[0] == "res_model" and leaf[2] == 'calendar.event']):
|
||||
for index in range(len(args)):
|
||||
if args[index][0] == "res_id" and isinstance(args[index][2], basestring):
|
||||
args[index] = (args[index][0], args[index][1], get_real_ids(args[index][2]))
|
||||
return super(ir_attachment, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)
|
||||
return super(Attachment, self).search(args, offset=offset, limit=limit, order=order, count=count)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
'''
|
||||
when posting an attachment (new or not), convert the virtual ids in real ids.
|
||||
'''
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
""" When posting an attachment (new or not), convert the virtual ids in real ids. """
|
||||
if isinstance(vals.get('res_id'), basestring):
|
||||
vals['res_id'] = get_real_ids(vals.get('res_id'))
|
||||
return super(ir_attachment, self).write(cr, uid, ids, vals, context=context)
|
||||
return super(Attachment, self).write(vals)
|
||||
|
||||
@@ -1,34 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import openerp
|
||||
from openerp.osv import osv
|
||||
import odoo
|
||||
from odoo import api, models, SUPERUSER_ID
|
||||
from openerp.http import request
|
||||
from openerp.api import Environment
|
||||
|
||||
from werkzeug.exceptions import BadRequest
|
||||
|
||||
|
||||
class ir_http(osv.AbstractModel):
|
||||
class IrHttp(models.AbstractModel):
|
||||
|
||||
_inherit = 'ir.http'
|
||||
|
||||
def _auth_method_calendar(self):
|
||||
token = request.params['token']
|
||||
db = request.params['db']
|
||||
dbname = request.params['db']
|
||||
|
||||
registry = openerp.modules.registry.RegistryManager.get(db)
|
||||
attendee_pool = registry.get('calendar.attendee')
|
||||
registry = odoo.modules.registry.RegistryManager.get(dbname)
|
||||
error_message = False
|
||||
with registry.cursor() as cr:
|
||||
attendee_id = attendee_pool.search(cr, openerp.SUPERUSER_ID, [('access_token', '=', token)])
|
||||
if not attendee_id:
|
||||
env = Environment(cr, SUPERUSER_ID, {})
|
||||
|
||||
attendee = env['calendar.attendee'].sudo().search([('access_token', '=', token)], limit=1)
|
||||
if not attendee:
|
||||
error_message = """Invalid Invitation Token."""
|
||||
elif request.session.uid and request.session.login != 'anonymous':
|
||||
# if valid session but user is not match
|
||||
attendee = attendee_pool.browse(cr, openerp.SUPERUSER_ID, attendee_id[0])
|
||||
user = registry.get('res.users').browse(cr, openerp.SUPERUSER_ID, request.session.uid)
|
||||
if attendee.partner_id.id != user.partner_id.id:
|
||||
# if valid session but user is not match
|
||||
user = env['res.users'].sudo().browse(request.session.uid)
|
||||
if attendee.partner_id != user.partner_id:
|
||||
error_message = """Invitation cannot be forwarded via email. This event/meeting belongs to %s and you are logged in as %s. Please ask organizer to add you.""" % (attendee.email, user.email)
|
||||
|
||||
if error_message:
|
||||
raise BadRequest(error_message)
|
||||
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from openerp.osv import osv
|
||||
from odoo import api, models
|
||||
|
||||
from odoo.addons.calendar.models.calendar import calendar_id2real_id
|
||||
|
||||
|
||||
class ir_values(osv.Model):
|
||||
class IrValues(models.Model):
|
||||
|
||||
_inherit = 'ir.values'
|
||||
|
||||
def set(self, cr, uid, key, key2, name, models, value, replace=True, isobject=False, meta=False, preserve_user=False, company=False):
|
||||
@api.model
|
||||
def set(self, key, key2, name, models, value, replace=True, isobject=False, meta=False, preserve_user=False, company=False):
|
||||
new_model = []
|
||||
for data in models:
|
||||
if type(data) in (list, tuple):
|
||||
new_model.append((data[0], calendar_id2real_id(data[1])))
|
||||
else:
|
||||
new_model.append(data)
|
||||
return super(ir_values, self).set(cr, uid, key, key2, name, new_model,
|
||||
value, replace, isobject, meta, preserve_user, company)
|
||||
return super(IrValues, self).set(key, key2, name, new_model, value, replace, isobject, meta, preserve_user, company)
|
||||
|
||||
def get(self, cr, uid, key, key2, models, meta=False, context=None, res_id_req=False, without_user=True, key2_req=True):
|
||||
if context is None:
|
||||
context = {}
|
||||
@api.model
|
||||
def get(self, key, key2, models, meta=False, res_id_req=False, without_user=True, key2_req=True):
|
||||
new_model = []
|
||||
for data in models:
|
||||
if type(data) in (list, tuple):
|
||||
new_model.append((data[0], calendar_id2real_id(data[1])))
|
||||
else:
|
||||
new_model.append(data)
|
||||
return super(ir_values, self).get(cr, uid, key, key2, new_model,
|
||||
meta, context, res_id_req, without_user, key2_req)
|
||||
return super(IrValues, self).get(key, key2, new_model, meta, res_id_req, without_user, key2_req)
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from openerp.osv import osv
|
||||
from odoo import api, models
|
||||
|
||||
from odoo.addons.calendar.models.calendar import get_real_ids
|
||||
|
||||
|
||||
class mail_message(osv.Model):
|
||||
class Message(models.Model):
|
||||
|
||||
_inherit = "mail.message"
|
||||
|
||||
def search(self, cr, uid, args, offset=0, limit=0, order=None, context=None, count=False):
|
||||
'''
|
||||
convert the search on real ids in the case it was asked on virtual ids, then call super()
|
||||
'''
|
||||
@api.model
|
||||
def search(self, args, offset=0, limit=0, order=None, count=False):
|
||||
""" Convert the search on real ids in the case it was asked on virtual ids, then call super() """
|
||||
args = list(args)
|
||||
for index in range(len(args)):
|
||||
if args[index][0] == "res_id":
|
||||
@@ -20,13 +20,12 @@ class mail_message(osv.Model):
|
||||
args[index] = (args[index][0], args[index][1], get_real_ids(args[index][2]))
|
||||
elif isinstance(args[index][2], list):
|
||||
args[index] = (args[index][0], args[index][1], map(lambda x: get_real_ids(x), args[index][2]))
|
||||
return super(mail_message, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)
|
||||
return super(Message, self).search(args, offset=offset, limit=limit, order=order, count=count)
|
||||
|
||||
def _find_allowed_model_wise(self, cr, uid, doc_model, doc_dict, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
@api.model
|
||||
def _find_allowed_model_wise(self, doc_model, doc_dict):
|
||||
if doc_model == 'calendar.event':
|
||||
order = context.get('order', self._order)
|
||||
for virtual_id in self.pool[doc_model].get_recurrent_ids(cr, uid, doc_dict.keys(), [], order=order, context=context):
|
||||
order = self._context.get('order', self._order)
|
||||
for virtual_id in self.env[doc_model].get_recurrent_ids(doc_dict.keys(), [], order=order):
|
||||
doc_dict.setdefault(virtual_id, doc_dict[get_real_ids(virtual_id)])
|
||||
return super(mail_message, self)._find_allowed_model_wise(cr, uid, doc_model, doc_dict, context=context)
|
||||
return super(Message, self)._find_allowed_model_wise(doc_model, doc_dict)
|
||||
|
||||
@@ -3,28 +3,28 @@
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from openerp.osv import osv, fields
|
||||
from odoo import api, fields, models
|
||||
|
||||
from odoo.addons.calendar.models.calendar import get_real_ids
|
||||
|
||||
|
||||
class res_partner(osv.Model):
|
||||
class Partner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
_columns = {
|
||||
'calendar_last_notif_ack': fields.datetime('Last notification marked as read from base Calendar'),
|
||||
}
|
||||
|
||||
def get_attendee_detail(self, cr, uid, ids, meeting_id, context=None):
|
||||
"""
|
||||
Return a list of tuple (id, name, status)
|
||||
Used by web_calendar.js : Many2ManyAttendee
|
||||
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 web_calendar.js : Many2ManyAttendee
|
||||
"""
|
||||
datas = []
|
||||
meeting = None
|
||||
if meeting_id:
|
||||
meeting = self.pool['calendar.event'].browse(cr, uid, get_real_ids(meeting_id), context=context)
|
||||
for partner in self.browse(cr, uid, ids, context=context):
|
||||
data = self.name_get(cr, uid, [partner.id], context)[0]
|
||||
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:
|
||||
@@ -33,7 +33,8 @@ class res_partner(osv.Model):
|
||||
datas.append(data)
|
||||
return datas
|
||||
|
||||
def _set_calendar_last_notif_ack(self, cr, uid, context=None):
|
||||
partner = self.pool['res.users'].browse(cr, uid, uid, context=context).partner_id
|
||||
self.write(cr, uid, partner.id, {'calendar_last_notif_ack': datetime.now()}, context=context)
|
||||
@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
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="calendar_event_rule_my" model="ir.rule">
|
||||
<field name="name">Own events</field>
|
||||
<field ref="model_calendar_event" name="model_id"/>
|
||||
<field ref="model_calendar_event" name="model_id"/>
|
||||
<field name="domain_force">[('partner_ids','in',user.partner_id.id)]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
</record>
|
||||
|
||||
<record id="calendar_event_rule_employee" model="ir.rule">
|
||||
@@ -18,10 +18,10 @@
|
||||
|
||||
<record id="calendar_attendee_rule_my" model="ir.rule">
|
||||
<field name="name">Own attendees</field>
|
||||
<field ref="model_calendar_attendee" name="model_id"/>
|
||||
<field ref="model_calendar_attendee" name="model_id"/>
|
||||
<field name="domain_force">[(1,'=',1)]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
ids = self.search(cr, uid, [('start', '>=', '2011-04-30 16:00:00'), ('start', '<=', '2011-05-31 00:00:00')], context={'virtual_id': True} )
|
||||
before = self.search(cr, uid, [('start', '>=', '2011-04-30 16:00:00'), ('start', '<=', '2011-05-31 00:00:00')], context={'virtual_id': False})
|
||||
# We start by detach the event
|
||||
newid = self._detach_one_event(cr, uid,ids[1])
|
||||
newid = self._detach_one_event(cr, uid,ids[1]).id
|
||||
self.write(cr, uid,[newid], {'name':'New Name','recurrency' : True}, context={'virtual_id': True})
|
||||
after = self.search(cr, uid, [('start', '>=', '2011-04-30 16:00:00'), ('start', '<=', '2011-05-31 00:00:00')], context={'virtual_id': False})
|
||||
assert len(after) == len(before)+1, 'Wrong number of events found, after to have moved a virtual event'
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
|
||||
<!-- Calendar Events Types Form View -->
|
||||
<odoo>
|
||||
|
||||
<!-- Calendar Events Types : Views and Actions -->
|
||||
<record id="view_calendar_event_type_tree" model="ir.ui.view">
|
||||
<field name="name">Meeting Types Tree</field>
|
||||
<field name="name">calendar.event.type</field>
|
||||
<field name="model">calendar.event.type</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Meeting Types" editable="bottom">
|
||||
@@ -22,16 +19,16 @@
|
||||
<field name="view_id" ref="view_calendar_event_type_tree"/>
|
||||
</record>
|
||||
|
||||
<!-- Calendar Alarm -->
|
||||
<!-- Calendar Alarm : -->
|
||||
<record id="view_calendar_alarm_tree" model="ir.ui.view">
|
||||
<field name="name">Calendar Alarm Tree</field>
|
||||
<field name="name">calendar.alarm.tree</field>
|
||||
<field name="model">calendar.alarm</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Calendar Alarm" editable="bottom">
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="duration" on_change="onchange_duration_interval(duration, interval)"/>
|
||||
<field name="interval" on_change="onchange_duration_interval(duration, interval)"/>
|
||||
<field name="duration"/>
|
||||
<field name="interval"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -47,8 +44,8 @@
|
||||
<field name="type" groups="base.group_no_one"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="interval" on_change="onchange_duration_interval(duration, interval)"/>
|
||||
<field name="duration" on_change="onchange_duration_interval(duration, interval)"/>
|
||||
<field name="interval"/>
|
||||
<field name="duration"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
@@ -62,10 +59,27 @@
|
||||
<field name="view_id" ref="view_calendar_alarm_tree"/>
|
||||
</record>
|
||||
|
||||
<!-- Calendar Events Form View -->
|
||||
<!-- Calendar Events : Views and Actions -->
|
||||
<record id="view_calendar_event_tree" model="ir.ui.view">
|
||||
<field name="name">calendar.event.tree</field>
|
||||
<field name="model">calendar.event</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Meetings" decoration-bf="message_needaction==True">
|
||||
<field name="name" string="Subject"/>
|
||||
<field name="allday" invisible="True"/>
|
||||
<field name="start" string="Start Date"/>
|
||||
<field name="stop" string="End Date"/>
|
||||
<field name="partner_ids"/>
|
||||
<field name="location"/>
|
||||
<field name="state" invisible="True"/>
|
||||
<field name="duration"/>
|
||||
<field name="message_needaction" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_calendar_event_form">
|
||||
<field name="name">Calendar - Event Form</field>
|
||||
<record id="view_calendar_event_form" model="ir.ui.view">
|
||||
<field name="name">calendar.event.form</field>
|
||||
<field name="model">calendar.event</field>
|
||||
<field name="priority" eval="1"/>
|
||||
<field name="arch" type="xml">
|
||||
@@ -86,7 +100,6 @@
|
||||
<field name="partner_ids" widget="many2manyattendee"
|
||||
placeholder="Select attendees..."
|
||||
context="{'force_email':True}"
|
||||
on_change="onchange_partner_ids(partner_ids)"
|
||||
class="oe_inline"/>
|
||||
</h2>
|
||||
</div>
|
||||
@@ -103,17 +116,17 @@
|
||||
<field name="stop" attrs="{'invisible': True}"/>
|
||||
<field name="id" attrs="{'invisible': True}"/>
|
||||
|
||||
<field name="start_date" string="Starting at" on_change="onchange_dates('start', start_date, stop_date, allday, True)" attrs="{'invisible': [('allday','=',False)], 'readonly': [('id', '!=', False), ('recurrency','=',True)]}"/>
|
||||
<field name="stop_date" string="Ending at" on_change="onchange_dates('stop', start_date, stop_date, allday, True)" attrs="{'invisible': [('allday','=',False)], 'readonly': [('id', '!=', False), ('recurrency','=',True)]}"/>
|
||||
<field name="start_date" string="Starting at" attrs="{'invisible': [('allday','=',False)], 'readonly': [('id', '!=', False), ('recurrency','=',True)]}"/>
|
||||
<field name="stop_date" string="Ending at" attrs="{'invisible': [('allday','=',False)], 'readonly': [('id', '!=', False), ('recurrency','=',True)]}"/>
|
||||
|
||||
<field name="start_datetime" string="Starting at" on_change="onchange_duration(start_datetime, duration)" attrs="{'invisible': [('allday','=',True)], 'readonly': [('id', '!=', False), ('recurrency','=',True)]}"/>
|
||||
<field name="start_datetime" string="Starting at" attrs="{'invisible': [('allday','=',True)], 'readonly': [('id', '!=', False), ('recurrency','=',True)]}"/>
|
||||
<field name="stop_datetime" invisible="1"/>
|
||||
<label for="duration" attrs="{'invisible': [('allday','=',True)]}"/>
|
||||
<div attrs="{'invisible': [('allday','=',True)]}">
|
||||
<field name="duration" widget="float_time" string="Duration" on_change="onchange_duration(start_datetime, duration)" class="oe_inline" attrs="{'readonly': [('id', '!=', False), ('recurrency','=',True)]}"/>
|
||||
<field name="duration" widget="float_time" string="Duration" class="oe_inline" attrs="{'readonly': [('id', '!=', False), ('recurrency','=',True)]}"/>
|
||||
<span> hours</span>
|
||||
</div>
|
||||
<field name="allday" on_change="onchange_allday(start, stop, start_date, stop_date, start_datetime, stop_datetime, allday)" attrs="{'readonly': [('id', '!=', False), ('recurrency','=',True)]}"/>
|
||||
<field name="allday" attrs="{'readonly': [('id', '!=', False), ('recurrency','=',True)]}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="categ_ids" widget="many2many_tags" options="
|
||||
@@ -211,8 +224,8 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_calendar_event_form_popup">
|
||||
<field name="name">Meetings Dialog</field>
|
||||
<record id="view_calendar_event_form_popup" model="ir.ui.view">
|
||||
<field name="name">calendar.event.form</field>
|
||||
<field name="model">calendar.event</field>
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
@@ -242,29 +255,8 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- CRM Meeting Tree View -->
|
||||
|
||||
<record model="ir.ui.view" id="view_calendar_event_tree">
|
||||
<field name="name">CRM - Meetings Tree</field>
|
||||
<field name="model">calendar.event</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Meetings" decoration-bf="message_needaction==True">
|
||||
<field name="name" string="Subject"/>
|
||||
<field name="allday" invisible="True"/>
|
||||
<field name="start" string="Start Date"/>
|
||||
<field name="stop" string="End Date"/>
|
||||
<field name="partner_ids"/>
|
||||
<field name="location"/>
|
||||
<field name="state" invisible="True"/>
|
||||
<field name="duration"/>
|
||||
<field name="message_needaction" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- CRM Meeting Calendar -->
|
||||
<record model="ir.ui.view" id="view_calendar_event_calendar">
|
||||
<field name="name">Meeting</field>
|
||||
<record id="view_calendar_event_calendar" model="ir.ui.view">
|
||||
<field name="name">calendar.event.calendar</field>
|
||||
<field name="model">calendar.event</field>
|
||||
<field name="priority" eval="2"/>
|
||||
<field name="arch" type="xml">
|
||||
@@ -279,9 +271,8 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- CRM Meeting Search View -->
|
||||
<record id="view_calendar_event_search" model="ir.ui.view">
|
||||
<field name="name">CRM - Meetings Search</field>
|
||||
<field name="name">calendar.event.search</field>
|
||||
<field name="model">calendar.event</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Meetings">
|
||||
@@ -320,31 +311,54 @@
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_view_calendar_event_calendar">
|
||||
|
||||
<record id="action_view_calendar_event_calendar" model="ir.actions.act_window.view">
|
||||
<field name="act_window_id" ref="action_calendar_event"/>
|
||||
<field name="sequence" eval="1"/>
|
||||
<field name="view_mode">calendar</field>
|
||||
<field name="view_id" ref="view_calendar_event_calendar"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_view_calendar_event_tree">
|
||||
|
||||
<record id="action_view_calendar_event_tree" model="ir.actions.act_window.view">
|
||||
<field name="act_window_id" ref="action_calendar_event"/>
|
||||
<field name="sequence" eval="2"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_calendar_event_tree"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window.view" id="action_view_calendar_event_form">
|
||||
|
||||
<record id="action_view_calendar_event_form" model="ir.actions.act_window.view">
|
||||
<field name="act_window_id" ref="action_calendar_event"/>
|
||||
<field name="sequence" eval="3"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_calendar_event_form"/>
|
||||
</record>
|
||||
|
||||
<!-- Menus -->
|
||||
<menuitem
|
||||
id="mail_menu_calendar"
|
||||
name="Calendar"
|
||||
sequence="2"
|
||||
action="action_calendar_event"
|
||||
web_icon="calendar,static/description/icon.png"
|
||||
groups="base.group_user"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_calendar_configuration"
|
||||
name="Calendar"
|
||||
parent="base.menu_custom"
|
||||
groups="base.group_no_one"/>
|
||||
|
||||
<menuitem name="Calendar" id="mail_menu_calendar" sequence="2" action="action_calendar_event" web_icon="calendar,static/description/icon.png" groups="base.group_user"/>
|
||||
<menuitem id="menu_calendar_configuration" name="Calendar" parent="base.menu_custom" groups="base.group_no_one"/>
|
||||
<menuitem id="menu_calendar_event_type" parent="menu_calendar_configuration" action="action_calendar_event_type" groups="base.group_no_one"/>
|
||||
<menuitem id="menu_calendar_alarm" parent="menu_calendar_configuration" action="action_calendar_alarm" groups="base.group_no_one"/>
|
||||
<menuitem
|
||||
id="menu_calendar_event_type"
|
||||
parent="menu_calendar_configuration"
|
||||
action="action_calendar_event_type"
|
||||
groups="base.group_no_one"/>
|
||||
|
||||
<menuitem
|
||||
id="menu_calendar_alarm"
|
||||
parent="menu_calendar_configuration"
|
||||
action="action_calendar_alarm"
|
||||
groups="base.group_no_one"/>
|
||||
|
||||
<!-- called in js from '/js/base_calendar.js' -->
|
||||
<record id="action_calendar_event_notify" model="ir.actions.act_window">
|
||||
@@ -354,6 +368,4 @@
|
||||
<field name="view_id" ref="view_calendar_event_form"/>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
@@ -1,21 +1,21 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from openerp.osv import osv
|
||||
from odoo import models
|
||||
|
||||
from odoo.addons.calendar.models.calendar import get_real_ids
|
||||
|
||||
|
||||
class invite_wizard(osv.osv_memory):
|
||||
class MailInvite(models.TransientModel):
|
||||
|
||||
_inherit = 'mail.wizard.invite'
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
'''
|
||||
in case someone clicked on 'invite others' wizard in the followers widget, transform virtual ids in real ids
|
||||
'''
|
||||
if 'default_res_id' in context:
|
||||
context = dict(context, default_res_id=get_real_ids(context['default_res_id']))
|
||||
result = super(invite_wizard, self).default_get(cr, uid, fields, context=context)
|
||||
def default_get(self, fields):
|
||||
""" In case someone clicked on 'invite others' wizard in the followers widget, transform virtual ids in real ids """
|
||||
if 'default_res_id' in self._context:
|
||||
self = self.with_context(default_res_id=get_real_ids(self._context['default_res_id']))
|
||||
|
||||
result = super(MailInvite, self).default_get(fields)
|
||||
if 'res_id' in result:
|
||||
result['res_id'] = get_real_ids(result['res_id'])
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user