Hi,
I've inherit the 'crm.meeting' and change the name to 'radar.eventos 'but now I can't save a record.
I've this error :
2013-06-17 19:06:56,060 27957 ERROR teste17junho openerp.netsvc: ValidateError
The value "radar.eventos,4" for the field "calendar_attendee.ref" is not in the selection
Traceback (most recent call last):
File "/opt/openerp-7.0-20130516-231144/openerp/netsvc.py", line 292, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/opt/openerp-7.0-20130516-231144/openerp/service/web_services.py", line 626, in dispatch
res = fn(db, uid, *params)
File "/opt/openerp-7.0-20130516-231144/openerp/osv/osv.py", line 188, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/opt/openerp-7.0-20130516-231144/openerp/osv/osv.py", line 144, in wrapper
raise except_osv(inst.name, inst.value)
except_osv: (u'ValidateError', u'The value "radar.eventos,4" for the field "calendar_attendee.ref" is not in the selection')
My code is:
mymodule/mymodule.py
class radar_eventos(osv.osv):
""" Model for Events """
_name = 'radar.eventos'
_description = "Events"
_inherit = 'crm.meeting'
_columns = {
'state': fields.selection([
('novo', 'Novo'),
('cancelado', 'Cancelado'),
('agendado', 'Agendado'),
('emcurso', 'Em Curso'),
('realizado', 'Realizado'),
], 'Status', readonly=True),
'eventotipo_ids': fields.many2many('radar.eventos.tipo', 'radar_tipo_eventos_rel',
'evento_id','tipo_id','Tipo de Evento'),
'id_evento': fields.char('Id Evento', size=64, readonly=True),
'registo_id': fields.many2one('registos.vigilancia',u'Registo de Vigilância'),
'accoes_tarefas_id': fields.one2many('accoes.tarefas','evento_id', u'Acções e Tarefas'),
'ideias_id': fields.one2many('gestao.ideias','evento_id', u'Ideias'),
'objectivos': fields.text('Objectivos'),
#fields many2one - new tables
'attendee_ids': fields.many2many('calendar.attendee', 'radar_attendee_rel', 'event_id', 'attendee_id', 'Attendees', states={'done': [('readonly', True)]}),
'partner_ids': fields.many2many('res.partner', 'radar_partner_rel', 'meeting_id', 'partner_id',
string='Attendees', states={'done': [('readonly', True)]}),
}
_defaults = {
'state': 'novo',
}
def create(self, cr, uid, vals, context=None):
if vals.get('id_evento') == None:
vals['id_evento'] = self.pool.get('ir.sequence').get(cr, uid, 'radar.eventos.id_evento')
return super(radar_eventos, self).create(cr, uid, vals, context)
def copy(self, cr, uid, id, default=None, context=None):
default.update({
'id_evento': self.pool.get('ir.sequence').get(cr, uid, 'radar.eventos.id_evento'),
})
return super(radar_eventos, self).create(cr, uid, vals, context)
radar_eventos()
mymodule/mymodule_view.xml
Eventos Form radar.eventos Eventos Tree radar.eventos Eventos Calendar radar.eventos Eventos Search radar.eventos Eventos ir.actions.act_window radar.eventos form calendar,tree,form calendar tree form
I don't understand what am I doing wrong, can you please help me ?
I made a debug and in the function _links_get the res as this :
[{'id': 1, 'name': u'Partner', 'object': u'res.partner'},
{'id': 2, 'name': u'Product', 'object': u'product.product'},
{'id': 3, 'name': u'Invoice', 'object': u'account.invoice'},
{'id': 4, 'name': u'Voucher', 'object': u'account.voucher'},
{'id': 5, 'name': u'Sales Order', 'object': u'sale.order'},
{'id': 6, 'name': u'Event', 'object': u'calendar.event'},
{'id': 7, 'name': u'Meeting', 'object': u'crm.meeting'},
{'id': 8, 'name': u'Serial Number', 'object': u'stock.production.lot'},
{'id': 9, 'name': u'Purchase Order', 'object': u'purchase.order'},
{'id': 10, 'name': u'Project', 'object': u'project.project'},
{'id': 11, 'name': u'Project task', 'object': u'project.task'}]
I think that I'm getting the error above because my module isn't in this list.
I created my inherit with another name (radar.eventos) because I don't wanted to change the calendar of other modules, I wanted to keep the original in the other modules of Openerp and create a new one with new tables to my new module.
↧