Odoo Help

Welcome!

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.

0

Error creating new record: _id_seq

By
Laura
on 4/3/13, 5:04 PM 1,410 views

Hi,

I'm trying to create a new record of a custom class and when I call the method create(cr, uid, values) I get this error: Programming error: no existe la relación (relation does not exist) «pedidos_web_domicilio_id_seq» LINE 1: SELECT nextval('pedidos_web_domicilio_id_seq')

I have not defined anything related with sequences, and I don't know why I get this error.

Can you help me, please?

Thanks ;)

Here is my class definition:

class pedidos_web_domicilio(osv.osv):
    _name = 'pedidos.web.domicilio'
    _description = "Pedidos Web Domicilio"
    _columns = {
        'name'          : fields.char('Descripción', size=50),
        'company_id'    : fields.many2one('res.company', 'Company'),
        'shop_id'       : fields.many2one('sale.shop', 'Tienda'),
        'cliente_id'    : fields.many2one('res.partner', 'Cliente'),
        'domicilio'     : fields.char('Domicilio', size=128),
        'codigo_postal' : fields.char('Codigo Postal', size=5),
        'poblacion'     : fields.char('Poblacion', size=30),
        'provincia'     : fields.char('Provincia', size=30),
        'pais'          : fields.char('País', size=30),
        'email'         : fields.char('Email', size=240),
        'phone'         : fields.char('Teléfono', size=64),
        'state'         : fields.selection((('P','Pendiente'),('A','Asignado')),'Estado'),
        'lineas'        : fields.one2many('pedidos.web.domicilio.lineas', 'pedido_id', 'Lineas del Pedido'),
        'tipo_entrega'  : fields.selection((('1','Servicio Domicilio'),('2','Recoger en Local')),'Tipo de Entrega')
}

and the function:

def importar_cabecera(self, cr, uid, lista):
    lista_lineas = lista[0].strip('\r\n').split('\r\n')

    cabecera = lista_lineas[0].split('\t')
    lineas_pedido = []
    for i in range(1, len(lista_lineas)):
        linea = lista_lineas[i].split('\t')
        values = { 
              'product_id' : int(linea[0]),
              'cantidad' : float(linea[1]),
              'precio' : float(linea[2]),
              }
        lineas_pedido.append((0,0,values))

    cliente = int(cabecera[0])
    if cliente == 0:
        print 'buscar cliente con 999999999'
        cliente = 1
    values = {                
          'name' : cabecera[2],
          'shop_id' : 1, 
          'company_id' : 1,
          'cliente_id' : cliente,
          'domicilio' : cabecera[5], 
          'codigo_postal' : cabecera[6],
          'poblacion' : cabecera[7],
          'provincia' : cabecera[8], 
          'pais' : cabecera[9],
          'email' : cabecera[11],
          'phone' : cabecera[10], 
          'state' : 'P',
          'lineas' : lineas_pedido,
          'tipo_entrega' : cabecera[12],
              }      
    order_id = super(pedidos_web_domicilio, self).create(cr, uid, values)
    return True

This is the error I get:

