İçereği Atla
Odoo Menü
  • Portal
  • Ücretsiz deneyin
  • Uygulamalar
    Finans
    • Muhasebe
    • Faturalama
    • Masraf Yönetimi
    • Elektronik Çizelge (BI)
    • Belgeler
    • İmza
    Satış
    • Müşteri İlişkileri Yönetimi (CRM)
    • Satış
    • Satış Noktası Mağaza
    • Satış Noktası Restoran
    • Abonelikler
    • Kiralama
    Web Sitesi
    • Web Sitesi Oluşturucu
    • eTicaret
    • Blog
    • Forum
    • Canlı Sohbet
    • eÖğrenme
    Tedarik Zinciri
    • Envanter
    • Üretim
    • Ürün Yaşam Döngüsü Yönetimi
    • Satın Alma
    • Bakım
    • Kalite
    İnsan Kaynakları
    • Çalışanlar
    • İşe Alım
    • İzin
    • Değerlendirme
    • Referans
    • Filo Yönetimi
    Pazarlama
    • Sosyal Medyada Pazarlama
    • E-posta ile Pazarlama
    • SMS ile Pazarlama
    • Etkinlikler
    • Pazarlama Otomasyonu
    • Anket
    Hizmetler
    • Proje Yönetimi
    • Çalışma Çizelgeleri
    • Saha Hizmeti
    • Yardım Masası
    • Planlama
    • Randevular
    Verimlilik
    • Sohbet
    • Onay
    • Nesnelerin İnterneti
    • VoIP
    • Bilgi Bankası
    • WhatsApp
    Üçüncü taraf uygulamalar Odoo Stüdyo Odoo Bulut Platformu
  • Sektörler
    Perakende satış
    • Kitapçı
    • Giyim Mağazası
    • Mobilya Mağazası
    • Gıda Marketi
    • Hırdavat Dükkanı
    • Oyuncak Dükkanı
    Gıda ve Konaklama
    • Bar ve Pub
    • Restoran
    • Fast Food Restoranı
    • Konuk Evi
    • İçecek Distribütörü
    • Otel
    Gayrimenkul
    • Emlak Acentesi
    • Mimarlık Firması
    • İnşaat
    • Emlak Yönetimi
    • Bahçe Tasarımı
    • Mülk Sahipleri Derneği
    Uzmanlık
    • Muhasebe Firması
    • Odoo Partner
    • Pazarlama Ajansı
    • Hukuk Firması
    • Yetenek Kazanımı
    • Denetim ve Belgelendirme
    Üretim
    • Tekstil
    • Metal
    • Mobilyalar
    • Gıda
    • Bira fabrikası
    • Kurumsal Hediye
    Sağlık ve Spor
    • Spor Kulübü
    • Optik Mağazası
    • Fitness Merkezi
    • Sağlıklı Yaşam Merkezi
    • Eczane
    • Kuaför Salonu
    Ticaret
    • Tamirci
    • BT Donanım & Destek
    • Güneş Enerjisi Sistemleri
    • Ayakkabı İmalatçısı
    • Temizlik Hizmetleri
    • HVAC Hizmetleri
    Diğerleri
    • Kar Amacı Gütmeyen Kuruluş
    • Çevre Ajansı
    • Reklam Panosu Kiralama
    • Fotoğrafçılık
    • Bisiklet Kiralama
    • Yazılım Bayisi
    Tüm Sektörlere Göz Atın
  • Topluluk
    Öğrenim
    • Eğitim Araçları
    • Dokümantasyon
    • Sertifikasyonlar
    • Eğitim Etkinlikleri
    • Blog
    • Podcast
    Eğitim ve Gelişim
    • Eğitim Programı
    • Scale Up! İşletme Oyunu
    • Odoo'yu Ziyaret Edin
    Yazılım
    • İndirin
    • Sürümleri Kıyaslayın
    • Sürümler
    İş Birliği
    • Github
    • Forum
    • Etkinlikler
    • Çeviriler
    • Partner Olun
    • Partnerler için Hizmetler
    • Muhasebe Firmanızı Kaydettirin
    Hizmetler
    • Partner Bulun
    • Muhasebeci Bulun
    • Bir danışmanla görüşün
    • Kurulum Hizmetleri
    • Müşteri Referansları
    • Destek
    • Sürüm Yükseltme
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Demo randevusu alın
  • Fiyatlandırma
  • Yardım

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

  • Müşteri İlişkileri Yönetimi
  • e-Commerce
  • Muhasebe
  • Envanter
  • PoS
  • Proje Yönetimi
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiketler (View all)
odoo accounting v14 pos v15
About this forum
Yardım

Odoo project task tags domain

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
1 Cevapla
4805 Görünümler
Avatar
Willmore BattleShipNet

Project task can have many tags. Now when the user creates a task he can choose from all tags. But he wants to be able to choose tags only from those tags that are used for that project. 


What domain rule should I have on the field "tag" (on the form) to let user when creating new project task to see (and eventually to choose) only those tags that are used in the project the user creates task for?

2
Avatar
Vazgeç
Avatar
Sudhir Arya (ERP Harbor Consulting Services)
En İyi Yanıt

You can do this from the onchange of the project and return the domain.

Ex:

