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

The operation cannot be completed, probably due to the following: - deletion: you may be trying to delete a record while other records still reference it - creation/update: a mandatory field is not correctly set [object with reference: product_id - product.id]

Abone Ol

Get notified when there's activity on this post

Bu soru işaretlendi
odoo10
5 Cevaplar
15245 Görünümler
Avatar
kaiserkos

Hi, I am working on a BOM (Bill of Materials) creator, but currently stuck at this error:

The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set

[object with reference: product_id - product.id]

Error Log:

2019-06-28 02:57:40,220 9396 INFO 20190620 odoo.sql_db: bad query: INSERT INTO "mrp_production" ("id", "building", "procurement_group_id", "propagate", "user_id", "contract_id", "picking_type_id", "product_uom_id", "company_id", "priority", "date_planned_finished", "state", "product_id", "location_dest_id", "product_qty", "bom_id", "date_planned_start", "atlas_id", "partner_id", "location_src_id", "name", "create_uid", "write_uid", "create_date", "write_date") VALUES(nextval('mrp_production_id_seq'), NULL, 546, false, 1, 7, 6, NULL, 1, '1', '2019-06-28 02:57:40', 'confirmed', NULL, 15, '8.000000', NULL, '2019-06-28 02:57:40', 23, NULL, 28, 'MO/00528', 1, 1, (now() at time zone 'UTC'), (now() at time zone 'UTC')) RETURNING id ​

Does this means my product_id - product.id value is empty? If so, how do I set a value in its field? 

Much appreciated for any assistance.

**I am on Odoo 10**

0
Avatar
Vazgeç
kaiserkos
Üretici

Hi Hoang Tran, thanks for the reply, though I'm not exactly sure how to do that.

Avatar
iuv.li
En İyi Yanıt

Hello, you can check the value of product_id. Perhaps product_id is a required value, but it is not read or not filled in in the background

0
Avatar
Vazgeç
Avatar
Ryan Tran
En İyi Yanıt

Hi,

This error occurs because the value you see on the UI gets lost while saving the record before the method is executed. Maybe the fields that you require when creating a new record using method act_product is missing. To prevent this, you can apply a quick workaround, which updating the prouduct_id in the write method. For further debugging, you should look at the fields you are using to extract the product_id, is it read-only on the UI? Do the fields you are using the creating new record in the act_product is somewhat related to other onchange or computed fields using depends?

0
Avatar
Vazgeç
Avatar
kaiserkos
Üretici En İyi Yanıt

Hi Niyas Raphy, thanks for the reply!

This is a custom module, and here's the section I suspect the error might have occurred:

@api.multi
def act_production(self):
project_id = self.env.user.project_id
for a in self:
boms = {}
buildings = {}

for al in a.atlas_line_ids:
al.assembly_section = parse_str(al.assembly_section)
al.bom_no = parse_str(al.bom_no)

# if it doesn't have bom_no, then the data format is incorrect
if not al.bom_no or len(al.bom_no.strip()) == 0:
continue

# sub_bom create.
if al.assembly_categ.code in ['frame']: # not include 'others', 'regardless' category
group_key = "%s/%s" % (al.bom_no, al.assembly_categ.code)

sub_bom = self.env['mrp.bom'].sudo().search(
[('project_id', '=', project_id.id),
('product_id.default_code', '=', group_key),
('atlas_id', '=', al.atlas_id.edit_atlas_id.id)], limit=1)

# Create BOM when BOM does not exist
if not sub_bom:
bom_product = self.env['product.product'].sudo().search(
[('name', '=', group_key),
('default_code', '=', group_key),
('project_id', '=', project_id.id),
('categ_id', '=', al.categ_id.id)], limit=1)
if not bom_product:
bom_product = self.env['product.product'].sudo().create({
'project_id': project_id.id,
'categ_id': al.categ_id.id,
'name': group_key,
'default_code': group_key,
'product_id': bom_product.id,
'type': 'product',
# 'material': p.material_no
})
sub_bom = self.env['mrp.bom'].sudo().create ({
'project_id': project_id.id,
'product_tmpl_id': bom_product.product_tmpl_id.id,
'product_id': bom_product.id,
'atlas_id': al.atlas_id.edit_atlas_id.id,
# 'product_qty': p.qty
})

if al.categ_id.code == 'aluminum' or 'raw':
product = self.env['product.product'].sudo ().search (
[('project_id', '=', project_id.id),
('categ_id', '=', al.categ_id.id),
('default_code', '=', al.name),
('part_no', '=', al.code),
], limit=1)
else:
product = self.env['product.product'].sudo ().search (
[('project_id', '=', project_id.id),
('categ_id', '=', al.categ_id.id),
('default_code', '=', al.name),
], limit=1)
# if it already has bom_line, find it.
bom_line = sub_bom.bom_line_ids.filtered(lambda l: l.product_id.default_code == al.name)
# if it doesn't have bom_line, create it.
if not bom_line:
bom_line = self.env['mrp.bom.line'].sudo().create({
'product_id': product.id,
'product_qty': parse_float(al.unit_qty),
'bom_id': sub_bom.id
})

# then assign unit qty to bom_line.
bom_line.product_qty = parse_float(al.unit_qty)

for al in a.atlas_line_ids:
if not al.bom_no or len(al.bom_no.strip()) == 0:
continue
elif (not al.name or len(al.name.strip()) == 0) and (not al.unit_qty or len(al.unit_qty.strip()) == 0) \
and al.bom_no and (not al.assembly_categ.code) and (not al.building or len(al.building)):
# Search BOM
bom = self.env['mrp.bom'].sudo().search(
[('project_id', '=', project_id.id),
('product_id.default_code', '=', al.bom_no),
('atlas_id', '=', a.edit_atlas_id.id)], limit=1)
# Create BOM when BOM does not exist
if not bom:
bom_product = self.env['product.product'].sudo().search(
[('name', '=', al.bom_no),
('project_id', '=', project_id.id),
('categ_id', '=', al.categ_id.id)], limit=1)
if not bom_product:
bom_product = self.env['product.product'].sudo().create({
'project_id': project_id.id,
'categ_id': al.categ_id.id,
'name': al.bom_no,
'default_code': al.bom_no,
'type': 'product',
# 'material': p.material_no
})

bom = self.env['mrp.bom'].sudo().create({
'project_id': project_id.id,
'product_tmpl_id': bom_product.product_tmpl_id.id,
'product_id': bom_product.id,
'atlas_id': a.edit_atlas_id.id,
# 'product_qty': p.qty
})

boms['%s:%s' % (al.building, bom.id)] = {"bom": bom, "qty": parse_float (al.qty), "building": al.building}

# Add bom search in atlas_id.
for sub_categ in ['frame']:
sub_bom_name = '%s/%s' % (bom.product_id.name, sub_categ)
sub_bom_exist = bom.bom_line_ids.filtered(lambda x: x.product_id.default_code == sub_bom_name)
# if not sub_bom_exist:
sub_bom = self.env['mrp.bom'].sudo().search(
[('project_id', '=', project_id.id),
('product_id.default_code', '=', sub_bom_name),
('atlas_id', '=', al.atlas_id.edit_atlas_id.id)], limit=1)

if sub_bom and not sub_bom_exist:
bom.write({'bom_line_ids': [(0, 0, {'product_id': sub_bom.product_id.id})],})

boms['%s:%s' % (al.building, sub_bom.id)] = {"bom": sub_bom, "qty": parse_float(al.qty), "building": al.building}

# a.production_ids = [(6, 0, production_ids)]

elif al.assembly_categ.code in ['surface', 'others']:
if al.categ_id.code == 'aluminum' or 'raw':
product = self.env['product.product'].sudo ().search (
[('project_id', '=', project_id.id),
('categ_id', '=', al.categ_id.id),
('default_code', '=', al.name),
('part_no', '=', al.code),
], limit=1)
else:
product = self.env['product.product'].sudo().search (
[('project_id', '=', project_id.id),
('categ_id', '=', al.categ_id.id),
('default_code', '=', al.name),
], limit=1)
# if it already has bom_line, find it.
bom_line = bom.bom_line_ids.filtered(lambda l: l.product_id.default_code == al.name)

