420ce976d06bd233f0815037024a06ec18bf3b75
[burette/lhc.git] / lhc.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 # lhc module for OpenERP, Customize OpenERP for L'Heureux Cyclage Copyright
5 # (C) 2013-2020 L'Heureux Cyclage (<http://www.heureux-cyclage.org>)
6 #
7 # This file is a part of lhc_custom_oe
8 #
9 # lhc_custom_oe is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # lhc_custom_oe is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #
22 ##############################################################################
23
24 from openerp.osv import osv
25 from openerp.osv import orm
26 from openerp.osv import fields
27 import openerp.addons.decimal_precision as dp
28
29
30 class res_partner(orm.Model):
31 _inherit = 'res.partner'
32
33 _columns = {
34 'usual_contact': fields.boolean('Usual contact', help='This contact is a usual contact for L\'Heureux Cyclage employees. This field can be used to discriminated contacts for differents usages.'),
35 'kit_sent': fields.boolean('Welcome kit sent'),
36 }
37
38 _defaults = {
39 'kit_sent': lambda *a: False,
40 }
41
42
43 class product_template(orm.Model):
44 _inherit = 'product.template'
45
46 _columns = {
47 '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,lhc.group_volunteer"),
48 }
49
50
51 class res_users(orm.Model):
52 _inherit = 'res.users'
53
54 def onchange_partner_id(self, cr, uid, ids, partner_id, login):
55 """Define user email address from partner email address"""
56 v = {}
57 partners = self.pool.get('res.partner')
58 partner = partners.browse(cr, uid, partner_id)
59 import pdb
60 pdb.set_trace()
61 if partner.email:
62 v['email'] = partner.email
63 else:
64 v = {}
65 return {'value': v}
66
67
68 class event_registration(orm.Model):
69 _inherit = 'event.registration'
70
71 _columns = {
72 'gender': fields.selection([
73 ('female', 'Female'),
74 ('male', 'Male'),
75 ('other', 'Other')],
76 'Gender'),
77 'position': fields.selection([
78 ('employee', 'Employee'),
79 ('individual', 'Invividual'),
80 ('volunteer', 'Volunteer')],
81 'Position'),
82 'funding_main': fields.selection([
83 ('individual', 'Individual'),
84 ('opco', 'OPCO'),
85 ('company', 'Company'),
86 ('pole_emploi', 'Pole Emploi')],
87 'Main funding', help='Main funding origin'),
88 'fundings_others': fields.char('Others fundings origins', size=128),
89 }
90
91 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: