Odoo Help

Welcome!

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.

1

My button is not enabled.

By
Carlos
on 9/23/14, 3:51 PM 636 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 :)

1
Carlos
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"/>
                            </tree>
                            <form string="Especificaciones Especiales">
                                <field name="product_id"/>
                                <field name="ancho"/>
                                <field name="alto"/>
                                <field name="mecanismo"/>
                    <button name="costos" type="object" string="Otro" />
                            </form>
                        </field>
                    </div>
                </xpath>
            </field>
        </record>

 

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': [
        'base',
        'crm',
        'l10n_mx_cities',
        'l10n_mx_settings_facturae',
        'l10n_mx_facturae_pac',
        'l10n_mx_sale_payment_method',
        'l10n_mx_purchase_payment_method',
        'l10n_mx_account_invoice_tax',
        'l10n_mx_facturae_pac_sf',

'sale',
            'sale_stock',
            'point_of_sale',

        'purchase',

        'stock',

        'mrp',

        'project',

        'account',

        'hr',

        'knowledge',

        'fleet',
    ],
    'data': [
      
        'vistas/sales.xml',

    ],
    '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.

 

 


 

0

Ludo - Neobis

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

Developer

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)

Stats

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