# if it doesn't have bom_line, create it.
if not bom_line:
bom_line = self.env['mrp.bom.line'].sudo().create ({
'product_id': product.id,
'product_qty': parse_float (al.unit_qty),
'bom_id': bom.id
})

# then assign unit qty to bom_line.
bom_line.product_qty = parse_float(al.unit_qty)


production_ids = []
# for al in a.atlas_line_ids:

categs = self.env['product.category'].sudo ().search ([('code', 'in', ['assembly', 'assembly_preparation'])])
panels = self.env['tokiku.panel'].sudo ().search (
[('project_id', '=', self.env.user.project_id.id),
('categ_id', 'in', [c.id for c in categs])])

for v in boms.itervalues():
# if i in buildings:
# for k in buildings.keys():
# if boms[i][0].id == buildings[k][0]:
production_id = self.env['mrp.production'].sudo().search(
[('contract_id', '=', a.contract_id.id),
('bom_id', '=', v['bom'].id),
('atlas_id', '=', a.edit_atlas_id.id),
('building', '=', v['building'])])
location_src_id = self.env['stock.location'].with_context(lang=None).search(
[('usage', '=', 'internal'),
('name', '=', 'Assembly')], limit=1)
location_dest_id = self.env['stock.location'].with_context (lang=None).search (
[('usage', '=', 'internal'),
('name', '=', 'Pending'),
('location_id', '=', location_src_id.id)], limit=1)
if not production_id:
prod_obj = {
'contract_id': al.atlas_id.contract_id.id,
'bom_id': v['bom'].id,
'product_id': v['bom'].product_id.id,
'product_uom_id': v['bom'].product_id.uom_id.id,
'product_qty': v['qty'],
'atlas_id': a.edit_atlas_id.id,
'location_src_id': location_src_id.id,
'building': v['building'],
'partner_id': a.partner_id.id
# 'panel_ids': panel.id,
}
default_code = v['bom'].product_id.default_code
if default_code and ('frame' in default_code):
prod_obj.update({'location_dest_id': location_dest_id.id})
production_id = self.env['mrp.production'].sudo().create(prod_obj)

for r in production_id:
production_ids.append(r.id)

a.production_ids = [(6, 0, production_ids)]

for p in panels:
p.assembly_line_ids = [(6, 0, production_ids)]
0
Avatar
Vazgeç
Niyas Raphy (Walnut Software Solutions)

by putting if or print statement in the code, the product_id key in the dictionary passed to the create method contains the value or not, sometime if might be Null or False

Avatar
Anusha
En İyi Yanıt

Hi,  

the error shows that ,you dint provide product when you create manufacturing order.so pass the product_id in the dictionary when you create MO.

0
Avatar
Vazgeç
Avatar
Niyas Raphy (Walnut Software Solutions)
En İyi Yanıt

Hi,

By default there is no chance for such an error. Have you done any customization are you use any custom module in the database? As you specified, the issue is that, the value for the mandatory field is not supplied. For setting the value you can see the field named Product in the interface.


Thanks

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
Create schedule action For sending emails
odoo10
Avatar
Avatar
Avatar
2
Tem 25
6941
How to send messages that are not shown in chatter? Çözüldü
odoo10
Avatar
Avatar
Avatar
2
Eki 25
9052
How to ORDER BY? [Odoo 10] Çözüldü
odoo10
Avatar
Avatar
2
Kas 24
29975
Dynamic domain functionality - possible to change domain of a field in another model with onchange? (Odoo 10) Çözüldü
odoo10
Avatar
Avatar
Avatar
2
May 24
8598
Change state of other module
odoo10
Avatar
Avatar
Avatar
Avatar
3
Mar 24
8009
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