...
 
Commits (3)
......@@ -39,6 +39,7 @@ class CGScopCalendar(models.Model):
[('outside', 'Extérieur'),
('ur', 'UR'),
('training', 'Formation'),
('teleworking', 'Télétravail'),
('absent', 'Absence, Congés, Divers')],
string="Type de Réunion")
location = fields.Text()
......@@ -105,7 +106,7 @@ class CGScopCalendar(models.Model):
# affecte l'id UR du partner lié au user pour la gestion
# du multi société -> un utlisateur ne peut créer de RDV
# que sur son UR d'origine
event.ur_id = self.env.user.partner_id.ur_id
event.ur_id = event.user_id.partner_id.ur_id
@api.depends('ur_id')
def _compute_ur_system_nb(self):
......
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import test_event_creation
# © 2019 Le Filament (<http://www.le-filament.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import random
import logging
from odoo.tests import tagged, common
_logger = logging.getLogger(__name__)
@tagged('post_install', '-at_install')
class TestEventCreation(common.TransactionCase):
def setUp(self):
super(TestEventCreation, self).setUp()
self.CalendarEvent = self.env['calendar.event']
def test_calender_simple_event(self):
m = self.CalendarEvent.create({
'name': "Test compute",
'start': '2017-07-12 14:30:00',
'allday': False,
'stop': '2017-07-12 15:00:00',
'user_id': 180
})
self.assertEqual(
(m.ur_id),
(m.user_id.partner_id.ur_id),
"Event UR check"
)