api.onchange('project_id')
def onchange_project(self):
    tag_ids = []
    if self.project_id:
        for task in self.project_id.task_ids:
            tag_ids += task.tag_ids.ids
    return {'domain': {'tag_ids': [('id', 'in', tag_ids)]}}
Sudhir Arya
ERP Harbor Consulting Services
Skype:sudhir@erpharbor.com
Website: http://www.erpharbor.com
6
Avatar
Vazgeç
Willmore BattleShipNet
Üretici

Thank you. I tried but got error. What can be wrong with that approach?

I have the following code

class InheritedProjectTask(models.Model):

"""docstring"""

_inherit = 'project.task'

@api.onchange('project_id')

def onchange_project(self):

"""docstring"""

tag_ids = []

if self.project_id:

tag_ids += [task.tag_ids.ids for task in self.project_id.task_ids]

return {'domain': {'tag_ids': [('id', 'in', tag_ids)]}}

With this code installed. I open a Project and click "Create" to open a Task creation form (form for new "project.task" model's object). On that form I click on drop-down "Tags" to list possible "Tags" for the project ("possible tags for the project" are all tags that are used on any of the task of the project the task is created for). And then I get error:

> res = self._obj.execute(query, params)

>

> TypeError: not all arguments converted during string formatting

on the console I see the error

> INFO DB odoo.sql_db: bad query: SELECT "project_tags".id FROM "project_tags" WHERE (("project_tags"."id" in (%s,%s,%s,%s,%s,%s,%s,%s)) AND (("project_tags"."id" not in (%s)) OR "project_tags"."id" IS NULL)) ORDER BY "project_tags"."id" limit 8

2018-08-03 10:40:20,476 12978 ERROR DB odoo.http: Exception during JSON request handling.

What did I do wrong in the code?

Sudhir Arya (ERP Harbor Consulting Services)

See my updated code in answer. It should work now.

Willmore BattleShipNet
Üretici

Thank You very much for the proposed solution! I would not come to that in near time! :) But after applying it I can see on the "Tags" field (in debug mode when I hover over "Tags" drop down) that effective Domain is id, in,4,5,6,7,8,9,10,11,12,13,14,18,19,20,22,23,24,25,26,27,28,5,4,5,35 . And that is the problem: it doesn't really take tags from just this project's tasks. Tags from other projetcs tasks appear too which is unwanted. How this can be that all tags are included not just those from tasks of the current project?

Sudhir Arya (ERP Harbor Consulting Services)

It will only show all the tags which are used in the tasks of selected project.

Willmore BattleShipNet
Üretici

It is really strange. I do the following: 1) Open "Projects". 2) Click "Create" 3) Create a project with a name "Really new project". 4) I open project "Really new project" tasks window. This window is empty as we didn't create any tasks yet. 5) I click "Create" and a form to create new task appears. 6) I enter task title "This is really new task in a really new project" . 7) In the field "Tags" I click with mouse and drop-down appears with text "No results to show" and I enter "1234657890" (this tag name is never used anywhere so it's completely new tag). I click "Create 1234657890" for this tag to be created and it appears in "Tags" field. So far so good. 8) I press "Save" on the task so that the new record is saved. Task is saved and on the form appears a button "Edit". 9) without reloading a page I click "Edit" and click on the "Tags" for drop-down to appear. Drop-down appears and it contains text "No results to show" (this is good because there are no more tags in that project to be selected because we have not created any other tags). I type "qqq" in "Tags" and create this tag, then on the task form I press "Save" to save that task. Then I navigate to any other project (let's say I navigate to **Another project**) and open one of project's tasks just to see it. And then I navigate to the project "Really new project" and press "Edit" and click "Tags" and I see all the tags appear from other project's. Why?

What I have noticed. If I go to any project (project1) and open a task of it then navigate to another project (project2) and click "Create" to create new task for the project2 then on "Tags" there will be only tags from project1 tasks (as we want) it seems that domain works. BUT if I go to any project (project1) and open a task of it then navigate to another project (project2) and click "Edit" to edit a task (of the project2) then on "Tags" there will be ALL TAGS (as if domain was ineffective). How is that possible?

I have noticed (from looking at the console output) that method onchange is called only when I click "Create" on the task. So I have troubles when I want to edit task because onchange is not called and all tags show up :(.

Is there anything else I could add besides onchange to make domain apply all the time.

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

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

Üye Ol
Topluluk
  • Eğitim Araçları
  • Dokümantasyon
  • Forum
Açık Kaynak
  • İndirin
  • Github
  • Runbot
  • Çeviriler
Hizmetler
  • Odoo.sh Hosting
  • Destek
  • Sürüm Yükseltme
  • Özel Geliştirmeler
  • Eğitim
  • Muhasebeci Bulun
  • Partner Bulun
  • Partner Olun
Hakkında
  • Şirketimiz
  • Pazarlama Gereçleri
  • İletişim
  • Kariyer
  • Etkinlikler
  • Podcast
  • Blog
  • Müşteriler
  • Hukuki • Gizlilik
  • Güvenlik
الْعَرَبيّة 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, müşteri ilişkileri yönetimi, eTicaret, muhasebe, envanter, satış noktası, proje yönetimi gibi şirketinizin tüm ihtiyaçlarını karşılayan bir açık kaynak işletme uygulamaları paketidir.

Odoo’nun eşsiz değer önermesi, aynı anda hem kullanımının çok kolay olup hem de tamamen entegre olmasıdır.

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