Wednesday, 24 August 2011

Making Sequence and Using default dictionary

showing date as default only year (if the year field is in integer format)

'year' : lambda *a: int(time.strftime('%Y')),

******************
making default date as system

'pay_date': lambda self, cr, uid, context: time.strftime('%Y-%m-%d'),

*******************
making default selection value 'basis' to show

'basis': 'order_booking', #no use of lambda here

*******************************
making Sequence field

'name': fields.char('Ls #', size=64, required=True, select=True),
#in default
'name':lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'ls.master'),

#in xml
<!-- Sequence -->
        <record id="seq_type_ls_master" model="ir.sequence.type">
            <field name="name">ls.master</field>
            <field name="code">ls.master</field>
        </record>

        <record id="seq_ls_master" model="ir.sequence">
            <field name="name">ls.master</field>
            <field name="code">ls.master</field>
            <field name="prefix">Ls</field>
            <field name="padding">3</field>
        </record>
       
_________________________________________________________________

1 comment:

  1. Nice ,,, Thanks,,,,
    I want to create a wizard report than how it possible dynamically ???

    ReplyDelete