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

AttributeError: 'x_custom_model' en nuevo modulo

By
Juan
on 6/10/14, 12:09 PM 586 views

Buenas tardes

He creado  mi primero modulo en OpenERP 7.0 y me da el siguiente error cuando ejecuto el modulo al modificar/crear un registro y darle a un nuevo boton:

Detalle LOG

Server Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/openerp/addons/web/session.py", line 89, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 296, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, *params) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 190, in execute_kw return self.execute(db, uid, obj, method, *args, **kw or {}) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 132, in wrapper return f(self, dbname, *args, **kwargs) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 199, in execute res = self.execute_cr(cr, uid, obj, method, *args, **kw) File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 187, in execute_cr return getattr(object, method)(cr, uid, *args, **kw) AttributeError: 'x_custom_model' object has no attribute 'button_draft'

 

En el XML he incluido un boton:

Detalle XML

<record id="view_cirugia_form" model="ir.ui.view">

            <field name="name">x_ref.interna.form</field>

            <field name="model">x_ref.interna</field>

            <field name="arch" type="xml">

                <form string="Cirugía" version="7.0">

<header>

     <button string="Fijar Borrador" name="button_draft" x_state="cancel,done" type="object"/>

     <field name="x_state" widget="statusbar" statusbar_visible="draft,sent,progress,done,cancel"

statusbar_colors="{&quot;sent&quot;:&quot;red&quot;}"/>

 </header>

<sheet>

 

Detalle PY

 

class cirugia(osv.osv):

  _name = 'x_ref.interna'

  _columns = {

        'x_autoriza': fields.char('Autorización',size=20,required=False),

        'x_centro': fields.many2one('res.partner', 'Centro',required=False),

        'x_company_id': fields.many2one('res.company', 'Compañía',required=False),

        'x_doctor': fields.many2one('res.partner', 'Doctor',required=False),

        'x_fec_oper': fields.datetime('Fecha Operación'),

        'x_location1': fields.many2one('stock.location', 'Ubicación1',required=False),

        'x_location2': fields.many2one('stock.location', 'Ubicación2',required=False),

        'x_location3': fields.many2one('stock.location', 'Ubicación3',required=False),

        'x_location4': fields.many2one('stock.location', 'Ubicación4',required=False),

        'x_location5': fields.many2one('stock.location', 'Ubicación5',required=False),

        'x_location6': fields.many2one('stock.location', 'Ubicación6',required=False),

        'x_location7': fields.many2one('stock.location', 'Ubicación7',required=False),

        'x_location8': fields.many2one('stock.location', 'Ubicación8',required=False),   

        'x_location9': fields.many2one('stock.location', 'Ubicación9',required=False),

        'x_location10': fields.many2one('stock.location', 'Ubicación10',required=False),     

        'x_name': fields.char('Ref.Interna/Cirugía', size=20, required=True),

        'x_nhc': fields.char('NHC/Historial Clínico', size=60, required=False),

        'x_otros': fields.text('Otros'),

        'x_paciente': fields.char('Paciente', size=40, required=False),

        'x_poliza': fields.char('Póliza', size=20, required=False),

        'x_state': fields.selection([

            ('draft', 'Borrador'),

            ('sent', 'Enviada'),

            ('cancel', 'Cancelada'),

            ('waiting_date', 'Esperando programación'),

            ('progress', 'En curso'),

            ('done', 'Finalizada'),

            ], 'Estado', readonly=True), 

        'x_tarjeta': fields.char('Tarjeta', size=20, required=False),

        'x_user_id': fields.many2one('res.users', 'Comercial'),

  }

 

  def button_draft(self, cr, uid, ids, context=None):

      return self.write(cr, uid, ids, {'x_state': 'draft'}, context=context)

 

cirugia()

 

La instalación del modulo me ha ido bien pero:

 

1. Da el error de AttributeError: 'x_custom_model'

2. Si intento Actualizar el nuevo modulo también me da el siguiente error ->

File "/usr/lib/pymodules/python2.7/openerp/osv/orm.py", line 3217, in _auto_init

    if dest_model._table != 'ir_actions':

AttributeError: 'NoneType' object has no attribute '_table'

 

 

Agradecería si alguien puede orientarme acerca de cual es el motivo por el cual da el error en el nuevo modulo y porque revienta al intentar actualizar el modulo.

 

Mucha gracias a todos.

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)

Stats

Asked: 6/10/14, 12:09 PM
Seen: 586 times
Last updated: 3/16/15, 8:10 AM