Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

How do I suppress "Create and Edit" option on state field in extended form?

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
2 Respuestas
4771 Vistas
Avatar
Hummingbiz

I have a problem with some of my users adding spurious state entries because they don't navigate the state field properly and, rather than selecting their desired state, they end up creating a new record in res_country_state, often with improper data.

I would like to restrict this behavior by suppressing the "Create and Edit" option on the widget.  Setting options no_create and/or no_quick_create are said to suppress the option for a many2one widget, but do not have any apparent effect on the o_address_state widget.

These changes are on a form extended from the base product leads form.

We are running Odoo Enterprise v13.x.

Thanks in advance.

0
Avatar
Descartar
Avatar
Sunny Sheth
Mejor respuesta

Hi,

You can do it easily in your ODOO Standard View as of now or do it via a custom module for no_create on the state field. 

Add option ==> "no_create": True




Now you get the desired result.




Thanks & Regards,

Sunny Sheth

0
Avatar
Descartar
Hummingbiz
Autor

I confirmed that your solution -- editing the form online -- works. I have extended the CRM module to add some fields to the leads form, and that is where I am trying to effect this new behavior.

I have replaced the base state_id field by this:

<xpath expr="//group/group[1]/div/field[@name='state_id']" position="replace">

<field name="state_id" class="o_address_state" placeholder="State"

options="{'no_open': True, 'no_create': True}"/>

</xpath>

This doesn't seem to effect the change. I confirmed that this addresses the correct field by making it invisible temporarily.

Sunny Sheth

Can you put your Whole View / Record instead of the only XPath?

and add screenshot if possible

Thanks

Hummingbiz
Autor

I added the whole record to this thread.

Avatar
Hummingbiz
Autor Mejor respuesta

Here is the entire record:

