7
class product(osv.osv):
8
_name = "tiny_purchase.product"
10
'name': fields.char('Name', size=64),
11
'price': fields.float('Price'),
16
_name = "tiny_purchase.line"
18
def _get_price(self, cr, uid, ids, field_name=None, arg=None, context={}):
20
lines=self.browse(cr, uid, ids)
23
res[l.id]=l.quantity * l.product_id.price
29
'name': fields.date('Date'),
30
'user_id': fields.many2one('res.users', 'User', required=True),
31
'product_id': fields.many2one('tiny_purchase.product', 'Product', required=True),
32
'quantity': fields.integer('Quantity'),
33
'price': fields.function(_get_price, method=True, string='Price', type='float'),
34
'comments': fields.text('Comments'),
38
'name': lambda *a: time.strftime('%Y-%m-%d'),
39
'user_id': lambda self, cr, uid, context: uid,
40
'quantity': lambda *a: 0,