跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

  1. 主页
  2. 版块
  3. Odoo 开发与实施交流
  4. OE7.0中wizard的写法

OE7.0中wizard的写法

已定时 已固定 已锁定 已移动 Odoo 开发与实施交流
3 帖子 2 发布者 3.9k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • D 离线
    D 离线
    d_yang
    写于 最后由 编辑
    #1

    用代码说话:

    <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 />
    
    1 条回复 最后回复
    0
    • C 离线
      C 离线
      ccdos
      写于 最后由 编辑
      #2

      真及时 ,正好下面要写了

      谢谢分享

      1 条回复 最后回复
      0

      • 登录

      • 没有帐号? 注册

      • 登录或注册以进行搜索。
      • 第一个帖子
        最后一个帖子
      0
      • 版块
      • 标签
      • 热门
      • 用户
      • 群组