OE7.0中wizard的写法
-
用代码说话:
<br />class amount_by_partner_wizard(osv.osv_memory):<br /> _name = "fg_sale.amount.parnter.wizard"<br /><br /> _columns = {<br /> 'name': fields.char('文件名', 100, readonly=True),<br /> 'date_start': fields.date('开始日期', required=True),<br /> 'date_end': fields.date('截止日期', required=True),<br /> 'source':fields.boolean('分事业部统计'),<br /> 'data': fields.binary('文件', readonly=True),<br /> 'state': fields.selection( [('choose','choose'), ('get','get')]),<br /> }<br /> _defaults = {<br /> 'date_end': fields.date.context_today,<br /> 'state': lambda *a: 'choose',<br /> 'name': 'report.xls',<br /> }<br /> <br /> def show_result(self, cr, uid, ids, context=None):<br /> <br /> this = self.browse(cr, uid, ids)[0]<br /><br /> #do magic........<br /> #在v6.x里,是直接return的。<br /> self.write(cr, uid, ids, {'state':'get', 'data':out, 'name':this.name }, context=context)<br /><br /> return {<br /> 'type': 'ir.actions.act_window',<br /> 'res_model': 'fg_sale.amount.parnter.wizard',<br /> 'view_mode': 'form',<br /> 'view_type': 'form',<br /> 'res_id': this.id,<br /> 'views': [(False, 'form')],<br /> 'target': 'new',<br /> }<br /><br />
View里也有一些变化,主要是footer标签,和class属性的运用:<br /><record model="ir.ui.view" id="fg_sale_amount_parnter_wizard_form_view"><br /> <field name="name">fg_sale.amount.parnter.wizard.form</field><br /> <field name="model">fg_sale.amount.parnter.wizard</field><br /> <field name="type">form</field><br /> <field name="arch" type="xml"><br /> <form string="导出客户销量统计" version="7.0"><br /> <group col="4" states="choose"><br /> <field name="date_start"/><br /> <field name="date_end"/><br /> <field name="source"/><br /> <field invisible="1" name="state"/><br /> </group><br /> <group col="4" states="get"><br /> <separator string="导出完成, 点击'另存为'下载统计表." colspan="4"/><br /> <field name="name" invisible="1"/><br /> <field name="data" nolabel="1" readonly="1" filename="name" /><br /> </group><br /> <footer states="choose"><br /> <button name="show_result" string="导出" type="object" class="oe_highlight"/> or <br /> <button special="cancel" string="取消" type="object" class="oe_link"/><br /> </footer><br /> <footer states="get"><br /> <button special="cancel" string="关闭" type="object"/><br /> </footer><br /> </form><br /> </field><br /> </record><br />