It is currently Sat Feb 11, 2012 9:04 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: How to specify the defaut field values ?
PostPosted: Tue May 23, 2006 9:53 am 
Offline

Joined: Sat Mar 25, 2006 9:27 pm
Posts: 135
hello

i just want to know the syntax to specify the defaut field values in a wizard ?

my exemple wizard begins with :

Code:
_attest_form = '''<?xml version="1.0"?>
<form string="Generating of fiscalite Attestations">   
   <field name="shop_id"/>
   <separator string="Please, establish the period :" colspan="4"/>
   <field name="date_start"/>
   <field name="date_end"/>
   <separator string="Choose which consumers :" colspan="4"/>
   <field name="partner_all"/>
   <field name="partner_one"/>
   <field name="partner_from"/>
   <field name="partner_to"/>
   </form>'''

_attest_fields = {
   'shop_id': {'string':'Shop Structure','type':'many2one','relation':'sale.shop', 'required':True},   
   'date_start': {'string':'Start of period','type':'datetime', 'required':True},
   'date_end': {'string':'End of period', 'type':'datetime', 'required':True },
   'partner_all': {'string':'All the particular : ', 'type':'boolean' },
   'partner_one': {'string':'Only one : ','type':'many2one','relation':'res.partner', 'required':True},   
   'partner_from': {'string':'From letter :','type':'selection','selection':[('a','a'),('b','b'),('c','c'),('d','d'),('e','e'),('f','f'),('g','g'),('h','h'),('i','i'),('j','j'),('k','k'),('l','l'),('m','m'),('n','n'),('o','o'),('p','p'),('q','q'),('r','r'),('s','s'),('t','t'),('u','u'),('v','v'),('w','w'),('x','x'),('y','y'),('z','z')]},
   'partner_to': {'string':'From letter :','type':'selection','selection':[('a','a'),('b','b'),('c','c'),('d','d'),('e','e'),('f','f'),('g','g'),('h','h'),('i','i'),('j','j'),('k','k'),('l','l'),('m','m'),('n','n'),('o','o'),('p','p'),('q','q'),('r','r'),('s','s'),('t','t'),('u','u'),('v','v'),('w','w'),('x','x'),('y','y'),('z','z')]},   
}


for exemple, i wish my partner_all checkbox been already check at the wizard opening, i wish my selectied list been already selected with "From A" "To Z"

how can i do ?


Top
 Profile  
 
 Post subject: set default value in wizard's field
PostPosted: Fri Nov 06, 2009 12:28 pm 
Offline

Joined: Fri Nov 06, 2009 7:11 am
Posts: 36
You can use 'default' as shown below
'partner_all':
{ 'string':'All the particular : ',
'type':'boolean',
'default':lambda *a:1 },
'partner_from': {'string':'From letter :',
'type':'selection',
'selection':[('a','a'),('b','b'),('c','c'),('d','d'),('e','e'),('f','f'),('g','g'),('h','h'),('i','i'),('j','j'),('k','k'),('l','l'),('m','m'),('n','n'),('o','o'),('p','p'),('q','q'),('r','r'),('s','s'),('t','t'),('u','u'),('v','v'),('w','w'),('x','x'),('y','y'),('z','z')],
'default':lambda *a:'a'},
'partner_to': {'string':'To letter :',
'type':'selection',
'selection':[('a','a'),('b','b'),('c','c'),('d','d'),('e','e'),('f','f'),('g','g'),('h','h'),('i','i'),('j','j'),('k','k'),('l','l'),('m','m'),('n','n'),('o','o'),('p','p'),('q','q'),('r','r'),('s','s'),('t','t'),('u','u'),('v','v'),('w','w'),('x','x'),('y','y'),('z','z')],
'default':lambda *a:'z'}
--
Regards
rch


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP