Odoo Help


Run a python code from delete Button ?

abdelwahed chiheb
on 11/4/13, 4:42 PM 2,408 views

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) ...


Daniel Reis

--Daniel Reis--
| 7 8 9
Linda-a-Velha, Portugal
--Daniel Reis--

Author of the "Odoo Development Essentials" book.

Applications Manager at Securitas Portugal

Github: https://github.com/dreispt

Twitter; @reis_pt

Daniel Reis
On 11/4/13, 6:10 PM

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 :(

abdelwahed chiheb
on 11/5/13, 5:25 AM
Francisco Castro
On 2/25/14, 7:05 AM

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')


class tabela_lista(osv.osv):

 _name = 'tabela.lista'

 _columns = {
           '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"/>


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

    <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>

        name="Carrega Recinto teste"

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 11/4/13, 4:42 PM
Seen: 2408 times
Last updated: 3/16/15, 8:10 AM