Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Error saving record in model inherited from crm.meeting?

Naroči se

Get notified when there's activity on this post

This question has been flagged
calendarcreateinherit
1 Odgovori
8144 Prikazi
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
Opusti
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
Opusti
Anabela Damas
Avtor

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!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Is it possible to choose the priority of an overload of a function ? Solved
function create inherit
Avatar
Avatar
2
jul. 25
5104
Override create on model with no create method?
create v7 inherit
Avatar
Avatar
1
mar. 15
7225
how can I find calendar edit form footer and inherit?
calendar templates inherit footer
Avatar
0
mar. 21
3132
How to override a method using inherit? Solved
calendar inheritance inherit override
Avatar
Avatar
Avatar
2
feb. 18
34323
Jalali-calendar- odoo18
calendar
Avatar
Avatar
1
jul. 25
1464
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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