1
##############################################################################
3
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
6
# WARNING: This program as such is intended to be used by professional
7
# programmers who take the whole responsability of assessing all potential
8
# consequences resulting from its eventual inadequacies and bugs
9
# End users who are looking for a ready-to-use solution with commercial
10
# garantees and support are strongly adviced to contract a Free Software
13
# This program is Free Software; you can redistribute it and/or
14
# modify it under the terms of the GNU General Public License
15
# as published by the Free Software Foundation; either version 2
16
# of the License, or (at your option) any later version.
18
# This program is distributed in the hope that it will be useful,
19
# but WITHOUT ANY WARRANTY; without even the implied warranty of
20
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
# GNU General Public License for more details.
23
# You should have received a copy of the GNU General Public License
24
# along with this program; if not, write to the Free Software
25
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
##############################################################################
29
from osv import osv, fields
30
class library_price_category(osv.osv):
31
_name = 'library.price.category'
32
_description = 'Book Price Category'
34
'name': fields.char('Category', size=64, required=True),
35
'price': fields.float('Price', required=True),
36
'product_ids': fields.one2many('product.product', 'price_cat', 'Books' ,readonly=True)
40
'price': lambda *a : 0,
42
library_price_category()
44
class library_rack(osv.osv):
45
_name = 'library.rack'
46
_description="Library Rack"
48
'name': fields.char('Name', size=64,required=True),
49
'code' : fields.char('Code', size=16,),
50
'active': fields.boolean('Active'),
54
'active': lambda *a: True
58
class library_collection(osv.osv):
59
_name = 'library.collection'
60
_description="Library Collection"
62
'name': fields.char('Name', size=64,required=True),
63
'code' : fields.char('Code', size=16,),
67
class library_author(osv.osv):
68
_name = 'library.author'
71
'name': fields.char('Name', size=64,required=True, select=True),
72
'first_name':fields.char('First Name', size=64),
73
'born_date': fields.date('Date of birth'),
74
'death_date': fields.date('Date of death'),
75
'biography': fields.text('Biography'),
76
'note': fields.text('Notes'),
77
'editor_ids': fields.many2many('res.partner','author_editor_rel','author_id','partner_id','Editors', select=1),
79
def name_get(self, cr, uid, ids, context={}):
82
reads = self.read(cr, uid, ids, ['name','first_name'], context)
83
return map(lambda x: (x['id'], x['name'] + (x['first_name'] and (', '+x['first_name']) or '')), reads)