Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consulting
    • Accounting Firm
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Solar Energy Systems
    • Shoe Maker
    • Serveis de neteja
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Error saving record in model inherited from crm.meeting?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
calendarcreateinherit
1 Respondre
8157 Vistes
Avatar
Anabela Damas

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

    <record model="ir.ui.view" id="view_radar_eventos_form">
    <field name="name">Eventos Form</field>
    <field name="model">radar.eventos</field>
    <field name="inherit_id" ref="base_calendar.view_crm_meeting_form" />
    <field name="arch" type="xml">
    <xpath expr="/form/field[@name='state']" position="replace">
        <header>
        <field name="state" widget="statusbar"
            statusbar_visible="novo,agendado,emcurso,realizado,cancelado"/>
       </header>
    </xpath>

    <xpath expr="/form/sheet/div" position="after">
        <group>
        <group>
            <field name="id_evento"/>
        </group>
        <group>
            <field name="registo_id"/>
        </group>
        </group>
    </xpath>

    <xpath expr="/form/sheet/notebook/page/group/group/field[@name='categ_ids']" position="replace">
        <field name="eventotipo_ids" widget="many2many_tags" style="width: 50%%"/>
    </xpath>

    <xpath expr="/form/sheet/notebook/page/label[@for='description']" position="replace">
    </xpath>
    <xpath expr="/form/sheet/notebook/page/field[@name='description']" position="replace">
        <separator string="Descrição"/>
        <field name="description" placeholder="Descrição..."/>
        <separator string="Objectivos"/>
        <field name="objectivos" placeholder="Objectivos..."/>
    </xpath>

    <xpath expr="/form/sheet/notebook/page[@string='Invitations']" position="after">
        <page string="Ideias">
        <separator string="Informação sobre as ideias ...."/>
        <field name="ideias_id"/>
        </page>
        <page string="Acções e Tarefas">
        <separator string="Informação sobre as tarefas ...."/>
        <field name="accoes_tarefas_id"/>
        </page>
    </xpath>
    </field>
</record>

<!-- Tree View para os Eventos herdada do CRM Meeting -->

    <record model="ir.ui.view" id="view_radar_eventos_tree">
    <field name="name">Eventos Tree</field>
    <field name="model">radar.eventos</field>
    <field name="inherit_id" ref="base_calendar.view_crm_meeting_tree" />
    <field name="arch" type="xml">
    <xpath expr="/tree/field[@name='name']" position="before">
        <field name="id_evento"/>
        <field name="registo_id" string="Reg. Vigilância"/>
    </xpath>
    <xpath expr="/tree/field[@name='name']" position="after">
        <field name="eventotipo_ids"/>
        <field name="description" string="Descrição"/>
        <field name="objectivos"/>
    </xpath>
    <xpath expr="/tree/field[@name='user_id']" position="replace">
        <field name="user_id" string="Responsável"/>
    </xpath>
    <xpath expr="/tree/field[@name='state']" position="replace">
        <field name="state"/>
    </xpath>
    </field>
</record> 

<!-- Calendar View para os Eventos herdada do CRM Meeting -->
<record model="ir.ui.view" id="view_radar_eventos_calendar">
    <field name="name">Eventos Calendar</field>
    <field name="model">radar.eventos</field>
    <field name="priority" eval="2"/>
    <field name="inherit_id" ref="base_calendar.view_crm_meeting_calendar" />
    <field name="arch" type="xml">
    <xpath expr="/calendar" position="replace">
        <calendar string="Events" date_start="date" color="user_id" date_stop="date_deadline" date_delay="duration">
        <field name="name"/>
        <field name="user_id"/>
        <field name="eventotipo_ids"/>
        </calendar>
    </xpath>
    </field>
</record>

<!-- search View para os Eventos herdada do CRM Meeting -->


<record id="view_radar_eventos_search" model="ir.ui.view">
    <field name="name">Eventos Search</field>
    <field name="model">radar.eventos</field>
    <field name="inherit_id" ref="base_calendar.view_crm_meeting_search" />
    <field name="arch" type="xml">
    <xpath expr="/search/field[@name='name']" position="after">
        <field name="eventotipo_ids"/>
        <field name="id_evento"/>
        <field name="registo_id"/>
    </xpath>
    </field>
</record>

<!-- Action View para os Eventos herdada do CRM Meeting -->

<record id="action_radar_eventos" model="ir.actions.act_window">
    <field name="name">Eventos</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">radar.eventos</field>
    <field name="view_type">form</field>
    <field name="view_mode">calendar,tree,form</field>
    <field name="search_view_id" ref="view_radar_eventos_search"/> 
</record> 

<record model="ir.actions.act_window.view" id="action_radar_eventos_calendar">
    <field name="act_window_id" ref="action_radar_eventos"/>
    <field name="sequence" eval="1"/>
    <field name="view_mode">calendar</field>
    <field name="view_id" ref="view_radar_eventos_calendar"/>
</record>

<record model="ir.actions.act_window.view" id="action_radar_eventos_tree">
    <field name="act_window_id" ref="action_radar_eventos"/>
    <field name="sequence" eval="2"/>
    <field name="view_mode">tree</field>
    <field name="view_id" ref="view_radar_eventos_tree"/>
</record>

<record model="ir.actions.act_window.view" id="action_radar_eventos_form">
    <field name="act_window_id" ref="action_radar_eventos"/>
    <field name="sequence" eval="3"/>
    <field name="view_mode">form</field>
    <field name="view_id" ref="view_radar_eventos_form"/>
</record>

       <menuitem id="menu_eventos" name="Eventos" parent="menu_gestao_ideias"></menuitem>
    <menuitem id="menu_eventos_action" name="Eventos" parent="menu_eventos" action="action_radar_eventos"></menuitem>

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.

1
Avatar
Descartar
Avatar
ClueLogics Technologies Pvt. Ltd.
Best Answer

Hi

the the class name always treated a table in openERP , if you are want use same object crm.meeting then you must

change the class name crm_meeting or object name crm.meeting

so plz be careful in this part

Thanks
Sandeep

2
Avatar
Descartar
Anabela Damas
Autor

Hi, I update my question above. If I understand what you told me to do, you told me to do like this :

_name = 'crm.meeting'
_inherit = 'crm.meeting'

But I wanted to create a new object with new tables, and keep the crm.meeting original to the other modules.

I made some debug and the res in the_links_get function doesn't have my module so it isn't in the seletion of field res in calendar.attendee... Do you know how to solve this ?

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
Is it possible to choose the priority of an overload of a function ? Solved
function create inherit
Avatar
Avatar
2
de jul. 25
5112
Override create on model with no create method?
create v7 inherit
Avatar
Avatar
1
de març 15
7234
how can I find calendar edit form footer and inherit?
calendar templates inherit footer
Avatar
0
de març 21
3143
How to override a method using inherit? Solved
calendar inheritance inherit override
Avatar
Avatar
Avatar
2
de febr. 18
34334
Jalali-calendar- odoo18
calendar
Avatar
Avatar
1
de jul. 25
1494
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now