[web2py] Developers

2020-08-21 Thread Anthony Smith
Hi are there any programmers in Australia looking for work 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/157d048d-99b9-4ff4-bae0-38c1712e4aaen%40googlegroups.com.


[web2py] If condition is True

2017-11-11 Thread Anthony Smith
Hi all, 

I have been trying to work how to open a table if the condition is true.

If know that *show_if* will only reference if all fields are in the same 
table.

Example below:

Models:
db.define_table('taxpayer',
Field('name'),
Field('address'),
Field('spouse', 'boolean' ))

db.define_table('spouse',
   Field('spouse_name'),
   Field('spouse_phone'))

Controllers:
def taxpayer():
*db.spouse.show_if =(db.taxpayer.spouse==True)*
form= SQLFORM(db.taxpayer).process()
if form.accepted:
response.flash = 'record inserted'
return dict (form=form)


Thanks for any input 

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


[web2py] Re: Data Representation SQLFORM.factory /linked tables

2017-11-02 Thread Anthony Smith
Thanks Anthony

As usual something I never thought of. Always looking for my 
mistakes.lol

cheers Anthony

On Thursday, 2 November 2017 13:19:35 UTC+11, Anthony wrote:
>
>   db.define_table('drench',
>> Field('status', requires=IS_IN_SET(STATUSES), 
>> default=STATUSES[0]),
>> Field('assigned_to', db.auth_user), #, 
>> default=auth.user_id
>> Field('start_date', 'date',default=request.now),
>> Field('completed_date', 'date',default=request.now),
>> Field('mob',db.stock),
>> Field('count'),
>> Field('estimated_weight','integer', default=0),
>> 
>> Field('product',requires=IS_IN_DB(db,db.product.product_name, 
>> '%(product_name)s %(batch_no)s')),
>>
>
> You have defined the "product" field as a string field, not a reference 
> field. The default representation of a string field in a grid or read-only 
> form is simply the string itself. If you want a different representation, 
> you must specify the "represent" attribute of the field.
>
> The IS_IN_DB validator is used to generate a select widget in forms, so 
> the "label" argument you specified in that validator controls that values 
> shown in the select widget, but that has no effect on the representation in 
> grids and read-only forms.
>
> 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.


[web2py] Data Representation SQLFORM.factory /linked tables

2017-10-31 Thread Anthony Smith

Hi All, 

I have been pulling my hair out with this. Wen I view the drenches grid I 
shows the assigned to = the full name of the auth user which is correct , 
but when I add a product it only displays the name of the product and does 
not include the batch no which I require. I am lost as to why.


Thanks 

Anthony

I have the following tables:

   db.define_table('product',
Field('product_name'),
Field('active_ingredient'),
Field('batch_no'),
Field('expiry_date','date',default = request.now),
Field('product_type', 
requires=IS_IN_SET(PRODUCTTYPES),default= PRODUCTTYPES[0]),
Field('product_usage', 
requires=IS_IN_SET(PRODUCTSUBTYPES),default= PRODUCTSUBTYPES[0]),

Field('withholding_period','integer',requires=[IS_NOT_EMPTY()]),

Field('ESI_withholding','integer',requires=[IS_NOT_EMPTY()]),
Field('qty','integer'),
Field('date_purchased','date', default = request.now),
Field('purchased_from', 
requires=IS_IN_DB(db,'person.company','%(company)s')),
auth.signature,
format='%(product_name)s %(batch_no)s')

  db.define_table('drench',
Field('status', requires=IS_IN_SET(STATUSES), 
default=STATUSES[0]),
Field('assigned_to', db.auth_user), #, default=auth.user_id
Field('start_date', 'date',default=request.now),
Field('completed_date', 'date',default=request.now),
Field('mob',db.stock),
Field('count'),
Field('estimated_weight','integer', default=0),

Field('product',requires=IS_IN_DB(db,db.product.product_name, 
'%(product_name)s %(batch_no)s')),
Field('dose_rate'),
Field('withhold_until_date', 'date'),
Field('ESI_withhold_until_date', 'date'),
Field('paddock', 
requires=IS_IN_DB(db,db.paddock.paddock_name,'%(paddock_name)s')),
auth.signature)

In my controller I am using the following:

def manage_stock_tasks():
grid = 
SQLFORM.smartgrid(db.stock,linked_tables=['drench','vaccinate','joining', 
'marking','feeding','footbath'],
 user_signature=False)
return dict(grid=grid)

def drench():
form= SQLFORM.factory(
Field('status', requires=IS_IN_SET(STATUSES), default=STATUSES[0]),
Field('assigned_to', 
requires=IS_IN_DB(db.auth_user.id,'%(first_name)s %(last_name)s')),
Field('start_date', 'date',default=request.now),
Field('completed_date', 'date',default=request.now),
Field('mob',requires=IS_IN_DB(db,db.stock.id,'%(mob_name)s')),
Field('count'),
Field('estimated_weight','integer', default=0),
Field('product', requires=IS_IN_DB(db.product.id,'%(product_name)s 
%(batch_no)s')),
Field('dose_rate','integer'),
Field('withhold_until_date', 'date'),
Field('ESI_withhold_until_date', 'date'), #default=withheld), # 
need to use the completed date and product withhold peroid
Field('paddock', requires=IS_IN_DB(db,db.paddock.id,'%(paddock_name)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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQLFORM grid search : Get ids of filtered records

2016-11-13 Thread Anthony Smith
Hi Anthony,

I thought I would try this, but getting the following error:
(global name 'selected_true_callback' is not 
defined)
It would be great if you could explain what I am doing wrong 

thanks 
Anthony

On Thursday, 27 October 2016 03:20:30 UTC+11, Anthony wrote:
>
> Note, the "searchable" argument can be a custom callable -- so, you can 
> create a custom function that first calls the default internal query 
> builder to get the query that filters the records, then run the update 
> using that query, and then simply return the query for use by the grid. 
> Here is an example:
>
> def index():
> grid_query = db.mytable.id > 0
> selectable=[('Set Selected True', selected_true_callback),
> ('Set All True', all_true_callback)]
> if 'keywords' in request.get_vars:
> selectable.append(('Set Filtered True', lambda r: None))
>
> def update_filtered(sfields, keywords):
> search_query = SQLFORM.build_query(sfields, keywords)
> if 'submit_2' in request.post_vars:
> db(grid_query & search_query).update(myboolean=True)
> return search_query
>
> grid = SQLFORM.grid(grid_query, selectable=selectable,
> searchable=update_filtered)
> return dict(grid=grid)
>
> In the above, "selectable" is a list of tuples defining two or three 
> buttons corresponding to updating selected, all, or (optionally) filtered 
> records. The grid will name each button "submit_0", "submit_1", and 
> "submit_2", respectively. Whenever a search request comes in, the grid will 
> call update_filtered (passing in the search fields and keywords). This 
> function first simply calls the built-in query builder, just as the grid 
> normally would, generating a DAL query for the search. The code determines 
> if the "Set Filtered True" button was clicked by checking for "submit_2" in 
> request.post_vars. In that case, it defines the filtered set of records by 
> applying the main query for the grid in addition to the search query, and 
> then updates that set of records (note, if your first argument to 
> SQLFORM.grid is just a table rather than a query, you can skip the 
> grid_query part of the code). Finally, it returns the search query for the 
> grid to use as usual.
>
> Note, in "selectable", the callback function for "Set Filtered True" is 
> simply a do-nothing lambda function, as there won't actually be any 
> selected records in this case -- we're just using "selectable" as a 
> convenient way to add an additional submit button to the grid.
>
> Anthony
>
> On Tuesday, October 25, 2016 at 2:35:00 AM UTC-4, Madhavi wrote:
>>
>> Hi,
>>
>> I am new to web2py and am working on application with a SQLFORM grid with 
>> the search feature along with selectable option. I added extra buttons to 
>> my grid to set a boolean value for selected records using selectable 
>> feature, and added another button to set a boolean value for all the 
>> records in the table. Now, I also want to add a button the set this value 
>> for only filtered records using the search feature. Is there a way using 
>> which I can refer to the ids of only those records which are filtered 
>> through the search widget to perform this manipulation only on those 
>> records? To explain better, I have the below buttons in place:
>>
>> 1. Set true for all selected records
>> 2. Set true for all records
>>
>> I also want to add an option to:
>>
>> 3. Set true for filtered records (filtered records refer to the ones 
>> displayed on performing the search in the grid).
>>
>> Please let me know if this is possible,
>>
>> Thanks a ton,
>>
>> Madhavi
>>
>

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


[web2py] Re: Updating with Count

2016-11-12 Thread Anthony Smith


On Saturday, 12 November 2016 21:50:34 UTC+11, 黄祥 wrote:
>
> 'for the update to be automatic when changes are made to the 1st table'
> perhaps you can use after_update or before_update callback
> ref:
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#callbacks-on-record-insert--delete-and-update
>
> best regards,
> stifan
>

Thanks for your help

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.


[web2py] Updating with Count

2016-11-11 Thread Anthony Smith
Hi all, 

I am at a lose of how to update a table with the row count form another 
table, I have been able to count and create a new form , which updates the 
other table . 
But I am hoping it is possible to be for the update to be automatic when 
changes are made to the 1st table .

Below is a shorten version of the models and the controllers:

model/db1.py
db.define_table('stock',
Field('product'),,
Field('start_count','integer', default=0),
Field('count_now'))

db.define_table('stock_item',
Field('product',  'reference stock'),
Field('size'),
Field('color'),
Field('weight'))

controller/ default
def stocks():
db.stock.product.represent = lambda product,row:\
A(product,_href=URL('view_stock', args=row.id))
query = (db.stock.created_by.belongs(group_members))
grid = SQLFORM.grid(query, orderby=~db.stock.created_on,
create=False,details=False,editable=True,
deletable=False,
fields =[
db.stock.product,
db.stock.start_count,
db.stock.count_now,
])
return locals()

def stock_items():
db.stock_item.product.represent = lambda product,row:\
A(product,_href=URL('view_stock_item', args=row.id))
query = (db.stock_item.created_by.belongs(group_members))
grid = SQLFORM.grid(query, orderby=~db.stock_item.created_on,
create=False,details=False,editable=False,
deletable=False,
fields =[
db.stock_item.product,
db.stock_item.size,
db.stock_item.color,
db.stock_item.weight,
])
return locals()

This is the part I would like to run on update, there is no need for it to 
output to a form just update the stock table.
def stockcount():
query = 
db(db.stock_item._id>0).select(db.stock_item.product,db.stock_item.product.count(),orderby=db.stock_item.product,groupby=db.stock_item.product)
for row in query:
db.stock.update_or_insert(db.stock._id == row.stock_item.product,
  count_now = 
row[db.stock_item.product.count()])   
form =SQLTABLE(query)
return dict(form=form)


thanks for any help and assistance 

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.


[web2py] Re: order by the greater of 2 fields

2016-10-26 Thread Anthony Smith


On Wednesday, 26 October 2016 15:25:35 UTC+11, Anthony wrote:
>
> Hi all, 
>> This gets the results using sql but only able to do one or the other is 
>> the controller in web2py
>> select * from animalTask order by 
>> GREATEST(COALESCE(withhold_until_date,0),COALESCE(esi_withhold_until_date,0))
>>  
>> DESC 
>>
>
> What do you mean by "one or the other" -- what is "the other"?
>
> Anthony
>

I meant it would only order by 1 field not the other,but the sql works fine.
just implementing it now  

I will work on it 

cheers

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


[web2py] Re: order by the greater of 2 fields

2016-10-25 Thread Anthony Smith


On Tuesday, 25 October 2016 01:16:19 UTC+11, Anthony wrote:
>
> On Monday, October 24, 2016 at 7:11:29 AM UTC-4, Anthony Smith wrote:
>>
>> Hi all,
>>
>> I have table with 2 fields, withhold _until_date and esi_withhold_until.
>>
>> Is is it possible to order by so the the greater of the 2 fields was at 
>> the top of the list.
>>
>
> I think there are various ways to achieve this in SQL, though not sure you 
> could easily use the DAL to generate that SQL. Does you query involve a 
> limitby or pagination (i.e., does the sorting have to be done by the 
> database as part of the query)? If not, you could instead do the sorting in 
> Python -- check out the Rows.sort method: 
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#find--exclude--sort
> .
>

Hi all, 
This gets the results using sql but only able to do one or the other is the 
controller in web2py
select * from animalTask order by 
GREATEST(COALESCE(withhold_until_date,0),COALESCE(esi_withhold_until_date,0)) 
DESC 

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


[web2py] order by the greater of 2 fields

2016-10-24 Thread Anthony Smith
Hi all,

I have table with 2 fields, withhold _until_date and esi_withhold_until.

Is is it possible to order by so the the greater of the 2 fields was at the 
top of the list.

cheers 

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.


[web2py] Re: Web2py-appreport

2016-03-02 Thread Anthony Smith
Hi

I am not trying to do anything only following the tutorial, that is the way 
I have been learning web2py.

What other PDF generators does the group recommend? I do like to follow 
tutorials as I find doing thing that way I find it easy to learn by 
mistakes and correct problem I create.

cheers

On Tuesday, 1 March 2016 07:40:26 UTC+11, Dave S wrote:
>
> On Monday, February 29, 2016 at 11:56:56 AM UTC-8, Anthony Smith wrote:
>>
>> Hi All,
>>
>> There does seem to be much interest in this, I guess I will just keep 
>> looking. 
>>
>> cheers
>>
>>
> What are you trying to do with the plug-in?  There are a couple of other 
> PDF generators popular in the group; is there a feature that seems to be 
> unique here?
>
> Also, the error message suggests that there is a mismatch between the 
> directory structure the plug-in is expecting and the directory structure 
> you have, but I'm shooting from the hip with this.
>
> /dps
>
>
>  
>
>> On Sunday, 21 February 2016 02:35:02 UTC+11, Luca Malatesta wrote:
>>>
>>> Hi Antony and all,
>>> I am getting the same errors. I tried to modify the code to fix it but 
>>> no success until now.
>>> Maybe Massimo (thanks for the help) will be able to figure it out.
>>>
>>> I will keep you updated on this.
>>>
>>> Il giorno venerdì 12 febbraio 2016 14:26:06 UTC+1, LightDot ha scritto:
>>>>
>>>> I've been using it in production for years, generating quite a few pdfs 
>>>> daily. If I remember correctly, I made only minor modifications for my 
>>>> needs.
>>>>
>>>> Can't help with your issue though.
>>>>
>>>> Regards
>>>>
>>>> On Friday, February 12, 2016 at 1:05:22 PM UTC+1, Anthony Smith wrote:
>>>>>
>>>>> Hi,
>>>>> I gather this plugin is not correct and doesn't work without lots of 
>>>>> work.
>>>>>
>>>>> cheers 
>>>>> Anthony 
>>>>>
>>>>> On Tuesday, 9 February 2016 21:08:46 UTC+11, Anthony Smith wrote:
>>>>>>
>>>>>> Hi Massimo,
>>>>>>
>>>>>> Thanks for you help you can download form here 
>>>>>> https://github.com/lucasdavila/web2py-appreport/wiki
>>>>>>
>>>>>> Thanks for looking into this 
>>>>>>
>>>>>> On Tuesday, 9 February 2016 13:37:01 UTC+11, Massimo Di Pierro wrote:
>>>>>>>
>>>>>>>  do not know. Can you post this plugin? I have never seen it. 
>>>>>>> Perhaps assumes a library that is not installed.
>>>>>>>
>>>>>>> On Monday, 8 February 2016 02:24:38 UTC-6, Anthony Smith wrote:
>>>>>>>>
>>>>>>>> Hi Massimo, 
>>>>>>>>
>>>>>>>> Tried that and now getting this error 
>>>>>>>>
>>>>>>>> 1.
>>>>>>>> 2.
>>>>>>>> 3.
>>>>>>>> 4.
>>>>>>>> 5.
>>>>>>>> 6.
>>>>>>>> 7.
>>>>>>>> 8.
>>>>>>>> 9.
>>>>>>>> 10.
>>>>>>>> 11.
>>>>>>>> 12.
>>>>>>>> 13.
>>>>>>>>
>>>>>>>> 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/reports/models/plugin_appreport.py" 
>>>>>>>> <http://127.0.0.1:8000/admin/default/edit/reports/models/plugin_appreport.py>,
>>>>>>>>  line 25, in 
>>>>>>>> import plugin_appreport as plugin_appreport_module
>>>>>>>>   File "/home/tony/web2py/gluon/custom_import.py", line 85, in 
>>>>>>>> custom_importer
>>>>>>>> modules_prefix, globals, locals, [itemname], level)
>>>>>>>>   File "applications/reports/modules/plugin_appreport/__init__.py", 
>>>>>>>> line 2, in 
>>>>>>>> import report_web2py
>>>>>>>>   File "/home/tony/web2py/gluon/custom_import.py",

[web2py] Re: Web2py-appreport

2016-02-29 Thread Anthony Smith
Hi All,

There does seem to be much interest in this, I guess I will just keep 
looking. 

cheers

On Sunday, 21 February 2016 02:35:02 UTC+11, Luca Malatesta wrote:
>
> Hi Antony and all,
> I am getting the same errors. I tried to modify the code to fix it but no 
> success until now.
> Maybe Massimo (thanks for the help) will be able to figure it out.
>
> I will keep you updated on this.
>
> Il giorno venerdì 12 febbraio 2016 14:26:06 UTC+1, LightDot ha scritto:
>>
>> I've been using it in production for years, generating quite a few pdfs 
>> daily. If I remember correctly, I made only minor modifications for my 
>> needs.
>>
>> Can't help with your issue though.
>>
>> Regards
>>
>> On Friday, February 12, 2016 at 1:05:22 PM UTC+1, Anthony Smith wrote:
>>>
>>> Hi,
>>> I gather this plugin is not correct and doesn't work without lots of 
>>> work.
>>>
>>> cheers 
>>> Anthony 
>>>
>>> On Tuesday, 9 February 2016 21:08:46 UTC+11, Anthony Smith wrote:
>>>>
>>>> Hi Massimo,
>>>>
>>>> Thanks for you help you can download form here 
>>>> https://github.com/lucasdavila/web2py-appreport/wiki
>>>>
>>>> Thanks for looking into this 
>>>>
>>>> On Tuesday, 9 February 2016 13:37:01 UTC+11, Massimo Di Pierro wrote:
>>>>>
>>>>>  do not know. Can you post this plugin? I have never seen it. Perhaps 
>>>>> assumes a library that is not installed.
>>>>>
>>>>> On Monday, 8 February 2016 02:24:38 UTC-6, Anthony Smith wrote:
>>>>>>
>>>>>> Hi Massimo, 
>>>>>>
>>>>>> Tried that and now getting this error 
>>>>>>
>>>>>> 1.
>>>>>> 2.
>>>>>> 3.
>>>>>> 4.
>>>>>> 5.
>>>>>> 6.
>>>>>> 7.
>>>>>> 8.
>>>>>> 9.
>>>>>> 10.
>>>>>> 11.
>>>>>> 12.
>>>>>> 13.
>>>>>>
>>>>>> 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/reports/models/plugin_appreport.py" 
>>>>>> <http://127.0.0.1:8000/admin/default/edit/reports/models/plugin_appreport.py>,
>>>>>>  line 25, in 
>>>>>> import plugin_appreport as plugin_appreport_module
>>>>>>   File "/home/tony/web2py/gluon/custom_import.py", line 85, in 
>>>>>> custom_importer
>>>>>> modules_prefix, globals, locals, [itemname], level)
>>>>>>   File "applications/reports/modules/plugin_appreport/__init__.py", line 
>>>>>> 2, in 
>>>>>> import report_web2py
>>>>>>   File "/home/tony/web2py/gluon/custom_import.py", line 89, in 
>>>>>> custom_importer
>>>>>> raise ImportError, 'Cannot import module %s' % str(e)
>>>>>> ImportError: Cannot import module 
>>>>>> 'applications.reports.modules.report_web2py'
>>>>>>
>>>>>>
>>>>>> On Sunday, 7 February 2016 16:43:47 UTC+11, Massimo Di Pierro wrote:
>>>>>>>
>>>>>>> import modules.plugin_appreport as plugin_appreport_module
>>>>>>>
>>>>>>> should be
>>>>>>>
>>>>>>>
>>>>>>> import plugin_appreport as plugin_appreport_module
>>>>>>>
>>>>>>>
>>>>>>> On Saturday, 6 February 2016 00:38:24 UTC-6, Anthony Smith wrote:
>>>>>>>>
>>>>>>>> Hi All, 
>>>>>>>>
>>>>>>>> I was following the tutorial from 
>>>>>>>> https://github.com/lucasdavila/web2py-appreport/wiki/Docs-and-examples,
>>>>>>>>  
>>>>>>>> Helper for simple reports and get the follow error when I try to open 
>>>>>>>> the 
>>>>>>>> app 
>>>>>>>>
>>>>>>>> Any ideas would be great 
>>>>>>>>
>>>>>>>>  Cannot import module 
>>>>>>>> 'applications.reports.modules.modules'Version 
>>>>>>>> web2py™ Version 2.13.4-stable+timestamp.2015.12.26.04.59.39 
>>>>>>>> Python Python 2.7.6: /usr/bin/python (prefix: /usr) Traceback 
>>>>>>>>
>>>>>>>> 1.
>>>>>>>> 2.
>>>>>>>> 3.
>>>>>>>> 4.
>>>>>>>> 5.
>>>>>>>> 6.
>>>>>>>> 7.
>>>>>>>> 8.
>>>>>>>> 9.
>>>>>>>>
>>>>>>>> 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/reports/models/plugin_appreport.py" 
>>>>>>>> <http://127.0.0.1:8000/admin/default/edit/reports/models/plugin_appreport.py>,
>>>>>>>>  line 25, in 
>>>>>>>> import modules.plugin_appreport as plugin_appreport_module
>>>>>>>>   File "/home/tony/web2py/gluon/custom_import.py", line 89, in 
>>>>>>>> custom_importer
>>>>>>>> raise ImportError, 'Cannot import module %s' % str(e)
>>>>>>>> ImportError: Cannot import module 
>>>>>>>> 'applications.reports.modules.modules'
>>>>>>>>
>>>>>>>>

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


[web2py] Re: Web2py-appreport

2016-02-12 Thread Anthony Smith
Hi,
I gather this plugin is not correct and doesn't work without lots of work.

cheers 
Anthony 

On Tuesday, 9 February 2016 21:08:46 UTC+11, Anthony Smith wrote:
>
> Hi Massimo,
>
> Thanks for you help you can download form here 
> https://github.com/lucasdavila/web2py-appreport/wiki
>
> Thanks for looking into this 
>
> On Tuesday, 9 February 2016 13:37:01 UTC+11, Massimo Di Pierro wrote:
>>
>>  do not know. Can you post this plugin? I have never seen it. Perhaps 
>> assumes a library that is not installed.
>>
>> On Monday, 8 February 2016 02:24:38 UTC-6, Anthony Smith wrote:
>>>
>>> Hi Massimo, 
>>>
>>> Tried that and now getting this error 
>>>
>>> 1.
>>> 2.
>>> 3.
>>> 4.
>>> 5.
>>> 6.
>>> 7.
>>> 8.
>>> 9.
>>> 10.
>>> 11.
>>> 12.
>>> 13.
>>>
>>> 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/reports/models/plugin_appreport.py" 
>>> <http://127.0.0.1:8000/admin/default/edit/reports/models/plugin_appreport.py>,
>>>  line 25, in 
>>> import plugin_appreport as plugin_appreport_module
>>>   File "/home/tony/web2py/gluon/custom_import.py", line 85, in 
>>> custom_importer
>>> modules_prefix, globals, locals, [itemname], level)
>>>   File "applications/reports/modules/plugin_appreport/__init__.py", line 2, 
>>> in 
>>> import report_web2py
>>>   File "/home/tony/web2py/gluon/custom_import.py", line 89, in 
>>> custom_importer
>>> raise ImportError, 'Cannot import module %s' % str(e)
>>> ImportError: Cannot import module 
>>> 'applications.reports.modules.report_web2py'
>>>
>>>
>>> On Sunday, 7 February 2016 16:43:47 UTC+11, Massimo Di Pierro wrote:
>>>>
>>>> import modules.plugin_appreport as plugin_appreport_module
>>>>
>>>> should be
>>>>
>>>>
>>>> import plugin_appreport as plugin_appreport_module
>>>>
>>>>
>>>> On Saturday, 6 February 2016 00:38:24 UTC-6, Anthony Smith wrote:
>>>>>
>>>>> Hi All, 
>>>>>
>>>>> I was following the tutorial from 
>>>>> https://github.com/lucasdavila/web2py-appreport/wiki/Docs-and-examples, 
>>>>> Helper for simple reports and get the follow error when I try to open the 
>>>>> app 
>>>>>
>>>>> Any ideas would be great 
>>>>>
>>>>>  Cannot import module 
>>>>> 'applications.reports.modules.modules'Version 
>>>>> web2py™ Version 2.13.4-stable+timestamp.2015.12.26.04.59.39 
>>>>> Python Python 2.7.6: /usr/bin/python (prefix: /usr) Traceback 
>>>>>
>>>>> 1.
>>>>> 2.
>>>>> 3.
>>>>> 4.
>>>>> 5.
>>>>> 6.
>>>>> 7.
>>>>> 8.
>>>>> 9.
>>>>>
>>>>> 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/reports/models/plugin_appreport.py" 
>>>>> <http://127.0.0.1:8000/admin/default/edit/reports/models/plugin_appreport.py>,
>>>>>  line 25, in 
>>>>> import modules.plugin_appreport as plugin_appreport_module
>>>>>   File "/home/tony/web2py/gluon/custom_import.py", line 89, in 
>>>>> custom_importer
>>>>> raise ImportError, 'Cannot import module %s' % str(e)
>>>>> ImportError: Cannot import module 'applications.reports.modules.modules'
>>>>>
>>>>>

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


[web2py] Re: Web2py-appreport

2016-02-09 Thread Anthony Smith
Hi Massimo,

Thanks for you help you can download form 
here https://github.com/lucasdavila/web2py-appreport/wiki

Thanks for looking into this 

On Tuesday, 9 February 2016 13:37:01 UTC+11, Massimo Di Pierro wrote:
>
>  do not know. Can you post this plugin? I have never seen it. Perhaps 
> assumes a library that is not installed.
>
> On Monday, 8 February 2016 02:24:38 UTC-6, Anthony Smith wrote:
>>
>> Hi Massimo, 
>>
>> Tried that and now getting this error 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>>
>> 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/reports/models/plugin_appreport.py" 
>> <http://127.0.0.1:8000/admin/default/edit/reports/models/plugin_appreport.py>,
>>  line 25, in 
>> import plugin_appreport as plugin_appreport_module
>>   File "/home/tony/web2py/gluon/custom_import.py", line 85, in 
>> custom_importer
>> modules_prefix, globals, locals, [itemname], level)
>>   File "applications/reports/modules/plugin_appreport/__init__.py", line 2, 
>> in 
>> import report_web2py
>>   File "/home/tony/web2py/gluon/custom_import.py", line 89, in 
>> custom_importer
>> raise ImportError, 'Cannot import module %s' % str(e)
>> ImportError: Cannot import module 
>> 'applications.reports.modules.report_web2py'
>>
>>
>> On Sunday, 7 February 2016 16:43:47 UTC+11, Massimo Di Pierro wrote:
>>>
>>> import modules.plugin_appreport as plugin_appreport_module
>>>
>>> should be
>>>
>>>
>>> import plugin_appreport as plugin_appreport_module
>>>
>>>
>>> On Saturday, 6 February 2016 00:38:24 UTC-6, Anthony Smith wrote:
>>>>
>>>> Hi All, 
>>>>
>>>> I was following the tutorial from 
>>>> https://github.com/lucasdavila/web2py-appreport/wiki/Docs-and-examples, 
>>>> Helper for simple reports and get the follow error when I try to open the 
>>>> app 
>>>>
>>>> Any ideas would be great 
>>>>
>>>>  Cannot import module 
>>>> 'applications.reports.modules.modules'Version 
>>>> web2py™ Version 2.13.4-stable+timestamp.2015.12.26.04.59.39 
>>>> Python Python 2.7.6: /usr/bin/python (prefix: /usr) Traceback 
>>>>
>>>> 1.
>>>> 2.
>>>> 3.
>>>> 4.
>>>> 5.
>>>> 6.
>>>> 7.
>>>> 8.
>>>> 9.
>>>>
>>>> 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/reports/models/plugin_appreport.py" 
>>>> <http://127.0.0.1:8000/admin/default/edit/reports/models/plugin_appreport.py>,
>>>>  line 25, in 
>>>> import modules.plugin_appreport as plugin_appreport_module
>>>>   File "/home/tony/web2py/gluon/custom_import.py", line 89, in 
>>>> custom_importer
>>>> raise ImportError, 'Cannot import module %s' % str(e)
>>>> ImportError: Cannot import module 'applications.reports.modules.modules'
>>>>
>>>>

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


[web2py] Re: Web2py-appreport

2016-02-08 Thread Anthony Smith
Hi Massimo, 

Tried that and now getting this error 

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

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/reports/models/plugin_appreport.py" 
<http://127.0.0.1:8000/admin/default/edit/reports/models/plugin_appreport.py>, 
line 25, in 
import plugin_appreport as plugin_appreport_module
  File "/home/tony/web2py/gluon/custom_import.py", line 85, in custom_importer
modules_prefix, globals, locals, [itemname], level)
  File "applications/reports/modules/plugin_appreport/__init__.py", line 2, in 

import report_web2py
  File "/home/tony/web2py/gluon/custom_import.py", line 89, in custom_importer
raise ImportError, 'Cannot import module %s' % str(e)
ImportError: Cannot import module 'applications.reports.modules.report_web2py'


On Sunday, 7 February 2016 16:43:47 UTC+11, Massimo Di Pierro wrote:
>
> import modules.plugin_appreport as plugin_appreport_module
>
> should be
>
>
> import plugin_appreport as plugin_appreport_module
>
>
> On Saturday, 6 February 2016 00:38:24 UTC-6, Anthony Smith wrote:
>>
>> Hi All, 
>>
>> I was following the tutorial from 
>> https://github.com/lucasdavila/web2py-appreport/wiki/Docs-and-examples, 
>> Helper for simple reports and get the follow error when I try to open the 
>> app 
>>
>> Any ideas would be great 
>>
>>  Cannot import module 
>> 'applications.reports.modules.modules'Version 
>> web2py™ Version 2.13.4-stable+timestamp.2015.12.26.04.59.39 
>> Python Python 2.7.6: /usr/bin/python (prefix: /usr) Traceback 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>>
>> 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/reports/models/plugin_appreport.py" 
>> <http://127.0.0.1:8000/admin/default/edit/reports/models/plugin_appreport.py>,
>>  line 25, in 
>> import modules.plugin_appreport as plugin_appreport_module
>>   File "/home/tony/web2py/gluon/custom_import.py", line 89, in 
>> custom_importer
>> raise ImportError, 'Cannot import module %s' % str(e)
>> ImportError: Cannot import module 'applications.reports.modules.modules'
>>
>>

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


[web2py] Web2py-appreport

2016-02-05 Thread Anthony Smith
Hi All, 

I was following the tutorial from 
https://github.com/lucasdavila/web2py-appreport/wiki/Docs-and-examples, 
Helper for simple reports and get the follow error when I try to open the 
app 

Any ideas would be great 

 Cannot import module 
'applications.reports.modules.modules'Version 
web2py™ Version 2.13.4-stable+timestamp.2015.12.26.04.59.39 
Python Python 2.7.6: /usr/bin/python (prefix: /usr) Traceback 

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

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/reports/models/plugin_appreport.py" 
, 
line 25, in 
import modules.plugin_appreport as plugin_appreport_module
  File "/home/tony/web2py/gluon/custom_import.py", line 89, in custom_importer
raise ImportError, 'Cannot import module %s' % str(e)
ImportError: Cannot import module 'applications.reports.modules.modules'

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


[web2py] Re: Dynamic Search

2016-01-20 Thread Anthony Smith
Hi 

what I mean is to have results so they can be either emailed or printed? 

On Thursday, 21 January 2016 08:48:08 UTC+11, Anthony wrote:
>
> What do you mean by "have the results to be a post"?
>
> On Sunday, January 17, 2016 at 3:16:11 PM UTC-5, Anthony Smith wrote:
>>
>> Hi All,
>>
>> I am using the dynamic search (
>> http://www.web2pyslices.com/slice/show/1403/dynamic-search), is it 
>> possible to have the results to be a post, if so do I go about it.
>>
>> cheers 
>>
>> 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.


[web2py] Re: Dynamic Search

2016-01-20 Thread Anthony Smith
Hi All,

I am guessing this cant be done or I have asked a stupid question

Cheers 

Anthony

On Monday, 18 January 2016 07:16:11 UTC+11, Anthony Smith wrote:
>
> Hi All,
>
> I am using the dynamic search (
> http://www.web2pyslices.com/slice/show/1403/dynamic-search), is it 
> possible to have the results to be a post, if so do I go about it.
>
> cheers 
>
> 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.


[web2py] Dynamic Search

2016-01-17 Thread Anthony Smith
Hi All,

I am using the dynamic search 
(http://www.web2pyslices.com/slice/show/1403/dynamic-search), is it 
possible to have the results to be a post, if so do I go about it.

cheers 

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.


[web2py] Side by Side a Form and a Grid

2016-01-04 Thread Anthony Smith
Hi all, 

Hope you have all had a wonderful start to the New Year.

What is the best way to have a form and gird to appear side side on the 
same page.

I am totally lost.

Thanks everyone 

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.


[web2py] Re: Side by Side a Form and a Grid

2016-01-04 Thread Anthony Smith
 Hi,

Thanks for the response I dont get what you mean, can you provide an 
example. 

I have search the net and the group but unable to find an example 

cheer 

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.


[web2py] Re: Pre-populated Forms

2015-12-15 Thread Anthony Smith
Hi, 
Not really as new to this and working my way through it slowly, but best I 
keep on searching 

cheers

Anthony

On Tuesday, 15 December 2015 05:19:30 UTC+11, villas wrote:
>
> By 'prototype' I believe he means the record which you wish to use as a 
> 'template'.
>
> 1. Find your 'template' record which will be used for setting the default 
> values of the fields in the new record.
> 2. Set the field.default accordingly.
> 3. Do not pass a record to SQLFORM.  If you do,  it will update that 
> record.  It is presumed that you will wish to create a new record.
>
> Hope that helps to clarify ValK's response.
> All the best.
>
>
> On Sunday, 13 December 2015 17:53:36 UTC, Anthony Smith wrote:
>>
>> Hi Val,
>>
>> Thanks for your reply, but unable to find any about get prototype record 
>> in the book.
>>
>> Do you have an examples 
>>
>> Thanks
>>
>> Anthony
>>
>> On Saturday, 12 December 2015 06:03:26 UTC+11, Val K wrote:
>>>
>>> 1. get prototype record
>>> 2. overwrite  field.default  with corresponding prototype value  
>>> 3. don't pass record to SQLFORM 
>>>
>>> On Monday, December 7, 2015 at 7:15:46 AM UTC+3, Anthony Smith wrote:
>>>>
>>>> Hi All, 
>>>>
>>>> I have a products table:
>>>>  db.define_table('product',
>>>> Field('product_name'),
>>>> Field('active_ingredient'),
>>>> Field('batch_no'),
>>>> Field('expiry_date','date'),
>>>> Field('product_type', 
>>>> requires=IS_IN_SET(PRODUCTTYPES),default= PRODUCTTYPES[0]),
>>>> Field('withholding_period','integer'),
>>>> Field('ESI_withholding','integer'),
>>>> Field('qty','integer'),
>>>> Field('date_purchased','date', default = request.now),
>>>> Field('purchased_from', 
>>>> requires=IS_IN_DB(db,'company.company_name','%(company_name)s')),
>>>> (auth.signature),
>>>> format='%(product_name)s %(batch_no)s')
>>>>
>>>> I can edit the product with the following controller:
>>>> def edit_product():
>>>> product_id = request.args(0,cast=int)
>>>> product = db.product(product_id) or error()
>>>> if not product.created_by==me:
>>>> product.created_by.writable = True
>>>> else:
>>>> product.created_by.writable = False
>>>> form = SQLFORM(db.product,product,
>>>>showid=False,
>>>>
>>>> deletable=(product.created_by==me)).process(onsuccess=auth.archive)
>>>> if form.accepted:
>>>> session.flash="Edit Successful"
>>>> redirect(URL('products'))
>>>> return locals()
>>>>
>>>> At times I need to add new products but only some of the fields change 
>>>> E.G. batch_no, expiry_date, and supplier. 
>>>> In short if need to add similar item that I already have in the 
>>>> products table 
>>>>
>>>>
>>>> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Pre-populated Forms

2015-12-13 Thread Anthony Smith
Hi Val,

Thanks for your reply, but unable to find any about get prototype record in 
the book.

Do you have an examples 

Thanks

Anthony

On Saturday, 12 December 2015 06:03:26 UTC+11, Val K wrote:
>
> 1. get prototype record
> 2. overwrite  field.default  with corresponding prototype value  
> 3. don't pass record to SQLFORM 
>
> On Monday, December 7, 2015 at 7:15:46 AM UTC+3, Anthony Smith wrote:
>>
>> Hi All, 
>>
>> I have a products table:
>>  db.define_table('product',
>> Field('product_name'),
>> Field('active_ingredient'),
>> Field('batch_no'),
>> Field('expiry_date','date'),
>> Field('product_type', 
>> requires=IS_IN_SET(PRODUCTTYPES),default= PRODUCTTYPES[0]),
>> Field('withholding_period','integer'),
>> Field('ESI_withholding','integer'),
>> Field('qty','integer'),
>> Field('date_purchased','date', default = request.now),
>> Field('purchased_from', 
>> requires=IS_IN_DB(db,'company.company_name','%(company_name)s')),
>> (auth.signature),
>> format='%(product_name)s %(batch_no)s')
>>
>> I can edit the product with the following controller:
>> def edit_product():
>> product_id = request.args(0,cast=int)
>> product = db.product(product_id) or error()
>> if not product.created_by==me:
>> product.created_by.writable = True
>> else:
>> product.created_by.writable = False
>> form = SQLFORM(db.product,product,
>>showid=False,
>>
>> deletable=(product.created_by==me)).process(onsuccess=auth.archive)
>> if form.accepted:
>> session.flash="Edit Successful"
>> redirect(URL('products'))
>> return locals()
>>
>> At times I need to add new products but only some of the fields change 
>> E.G. batch_no, expiry_date, and supplier. 
>> In short if need to add similar item that I already have in the products 
>> table 
>>
>>
>> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Pre-populated Forms

2015-12-06 Thread Anthony Smith
Hi All, 

I have a products table:
 db.define_table('product',
Field('product_name'),
Field('active_ingredient'),
Field('batch_no'),
Field('expiry_date','date'),
Field('product_type', 
requires=IS_IN_SET(PRODUCTTYPES),default= PRODUCTTYPES[0]),
Field('withholding_period','integer'),
Field('ESI_withholding','integer'),
Field('qty','integer'),
Field('date_purchased','date', default = request.now),
Field('purchased_from', 
requires=IS_IN_DB(db,'company.company_name','%(company_name)s')),
(auth.signature),
format='%(product_name)s %(batch_no)s')

I can edit the product with the following controller:
def edit_product():
product_id = request.args(0,cast=int)
product = db.product(product_id) or error()
if not product.created_by==me:
product.created_by.writable = True
else:
product.created_by.writable = False
form = SQLFORM(db.product,product,
   showid=False,
   
deletable=(product.created_by==me)).process(onsuccess=auth.archive)
if form.accepted:
session.flash="Edit Successful"
redirect(URL('products'))
return locals()

At times I need to add new products but only some of the fields change E.G. 
batch_no, expiry_date, and supplier. 
In short if need to add similar item that I already have in the products 
table 


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


[web2py] Re: auth.requires_login

2015-11-30 Thread Anthony Smith
Hi Anthony, 

Thanks ,but I am getting the following error,

IndexError: list index out of range

group_members = db(db.auth_membership.group_id ==
   auth.id_group('user'))._select(db.auth_membership.user_id)

@auth.requires_login()
def companys():
db.company.created_on.readable = True
db.company.created_by.readable = True
db.company.company_name.represent = lambda company_name,row:\
A(company_name,_href=URL('view_company',args=row.id))
query = db(db.company.created_by.belongs(group_members))
grid = SQLFORM.grid(query, orderby=~db.company.created_on,
create=False,details=False,editable=False,
deletable=lambda row: 
(row.created_by.belongs(group_members)),
fields =[
db.company.company_name,
db.company.client_type,
db.company.address1,
db.company.address2,
db.company.phone,
db.company.mobile,
db.company.email,
db.company.created_by,
db.company.created_on,
]
)
return locals()
What do I have wrong? 

Thanks 


On Tuesday, 1 December 2015 03:16:03 UTC+11, Anthony wrote:
>
> Are you saying you want to limit the query to records created by members 
> of a specific auth_group? Assuming you have stored the auth_user IDs in 
> something like a "created_by" field, you could do:
>
> group_members = db(db.auth_membership.group_id ==
>auth.id_group('my role'))._select(db.auth_membership.
> user_id)
> rows = db(db.mytable.created_by.belongs(group_members)).select()
>
> group_members is defined with ._select rather than .select so it simply 
> generates the SQL without running the query. The SQL is then used to create 
> a nested select with the .belongs expression in the next line. This could 
> also be done in a single query with a join, but then you would have to 
> refer to all fields with row.tablename.fieldname syntax rather than the 
> simpler row.fieldname syntax (and also explicitly exclude fields from 
> db.auth_membership, which you don't really need).
>
> Anthony
>
> On Monday, November 30, 2015 at 3:18:54 AM UTC-5, Anthony Smith wrote:
>>
>> Hi all 
>>
>> I know auth.requires_login can be used, also auth.requires_has membership.
>>
>> If I want to query the records created by a group can this be done. 
>>
>> I want to be able to have certain groups to be only able to query certain 
>> record of the same table.
>>
>> Cheers 
>>
>> 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.


[web2py] auth.requires_login

2015-11-30 Thread Anthony Smith
Hi all 

I know auth.requires_login can be used, also auth.requires_has membership.

If I want to query the records created by a group can this be done. 

I want to be able to have certain groups to be only able to query certain 
record of the same table.

Cheers 

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.


[web2py] Re: AttributeError'> 'Set' object has no attribute

2015-11-20 Thread Anthony Smith
Hi Anthony, 

I am trying to get the product.withholding_period (no of days ,integer) and 
add to the stock_task.completed _date (date) = 
stock_task.withhold_until_date (date), where the product is used in each 
task.

Before I added  format='%(product_name)s %(batch_no)s') to the product 
table this would work,
"update stock_task, product set withhold_until_date= 
DATE_ADD(stock_task.completed_date, INTERVAL product.withholding_period 
DAY)where product.product_name = stock_task.product" 

cheers

Anthony

On Friday, 20 November 2015 20:05:06 UTC+11, Anthony Smith wrote:
>
> 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 
>   File "/home/tony/web2py/gluon/globals.py", line 412, in 
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: AttributeError'> 'Set' object has no attribute

2015-11-20 Thread Anthony Smith
Hi Anthony, 

Thanks, is ok to use sql or is there a better way of doing this, been new I 
would rather learn the proper way rather just making it work.

cheers 
Anthony  

On Friday, 20 November 2015 20:05:06 UTC+11, Anthony Smith wrote:
>
> 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 
>   File "/home/tony/web2py/gluon/globals.py", line 412, in 
> 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] AttributeError'> 'Set' object has no attribute

2015-11-20 Thread Anthony Smith
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 
  File "/home/tony/web2py/gluon/globals.py", line 412, in 
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

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


[web2py] Re: record representation and lambda

2015-11-16 Thread Anthony Smith
Thanks Anthony, yes there were some typo's my mistakes

On Sunday, 15 November 2015 18:25:01 UTC+11, Anthony Smith wrote:
>
> Hi All,
>
> I have looking though the group for and answer on this, I am try to get 
> the product_name and batch_no from the product table to be the product in 
> the stock task table.
>
> But  getting the following traceback:
>
> 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/cps2d/models/db1.py" 
> <http://127.0.0.1:8000/admin/default/edit/cps2d/models/db1.py>, line 112, in 
> 
> db.stock_task.product.requires=IS_IN_DB(db,db.product,lambda record: 
> format_product(record))
>   File "/home/tony/web2py/gluon/packages/dal/pydal/base.py", line 906, in 
> __getattr__
> return super(DAL, self).__getattr__(key)
>   File "/home/tony/web2py/gluon/packages/dal/pydal/helpers/classes.py", line 
> 30, in __getattr__
> raise AttributeError
> AttributeError
>
> Error Snapshot:
>
> ()
>
>
> db.define_table('product',
> Field('product_name'),
> Field(batch_no),
> format=lambda record: format_product(record))
>
> def format_product(record):
> return '%s %s' % (record.product_name, record.batch_no)
>
>
> db.define_table('stock_task',
> Field()
> Field()
> Field('product','list:reference products'),
>
> auth.signature)
>
> db.stock_task.product.requires=IS_IN_DB(db,db.product,lambda record: 
> format_product(record))
>
> any help would be great 
>
> cheers 
> 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.


[web2py] Is this the best mailing list ever for web app developers?

2015-11-15 Thread Anthony Smith
To All the Web2py Team,

I speak for myself, but feel there will be others that have the same 
opinion.

As I am quiet new to Web2py and programming as a whole, we are 
trying/willing learners (if we weren’t we would be here).

When I come across a problem/error, I don’t ask for help straight away, 
sometimes I may spend a week reading, researching, thinking about what I am 
trying to do, and sometimes put the project down and come back to it.

The help provide by this is excellent, I like the way at times you are 
given a nudge in the right direction and that can make so much difference.

Other times the help may need more explanation and details as what my seem 
a simple question to the  person answering the question, the person asking 
the question, may have decided to do something they don’t understand, 
myself I like to make sure I understand every thing I code.

Anyway Team Keep up the good work as this is such a great group and 
framework to work with.

Cheers all

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.


[web2py] Re: Is this the best mailing list ever for web app developers?

2015-11-15 Thread Anthony Smith
That wasn’t suppose the be a question.

sorry Guys

On Sunday, 15 November 2015 19:08:46 UTC+11, Anthony Smith wrote:
>
> To All the Web2py Team,
>
> I speak for myself, but feel there will be others that have the same 
> opinion.
>
> As I am quiet new to Web2py and programming as a whole, we are 
> trying/willing learners (if we weren’t we would be here).
>
> When I come across a problem/error, I don’t ask for help straight away, 
> sometimes I may spend a week reading, researching, thinking about what I am 
> trying to do, and sometimes put the project down and come back to it.
>
> The help provide by this is excellent, I like the way at times you are 
> given a nudge in the right direction and that can make so much difference.
>
> Other times the help may need more explanation and details as what my seem 
> a simple question to the  person answering the question, the person asking 
> the question, may have decided to do something they don’t understand, 
> myself I like to make sure I understand every thing I code.
>
> Anyway Team Keep up the good work as this is such a great group and 
> framework to work with.
>
> Cheers all
>
> 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.


[web2py] record representation and lambda

2015-11-14 Thread Anthony Smith
Hi All,

I have looking though the group for and answer on this, I am try to get the 
product_name and batch_no from the product table to be the product in the 
stock task table.

But  getting the following traceback:

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/cps2d/models/db1.py" 
, line 112, in 

db.stock_task.product.requires=IS_IN_DB(db,db.product,lambda record: 
format_product(record))
  File "/home/tony/web2py/gluon/packages/dal/pydal/base.py", line 906, in 
__getattr__
return super(DAL, self).__getattr__(key)
  File "/home/tony/web2py/gluon/packages/dal/pydal/helpers/classes.py", line 
30, in __getattr__
raise AttributeError
AttributeError

Error Snapshot:

()


db.define_table('product',
Field('product_name'),
Field(batch_no),
format=lambda record: format_product(record))

def format_product(record):
return '%s %s' % (record.product_name, record.batch_no)


db.define_table('stock_task',
Field()
Field()
Field('product','list:reference products'),

auth.signature)

db.stock_task.product.requires=IS_IN_DB(db,db.product,lambda record: 
format_product(record))

any help would be great 

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


[web2py] Re: TypeError: an integer is required

2015-11-11 Thread Anthony Smith
Thanks Anthony, you guys are a great assistance to all the newbies 

cheers

On Wednesday, 11 November 2015 23:30:54 UTC+11, Anthony wrote:
>
> datetime.date() is for constructing a date object and it takes integer 
> arguments (for the year, month, and day) -- you don't pass a date to it. 
> Instead, just do:
>
> SPAN(v, ...)
>
> Or if you don't like the default format you get when the date is converted 
> to a string, use the .strftime method:
>
> SPAN(v.strftime('%m/%d/%Y'))
>
> Anthony
>
> On Wednesday, November 11, 2015 at 2:09:04 AM UTC-5, Anthony Smith wrote:
>>
>> Hi, 
>> I am using the follow to highlight a date field where the date is greater 
>> then the current date.
>>
>> db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
>> SPAN(datetime.date(v),_class='withhold' if v >datetime.date.today() else 
>> None)
>> db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
>> SPAN(datetime.date(v),_class='withhold' if v and v> datetime.date.today() 
>> else None)
>>
>> 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/cps5c/controllers/default.py" 
>> <http://127.0.0.1:8000/admin/default/edit/cps5c/controllers/default.py>, 
>> line 562, in 
>>   File "applications/cps5c/modules/plugin_sqleditable/editable.py", line 
>> 415, in extract
>> r=func()
>>   File "/home/tony/web2py/gluon/tools.py", line 3774, in f
>> return action(*a, **b)
>>   File "/home/tony/web2py/applications/cps5c/controllers/default.py" 
>> <http://127.0.0.1:8000/admin/default/edit/cps5c/controllers/default.py>, 
>> line 268, in stock_tasks
>> db.stock_task.created_by,
>>   File "/home/tony/web2py/gluon/sqlhtml.py", line 2717, in grid
>> nvalue = field.represent(value, row)
>>   File "/home/tony/web2py/applications/cps5c/models/db1.py" 
>> <http://127.0.0.1:8000/admin/default/edit/cps5c/models/db1.py>, line 144, in 
>> 
>> db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
>> SPAN(datetime.date (v),_class='withhold' if v > datetime.date.today() else 
>> None)
>> TypeError: an integer is required
>>
>>
>> if I use the following works fine.
>> db.stock_task.withhold_until_date.represent = lambda v, row: 
>> SPAN(prettydate(v),_class='withhold' if v and v>datetime.date.today() else 
>> None)
>>
>> any help appreciated
>>
>> cheers
>>
>

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


[web2py] TypeError: an integer is required

2015-11-10 Thread Anthony Smith
Hi, 
I am using the follow to highlight a date field where the date is greater 
then the current date.

db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
SPAN(datetime.date(v),_class='withhold' if v >datetime.date.today() else None)
db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
SPAN(datetime.date(v),_class='withhold' if v and v> datetime.date.today() else 
None)

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/cps5c/controllers/default.py" 
, line 
562, in 
  File "applications/cps5c/modules/plugin_sqleditable/editable.py", line 415, 
in extract
r=func()
  File "/home/tony/web2py/gluon/tools.py", line 3774, in f
return action(*a, **b)
  File "/home/tony/web2py/applications/cps5c/controllers/default.py" 
, line 
268, in stock_tasks
db.stock_task.created_by,
  File "/home/tony/web2py/gluon/sqlhtml.py", line 2717, in grid
nvalue = field.represent(value, row)
  File "/home/tony/web2py/applications/cps5c/models/db1.py" 
, line 144, in 

db.stock_task.ESI_withhold_until_date.represent = lambda v,row: 
SPAN(datetime.date (v),_class='withhold' if v > datetime.date.today() else None)
TypeError: an integer is required


if I use the following works fine.
db.stock_task.withhold_until_date.represent = lambda v, row: 
SPAN(prettydate(v),_class='withhold' if v and v>datetime.date.today() else 
None)

any help appreciated

cheers

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


[web2py] Re: Should this work in Web2py

2015-11-03 Thread Anthony Smith
Ok thanks for the help, much appreciated by newbie trying to learn 

On Tuesday, 3 November 2015 02:09:28 UTC+11, Niphlod wrote:
>
> it works but it's a rather inefficient way. first() and last() will need 
> to fetch every record of that table 
>
> you'd better rewrite 
>
> task = db(db.stock_task.id).select().last()
>
> as
>
> task = db(db.stock_task.id>0).select(limitby=(0,1), orderby=~
> db.stock_task.id).first()
>
> etc etc etc
>
> to leverage the backend capabilities instead of fetching the entire table 
> and then discarding every row that is not the last one ...
>
> On Saturday, October 31, 2015 at 7:02:03 AM UTC+1, Anthony Smith wrote:
>>
>> Thanks for the input everyone , I did get it to successfully update using 
>> the following 
>>
>> def create_stock_task():
>> form = SQLFORM (db.stock_task).process()
>> if form.accepted:
>> task = db(db.stock_task.id).select().last()
>> pdays_row = db(db.product.withholding_period>0).select().last()
>> pdays =  pdays_row.withholding_period
>> esidays_row = db(db.product.ESI_withholding>0).select().last()
>> esidays = esidays_row.ESI_withholding
>> wdate_row = db(db.stock_task.completed_date>0).select().last()
>> wdate = wdate_row.completed_date
>> fdate = wdate + datetime.timedelta(days + pdays)
>> esidate = wdate + datetime.timedelta(days + esidays)
>> db(db.stock_task.id == task).update(withhold_until_date=fdate)
>> db(db.stock_task.id == 
>> task).update(ESI_withhold_until_date=esidate)
>>
>> On Wednesday, 28 October 2015 18:00:05 UTC+11, Anthony Smith wrote:
>>>
>>> added the following
>>>
>>> def create_stock_task():
>>> form = SQLFORM (db.stock_task).process()
>>> if form.accepted:
>>> task = db(db.stock_task.id).select().first()
>>> pdays_row = db(db.product.withholding_period>0).select().first()
>>> pdays =  pdays_row.withholding_period
>>> wdate_row = db(db.stock_task.completed_date>0).select().first()
>>> wdate = wdate_row.completed_date
>>> 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 locals()
>>>
>>>
>>>  and now getting ('ndate')
>>>
>>> further would be great 
>>>
>>> thanks.
>>>
>>> On Monday, 26 October 2015 20:09:15 UTC+11, Niphlod wrote:
>>>>
>>>> an update operation NEEDS an update() call.
>>>>
>>>> given the records you want to update are defined by a condition, namely
>>>>
>>>> db.table.column_1 == somevalue
>>>>
>>>> and the update on column_2 resulting in all those records equal to 
>>>> "somevalue_2", you need to write
>>>>
>>>> db(db.table.column_1 == somevalue).update(column_2 = somevalue_2)
>>>>
>>>>  
>>>>
>>>> On Saturday, October 24, 2015 at 7:27:20 AM UTC+2, Anthony Smith wrote:
>>>>>
>>>>> what I want to is update the stock_task.withhold until date with the 
>>>>> result of db.product.withholding_
>>>>> period (int) + stock_task.completed date (date)
>>>>>
>>>>>

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


[web2py] Re: Should this work in Web2py

2015-10-31 Thread Anthony Smith
Thanks for the input everyone , I did get it to successfully update using 
the following 

def create_stock_task():
form = SQLFORM (db.stock_task).process()
if form.accepted:
task = db(db.stock_task.id).select().last()
pdays_row = db(db.product.withholding_period>0).select().last()
pdays =  pdays_row.withholding_period
esidays_row = db(db.product.ESI_withholding>0).select().last()
esidays = esidays_row.ESI_withholding
wdate_row = db(db.stock_task.completed_date>0).select().last()
wdate = wdate_row.completed_date
fdate = wdate + datetime.timedelta(days + pdays)
esidate = wdate + datetime.timedelta(days + esidays)
db(db.stock_task.id == task).update(withhold_until_date=fdate)
db(db.stock_task.id == task).update(ESI_withhold_until_date=esidate)

On Wednesday, 28 October 2015 18:00:05 UTC+11, Anthony Smith wrote:
>
> added the following
>
> def create_stock_task():
> form = SQLFORM (db.stock_task).process()
> if form.accepted:
> task = db(db.stock_task.id).select().first()
> pdays_row = db(db.product.withholding_period>0).select().first()
> pdays =  pdays_row.withholding_period
> wdate_row = db(db.stock_task.completed_date>0).select().first()
> wdate = wdate_row.completed_date
> 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 locals()
>
>
>  and now getting ('ndate')
>
> further would be great 
>
> thanks.
>
> On Monday, 26 October 2015 20:09:15 UTC+11, Niphlod wrote:
>>
>> an update operation NEEDS an update() call.
>>
>> given the records you want to update are defined by a condition, namely
>>
>> db.table.column_1 == somevalue
>>
>> and the update on column_2 resulting in all those records equal to 
>> "somevalue_2", you need to write
>>
>> db(db.table.column_1 == somevalue).update(column_2 = somevalue_2)
>>
>>  
>>
>> On Saturday, October 24, 2015 at 7:27:20 AM UTC+2, Anthony Smith wrote:
>>>
>>> what I want to is update the stock_task.withhold until date with the 
>>> result of db.product.withholding_
>>> period (int) + stock_task.completed date (date)
>>>
>>>

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


[web2py] Re: Should this work in Web2py

2015-10-28 Thread Anthony Smith
added the following

def create_stock_task():
form = SQLFORM (db.stock_task).process()
if form.accepted:
task = db(db.stock_task.id).select().first()
pdays_row = db(db.product.withholding_period>0).select().first()
pdays =  pdays_row.withholding_period
wdate_row = db(db.stock_task.completed_date>0).select().first()
wdate = wdate_row.completed_date
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 locals()


 and now getting ('ndate')

further would be great 

thanks.

On Monday, 26 October 2015 20:09:15 UTC+11, Niphlod wrote:
>
> an update operation NEEDS an update() call.
>
> given the records you want to update are defined by a condition, namely
>
> db.table.column_1 == somevalue
>
> and the update on column_2 resulting in all those records equal to 
> "somevalue_2", you need to write
>
> db(db.table.column_1 == somevalue).update(column_2 = somevalue_2)
>
>  
>
> On Saturday, October 24, 2015 at 7:27:20 AM UTC+2, Anthony Smith wrote:
>>
>> what I want to is update the stock_task.withhold until date with the 
>> result of db.product.withholding_
>> period (int) + stock_task.completed date (date)
>>
>>

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


[web2py] Should this work in Web2py

2015-10-23 Thread Anthony Smith

I am trying to update *withhold_until_date* with the following 



import datetime
#product withholding in days
days = (0)

#get the days
pdays_row = db(db.product.withholding_period>0).select().first()
pdays =  pdays_row.pdays

#get the date
wdate_rows = db(db.stock_task.completed_date>0).select().first()
wdate = wdate_row.wdate

#finish date
fdate = wdate + datetime.timedelta(days + pdays)


def stock_tasks():
db.stock_task.created_on.readable = True
db.stock_task.created_by.readable = True
db.stock_task.task_name.represent =lambda stock_task,row:\
A(stock_task,_href=URL('view_stock_task',args=row.id))
query = (db.stock_task.created_by==me)
query = (db.stock_task.*withhold_until_date*==fdate)
grid = SQLFORM.grid(query, orderby=~db.stock_task.created_on,
create=False,details=False,editable=False,
deletable=lambda row: (row.created_by==me),
fields =[
db.stock_task.status,
db.stock_task.task_name,
db.stock_task.start_date,
db.stock_task.completed_date,
db.stock_task.mob,
db.stock_task.*withhold_until_date*,
db.stock_task.product,
db.stock_task.paddock_name,
db.stock_task.created_by,
db.stock_task.created_on,
])
return locals()

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


[web2py] Re: Should this work in Web2py

2015-10-23 Thread Anthony Smith
what I want to is update the stock_task.withhold until date with the result 
of db.product.withholding_
period (int) + stock_task.completed date (date)

This is what I have tried, below 

On Friday, 23 October 2015 20:56:44 UTC+11, Anthony Smith wrote:
>
>
> I am trying to update *withhold_until_date* with the following 
>
>
>
> import datetime
> #product withholding in days
> days = (0)
>
> #get the days
> pdays_row = db(db.product.withholding_period>0).select().first()
> pdays =  pdays_row.pdays
>
> #get the date
> wdate_rows = db(db.stock_task.completed_date>0).select().first()
> wdate = wdate_row.wdate
>
> #finish date
> fdate = wdate + datetime.timedelta(days + pdays)
>
>
> def stock_tasks():
> db.stock_task.created_on.readable = True
> db.stock_task.created_by.readable = True
> db.stock_task.task_name.represent =lambda stock_task,row:\
> A(stock_task,_href=URL('view_stock_task',args=row.id))
> query = (db.stock_task.created_by==me)
> query = (db.stock_task.*withhold_until_date*==fdate)
> grid = SQLFORM.grid(query, orderby=~db.stock_task.created_on,
> create=False,details=False,editable=False,
> deletable=lambda row: (row.created_by==me),
> fields =[
> db.stock_task.status,
> db.stock_task.task_name,
> db.stock_task.start_date,
> db.stock_task.completed_date,
> db.stock_task.mob,
> db.stock_task.*withhold_until_date*,
> db.stock_task.product,
> db.stock_task.paddock_name,
> db.stock_task.created_by,
> db.stock_task.created_on,
> ])
> return locals()
>

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


[web2py] Re: Should this work in Web2py

2015-10-23 Thread Anthony Smith
I think I need to re think how I am doing this as I am learning web2py. It 
maybe a case of re looking at the book.

cheers

On Friday, 23 October 2015 20:56:44 UTC+11, Anthony Smith wrote:
>
>
> I am trying to update *withhold_until_date* with the following 
>
>
>
> import datetime
> #product withholding in days
> days = (0)
>
> #get the days
> pdays_row = db(db.product.withholding_period>0).select().first()
> pdays =  pdays_row.pdays
>
> #get the date
> wdate_rows = db(db.stock_task.completed_date>0).select().first()
> wdate = wdate_row.wdate
>
> #finish date
> fdate = wdate + datetime.timedelta(days + pdays)
>
>
> def stock_tasks():
> db.stock_task.created_on.readable = True
> db.stock_task.created_by.readable = True
> db.stock_task.task_name.represent =lambda stock_task,row:\
> A(stock_task,_href=URL('view_stock_task',args=row.id))
> query = (db.stock_task.created_by==me)
> query = (db.stock_task.*withhold_until_date*==fdate)
> grid = SQLFORM.grid(query, orderby=~db.stock_task.created_on,
> create=False,details=False,editable=False,
> deletable=lambda row: (row.created_by==me),
> fields =[
> db.stock_task.status,
> db.stock_task.task_name,
> db.stock_task.start_date,
> db.stock_task.completed_date,
> db.stock_task.mob,
> db.stock_task.*withhold_until_date*,
> db.stock_task.product,
> db.stock_task.paddock_name,
> db.stock_task.created_by,
> db.stock_task.created_on,
> ])
> return locals()
>

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


[web2py] Re: Emailing

2015-08-07 Thread Anthony Smith


I have looked at that but still cant figure out, do you have example 
cheers
tony

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


Re: [web2py] Re: Emailing

2015-08-07 Thread Anthony Smith
Are got it.

thankyou

On Sat, Aug 8, 2015 at 9:58 AM, 黄祥 steve.van.chris...@gmail.com wrote:

 e.g.
 *private/appconfig.ini*
 [smtp]
 server = smtp.gmail.com:587
 sender = em...@gmail.com
 login  = email:password

 *models/db.py*
 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
 auth = Auth(db)

 mail = auth.settings.mailer
 mail.settings.server = 'logging' if request.is_local else
 myconf.take('smtp.sender')
 mail.settings.sender = myconf.take('smtp.sender')
 mail.settings.login = myconf.take('smtp.login')

 db.define_table('contact_us',
 Field('name'),
 Field('email'),
 Field('phone'),
 Field('address', 'text'),
 Field('messages', 'text'),
 format = '%(email)s %(name)s')

 *controllers/default.py*
 def contact_us():
 form = SQLFORM(db.contact_us)
 email = em...@gmail.com
 if form.process().accepted:
 mail.send(email,
  'Contacted from %s' % request.env.http_host,
  
 'htmltabletrtdbName/b/tdtd%s/td/trtrtdbEmail/b/tdtd%s/td/trtrtdbPhone/b/tdtd%s/td/trtrtdbAddress/b/tdtd%s/td/trtrtdbMessages/b/tdtd%s/td/tr/table/html'
 % (form.vars.name, form.vars.email, form.vars.phone, form.vars.address,
 form.vars.messages))
 response.flash = T('messages sent')
 elif form.errors:
 response.flash = T('there is an error in the form')
 else:
 response.flash = T('please fill out the form')
 return dict(form = form)

 p.s.
 you can modify to suit with your requirement

 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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/diE-ddw8EYY/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


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


[web2py] Emailing

2015-08-07 Thread Anthony Smith
Hi All,

I have a app where I records sales, but I want to email different part of 
the sale to different people eg the person I brought only need to know what 
I item and how much, then another person needs to know how many and the 
item and how much.

I can get this by using a post,but I cant workout how to email the post or 
create a controller that will do this.

thanks for any help 

cheers

tony

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


[web2py] Re: [solved] Weird type 'exceptions.AttributeError' 'Row' object has no attribute 'id' and Ñ error

2015-08-04 Thread Anthony Smith
yes a good find I had the same thing my $ in the field names 

cheers

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


[web2py] Re: Adding the number of day to a date

2015-02-02 Thread Anthony Smith
Hi 
Sorry misunderstood the question.
T2.completed_date is triggered when someone enters the date the task is 
completed on.

cheers

On Tuesday, 3 February 2015 06:35:00 UTC+11, Dave S wrote:



 On Sunday, February 1, 2015 at 12:13:54 AM UTC-8, Anthony Smith wrote:

 Hi Richard

 the trigger is T2.completed_date+T1.with_holding = T2.withhold_until

 I am reasonably new to web2py, can get though most things, but this has 
 me.

  
 I think Richard was asking what event causes T2 to be updated.  Does it 
 happen, for instance, when someone  visits a web page that display values 
 from T2?   Is it supposed to happen when someone completes a form updating 
 T1?  Should it happen on a periodic basis even if there is no user activity?

 That said, Massimo's comments explain the way the arithmetic is done; 
 Richard's question is about where the arithmetic code should be placed.

 (This is one of my favorite references:
 URL:http://docs.python.org/2/library/datetime.html#timedelta-objects)

 /dps



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


[web2py] Re: Adding the number of day to a date

2015-02-01 Thread Anthony Smith
Hi Richard

the trigger is T2.completed_date+T1.with_holding = T2.withhold_until

I am reasonably new to web2py, can get though most things, but this has me.

cheers 

Anthony S 

On Sunday, 1 February 2015 18:42:34 UTC+11, Richard D wrote:

 Anthony S

 What is the trigger for this update of T2 withholding _until? This will 
 influence the solution drastically.

 Richard D

 On Saturday, January 31, 2015 at 8:47:47 PM UTC+1, Anthony Smith wrote:

 Hi 

 I never explained it very well,
 Table 1 has products with a with-holding period in days eg. product1 10 
 days, product2 7 7days etc
 Table2 has when, where, completed_date the product was used, it also has 
 a withholding_until date field

 I am trying to get the T2 withholding _until to be update using the 
 T2completed_date+ T1with-holding period 

 On Sunday, 1 February 2015 02:41:02 UTC+11, Massimo Di Pierro wrote:

 I do not understand the context of your question. In python you can do:

 d = datetime.datetime(2015,1,29,11,30,00)
 d = d + datetime.timedelta(days = 7)

 If a date is in a database you can do the same, you select, add and 
 store it again. Some databases allow you to do it at the SQL level but not 
 all, so the DAL does not support this.

 Or is your question about the web2py built-in scheduler?



 On Saturday, 31 January 2015 04:18:16 UTC-6, Anthony Smith wrote:

 Hi,
 I am unable to find any information on adding the number of days to a 
 date.

 The number of days is stored in a table as a int

 Second it where a task is created and a expiry is require using the 
 completed date of the task + the number of days from the first table.

 What is the best way to handle this?

 thanks 





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


[web2py] Re: Adding the number of day to a date

2015-01-31 Thread Anthony Smith
Hi 

I never explained it very well,
Table 1 has products with a with-holding period in days eg. product1 10 
days, product2 7 7days etc
Table2 has when, where, completed_date the product was used, it also has a 
withholding_until date field

I am trying to get the T2 withholding _until to be update using the 
T2completed_date+ T1with-holding period 

On Sunday, 1 February 2015 02:41:02 UTC+11, Massimo Di Pierro wrote:

 I do not understand the context of your question. In python you can do:

 d = datetime.datetime(2015,1,29,11,30,00)
 d = d + datetime.timedelta(days = 7)

 If a date is in a database you can do the same, you select, add and store 
 it again. Some databases allow you to do it at the SQL level but not all, 
 so the DAL does not support this.

 Or is your question about the web2py built-in scheduler?



 On Saturday, 31 January 2015 04:18:16 UTC-6, Anthony Smith wrote:

 Hi,
 I am unable to find any information on adding the number of days to a 
 date.

 The number of days is stored in a table as a int

 Second it where a task is created and a expiry is require using the 
 completed date of the task + the number of days from the first table.

 What is the best way to handle this?

 thanks 





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


[web2py] Adding the number of day to a date

2015-01-31 Thread Anthony Smith
Hi,
I am unable to find any information on adding the number of days to a date.

The number of days is stored in a table as a int

Second it where a task is created and a expiry is require using the 
completed date of the task + the number of days from the first table.

What is the best way to handle this?

thanks 



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


[web2py] Australian Users

2014-12-16 Thread Anthony Smith
Hi 

are there any users in Australia willing to help tutor in web2py?

cheers 

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


[web2py] summing fields

2014-12-13 Thread Anthony Smith
Hi 
I have the following sql which returns what I want , but losted on how to 
use in my web2py controller.
any pointers or help would be grateful.

select sum (total_sale_price, buyer, stock_desc from sales group by 
stock_desc

thanks 

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


[web2py] Re: Geraldo Reports 4.0

2014-11-04 Thread Anthony Smith
hi 

did you have any sucess with this ?

On Friday, 3 December 2010 00:22:58 UTC+11, rochacbruno wrote:

 Is there someone using Geraldo Reports 4.0 with web2py?

 http://www.geraldoreports.org/blog/releasing-04/

 sometime ago someone created a tutorial 
 http://www.geraldoreports.org/docs/tutorial-web2py.html
 but I guess this is outdated for the new version.

 I am giving a try today, if someone has a working code.

 -- 

 Bruno Rocha
 http://about.me/rochacbruno/bio
  

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


[web2py] Computed fields

2014-11-04 Thread Anthony Smith
Hi 

I am stuck on the following,  if no_of _items, dollars_items are not used 
the total_sale_price  is  left blank I get the follow message

compute=lambda r: r['no_of_items']*r['dollars_items']),
TypeError: unsupported operand type(s) for *: 'NoneType' and 'NoneType'

If I leave the no_by weight, cent_per_kg i get the following

compute=lambda r: r['estimated_weight']*r['no_by_weight']*r['cents_per_kg']),
TypeError: unsupported operand type(s) for *: 'NoneType' and 'NoneType'

  
Field('no_of_items', 'integer'),
Field('dollars_items', 'double'),
Field('sub_total_items','double',
  compute=lambda r: r['no_of_head']*r['dollars_hd']),
Field('no_by_weight', 'integer'),
Field('estimated_weight', 'double'),
Field('cents_per_kg', 'double'),
Field('sub_total_kg', 'double',
  compute=lambda r: 
r['estimated_weight']*r['no_by_weight']*r['cents_per_kg']),
   Field('total_sale_price', 'double',
  compute=lambda r: r['sub_total_hd'] 
+r['sub_total_kg']),


Where am I going wrong 

cheers 



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


[web2py] Re: Computed fields

2014-11-04 Thread Anthony Smith

 Thank for that 
On Tuesday, 4 November 2014 10:45:30 UTC+11, Anthony Smith wrote:

 Hi 

 I am stuck on the following,  if no_of _items, dollars_items are not used 
 the total_sale_price  is  left blank I get the follow message

 compute=lambda r: r['no_of_items']*r['dollars_items']),
 TypeError: unsupported operand type(s) for *: 'NoneType' and 'NoneType'

 If I leave the no_by weight, cent_per_kg i get the following

 compute=lambda r: r['estimated_weight']*r['no_by_weight']*r['cents_per_kg']),
 TypeError: unsupported operand type(s) for *: 'NoneType' and 'NoneType'

   
 Field('no_of_items', 'integer'),
 Field('dollars_items', 'double'),
 Field('sub_total_items','double',
   compute=lambda r: r['no_of_head']*r['dollars_hd']),
 Field('no_by_weight', 'integer'),
 Field('estimated_weight', 'double'),
 Field('cents_per_kg', 'double'),
 Field('sub_total_kg', 'double',
   compute=lambda r: 
 r['estimated_weight']*r['no_by_weight']*r['cents_per_kg']),
Field('total_sale_price', 'double',
   compute=lambda r: r['sub_total_hd'] 
 +r['sub_total_kg']),


 Where am I going wrong 

 cheers 





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