diff --git a/__manifest__.py b/__manifest__.py
index a5a7a66..87c735d 100644
--- a/__manifest__.py
+++ b/__manifest__.py
@@ -25,6 +25,7 @@
'license': 'AGPL-3',
'application': False,
'installable': True,
- 'data': ['views/coworking_menu.xml', 'views/coworker_views.xml', 'security/ir.model.access.csv'],
+ 'data': ['views/coworking_menu.xml', 'views/coworker_views.xml',
+ 'security/ir.model.access.csv', 'views/event_menu.xml', 'views/event_views.xml'],
'depends': ['base']
}
diff --git a/models/__init__.py b/models/__init__.py
index 03e0817..7f37d89 100644
--- a/models/__init__.py
+++ b/models/__init__.py
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
-
+"""dd"""
from . import coworker
+from . import event
diff --git a/models/event.py b/models/event.py
new file mode 100644
index 0000000..a8929a1
--- /dev/null
+++ b/models/event.py
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+
+""" Event module """
+
+from odoo import models, fields, api, _
+from odoo.exceptions import ValidationError
+
+class Event(models.Model):
+ """ Event model """
+ _name = 'coworking.event'
+ _description = 'Event model definition'
+ _order = 'id desc'
+
+ title = fields.Char(required=True)
+ # manager = fields.Many2one('coworker.users', 'Manager', required=True, index=True)
+
+ date_start = fields.Date(default=fields.Date.context_today, required=True)
+ date_end = fields.Date(required=True)
+
+ duration = fields.Float()
+
+
+ @api.constrains('date_end')
+ def _check_date_end(self):
+ """Test si la modification de la date n'est pas postérieur à la date de début"""
+ if self.date_start > self.date_end:
+ raise ValidationError(_('Date most be supperior to to start date'))
+
+ #
+ # @api.constrains('duration')
+ # def _check_duration(self):
+ # """Calcul du temps entre date_start et date_end ne heure"""
+ # for event in self:
+ # self.date_start.hour - self.date_end-hour:
diff --git a/views/event_menu.xml b/views/event_menu.xml
new file mode 100644
index 0000000..8c46ee4
--- /dev/null
+++ b/views/event_menu.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/views/event_views.xml b/views/event_views.xml
new file mode 100644
index 0000000..ad20cdf
--- /dev/null
+++ b/views/event_views.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+ Event Form
+ coworking.event
+
+
+
+
+
+