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

Make readonly start_date, end_date from sale order view

Subscriure's

Get notified when there's activity on this post

This question has been flagged
viewsreadonlysale.order.form
2 Respostes
1322 Vistes
Avatar
Vikas Maharana

Hi All,

I want to make  start_date, end_date readonly from the sale order view.

so I tried the below approach.



I checked with other view id's and tried to make is readonly but it is not working.
please help on this.

0
Avatar
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,


Try the following code.


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

    <field name="name">sale.subscription.order.form.readonly</field>

    <field name="model">sale.order</field>

    <field name="inherit_id" ref="sale_subscription.sale_subscription_primary_form_view"/>

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

        <xpath expr="//field[@name='start_date']" position="attributes">

            <attribute name="readonly">1</attribute>

        </xpath>

        <xpath expr="//field[@name='end_date']" position="attributes">

            <attribute name="readonly">1</attribute>

        </xpath>

    </field>

</record>


In the enterprise add-on, there is another view that inherits from sale_subscription.sale_subscription_order_view_form and is set as the primary view.


Hope it helps

0
Avatar
Descartar
Avatar
D Enterprise
Best Answer

Hi,

Here is update code so please try this 
<record id="sale_subscription_order_view_form_readonly" model="ir.ui.view">

    <field name="name">sale.subscription.order.form.readonly</field>

    <field name="model">sale.order</field>

    <field name="inherit_id" ref="sale_subscription.sale_subscription_order_view_form"/>

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

        <xpath expr="//field[@name='start_date']" position="attributes">

            <attribute name="readonly">1</attribute>

        </xpath>

        <xpath expr="//field[@name='end_date']" position="attributes">

            <attribute name="readonly">1</attribute>

        </xpath>

    </field>

</record>


Use xpath for reliability


other way to make filed readonly is :


<field name="start_date" readonly="1"/>

<field name="end_date" readonly="1"/>

it is make always readonly filed


I hope it is usefull

0
Avatar
Descartar
Vikas Maharana
Autor

in Odoo 18 we can do both path and using fields also.
I already tried this approach but it's no working

D Enterprise

Hii,
Check This:
Open a sale order in Odoo

Enable Developer Mode

Click the bug icon → "Edit View: Form"

Note the External ID — is it really sale_subscription.sale_subscription_order_view_form?

If not — you are patching the wrong view.
start_date and end_date are coming from another model
Use Developer Mode to check the field origin:

Hover over the field label → if it's a related field (e.g., from subscription_id.start_date), you must modify that model/view, or set readonly in the Python field definition.
Some view or module is overriding your change after yours loads
To rule this out:

Give your view a high sequence:
<field name="priority" eval="1000"/>

OR place it at the bottom of the data list in your __manifest__.py

Try This Final Setup (Full Example):

<record id="sale_order_start_end_readonly" model="ir.ui.view">
<field name="name">sale.order.readonly.start_end</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale_subscription.sale_subscription_order_view_form"/>
<field name="priority" eval="1000"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='start_date']" position="attributes">
<attribute name="readonly">1</attribute>
</xpath>
<xpath expr="//field[@name='end_date']" position="attributes">
<attribute name="readonly">1</attribute>
</xpath>
</field>
</record>
i hope it is usefull
Add this temporarily to verify:
<xpath expr="//field[@name='start_date']" position="replace">
<field name="start_date" readonly="1"/>
</xpath>

Vikas Maharana
Autor

I did this, The external id is sale.view_order_form but there is no field called start_date and end_date.
so I check the inherited views and then find it is subscription module's view and tried to change the attribute but it is not working.
I did it using python field as well but don't know what wrong with 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
Make fields readonly based for certain groups which are having default groups Solved
readonly sale.order.form Groups
Avatar
Avatar
1
de nov. 24
4254
Odoo 10 : Make a specific field of popup window only readable
views relationship readonly odoo10
Avatar
Avatar
Avatar
5
de maig 17
6262
[9.0c] Readonly m2o fields not opens in modal view like no readonly m2o
views readonly click 9.0c
Avatar
0
d’abr. 16
4237
Odoo Sales
readonly
Avatar
Avatar
1
d’oct. 24
7833
lock sales confirm
sale.order.form
Avatar
Avatar
1
d’ag. 24
1765
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