`2013-04-04 07:25:53,480 2836 ERROR certezas openerp.sql_db: Programming error: no existe la relación «pedidos_web_domicilio_id_seq» LINE 1: SELECT nextval('pedidos_web_domicilio_id_seq') ^ , in query SELECT nextval('pedidos_web_domicilio_id_seq') 2013-04-04 07:25:53,496 2836 ERROR certezas openerp.sql_db: bad query: SELECT res_users."menu_id",res_users."pos_config",res_users."ean13",res_users."alias_id",res_users."share",res_users."default_section_id",res_users."active",res_users."password",res_users."partner_id",res_users."id",res_users."comercial_ineed",res_users."login_date",res_users."company_id",res_users."signature",res_users."login",res_users."perfil_id",res_users."action_id",res_users."ean13",res_users."company_id",res_users."active",res_users."partner_id",res_users."alias_id",res_users.id FROM "res_users" WHERE res_users.id IN (1) ORDER BY id Traceback (most recent call last): File "C:\Python27\lib\site-packages\openerp-7.0_20130130_000102-py2.7.egg\openerp\sql_db.py", line 227, in execute res = self._obj.execute(query, params) InternalError: transacción abortada, las órdenes serán ignoradas hasta el fin de bloque de transacción

2013-04-04 07:25:53,512 2836 ERROR certezas openerp.sql_db: bad query: SELECT res_users."menu_id",res_users."pos_config",res_users."ean13",res_users."alias_id",res_users."share",res_users."default_section_id",res_users."active",res_users."password",res_users."partner_id",res_users."id",res_users."comercial_ineed",res_users."login_date",res_users."company_id",res_users."signature",res_users."login",res_users."perfil_id",res_users."action_id",res_users."ean13",res_users."company_id",res_users."active",res_users."partner_id",res_users."alias_id",res_users.id FROM "res_users" WHERE res_users.id IN (1) ORDER BY id Traceback (most recent call last): File "C:\Python27\lib\site-packages\openerp-7.0_20130130_000102-py2.7.egg\openerp\sql_db.py", line 227, in execute res = self._obj.execute(query, params) InternalError: transacción abortada, las órdenes serán ignoradas hasta el fin de bloque de transacción

2013-04-04 07:25:53,513 2836 ERROR certezas openerp.netsvc: UserError You cannot perform this operation. New Record Creation is not allowed for this object as this object is for reporting purpose. Traceback (most recent call last): File "C:\Python27\lib\site-packages\openerp-7.0_20130130_000102-py2.7.egg\openerp\netsvc.py", line 289, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "C:\Python27\lib\site-packages\openerp-7.0_20130130_000102-py2.7.egg\openerp\service\web_services.py", line 614, in dispatch res = fn(db, uid, *params) File "C:\Python27\lib\site-packages\openerp-7.0_20130130_000102-py2.7.egg\openerp\osv\osv.py", line 125, in wrapper raise except_osv(inst.name, inst.value) except_osv: ('UserError', 'You cannot perform this operation. New Record Creation is not allowed for this object as this object is for reporting purpose.')`

c:\python27\lib\site-packages\openerp-7.0_20130130_000102-py2.7.egg\openerp\osv\osv.py(125)wrapper() -> raise except_osv(inst.name, inst.value) (Pdb)

You should post your relevant code.

Sudhir Arya (SA)
on 4/4/13, 2:04 AM
0
Laura
On 4/4/13, 3:11 AM

Here is my class definition: class pedidos_web_domicilio(osv.osv): _name = 'pedidos.web.domicilio' _description = "Pedidos Web Domicilio" _columns = { 'name' : fields.char('Descripción', size=50), 'company_id' : fields.many2one('res.company', 'Company'), 'shop_id' : fields.many2one('sale.shop', 'Tienda'), 'cliente_id' : fields.many2one('res.partner', 'Cliente'), 'domicilio' : fields.char('Domicilio', size=128), 'codigo_postal' : fields.char('Codigo Postal', size=5), 'poblacion' : fields.char('Poblacion', size=30), 'provincia' : fields.char('Provincia', size=30), 'pais' : fields.char('País', size=30), 'email' : fields.char('Email', size=240), 'phone' : fields.char('Teléfono', size=64), 'state' : fields.selection((('P','Pendiente'),('A','Asignado')),'Estado'), 'lineas' : fields.one2many('pedidos.web.domicilio.lineas', 'pedido_id', 'Lineas del Pedido'), 'tipo_entrega' : fields.selection((('1','Servicio Domicilio'),('2','Recoger en Local')),'Tipo de Entrega') } and the function: def importar_cabecera(self, cr, uid, lista): lista_lineas = lista[0].strip('\r\n').split('\r\n')

    cabecera = lista_lineas[0].split('\t')
    lineas_pedido = []
    for i in range(1, len(lista_lineas)):
        linea = lista_lineas[i].split('\t')
        values = { 
              'product_id' : int(linea[0]),
              'cantidad' : float(linea[1]),
              'precio' : float(linea[2]),
              }
        lineas_pedido.append((0,0,values))

    cliente = int(cabecera[0])
    if cliente == 0:
        print 'buscar cliente con 999999999'
        cliente = 1
    values = {                
          'name' : cabecera[2],
          'shop_id' : 1, 
          'company_id' : 1,
          'cliente_id' : cliente,
          'domicilio' : cabecera[5], 
          'codigo_postal' : cabecera[6],
          'poblacion' : cabecera[7],
          'provincia' : cabecera[8], 
          'pais' : cabecera[9],
          'email' : cabecera[11],
          'phone' : cabecera[10], 
          'state' : 'P',
          'lineas' : lineas_pedido,
          'tipo_entrega' : cabecera[12],
              }      
    order_id = super(pedidos_web_domicilio, self).create(cr, uid, values)
    return True

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

0 follower(s)

Stats

Asked: 4/3/13, 5:04 PM
Seen: 1410 times
Last updated: 3/16/15, 8:10 AM