İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
29724 Görünümler

here is my festival model class.

class festival_registration(osv.osv):
    _name = "bpl.festival"
    _description = "Festivals"
    _columns = {
        'relegious_places_id': fields.many2one('bpl.relegious.places', 'Religious Places'),
        'name': fields.char('Name', size=256, required=True, help='Festival Name'),
        'fest_allowance': fields.float('Advance', size=64, required=True, help='Advance Amount'),
        'installments': fields.integer('Installments', size=32, required=True, help='Number of Installments Installment'),
        'month':fields.selection([('1', 'January'), ('2', 'February'), ('3', 'March'), ('4', 'April'),
            ('5', 'May'), ('6', 'June'), ('7', 'July'), ('8', 'August'), ('9', 'September'),
            ('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month'),

    }
festival_registration()

i need to get festivals in my another form for give festival advances. then i need to filter that records and need to show only festivals related to current month how to add domain filter for this requirement or please advice me to sort out this issue by another technique

thanks

here shows my view xml of another model class

<record model="ir.ui.view" id="bpl_religion_registration_form">
<field name="name">bpl.relegious.places.form</field>
<field name="model">bpl.relegious.places</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="bpl_religion_registration" version='7.0'>
<sheet>
<group>
    <group>
        <field name="religion_id" style="width: 80%%" />
        <field name="relegious_place" style="width: 80%%" />
    </group>
</group>
<div name="Other Info"></div>
<notebook>
    <page string=" Festivals">
        <field name='festival_id' nolabel='1'>
            <tree string='List' editable='bottom'>
                <field name='name' />
                <field name='fest_allowance' />
                <field name='installments' />
                <field name='month' />  .....

and here is that another model class which is going to refer festival class

class festival_advance(osv.osv):
    _name = "bpl.festival.advance"
    _description = "Festival Advance"
    _columns = {
        'bpl_company_id':fields.many2one('res.company', 'Company', help='Company'),
        'bpl_estate_id':fields.many2one('bpl.estate.n.registration', 'Estate', help='Estate', required=True),
        'bpl_division_id':fields.many2one('bpl.division.n.registration', 'Division', help='Division', domain="[('estate_id','=',bpl_estate_id)]", required=True),
        'festival_id': fields.many2one('bpl.festival', 'Festival' **NEED TO ADD FILTER HERE TO GET CURRENT MONTH FESTIVALS**),
        'festival_advance': fields.float('Amount'),
        'installment': fields.integer('Installment'),
        'festival_advance_ids': fields.one2many('bpl.festival.advance.register', 'festival_advance_id', 'Festival Advances'),
    }

and here shows the screen snapshot for more easeness

refer this image festival_advance()

Avatar
Vazgeç
En İyi Yanıt

[('month','=',time.strftime('%m'))]

Avatar
Vazgeç
Üretici

thanks Jignesh

Üretici En İyi Yanıt

its Done with following code

<field name='festival_id' on_change="on_change_festival(bpl_division_id,festival_id)"
domain="[('month','=',time.strftime('%%m'))]" />
Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Mar 15
4576
0
Mar 15
6528
2
Ara 23
12768
3
Tem 22
23151
2
Haz 22
3878