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.


How to add amount of One2many table?

Juan Carlos
on 12/19/14, 5:00 PM 562 views

Help, please. This is my code.


class Facturacion(models.Model):
    _name = 'openacademy.factura'

    numeroFactura = fields.Char(string="No. Factura")
    serieFactura = fields.Char(string="Serie")
    fechaFactura = fields.Date(string="Fecha")
    cantidadFactura = fields.Float('Cantidad')
    empresa_ids = fields.Many2one('openacademy.empresa', 'Empresa')
    producto_box = fields.One2many('openacademy.detalle', 'name')
    pago_ids = fields.Many2one('openacademy.pago', 'Tipo de Pago')
    partner_ids = fields.Many2one('res.partner', 'Cliente')
    totales = fields.Float(string="Totales", readonly=True)

class DetalleFactura(models.Model):
    _name = "openacademy.detalle"

    def _onchange_producto_id(self):
        if self.producto_id:
            self.precio = 100.00

    name = fields.Char(string="Titulo")
    producto_id = fields.Many2one('product.product', 'Producto')
    precio = fields.Float(string="Precio")


                            <page string="Compras">
                                    <group string="Compras">
                                        <field name="producto_box" nolabel="1">
                                            <tree editable="bottom">
                                                <field name="producto_id"/>
                                                <field name="precio" />
                                    </group >
                                    <br />
                                        <group class="oe_subtotal_footer">
                                            <field name="totales" class="oe_subtotal_footer_separator"/>



| 5 4 7
Bangalore, India

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

On 12/22/14, 1:18 AM

Refer Invoice object or Sale Order object etc, to achieve your requirement

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: 12/19/14, 5:00 PM
Seen: 562 times
Last updated: 3/16/15, 8:10 AM