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 <http://127.0.0.1:8000/examples/global/vars/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 <http://127.0.0.1:8000/examples/global/vars/session>.flash="New
Task Added"
redirect <http://127.0.0.1:8000/examples/global/vars/redirect>(URL
<http://127.0.0.1:8000/examples/global/vars/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"
<http://127.0.0.1:8000/admin/default/edit/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"
<http://127.0.0.1:8000/admin/default/edit/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
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.