Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Jídlo a pohostinství
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Penzion
    • Distributor nápojů
    • Hotel
    Nemovitost
    • Realitní kancelář
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Poradenství
    • Účetní firma
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textil
    • Kov
    • Nábytek
    • Jídlo
    • Pivovar
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Transakce
    • Údržbář
    • Podpora IT & hardware
    • Systémy solární energie
    • Výrobce obuvi
    • Úklidové služby
    • Služby HVAC
    Ostatní
    • Nezisková organizace
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Procházet všechna odvětví
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Služby pro partnery
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Prevent record creation in computed One2Many or Mayn2Many in Tree/Kanban field

Odebírat

Get notified when there's activity on this post

This question has been flagged
readonlymany2manyinversecomputed
2 Odpovědi
3166 Zobrazení
Avatar
Torsten

Hi,

I created a computed Many2Many field. To make it writable, I used the inverted argument to define a reverse function like so:

document_ids = fields.Many2many(..., compute='_compute_document_ids', inverse='_set_document_ids')
def _compute_document_ids(self): ​...
def _set_document_ids(self): ​...

Then I created a view which makes use of this field with a Kanban or Tree element. So far everything works fine, I can read, create and delete documents.


Now I want to have the Kanban not to be able to create or delete records, only to be able to edit records when opening them. So I tried the following attemps, none of them works:

### 1:
field name="document_ids" mode="kanban" options="{'no_create': True}" /> 

### 2:
field name="document_ids" mode="kanban" create="0" />
### 3:
field name="document_ids">
​tree create="0">
​ ...


No matter if I use Kanban/Tree here, I still have the "add" or "add a line" option. When I make the field readonly, then the add/delete options disappear. But when I open the record details, I also cannot edit the (because read only).


What am I missing? I need to have a computed field for showing related Many2Many records, I do not want to be able to add/remove records from the parent record but be able to edit them in detail view by clicking on them.

THX



0
Avatar
Zrušit
Avatar
Nomadoo
Nejlepší odpověď

To achieve your goal of making the Kanban view not able to create or delete records, but still be able to edit them when opening, you can use a combination of the following approaches:


    Make the Field Readonly in Kanban:

    Set the readonly attribute for the document_ids field in the Kanban view to prevent creating or deleting records directly from the Kanban view.


Use a Separate Form View for Editing:

Create a separate form view for editing the records and use it when clicking on a record in the Kanban view. This allows you to control the edit behavior independently.

Then, define a form view for the model where you can customize the behavior as needed.


When clicking on a record in the Kanban view, Odoo will open the form view specified in the model.


Use a Related Field for Display:

If you only need to display related records in the Kanban view and do not require direct editing, you can use a related field for display purposes in the Kanban view.


Then, define a related field in your model. 


    display_document_ids = fields.Many2many(related='document_ids')


    Note: This approach will only allow displaying related records in the Kanban view without the ability to edit them directly.


Choose the approach that best fits your requirements. If you need to customize the editing behavior, creating a separate form view for editing is a flexible solution.

1
Avatar
Zrušit
Avatar
Torsten
Autor Nejlepší odpověď

Hi. Thanks for your answer. 

According to it I created another view for editing the detail data (in my case Document). Odoo also uses this view correctly to display the detail date and I am also able to edit the record with this view.

But as soon as I make the Many2Many / One2Many field *readonly* in the parent view then the detail data view is also *locked* so that I cannot edit data anymore.

The same result also if I replace the Kanbank Many2Many with a tree.


0
Avatar
Zrušit
Enjoying the discussion? Don't just read, join in!

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

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Computed field value stored even when remove line Vyřešeno
many2many computed
Avatar
Avatar
Avatar
2
dub 24
4750
Computed many2many field dependencies in Odoo 10
many2many computed
Avatar
1
pro 16
8790
How do I make a button invisible if field (m2m) is False? Vyřešeno
many2many computed odoo10
Avatar
Avatar
4
úno 20
5141
many2many, records/rows readonly
readonly many2many records
Avatar
Avatar
2
bře 15
10920
Inverse Function ind Odoo 9
treeview inverse odoo9 computed
Avatar
2
čvc 16
519
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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