Odoo Help

1

0
2 Answers
1
Carlos
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"/>
                            </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
Avatar

Ludo - 21South

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

Developer

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

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now