Odoo 中文社区

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

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

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

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

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

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

    试图中添加一个按钮

    Odoo 开发与实施交流
    4
    13
    9366
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      K_Go last edited by

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

      &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 Reply Last reply Reply Quote 0
      • mrshelly
        mrshelly last edited by

        哪里的内容全部空了?

        1 Reply Last reply Reply Quote 0
        • K
          K_Go last edited by

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

          1 Reply Last reply Reply Quote 0
          • K
            K_Go last edited by

            我是对照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 Reply Last reply Reply Quote 0
            • K
              K_Go last edited by

              经过几天的实验,发现直接在上面加一个按钮很难实现,于是在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 Reply Last reply Reply Quote 0
              • mrshelly
                mrshelly last edited by

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

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

                1 Reply Last reply Reply Quote 0
                • wjfonhand
                  wjfonhand last edited by

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

                  GoodERP -- Odoo China fork

                  1 Reply Last reply Reply Quote 0
                  • mrshelly
                    mrshelly last edited by

                    嗯. 问了一个问题
                    <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 Reply Last reply Reply Quote 0
                    • Joshua
                      Joshua 管理员 last edited by

                      [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 Reply Last reply Reply Quote 0
                      • K
                        K_Go last edited by

                        😮 😮 😮 😮 😮 😮 😮 😮 😞 😞 😞 :-[[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 Reply Last reply Reply Quote 0
                        • K
                          K_Go last edited by

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

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

                          1 Reply Last reply Reply Quote 0
                          • mrshelly
                            mrshelly last edited by

                            [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 Reply Last reply Reply Quote 0
                            • First post
                              Last post