İç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

Error: ("Invalid field %r on model %r" % (e.args[0], self._name)), adding existing one2many field to another view.

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
one2manyapiv13
2 Cevaplar
11347 Görünümler
Avatar
Jan Krähling

Hello,

I'm using Odoo 13 Community Edition.


In my case I need a routing for every product.

So to assign every routing to a product I created this field in my custom module for product.template:


class ProductTemplate(models.Model):

    _inherit = ['product.template']

 

    routing_id = fields.Many2one(

        'mrp.routing', 'Arbeitsplan', compute='_compute_routing_id')


    @api.depends('routing_id')

    def _compute_routing_id(self):

        for product in self:

            product.routing_id = self.env['mrp.routing'].search([('product_id','=',product.id)])




And in mrp.routing:


class MrpRouting(models.Model):

    _inherit = ['mrp.routing']


    product_id = fields.Many2one(

        'product.template', 'Produkt', required=True)


    @api.onchange('product_id')    

    def _onchange_product_id_name(self):

        self.name = self.product_id.name


(The onchange method because I made the name field invisible in the form view.)




Now I thought I could show the operation_ids field directly in the product.template form view.


So I also added the field to product.template in my custom module like the routing_id:

class ProductTemplate(models.Model):

    _inherit = ['product.template']

 

    operation_ids = fields.One2many(

        'mrp.routing.workcenter', 'routing_id', 'Operations',

        copy=True)


And in the form view:

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

            <field name="name">product.template.product.form.mgtec</field>

            <field name="model">product.template</field>

            <field name="inherit_id" ref="product.product_template_only_form_view"/>

<field name="priority" eval="100"/>

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

<xpath expr="//page[@name='variants']" position="before">

<page string="Vorgänge" name="vorgaenge">

                        <field name="operation_ids" context="{'default_routing_id': routing_id}"/>

</page>

</xpath>

</field>

</record>




But when I want to change the operations in the product view and it opens the pop up form view from mrp.routing.workcenter to change the operations in the routing, I get an error and its like a never ending story like it needs every field from product.template/product.product in mrp.routing.


I searched for a method that could cause the errors, but i dont find any solution.


Thanks in advance.


The full error code:


Odoo Server Error
Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\models.py", line 5089, in _update_cache
    field_values = [(fields[name], value) for name, value in values.items()]
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\models.py", line 5089, in <listcomp>
    field_values = [(fields[name], value) for name, value in values.items()]
KeyError: 'sale_delay'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\http.py", line 619, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\http.py", line 309, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\tools\pycompat.py", line 14, in reraise
    raise value
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\http.py", line 664, in dispatch
    result = self._call_function(**self.params)
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\http.py", line 345, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\service\model.py", line 93, in wrapper
    return f(dbname, *args, **kwargs)
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\http.py", line 338, in checked_call
    result = self.endpoint(*a, **kw)
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\http.py", line 909, in __call__
    return self.method(*args, **kw)
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\http.py", line 510, in response_wrap
    response = f(*args, **kw)
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\addons\web\controllers\main.py", line 1320, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\addons\web\controllers\main.py", line 1312, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\api.py", line 395, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\api.py", line 382, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\models.py", line 6030, in onchange
    record._update_cache(changed_values, validate=False)
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\models.py", line 5095, in _update_cache
    cache.set(self, field, field.convert_to_cache(value, self, validate))
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\fields.py", line 2393, in convert_to_cache
    id_ = record.env[self.comodel_name].new(value).id
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\models.py", line 5432, in new
    record._update_cache(values, validate=False)
  File "C:\Program Files (x86)\Odoo 13.0\server\odoo\models.py", line 5091, in _update_cache
    raise ValueError("Invalid field %r on model %r" % (e.args[0], self._name))
ValueError: Invalid field 'sale_delay' on model 'mrp.routing'





0
Avatar
Vazgeç
Mostafa Barmshory

Did you fix this error?

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

Try to create inline tree/form view for operation_ids field:

<field name="operation_ids" context="{'default_routing_id': routing_id}">
<tree>
<field name=""/>
</tree>
<form>
<field name=""/>
</form>
</field>


2
Avatar
Vazgeç
Jan Krähling
Üretici

Did not work, I'm still getting the same errors.

Avatar
Muneeb Alalfi
En İyi Yanıt

Any Idea guys ?!!
Please

0
Avatar
Vazgeç
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
İlgili Gönderiler Cevaplar Görünümler Aktivite
Odoo API UID not working v13
api v13
Avatar
0
Oca 20
4673
one2many update() vs self.env[]
one2many create api
Avatar
0
Tem 21
4543
Hide field from the create view of one2many
one2many popup v13
Avatar
Avatar
1
Eyl 20
3618
How can I get a recordset with the records from a one2many relationship? v13
one2many recordset v13
Avatar
Avatar
1
Ara 19
5674
fetch related models via web API
one2many api xmlrpc
Avatar
0
Ağu 16
4679
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