--- /dev/null
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# velosenville module for OpenERP, Vélos en Ville specificities
+# Copyright (C) 2012-2013 Vélos en Ville (<http://www.velosenville.org>)
+#
+# This file is a part of velosenville
+#
+# velosenville is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# velosenville is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from openerp.osv import osv
+from openerp.osv import fields
+from datetime import date
+
+
+class res_partner(osv.osv):
+ _inherit = 'res.partner'
+
+ _columns = {
+ #Overload birthdate field to have date format. Don't know why it's char type in mainstream version
+ 'birthdate': fields.date('Birthdate'),
+ }
+
+ def _check_birthdate(self, cr, uid, ids, context=None):
+ obj = self.browse(cr, uid, ids[0], context=context)
+ if obj.birthdate:
+ if obj.birthdate < '1900-01-01' or obj.birthdate > str(date.today()):
+ return False
+ return True
+
+ _constraints = [
+ (_check_birthdate, 'Error: this birthdate is not valid.', ['birthdate']),
+ ]
+res_partner()
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
--- /dev/null
+<openerp>
+ <data>
+ <record id="view_bikecoop_members_form" model="ir.ui.view">
+ <field name="name">res.partner.form</field>
+ <field name="model">res.partner</field>
+ <field name="inherit_id" ref="bikecoop.view_bikecoop_members_form"/>
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='year']" position="replace">
+ <field name="birthdate" attrs="{'required': [('is_company','=', False)]}"/>
+ </xpath>
+ </field>
+ </record>
+ </data>
+</openerp>