<record id="crm_lead_view_form_ext" model="ir.ui.view">
<field name="name">crm.lead.form.ext</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_lead_view_form"/>
<field name="arch" type="xml">
<xpath expr="//h2" position="replace"/>
<button name="%(crm.crm_lead_lost_action)d" position="attributes">
<attribute name="attrs">{'invisible': [('active', '=', False)]}
</attribute>
</button>
<button name="%(crm.action_crm_lead2opportunity_partner)d" position="after">
<button name="%(crm.crm_lead_lost_action)d" position="move"/>
</button>
<button name="action_set_lost" position="replace">
<button name="action_set_lost" string="Mark as Lost" type="object" invisible="1"/>
</button>
<button name="action_set_lost" position="after">
<button name="%(action_crm_lead2irslogics)d" string="Submit Case to IRS Logics"
type="action"
help="Submit Case to IRS Logics"
class="oe_highlight"
attrs="{'invisible': ['|', ('active', '=', False), ('irs_logics_case_id', '!=', False)]}"/>
</button>
<xpath expr="//group/group[1]/field[@name='partner_id']" position="before">
<field name="id_string" string="Lead ID" readonly="1"/>
</xpath>
<xpath expr="//group/group[2]/field[@name='partner_id']" position="before">
<field name="id_string" string="Lead ID" readonly="1"/>
</xpath>
<xpath expr="//field[@name='function']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='email_cc']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='website']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='lang_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='team_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//group/group[4]/field[@name='tag_ids']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//group/group[6]/field[@name='tag_ids']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='user_id']" position="replace">
<field name="user_id"
string="Settlement Officer"
domain="[('share', '=', False)]"
context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'sales_team.group_sale_salesman_all_leads'], 'team_id': team_id}"/>
</xpath>
<xpath expr="//field[@name='user_id']" position="replace">
<field name="user_id"
string="Settlement Officer"
domain="[('share', '=', False)]"
context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'sales_team.group_sale_salesman_all_leads'], 'team_id': team_id}"/>
</xpath>
<xpath expr="//field[@name='user_id']" position="before">
<field name="contact_first_name" string="Contact First Name"/>
<field name="contact_last_name" string="Contact Last Name"/>
<field name="last4"/>
<field name="opening_salesperson_user_id" required="True"/>
</xpath>
<xpath expr="//group/group[4]/field[@name='priority']" position="before">
<field name="irs_logics_case_id" readonly="1"/>
<field name="irs_logics_case_status" readonly="1"/>
<field name="irs_logics_endpoint" readonly="1"/>
</xpath>
<xpath expr="//group/group[1]/div/field[@name='state_id']" position="replace">
<field name="state_id" class="o_address_state" placeholder="State"
options="{'no_open': True, 'no_create': True}"/>
</xpath>
<xpath expr="//group/group[6]/field[@name='priority']" position="before">
<field name="irs_logics_case_id" readonly="1"/>
<field name="irs_logics_case_status" readonly="1"/>
<field name="irs_logics_endpoint" readonly="1"/>
</xpath>
<xpath expr="//page[1]" position="replace">
<page name="description" string="Third Base">
<field name="description" placeholder="Enter Third Base notes..."/>
</page>
</xpath>
<xpath expr="//page[@name='extra']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//page[@name='extra']" position="before">
<page name="tax_lien" string="Tax Liens">
<field name="tax_liens">
<tree create="true" delete="true">
<field name="plaintiff"/>
<field name="company_currency" invisible="1"/>
<field name="amount" string="Amount" class="oe_inline" widget='monetary'
options="{'currency_field': 'company_currency'}"/>
<field name="filing_date"/>
<field name="state_filed"/>
<field name="county"/>
<control>
<create name="add_lien_control" string="Add a lien"/>
</control>
</tree>
</field>
</page>
<page name="financial_data" string="Snap Financials">
<group string="Firms">
<group colspan="4">
<field name="customer_has_retained_other_firm"
string="Has customer retained another firm?" widget="boolean_toggle"/>
<field name="customer_has_retained_other_firm_notes" string="Notes"/>
</group>
</group>
<group string="Employment">
<group colspan="4">
<field name="employment_status" string="Employment Status"/>
<field name="employer"/>
<field name="employment_notes" string="Notes"/>
</group>
</group>
<group string="Income">
<group colspan="4">
<div class="o_row">
<field name="company_currency" invisible="1"/>
<field name="income" string="Income" class="oe_inline" widget='monetary'
options="{'currency_field': 'company_currency'}"/>
<span class="mr-1">Per</span>
<field name="income_frequency"/>
<span class="mr-1">Paid</span>
<field name="pay_period"/>
</div>
</group>
<group colspan="4">
<field name="income_notes" string="Notes" colspan="4"
placeholder="Enter details regarding customer's income here."/>
</group>
</group>
<group>
<group string="Assets" name="assets" colspan="4">
<field name="assets" nolabel="1"
placeholder="Enter details regarding customer's assets here."/>
</group>
</group>
<group>
<group string="Bank Data" name="bank_data" colspan="4">
<field name="bank_data" nolabel="1"
placeholder="Enter details regarding customer's bank accounts here."/>
</group>
</group>
<group>
<group string="Credit Score" colspan="4">
<group colspan="2">
<field name="credit_score"/>
</group>
<group colspan="4">
<field name="credit_score_notes" string="Notes"
placeholder="Enter details regarding customer's credit here."/>
</group>
</group>
</group>
</page>
<page name="closer_notes" string="Closer Notes">
<field name="closer_notes" placeholder="Add closer notes..."/>
</page>
<page name="tax_data" string="Tax Data">
<group string="General">
<group>
<field name="contact_first_name"/>
<field name="contact_last_name"/>
</group>
<group>
<field name="file_name"/>
<field name="list_date"/>
</group>
</group>
<group string="LexisNexis">
<group>
<field name="entity_type"/>
<field name="rmsid"/>
</group>
<group>
<field name="orig_dept"/>
<field name="age_range"/>
</group>
</group>
<group string="FLA">
<group>
<field name="ssn_fin"/>
</group>
</group>
<group string="ATYPE">
<group>
<field name="crrt"/>
<field name="dpc"/>
<field name="barcode"/>
<field name="gender"/>
<field name="individual"/>
<field name="business"/>
<field name="federal_tax"/>
<field name="state_tax"/>
</group>
<group>
<field name="ul_month"/>
<field name="rdi"/>
<field name="ran"/>
</group>
</group>
</page>
</xpath>
<!-- move third base (aka description aka page[1]) after closer notes -->
<xpath expr="//page[@name='closer_notes']" position="after">
<xpath expr="//page[1]" position="move"/>
</xpath>
</field>
</record>

0
Avatar
Descartar
Sunny Sheth

Hi,

Please try with the below code for the state_id field

<field name="state_id" class="o_address_state" placeholder="State"

options="{'no_open': True, 'no_create': True, 'no_create_edit': True}"/>

Thanks

Hummingbiz
Autor

Thanks for looking at this. I tried your suggestion -- options="{'no_open': True, 'no_create': True, 'no_create_edit': True}"/> -- but this did not change the results.

Hummingbiz
Autor

To be clear, I tried this as a replacement in my extended view (shown above).

¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

Sitio web hecho con

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