I solved the issue as hinted by Anthony and Dave S. 

In model db.py I added this function

def get_new_amcno():
    rows =  db.executesql("exec gen_amcno_new @ucod = 
?,@divcod=?,@sec=?",placeholders=([session.unit,session.divn, 
session.sec]),as_dict=True) 
    for i in rows:
        amcno = i['amcno']
    return amcno

And in table definition for amcno I set the default = get_new_amcno

Now this inserts the new coined amcno in the field.

Thanks Anthony, Dave S

-- 
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.

Reply via email to