Odoo Help


How to add amount of One2many table?

Juan Carlos
on 12/19/14, 5:00 PM 967 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"/>


Techno-Functional Associate with 7+ 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

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 E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 12/19/14, 5:00 PM
Seen: 967 times
Last updated: 3/16/15, 8:10 AM