跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • 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. 试图中添加一个按钮

试图中添加一个按钮

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

    我想在下面的试图中添加一个按钮,我也找到了相应的代码:

    &nbsp; &nbsp; &nbsp; &nbsp; &lt;record id=&quot;view_order_tree&quot; model=&quot;ir.ui.view&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;name&quot;&gt;sale.order.tree&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;model&quot;&gt;sale.order&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;type&quot;&gt;tree&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;priority&quot;&gt;2&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;tree string=&quot;Sales Orders&quot; colors=&quot;grey:state==&#039;cancel&#039;;blue:state in (&#039;waiting_date&#039;,&#039;manual&#039;);red:state in (&#039;invoice_except&#039;,&#039;shipping_except&#039;)&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field colspan=&quot;4&quot; name=&quot;name&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;field name=&quot;date_order&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;partner_id&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;user_id&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;picked_rate&quot; widget=&quot;progressbar&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;invoiced_rate&quot; widget=&quot;progressbar&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;amount_untaxed&quot; sum=&quot;Total Tax Excluded&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;amount_total&quot; sum=&quot;Total Tax Included&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;state&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/tree&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/record&gt;
    


    然后我尝试在tree上面加一个

     &lt;button name=&quot;order_confirm&quot; states=&quot;draft&quot; string=&quot;Confirm Order&quot; icon=&quot;gtk-apply&quot;/&gt;
    


    结果先面的内容全部空了。。。为什么啊。。。

    1 条回复 最后回复
    0
    • mrshellyM 离线
      mrshellyM 离线
      mrshelly
      写于 最后由 编辑
      #2

      哪里的内容全部空了?

      1 条回复 最后回复
      0
      • K 离线
        K 离线
        K_Go
        写于 最后由 编辑
        #3

        变成这样了。。不是很明白为什么。。

        1 条回复 最后回复
        0
        • K 离线
          K 离线
          K_Go
          写于 最后由 编辑
          #4

          我是对照form中的代码来改的,因为这个页面中的按钮就是我想要添加的,就像下面这个图一样。

          &lt;group col=&quot;17&quot; colspan=&quot;4&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;state&quot; widget=&quot;statusbar&quot; statusbar_visible=&quot;draft,progress,done&quot; statusbar_colors=&#039;{&quot;shipping_except&quot;:&quot;red&quot;,&quot;invoice_except&quot;:&quot;red&quot;,&quot;waiting_date&quot;:&quot;blue&quot;}&#039;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;invoice_recreate&quot; states=&quot;invoice_except&quot; string=&quot;Recreate Invoice&quot; icon=&quot;gtk-go-forward&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;invoice_corrected&quot; states=&quot;invoice_except&quot; string=&quot;Ignore Exception&quot; icon=&quot;gtk-apply&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;ship_recreate&quot; states=&quot;shipping_except&quot; string=&quot;Recreate Packing&quot; icon=&quot;gtk-ok&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;ship_corrected&quot; states=&quot;shipping_except&quot; string=&quot;Ignore Exception&quot; icon=&quot;gtk-apply&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;action_cancel&quot; states=&quot;manual,progress&quot; string=&quot;Cancel Order&quot; type=&quot;object&quot; icon=&quot;gtk-cancel&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;%(report_sale_order)d&quot; string=&quot;Print Order&quot; type=&quot;action&quot; icon=&quot;gtk-print&quot; states=&quot;waiting_date,manual,progress,done,shipping_except,invoice_except&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;manual_invoice&quot; states=&quot;manual&quot; string=&quot;Create Final Invoice&quot; icon=&quot;gtk-go-forward&quot; type=&quot;object&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;ship_cancel&quot; states=&quot;shipping_except&quot; string=&quot;Cancel Order&quot; icon=&quot;gtk-cancel&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;action_cancel_draft&quot; states=&quot;cancel&quot; string=&quot;Set to Draft&quot; type=&quot;object&quot; icon=&quot;gtk-convert&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;cancel&quot; states=&quot;draft&quot; string=&quot;Cancel Order&quot; icon=&quot;gtk-cancel&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;invoice_cancel&quot; states=&quot;invoice_except&quot; string=&quot;Cancel Order&quot; icon=&quot;gtk-cancel&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;%(report_sale_order)d&quot; string=&quot;Print Quotation&quot; type=&quot;action&quot; icon=&quot;gtk-print&quot; states=&quot;draft&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;order_confirm&quot; states=&quot;draft&quot; string=&quot;Confirm Order&quot; icon=&quot;gtk-apply&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/group&gt;
          


          我照着改,加了一个group后还是一样。。。

          1 条回复 最后回复
          0
          • K 离线
            K 离线
            K_Go
            写于 最后由 编辑
            #5

            经过几天的实验,发现直接在上面加一个按钮很难实现,于是在v7里面的 ”更多“ 添加了一个确认订单的触发。
            代码如下:

            &lt;record id=&quot;action_sale_order_confirm_sales&quot; model=&quot;ir.actions.server&quot;&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;name&quot;&gt;Confirm sale1&lt;/field&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;type&quot;&gt;ir.actions.server&lt;/field&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;model_id&quot; ref=&quot;model_sale_order&quot;/&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;state&quot;&gt;code&lt;/field&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;code&quot;&gt;obj.action_button_confirm(context=context)&lt;/field&gt;<br />&lt;/record&gt;<br />&lt;record id=&quot;id_of_the_action_value&quot; model=&quot;ir.values&quot;&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;name&quot;&gt;Confirm sale1&lt;/field&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;action_id&quot; ref=&quot;action_sale_order_confirm_sales&quot;/&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;value&quot; eval=&quot;&#039;ir.actions.server,&#039; + str(ref(&#039;action_sale_order_confirm_sales&#039;))&quot;/&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;key&quot;&gt;action&lt;/field&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;model_id&quot; ref=&quot;model_sale_order&quot;/&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;model&quot;&gt;sale.order&lt;/field&gt;<br />&nbsp; &nbsp; &lt;field name=&quot;key2&quot;&gt;client_action_multi&lt;/field&gt;<br />&lt;/record&gt;
            



            其中action_button_confirm就是确认订单的代码,它在saly.py,类sale_order里面...其实还有一些不是很明白,比如

            &lt;field name=&quot;model_id&quot; ref=&quot;model_sale_order&quot;/&gt;
            

            这一个,为什么它会知道是在saly.py里面?还有就是

            &lt;field name=&quot;model&quot;&gt;sale.order&lt;/field&gt;
            

            这一行和上一行有什么区别。。至于

            &nbsp;  &lt;field name=&quot;key2&quot;&gt;client_action_multi&lt;/field&gt;
            

            我猜应该就是添加到更多里面。。。总之还有一些不明白的地方,不过我想再经过一些摸索应该会慢慢明白。

            PS:大家有问题可以到http://help.openerp.com/questions/这里提问。。。。我就是在这里问的。。

            1 条回复 最后回复
            0
            • mrshellyM 离线
              mrshellyM 离线
              mrshelly
              写于 最后由 编辑
              #6

              7.0的更多, 就相当于 6.1-版本的"右侧菜单栏"...

              如果 help.openerp.com 可以用中文提问的话,估计去的人会很多.

              1 条回复 最后回复
              0
              • wjfonhandW 离线
                wjfonhandW 离线
                wjfonhand
                写于 最后由 编辑
                #7

                楼上的,help.openerp.com 并未指定不能用中文提问,何不试试?

                GoodERP -- Odoo China fork

                1 条回复 最后回复
                0
                • mrshellyM 离线
                  mrshellyM 离线
                  mrshelly
                  写于 最后由 编辑
                  #8

                  嗯. 问了一个问题
                  <br / http://help.openerp.com/question/8084/ta-men-shuo-zhe-li-wen-wen-ti-neng-gou-de-dao-hen-kuai-su-di-jie-jue-shi-zhe-yang-de-ma/ br />

                  1 条回复 最后回复
                  0
                  • JoshuaJ 离线
                    JoshuaJ 离线
                    Joshua 管理员
                    写于 最后由 编辑
                    #9

                    [quote author=mrshelly link=topic=5843.msg14627#msg14627 date=1364278207]
                    嗯. 问了一个问题
                    <br / http://help.openerp.com/question/8084/ta-men-shuo-zhe-li-wen-wen-ti-neng-gou-de-dao-hen-kuai-su-di-jie-jue-shi-zhe-yang-de-ma/ br />
                    [/quote]

                    The question has been closed for the following reason "too localized" by Fabien Pinckaers
                    close date 2013-03-26 07:58:43.401743

                    【上海先安科技】(joshua AT openerp.cn),欢迎关注公众号:openerp_cn

                    1 条回复 最后回复
                    0
                    • K 离线
                      K 离线
                      K_Go
                      写于 最后由 编辑
                      #10

                      😮 😮 😮 😮 😮 😮 😮 😮 :-[ :-[ :-[ :-[[quote author=mrshelly link=topic=5843.msg14627#msg14627 date=1364278207]
                      嗯. 问了一个问题
                      <br / http://help.openerp.com/question/8084/ta-men-shuo-zhe-li-wen-wen-ti-neng-gou-de-dao-hen-kuai-su-di-jie-jue-shi-zhe-yang-de-ma/ br />[/quote]

                      1 条回复 最后回复
                      0
                      • K 离线
                        K 离线
                        K_Go
                        写于 最后由 编辑
                        #11

                        [quote author=Jeff link=topic=5843.msg14626#msg14626 date=1364273186]
                        楼上的,help.openerp.com 并未指定不能用中文提问,何不试试?
                        [/quote]

                        好奇的问问里面的karma是什么意思。。。

                        1 条回复 最后回复
                        0
                        • mrshellyM 离线
                          mrshellyM 离线
                          mrshelly
                          写于 最后由 编辑
                          #12

                          [quote author=K_Go link=topic=5843.msg14633#msg14633 date=1364347379]
                          [quote author=Jeff link=topic=5843.msg14626#msg14626 date=1364273186]
                          楼上的,help.openerp.com 并未指定不能用中文提问,何不试试?
                          [/quote]

                          好奇的问问里面的karma是什么意思。。。
                          [/quote]

                          应该是贡献值的意思...

                          1 条回复 最后回复
                          0

                          • 登录

                          • 没有帐号? 注册

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