Files
odoo_source/addons/calendar/models/ir_values.py
T
Jérome Maes 6bc14c9142 [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
2016-07-14 14:04:33 +02:00

32 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, models
from odoo.addons.calendar.models.calendar import calendar_id2real_id
class IrValues(models.Model):
_inherit = 'ir.values'
@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(IrValues, self).set(key, key2, name, new_model, value, replace, isobject, meta, preserve_user, company)
@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(IrValues, self).get(key, key2, new_model, meta, res_id_req, without_user, key2_req)