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
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • 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
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • 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

add sequence to an existing module

Subscriure's

Get notified when there's activity on this post

This question has been flagged
sequenceeventOdoo13.0
2 Respostes
5385 Vistes
Avatar
himaOdoo

i declared a new sequence field  in a relation of one2many of an existing module (event.event) 

like this 

    class event_trajet_line(models.Model):

    _inherit = "event.event"

    trajet = fields.One2many('event.trajet','trajet_id', string="Trajets")


    class event_trajets(models.Model):

    _name = "event.trajet"

    _description = "Trajet de la mission"

    name_id = fields.Char(string='Trajet Reference', required=True, copy=False, readonly=True, index=True, default=lambda self: _('New'))


    @api.model 

    def create(self, vals):

        if vals.get('name_id', _('New')) == _('New'):

            vals['name_id'] = self.env['ir.sequence'].next_by_code('trajet.order') or _('New')

        result = super(event_trajets, self).create(vals)

        return result 


and i declared then the sequence code and its suffix, prefix in a new xml file on a new directory data 

and i call the name of the directory to the _manifest_.py 

and the field works just fine, 

but i need to add it to the field 'name' of the form id "event.view_event_form" 
is there any solution to aproche this ? 

NP i tried this xml structure but it dosen work 


    <xpath expr="/form/sheet/div[@class='oe_title']" position="replace">

                    <div class="oe_title">

                            <label for="name" class="oe_edit_only"/>

                            <h1><field name="name" placeholder="Event Name"/><field name="trajet">          <field name="name_id"/></field></h1>

                            <field name="is_online" groups="base.group_no_one"/>

                            <label for="is_online" string="Online" groups="base.group_no_one"/>

                        </div>

                    </xpath>

0
Avatar
Descartar
Avatar
himaOdoo
Autor Best Answer

Hi Ibrahim, thanks for your answer 

I managed that by declaring the field as related

0
Avatar
Descartar
Avatar
Ibrahim Boudmir
Best Answer

Hi, 
If i understand well what you want to achieve, name_id should be the name that appears in form view at the breadcrumbs.
For example when you click on a record, you ll get : Sale order/  SO0001

If i'm right, then you shoud know that Odoo considers the field *name* by default. If you want other field to be considered, then you need to add _rec_name = "name_id" in your case. 

Note : Since your model is specific, i suggest that you replace *name_id*
with simply *name* for 2 reasons : 
1- with name, you don't need to add _rec_name. It is handled automatically 
2- name_id : For best practices, it should represent Many2one fields not a Char. 

Hope this helps. Upvote if it does.
Regards.

0
Avatar
Descartar
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
diffrent sequences based on a field's value condition
sequence Odoo13.0
Avatar
1
de jul. 23
4962
declared a sequence field in an exsisting module Solved
sequence Odoo13.0
Avatar
Avatar
1
de des. 22
3124
Bulk import error (Events)
event
Avatar
0
d’oct. 24
1942
set multiple organizer for event module
event
Avatar
0
de juny 24
2043
Odoo 13. Don't close a wizard when Click a button Solved
Odoo13.0
Avatar
Avatar
Avatar
Avatar
4
de maig 24
14229
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