[Partner] ~year of birth constraints. Must be greater than current year.
[burette/bikecoop.git] / bikecoop.py
index bd6b740..732528e 100644 (file)
@@ -1,5 +1,7 @@
 # -*- coding: utf-8 -*-
 from osv import fields, osv
+import openerp.addons.decimal_precision as dp
+from datetime import date
 
 
 class Theme(osv.osv):
@@ -34,15 +36,24 @@ class Partner(osv.osv):
     def _check_year(self, cr, uid, ids, context=None):
         obj = self.browse(cr, uid, ids[0], context=context)
         if obj.year:
-            if obj.year < 1900 or obj.year > 2100:
+            if obj.year < 1900 or obj.year > date.today().year:
                 return False
         return True
 
     _constraints = [
         (_check_year, 'Error: this year is not valid.', ['year']),
     ]
+Partner()
 
 
-Partner()
+class product_template(osv.osv):
+    _inherit = 'product.template'
+
+    _columns = {
+        'standard_price': fields.float('Cost', digits_compute=dp.get_precision('Product Price'), help="Cost price of the product used for standard stock valuation in accounting and used as a base price on purchase orders.", groups="base.group_user,point_of_sale.group_pos_user"),
+    }
+
+product_template()
+
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: