From 61274df36da9e8965f7263911d234129b8538b11 Mon Sep 17 00:00:00 2001 From: michel Date: Fri, 24 Nov 2017 16:25:14 +0100 Subject: [PATCH] / --- coworking_coworker/models/res_partner.py | 25 ++++++++++++++++++- .../views/res_partner_views.xml | 14 +++++------ coworking_event/views/coworker_views.xml | 2 -- 3 files changed, 31 insertions(+), 10 deletions(-) diff --git a/coworking_coworker/models/res_partner.py b/coworking_coworker/models/res_partner.py index 3240131..90d22d8 100644 --- a/coworking_coworker/models/res_partner.py +++ b/coworking_coworker/models/res_partner.py @@ -8,7 +8,8 @@ from odoo.exceptions import ValidationError class ResPartner(models.Model): """ Coworker model """ _inherit = 'res.partner' - name = fields.Char(required=True) + + company_ids = fields.One2many( string="Company", comodel_name="res.partner", @@ -24,3 +25,25 @@ class ResPartner(models.Model): email = fields.Char() url = fields.Char('URL') comment = fields.Text() + job = fields.Char() + + + contact_date = fields.Date(default=fields.Date.context_today) + + coworker_type = fields.Selection([('staffer', 'Staffer'), + ('worker', 'Worker'), ('member', 'Member'), + ('volunteer', 'Volunteer'), + ('visitor', 'Visitor')]) + company_name = fields.Char('Company') + job = fields.Char() + + + url = fields.Char('URL') + + + + @api.constrains('contact_date') + def _check_contact_date(self): + """Test si la modification de la date n'est pas superieur à la date du jour""" + if self.contact_date > fields.Date.context_today(self): + raise ValidationError(_('Date most be equal of inferior to to day')) diff --git a/coworking_coworker/views/res_partner_views.xml b/coworking_coworker/views/res_partner_views.xml index 4a9ba39..cbdc0dd 100644 --- a/coworking_coworker/views/res_partner_views.xml +++ b/coworking_coworker/views/res_partner_views.xml @@ -8,16 +8,16 @@
- - - - + + + + + + + - - -
diff --git a/coworking_event/views/coworker_views.xml b/coworking_event/views/coworker_views.xml index 68f5668..70ed982 100644 --- a/coworking_event/views/coworker_views.xml +++ b/coworking_event/views/coworker_views.xml @@ -1,7 +1,6 @@ - Coworker Form adaptations @@ -20,5 +19,4 @@
-