[PARTNER] +country_id and nationality_id default value is 'France'
[burette/bikecoop_l10n_fr.git] / bikecoop.py
diff --git a/bikecoop.py b/bikecoop.py
new file mode 100644 (file)
index 0000000..7fe5b64
--- /dev/null
@@ -0,0 +1,27 @@
+from openerp.osv import osv
+from openerp.osv import fields
+
+class Partner(osv.osv):
+    _inherit = 'res.partner'
+
+    def _default_country(self, cr, uid, context=None):
+        if not context:
+            context = {}
+        country_obj = self.pool.get('res.country')
+        country = country_obj.search(cr, uid, [('name', '=', 'France')], context=context)
+        return country
+
+    def _default_nationality(self, cr, uid, context=None):
+        if not context:
+            context = {}
+        nationality_obj = self.pool.get('res.country')
+        nationality = nationality_obj.search(cr, uid, [('name', '=', 'France')], context=context)
+        return nationality
+
+    _defaults = {
+        'country_id': _default_country,
+        'nationality_id': _default_nationality,
+    }
+
+Partner()
+