Odoo Help


2 Answers
24‏/9‏/2014 11:26 ص

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

--Ludo - 21South--
| 3 2 7
Zwijndrecht, هولندا
--Ludo - 21South--


Ludo - 21South
24‏/9‏/2014 3:32 ص

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.

Ask a Question
Keep Informed
1 follower(s)
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 eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now