Hi
This has been driving me crazy, and dont what I am doing wrong
db.define_table('product',
Field('product_name'),
Field('batch_no'),
Field('withholding_period','integer'),
format='%(product_name)s %(batch_no)s')
db.define_table('stock_task',
Field('completed_date', 'date',default=request.now),
Field('product', db.product),
Field('withhold_until_date', 'date'),
Field('ESI_withhold_until_date', 'date'), #default=withheld), # need to use the completed date and product withhold peroid
def create_stock_task():
form = SQLFORM (db.stock_task).process()
if form.accepted:
task = db(db.stock_task.id>0).select(limitby=(0,1), orderby=~db.stock_task.id).first()
pdays_row = db(db.stock_task.product==db.product._format)
pdays = pdays_row.withholding_period.select()
wdate_row =db(db.stock_task.completed_date>0).select().first()
fdate = wdate + datetime.timedelta (days + pdays)
ndate_row = db(db.stock_task.withhold_until_date>0).select().first()
ndate = ndate_row.withhold_until_date
db(db.stock_task.id == task).update(ndate=fdate)
session.flash="New Task Added"
redirect(URL('stock_tasks'))
return dict( form=form)
Traceback
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. | Traceback (most recent call last): File "/home/tony/web2py/gluon/restricted.py", line 227, in restricted exec ccode in environment File "/home/tony/web2py/applications/cps21/controllers/default.py", line 553, in <module> File "/home/tony/web2py/gluon/globals.py", line 412, in <lambda> self._caller = lambda f: f() File "/home/tony/web2py/gluon/tools.py", line 3774, in f return action(*a, **b) File "/home/tony/web2py/applications/cps21/controllers/default.py", line 277, in create_stock_task pdays = pdays_row.withholding_period.select() AttributeError: 'Set' object has no attribute 'withholding_period' |
any help appreciated
thanks Anthony