Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn

由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

OE7.0中wizard的写法



  • 用代码说话:

    <br />class amount_by_partner_wizard(osv.osv_memory):<br />&nbsp; &nbsp; _name = &quot;fg_sale.amount.parnter.wizard&quot;<br /><br />&nbsp; &nbsp; _columns = {<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;name&#039;: fields.char(&#039;文件名&#039;, 100, readonly=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;date_start&#039;: fields.date(&#039;开始日期&#039;, required=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;date_end&#039;: fields.date(&#039;截止日期&#039;, required=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;source&#039;:fields.boolean(&#039;分事业部统计&#039;),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;data&#039;: fields.binary(&#039;文件&#039;, readonly=True),<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;state&#039;: fields.selection( [(&#039;choose&#039;,&#039;choose&#039;), (&#039;get&#039;,&#039;get&#039;)]),<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; _defaults = {<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;date_end&#039;: fields.date.context_today,<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;state&#039;: lambda *a: &#039;choose&#039;,<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;name&#039;: &#039;report.xls&#039;,<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; def show_result(self, cr, uid, ids, context=None):<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; this = self.browse(cr, uid, ids)[0]<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; #do magic........<br />&nbsp; &nbsp; &nbsp; &nbsp; #在v6.x里,是直接return的。<br />&nbsp; &nbsp; &nbsp; &nbsp; self.write(cr, uid, ids, {&#039;state&#039;:&#039;get&#039;, &#039;data&#039;:out, &#039;name&#039;:this.name }, context=context)<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; return {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;type&#039;: &#039;ir.actions.act_window&#039;,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;res_model&#039;: &#039;fg_sale.amount.parnter.wizard&#039;,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;view_mode&#039;: &#039;form&#039;,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;view_type&#039;: &#039;form&#039;,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;res_id&#039;: this.id,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;views&#039;: [(False, &#039;form&#039;)],<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &#039;target&#039;: &#039;new&#039;,<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br /><br />
    



    View里也有一些变化,主要是footer标签,和class属性的运用:

    <br />&lt;record model=&quot;ir.ui.view&quot; id=&quot;fg_sale_amount_parnter_wizard_form_view&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;name&quot;&gt;fg_sale.amount.parnter.wizard.form&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;model&quot;&gt;fg_sale.amount.parnter.wizard&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;type&quot;&gt;form&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;form string=&quot;导出客户销量统计&quot; version=&quot;7.0&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;group col=&quot;4&quot; states=&quot;choose&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;date_start&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;date_end&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;source&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field invisible=&quot;1&quot; name=&quot;state&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/group&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;group col=&quot;4&quot; states=&quot;get&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;separator string=&quot;导出完成, 点击&#039;另存为&#039;下载统计表.&quot; colspan=&quot;4&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;name&quot; invisible=&quot;1&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;data&quot; nolabel=&quot;1&quot; readonly=&quot;1&quot; filename=&quot;name&quot; /&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/group&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;footer states=&quot;choose&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;show_result&quot; string=&quot;导出&quot; type=&quot;object&quot; class=&quot;oe_highlight&quot;/&gt; or <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button special=&quot;cancel&quot; string=&quot;取消&quot; type=&quot;object&quot; class=&quot;oe_link&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/footer&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;footer states=&quot;get&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button special=&quot;cancel&quot; string=&quot;关闭&quot; type=&quot;object&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/footer&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/form&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/record&gt;<br />
    


  • 真及时 ,正好下面要写了

    谢谢分享


Log in to reply