Skip to Content
Odoo Menu
  • Log ind
  • Prøv gratis
  • Apps
    Økonomi
    • Bogføring
    • Fakturering
    • Udgifter
    • Regneark (BI)
    • Dokumenter
    • e-Signatur
    Salg
    • CRM
    • Salg
    • POS Butik
    • POS Restaurant
    • Abonnementer
    • Udlejning
    Hjemmeside
    • Hjemmesidebygger
    • e-Handel
    • Blog
    • Forum
    • LiveChat
    • e-Læring
    Forsyningskæde
    • Lagerbeholdning
    • Produktion
    • PLM
    • Indkøb
    • Vedligeholdelse
    • Kvalitet
    HR
    • Medarbejdere
    • Rekruttering
    • Fravær
    • Medarbejdersamtaler
    • Anbefalinger
    • Flåde
    Marketing
    • Markedsføring på sociale medier
    • E-mailmarketing
    • SMS-marketing
    • Arrangementer
    • Automatiseret marketing
    • Spørgeundersøgelser
    Tjenester
    • Projekt
    • Timesedler
    • Udkørende Service
    • Kundeservice
    • Planlægning
    • Aftaler
    Produktivitet
    • Dialog
    • Godkendelser
    • IoT
    • VoIP
    • Vidensdeling
    • WhatsApp
    Tredjepartsapps Odoo Studio Odoo Cloud-platform
  • Brancher
    Detailhandel
    • Boghandel
    • Tøjforretning
    • Møbelforretning
    • Dagligvarebutik
    • Byggemarked
    • Legetøjsforretning
    Mad og værtsskab
    • Bar og pub
    • Restaurant
    • Fastfood
    • Gæstehus
    • Drikkevareforhandler
    • Hotel
    Ejendom
    • Ejendomsmægler
    • Arkitektfirma
    • Byggeri
    • Ejendomsadministration
    • Havearbejde
    • Boligejerforening
    Rådgivning
    • Regnskabsfirma
    • Odoo-partner
    • Marketingbureau
    • Advokatfirma
    • Rekruttering
    • Audit & certificering
    Produktion
    • Tekstil
    • Metal
    • Møbler
    • Fødevareproduktion
    • Bryggeri
    • Firmagave
    Heldbred & Fitness
    • Sportsklub
    • Optiker
    • Fitnesscenter
    • Kosmetolog
    • Apotek
    • Frisør
    Håndværk
    • Handyman
    • IT-hardware og support
    • Solenergisystemer
    • Skomager
    • Rengøringsservicer
    • VVS- og ventilationsservice
    Andet
    • Nonprofitorganisation
    • Miljøagentur
    • Udlejning af billboards
    • Fotografi
    • Cykeludlejning
    • Softwareforhandler
    Gennemse alle brancher
  • Community
    Få mere at vide
    • Tutorials
    • Dokumentation
    • Certificeringer
    • Oplæring
    • Blog
    • Podcast
    Bliv klogere
    • Udannelselsesprogram
    • Scale Up!-virksomhedsspillet
    • Besøg Odoo
    Få softwaren
    • Download
    • Sammenlign versioner
    • Udgaver
    Samarbejde
    • Github
    • Forum
    • Arrangementer
    • Oversættelser
    • Bliv partner
    • Tjenester til partnere
    • Registrér dit regnskabsfirma
    Modtag tjenester
    • Find en partner
    • Find en bogholder
    • Kontakt en rådgiver
    • Implementeringstjenester
    • Kundereferencer
    • Support
    • Opgraderinger
    Github Youtube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Få en demo
  • Prissætning
  • Hjælp

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

  • CRM
  • e-Commerce
  • Bogføring
  • Lager
  • PoS
  • Projekt
  • MRP
All apps
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Du skal være registreret for at interagere med fællesskabet.
All Posts People Emblemer
Tags (View all)
odoo accounting v14 pos v15
Om dette forum
Hjælp

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

Tilmeld

Få besked, når der er aktivitet på dette indlæg

Dette spørgsmål er blevet anmeldt
2 Besvarelser
4782 Visninger
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
Kassér
Avatar
Sunny Sheth
Bedste svar

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
Kassér
Hummingbiz
Forfatter

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
Forfatter

I added the whole record to this thread.

Avatar
Hummingbiz
Forfatter Bedste svar

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
Kassér
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
Forfatter

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
Forfatter

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

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

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

Tilmeld dig
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Oversættelser
Tjenester
  • Odoo.sh-hosting
  • Support
  • Opgradere
  • Individuelt tilpasset udvikling
  • Uddannelse
  • Find en bogholder
  • Find en partner
  • Bliv partner
Om os
  • Vores virksomhed
  • Brandaktiver
  • Kontakt os
  • Stillinger
  • Arrangementer
  • Podcast
  • Blog
  • Kunder
  • Juridiske dokumenter • Privatlivspolitik
  • Sikkerhedspolitik
الْعَرَبيّة 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 er en samling open source-forretningsapps, der dækker alle dine virksomhedsbehov – lige fra CRM, e-handel og bogføring til lagerstyring, POS, projektledelse og meget mere.

Det unikke ved Odoo er, at systemet både er brugervenligt og fuldt integreret.

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