1 # -*- coding: utf-8 -*-
2 from openerp
.osv
import fields
, osv
3 import openerp
.addons
.decimal_precision
as dp
4 from datetime
import date
8 _name
= 'bikecoop.partner.theme'
9 _description
= 'Themes that could be related to a partner'
12 'code': fields
.char('Code', size
=8, help='Code of the occupation'),
13 'name': fields
.char('Name', size
=128, help='Name of the job or studies', required
=True, translate
=True),
14 'domain': fields
.selection([('gender', 'Gender'), ('occupation', 'Occupation'), ('volunteer', 'Volunteer')], 'Domain', required
=True, size
=24),
15 'active': fields
.boolean('Active', help='If check, this object is always available'),
19 'active': lambda *a
: 1,
25 class Partner(osv
.osv
):
26 _inherit
= 'res.partner'
29 'nationality_id': fields
.many2one('res.country', 'Nationality', help='Partner\'s nationality if he is a person'),
30 'year': fields
.integer('Year of birth', help='This partner year of birth'),
31 'occupation_id': fields
.many2one('bikecoop.partner.theme', 'Occupation', help='Main occupation of this partner'),
32 'volunteer_ids': fields
.many2many('bikecoop.partner.theme', 'res_partner_bikecoop_theme_rel', 'partner_id', 'theme_id', 'Want to be volunteer?', help='What kind of volunteer activities you want to do with us?'),
33 'gender_id': fields
.many2one('bikecoop.partner.theme', 'Gender'),
36 def _check_year(self
, cr
, uid
, ids
, context
=None):
37 obj
= self
.browse(cr
, uid
, ids
[0], context
=context
)
39 if obj
.year
< 1900 or obj
.year
> date
.today().year
:
44 (_check_year
, 'Error: this year is not valid.', ['year']),
49 class product_template(osv
.osv
):
50 _inherit
= 'product.template'
53 '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"),
59 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: