跳至内容
菜单
此问题已终结
2 回复
7492 查看

image description

How Can i run a python code from this button ... the button is defined in BASE.XML and run a CSS code (display None) ...

形象
丢弃
最佳答案

You override the unlink() method for the underlying model.

形象
丢弃
编写者

If the user add a sale order line and after some discussion with the customer the line will be deleted, (the line added not yet saved in the database) there is a python code behind this action ? The unlink method is run when the line is saved in the database :(

最佳答案

how can I list items that way without have to click on add item? I have two classes to build two tables:

class tabela_recintos(osv.osv):

_name = 'tabela.recintos'

_columns = {

    'recinto_ids': fields.one2many('tabela.lista','id_wizard','teste')
    }

tabela_recintos()

class tabela_lista(osv.osv):

 _name = 'tabela.lista'

 _columns = {
            'id_wizard':fields.many2one('tabela.recintos','id_wizard'),
           'cod': fields.char('Código', size=20, required='True'),
           'nome': fields.char('Designação', size=60, required='True')
            }

I click on a menu on the left and pop's up a wizard, this wizard ll list the items, but I dont know what can I do more. it only shows a field and the button add item...

my xml is this

    <record id="carrega_form" model="ir.ui.view">
        <field name="name">carrega.form</field>
        <field name="model">tabela.recintos</field>
        <field name="arch" type="xml">
            <form string="carrega" version="7.0">

                <group string="carrrega" col="1">

            <field name="recinto_ids"/>

                </group>

                <footer>
                   <button name='name' type='object' string='Criar novo Recinto' class="oe_highlight"/>
                    ou
                    <button string="Cancelar" class="oe_link" special="cancel"/>
                </footer>
            </form>
        </field>
    </record>




    <record id="gs_carrega_act" model="ir.actions.act_window">
        <field name="name">Carregar os Recintos</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">tabela.recintos</field>
        <field name="view_type">form</field>
        <field name="view_mode">form</field>
        <field name="target">new</field>
    </record>

    <menuitem
        name="Carrega Recinto teste"
        parent="gs_menuLotacoes"
        action="gs_carrega_act"
        id="gs_carrega"
        sequence="0"/>
形象
丢弃
相关帖文 回复 查看 活动
2
12月 23
12537
3
7月 22
22841
2
6月 21
18342
0
9月 20
3628
0
5月 16
3988