试图中添加一个按钮
-
我想在下面的试图中添加一个按钮,我也找到了相应的代码:
<record id="view_order_tree" model="ir.ui.view"><br /> <field name="name">sale.order.tree</field><br /> <field name="model">sale.order</field><br /> <field name="type">tree</field><br /> <field name="priority">2</field><br /> <field name="arch" type="xml"><br /> <tree string="Sales Orders" colors="grey:state=='cancel';blue:state in ('waiting_date','manual');red:state in ('invoice_except','shipping_except')"><br /> <field colspan="4" name="name"/><br /> <field name="date_order"/><br /> <field name="partner_id"/><br /> <field name="user_id"/><br /> <field name="picked_rate" widget="progressbar"/><br /> <field name="invoiced_rate" widget="progressbar"/><br /> <field name="amount_untaxed" sum="Total Tax Excluded"/><br /> <field name="amount_total" sum="Total Tax Included"/><br /> <field name="state"/><br /> </tree><br /> </field><br /> </record>
然后我尝试在tree上面加一个<button name="order_confirm" states="draft" string="Confirm Order" icon="gtk-apply"/>
结果先面的内容全部空了。。。为什么啊。。。 -
我是对照form中的代码来改的,因为这个页面中的按钮就是我想要添加的,就像下面这个图一样。
<group col="17" colspan="4"><br /> <field name="state" widget="statusbar" statusbar_visible="draft,progress,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/><br /> <button name="invoice_recreate" states="invoice_except" string="Recreate Invoice" icon="gtk-go-forward"/><br /> <button name="invoice_corrected" states="invoice_except" string="Ignore Exception" icon="gtk-apply"/><br /> <button name="ship_recreate" states="shipping_except" string="Recreate Packing" icon="gtk-ok"/><br /> <button name="ship_corrected" states="shipping_except" string="Ignore Exception" icon="gtk-apply"/><br /> <button name="action_cancel" states="manual,progress" string="Cancel Order" type="object" icon="gtk-cancel"/><br /> <button name="%(report_sale_order)d" string="Print Order" type="action" icon="gtk-print" states="waiting_date,manual,progress,done,shipping_except,invoice_except"/><br /> <button name="manual_invoice" states="manual" string="Create Final Invoice" icon="gtk-go-forward" type="object"/><br /> <button name="ship_cancel" states="shipping_except" string="Cancel Order" icon="gtk-cancel"/><br /> <button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/><br /> <button name="cancel" states="draft" string="Cancel Order" icon="gtk-cancel"/><br /> <button name="invoice_cancel" states="invoice_except" string="Cancel Order" icon="gtk-cancel"/><br /> <button name="%(report_sale_order)d" string="Print Quotation" type="action" icon="gtk-print" states="draft"/><br /> <button name="order_confirm" states="draft" string="Confirm Order" icon="gtk-apply"/><br /> </group>
我照着改,加了一个group后还是一样。。。 -
经过几天的实验,发现直接在上面加一个按钮很难实现,于是在v7里面的 ”更多“ 添加了一个确认订单的触发。
代码如下:<record id="action_sale_order_confirm_sales" model="ir.actions.server"><br /> <field name="name">Confirm sale1</field><br /> <field name="type">ir.actions.server</field><br /> <field name="model_id" ref="model_sale_order"/><br /> <field name="state">code</field><br /> <field name="code">obj.action_button_confirm(context=context)</field><br /></record><br /><record id="id_of_the_action_value" model="ir.values"><br /> <field name="name">Confirm sale1</field><br /> <field name="action_id" ref="action_sale_order_confirm_sales"/><br /> <field name="value" eval="'ir.actions.server,' + str(ref('action_sale_order_confirm_sales'))"/><br /> <field name="key">action</field><br /> <field name="model_id" ref="model_sale_order"/><br /> <field name="model">sale.order</field><br /> <field name="key2">client_action_multi</field><br /></record>
其中action_button_confirm就是确认订单的代码,它在saly.py,类sale_order里面...其实还有一些不是很明白,比如<field name="model_id" ref="model_sale_order"/>
这一个,为什么它会知道是在saly.py里面?还有就是
<field name="model">sale.order</field>
这一行和上一行有什么区别。。至于
<field name="key2">client_action_multi</field>
我猜应该就是添加到更多里面。。。总之还有一些不明白的地方,不过我想再经过一些摸索应该会慢慢明白。
PS:大家有问题可以到http://help.openerp.com/questions/这里提问。。。。我就是在这里问的。。 -
7.0的更多, 就相当于 6.1-版本的"右侧菜单栏"...
如果 help.openerp.com 可以用中文提问的话,估计去的人会很多. -
楼上的,help.openerp.com 并未指定不能用中文提问,何不试试?
-
[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 -
:-[ :-[ :-[ :-[[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] -
[quote author=Jeff link=topic=5843.msg14626#msg14626 date=1364273186]
楼上的,help.openerp.com 并未指定不能用中文提问,何不试试?
[/quote]
好奇的问问里面的karma是什么意思。。。 -
[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]
应该是贡献值的意思...