跳至内容
菜单
此问题已终结
2 回复
29744 查看

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()

形象
丢弃
最佳答案

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

形象
丢弃
编写者

thanks Jignesh

编写者 最佳答案

its Done with following code

<field name='festival_id' on_change="on_change_festival(bpl_division_id,festival_id)"
domain="[('month','=',time.strftime('%%m'))]" />
形象
丢弃
相关帖文 回复 查看 活动
0
3月 15
4591
0
3月 15
6559
2
12月 23
12815
3
7月 22
23191
2
6月 22
3892