Thanks Stifan and Anthony. 

Anthony, I changed the code accordingly. Is a no go. Below the traceback. I 
am expecting the result back. Is a simple multiplication between the 
discount (which is according to the supplier selected by the user) and the 
price the user inputs in the system.
THanks


Traceback

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

Traceback (most recent call last):
  File "/home/gs/Applications/web2py/gluon/main.py", line 482, in wsgibase
    session._try_store_in_cookie_or_file(request, response)
  File "/home/gs/Applications/web2py/gluon/globals.py", line 1193, in 
_try_store_in_cookie_or_file
    return self._try_store_in_file(request, response)
  File "/home/gs/Applications/web2py/gluon/globals.py", line 1200, in 
_try_store_in_file
    or self._unchanged(response)):
  File "/home/gs/Applications/web2py/gluon/globals.py", line 1145, in _unchanged
    session_pickled = pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
PicklingError: Can't pickle <type 'instancemethod'>: attribute lookup 
__builtin__.instancemethod failed




On Thursday, February 9, 2017 at 3:38:16 AM UTC-8, Anthony wrote:
>
>
>
>> def product_calc():
>>     form = SQLFORM.factory(
>>     Field('supplier',label='Supplier',requires=IS_IN_DB(db,db.supplier.id
>> ,'%(name)s')),
>>     
>> Field('costprice',label='Cost/Price',requires=[IS_FLOAT_IN_RANGE(0,100),IS_NOT_EMPTY()]),
>>     Field('uom',label='SQF or 
>> PC',default='PC',requires=(IS_IN_SET(UOM_SET))))
>>     
>>     suplidor = db().select(db.supplier.id,db.supplier.discount)
>>     thisrec = db.supplier(request.args)
>>     
>>
>>     if form.process().accepted:
>>
>>         response.flash = 'form accepted'
>>         session.supplier = form.vars.supplier        
>>         session.costprice = form.vars.costprice
>>         session.descuento = db.supplier.discount
>>
>
> db.supplier.discount is a DAL Field object, not a value of that field from 
> an individual record. Presumably you want to set session.descuento to 
> something like thisrec.discount or db.supplier(form.vars.supplier).discount.
>
> As an aside, it helps if you explain the specific problem you are having 
> (i.e., what do you expect, and what do you observer instead -- in 
> particular, report any errors and tracebacks).
>
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to