db.define_table('product_input',
Field('product', db.product, notnull=True),
Field('total_price','decimal(7,2)', readable=False,writable=False),
Field('amount', 'integer', readable=False,writable=False),
Field('supplier', db.supplier, notnull=True),
Field('location', db.location, notnull=True),
Field('input_type', 'string'),
auth.signature,
format = lambda r: '%s %s %s %s [%s]' % (r.product.model.model, r.product.manufacturer.manufacturer, r.product.part_number,
r.product.serial_number, r.product.expiration_date)
)
def stock():
count = db.product_input.id.count()
results = db(db.product_input).select(db.product_input.product, count, groupby=db.product)
return locals()