0

这是我的节日模特班。

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

我需要以我的另一种形式来获得节日,以取得节日进展。然后我需要过滤该记录,并且只需要显示与当月相关的节日 如何为此要求添加域过滤器,或者请建议我通过另一种技术解决这个问题

谢谢

这里显示了另一个模型类的视图 xml

<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' />  .....

这是另一个将参考节日课的模型课

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'),
    }

此处显示屏幕快照以更方便

参考这张图片 节日提前()

4

2 回答 2

1

尝试将此域添加到节日字段 [('month','=',time.strftime('%m'))]。它应该工作并显示本月即将到来的所有节日。

于 2013-05-14T06:01:39.810 回答
0

谢谢普里耶什。使用以下代码完成

<field name='festival_id' on_change="on_change_festival(bpl_division_id,festival_id)"
domain="[('month','=',time.strftime('%%m'))]" />
于 2013-05-14T07:03:50.327 回答