Odoo Help


Load a class in a field of the same module - OpenErp

on 4/9/13, 6:03 PM 889 views

I need to load data from a class, into a field of another class in the same module.

I need this to show a tree of data in the xml view.

class certificados(osv.osv):

_name = 'certificados.certificados'
_description="Certificados de No Produccion"
_inherit = ['mail.thread', 'ir.needaction_mixin']

_columns = {
        'Item' : fields.integer('Item'), 'Registro_Numero' : fields.integer('Registro Numero'),
        'Fecha_de_Emision': fields.date('Fecha de Emision', required=True, select=True),
        'Fecha_de_Solicitud': fields.date('Fecha de Solicitud', required=True, select=True),
        'Fecha_del_Documento': fields.date('Fecha del Documento', required=True, select=True),
        'Vigencia' : fields.integer('Vigencia'), 'cert_ids' : fields.one2many('certificados.line','requisicion_id','Items del Certificado',states={'done': [('readonly', True)]}),
        'descripcion' : fields.text('Descripcion'),
        'notas' : fields.text('Notas'),

class certificados_line(osv.osv):

_name = "certificados.line"
_description="Certificados No Produccion"

_columns = {
'Codigo_Arancelario' : fields.integer('Codigo Arancelario'),
'product_id' : fields.many2one('product.product', 'Material'),
'Descripcion_Arancelaria' : fields.char('Descripcion Arancelaria', size=42, required = True, translate = True), 
'Especificaciones_Tecnicas' : fields.char('Especificaciones Tecnicas', size=60, required = True, translate = True), 
'Cantidad' : fields.float('Cantidad'), 'Unidad_de_Medida': fields.many2one('product.uom', 'Unidad de Medida'),
'Precio_Unitario_Declarado' : fields.float('Precio Unitario Declarado'), 'Moneda' : fields.many2one('res.currency', 'Moneda'),
'Valor_En_Divisas' : fields.float('Valor En Divisas'),
'requisicion_id' : fields.many2one('certificados.certificados', 'Certificados de No Produccion', ondelete='cascade'),
'Cantidad_Consumida' : fields.float('Cantidad Consumida'), 'Cantidad_Disponible' : fields.float('Cantidad Disponible'),


I've seen in another module that the first class doesn't close itself, i mean, in this class 'certificados' wouldn't have the 'certificados()' code in the bottom.

Don't know if this is possible, or if i'm doing something wrong here.

The view of 'cert_ids' field of certificados, should be of the form:

                  <page string="Productos">
                        <field name="cert_ids">
                            <tree string="Productos">
                                <field name="product_id"/>
                                <field name="Codigo_Arancelario"/>
                                <field name="Descripcion_Arancelaria"/>
                                <field name="Especificaciones_Tecnicas"/>
                                <field name="Cantidad"/>
                                <field name="Precio_Unitario_Declarado"/>
                                <field name="Valor_En_Divisas"/>
                                <field name="Cantidad_Consumida"/>
                        <separator string="Observaciones"/>
                        <field name="descripcion"/>

I don't know if i'm doing something wrong, but the xml gives me invalid architecture errors, and the field is not working correctly.

Thanks in advance!

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 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: 4/9/13, 6:03 PM
Seen: 889 times
Last updated: 3/16/15, 8:10 AM