Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
29825 Ansichten

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
Verwerfen
Beste Antwort

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

Avatar
Verwerfen
Autor

thanks Jignesh

Autor Beste Antwort

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
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
0
März 15
4670
0
März 15
6654
2
Dez. 23
12946
3
Juli 22
23361
2
Juni 22
3982