【已解决】button所执行的方法(弹出一个窗口)
-
解决了。
关于弹出窗口可以看module 的project里面的例子比较简单
具体就是这句[code]
<button name="%(action_config_compute_remaining)d" string="Review" type="action" colspan="1" target="new" states="open,pending"/>
[/code]而="%(action_config_compute_remaining)d"这个写法官方论坛上也得出答案
[quote]
It will search for id of that action in ir_model_data and replace it with integer value.
you can check the view from Administration/Customization/User Interface/Views
You will get id of that action in views[/quote]
结果如下:
[attach]220[/attach][[i] 本帖最后由 popkar77 于 2009-9-21 16:37 编辑 [/i]]
-
view ID
我举个例子,例如:project这个moudule
project_view.xml
里面的[code]
<record id="view_config_compute_remaining" model="ir.ui.view">
<field name="name">Compute Remaining Hours </field>
<field name="model">config.compute.remaining</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Remaining Hours">
<separator colspan="4" string="Change Remaining Hours"/>
<newline/>
<field name="remaining_hours" widget="float_time"/>
<group col="4" colspan="4">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" name="compute_hours" string="Update" type="object"/>
</group>
</form>
</field>
</record><record id="action_config_compute_remaining" model="ir.actions.act_window">
<field name="name">Compute Remaining Hours</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">config.compute.remaining</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
[/code][code]
<button name="%(action_config_compute_remaining)d" string="Review" type="action" colspan="1" target="new" states="open,pending"/>
[/code]action_config_compute_remaining就是一个view的id,
最上面的view_config_compute_remaining就是要弹出窗口的详细内容。
view_config_compute_remaining和action_config_compute_remaining的连接方法就是field name
[code]
<field name="name">Compute Remaining Hours </field>
[/code]