Odoo Help


This community 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.


My button is not enabled.

on 9/23/14, 3:51 PM 601 views

Hi everybody. Today I add a button in my form view, but when I enter view my button is not enabled.

What happened?

This is my code..

<button name="costos" type="object" string="CostoCalculo" />

costos is a function.

Thanks :)

On 9/24/14, 11:26 AM

Thanks for support.

This is my code:

View (sales.xml):

<record model="ir.ui.view" id="linea_pedido_tree">
            <field name="name">linea_pedido.tree</field>
            <field name="model">sale.order</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
        <xpath expr="//field[@name='order_line']/form[@string='Sales Order Lines']/field[@name='name']" position="after">
                    <div string='Especificaciones'>
                        <label for="especificacion_especial_line"/>
                        <field name="especificacion_especial_line">
                            <tree string="Especificaciones Especiales">
                                  <field name="product_id"/>
                                  <field name="ancho"/>
                                  <field name="alto"/>
                            <form string="Especificaciones Especiales">
                                <field name="product_id"/>
                                <field name="ancho"/>
                                <field name="alto"/>
                                <field name="mecanismo"/>
                    <button name="costos" type="object" string="Otro" />


My class py (sales.py)

class linea_pedido(osv.Model):

    _inherit = 'sale.order.line'

    _columns = {
        'especificacion_especial_line': fields.one2many('sale.order.hud',
             'order_line_id', 'Especificaciones especiales'),

class sale_order_hud(osv.Model):

    _name = 'sale.order.hud'

    def costos(self, cr, uid, ids, context=None):
        print 'this is a messagge'
        res = {}
        for a in self.browse(cr, uid, ids, context):
            for b in a.especificacion_especial_line:
                res = (b.ancho + 20.2)
        return res

_columns = {
        'order_line_id': fields.many2one('sale.order.line',
             'Referencia linea de compra', ondelete='cascade', invisible=True),
        'product_id': fields.many2one('product.product', 'Nombre de tela'),
        'ancho': fields.float('Ancho', digits=(2, 2)),
        'alto': fields.float('Alto', digits=(2, 2)),
        'mecanismo': fields.selection([('izquierda', 'Izquierda'), ('derecha',
            'Derecha')], 'Ubicacion del mecanismo'),

My __init__.py

import sales


My __openerp__.py

    'name': 'Module Sales',
    'version': '0.1',
    'author': Carlos',
    'description': "Carlos",
    'summary': 'carlos',
    'category': 'Customization',
    'website': '',
    'depends': [









    'data': [

    'demo': [
        # Aqui van datos de demostracion
    'test': [
        # Archivos de testing
    'installable': True,
    'application': True,
    'auto_install': False,
    'images': [

That's all. In my XML view the button is named = costos.

Thank you for all.





Ludo - Neobis

--Ludo - Neobis--
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--


Ludo - Neobis
On 9/24/14, 3:32 AM

Could be so many things there. Post a snippet of your code, maybe we can analyse some more.

If the button does not show up, make sure that you have the modified XML file in your __openerp__.py file, in the right list.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 9/23/14, 3:51 PM
Seen: 601 times
Last updated: 3/16/15, 8:10 AM