thanks anthony, put the logic outside the form process do the trick, but it 
seems, that i process further for the value.
e.g.
def receipt_form():
    form = SQLFORM(db.receipt_header)
    #if form.vars.receipt_type == 'Purchase Order':
    #if request.vars.receipt_type == 'Purchase Order':
    if request.post_vars.receipt_type == 'Purchase Order':
        db.receipt_header.purchase_order_no.requires = 
IS_IN_DB(db(db.purchase_order_header.status == 'Purchase Order'), 
                                                                
db.purchase_order_header.id, db.purchase_order_header._format)

        #row_header = db(db.purchase_order_header.id == 
form.vars.purchase_order_no).select().first()
        row_header = db(db.purchase_order_header.id == 
request.vars.purchase_order_no).select().first()
        form.vars.supplier = row_header.supplier
        form.vars.receipt_no = 
str(receipt_id)+'/RC/'+request.now.strftime('%y%m%d')+'/'+str(form.vars.supplier)

        session.receipt_header = dict(form.vars)
        rows = db(db.purchase_order_detail.purchase_order_no == 
session.receipt_header['purchase_order_no']).select()
        
    """
    cutted for purchase return and sale return
    """

    #if form.validate():
    if form.process().accepted:
        for row in rows:
            id = int(row.product)
            quantity = int(row.quantity)
            
            session.receipt_detail[id] = quantity
            
        response.js =  "jQuery('#receipt_checkout').get(0).reload()"
    return dict(form = form)

it return an error traceback
Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

Traceback (most recent call last):
  File "C:\web2py\gluon\restricted.py", line 227, in restricted
    exec ccode in environment
  File "C:/web2py/applications/shop/controllers/warehouse_transaction.py" 
<https://127.0.0.1/admin/default/edit/shop/controllers/warehouse_transaction.py>,
 line 270, in <module>
  File "C:\web2py\gluon\globals.py", line 412, in <lambda>
    self._caller = lambda f: f()
  File "C:/web2py/applications/shop/controllers/warehouse_transaction.py" 
<https://127.0.0.1/admin/default/edit/shop/controllers/warehouse_transaction.py>,
 line 60, in receipt_form
    rows = db(db.purchase_order_detail.purchase_order_no == 
session.receipt_header['purchase_order_no']).select()
KeyError: 'purchase_order_no'


any idea, how to accomplish this using web2py way?

thanks and best regards,
stifan

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to