Skip to Content
Odoo เมนู
  • ลงชื่อเข้าใช้
  • ทดลองใช้ฟรี
  • แอป
    การเงิน
    • ระบบบัญชี
    • ระบบการออกใบแจ้งหนี้
    • ระบบบัญชีรายจ่าย
    • ระบบการจัดการข้อมูลผ่านสเปรดชีต (BI)
    • เอกสาร
    • ระบบลงลายเซ็น
    การขาย
    • ลูกค้าสัมพันธ์
    • การขาย
    • POS ร้านค้า
    • POS ร้านอาหาร
    • ระบบสมัครสมาชิก
    • การเช่า
    การจัดการเว็บไซต์
    • เครื่องมือสร้างเว็บไซต์
    • ระบบการขายออนไลน์
    • บล็อก
    • ฟอรั่ม
    • ไลฟ์แชท
    • ระบบการอบรมออนไลน์
    ซัพพลายเชน
    • คลังสินค้า
    • ระบบการผลิต
    • PLM
    • ระบบการจัดซื้อ
    • การซ่อมบำรุง
    • ระบบจัดการคุณภาพ
    ทรัพยากรบุคคล
    • ข้อมูลพนักงาน
    • ระบบสรรหาบุคลากร
    • ระบบการลา
    • การประเมิน
    • ระบบการแนะนำพนักงาน
    • ระบบจัดการยานพาหนะ
    การตลาด
    • โซเชียลมาร์เก็ตติ้ง
    • การตลาดผ่านอีเมล
    • ระบบการตลาดผ่าน SMS
    • ระบบการจัดงานอีเวนต์
    • การตลาดแบบอัตโนมัติ
    • ระบบแบบสำรวจ
    การบริการ
    • โปรเจกต์
    • ระบบบันทึกเวลา
    • ระบบการจัดการบริการภาคสนาม
    • ระบบดูแลช่วยเหลือ
    • การวางแผน
    • การนัดหมาย
    ประสิทธิผล
    • ระบบแสดงความคิดเห็น
    • ระบบการอนุมัติ
    • ไอโอที
    • VoIP
    • คลังข้อมูล
    • WhatsApp
    แอปพลิเคชันของบุคคลที่สาม Odoo สตูดิโอ แพลตฟอร์มคลาวด์ของ Odoo
  • อุตสาหกรรม
    การค้าปลีก
    • ร้านขายหนังสือ
    • ร้านขายเสื้อผ้า
    • ร้านขายเฟอร์นิเจอร์
    • ร้านขายของชำ
    • ร้านขายฮาร์ดแวร์
    • ร้านขายของเล่น
    Food & Hospitality
    • บาร์และผับ
    • ร้านอาหาร
    • อาหารฟาสต์ฟู้ด
    • Guest House
    • ตัวแทนจำหน่ายเครื่องดื่ม
    • Hotel
    Real Estate
    • Real Estate Agency
    • บริษัทสถาปัตยกรรม
    • บริษัทรับเหมา
    • การจัดการอสังหาริมทรัพย์
    • การจัดสวน
    • สมาคมเจ้าของอสังหาริมทรัพย์
    Consulting
    • Accounting Firm
    • Odoo พาร์ทเนอร์
    • เอเจนซี่การตลาด
    • สำนักงานกฎหมาย
    • บริการสรรหาบุคลากร
    • การตรวจสอบและการรับรอง
    ระบบการผลิต
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • ของขวัญขององค์กร
    สุขภาพ & ฟิตเนส
    • ชมรมกีฬา
    • ร้านขายแว่นตา
    • ฟิตเนส
    • ผู้ประกอบวิชาชีพด้านสุขภาพ
    • ร้านขายยา
    • ร้านทำผม
    Trades
    • ช่างซ่อม
    • ฮาร์ดแวร์และการสนับสนุนด้านไอที
    • Solar Energy Systems
    • ช่างทำรองเท้า
    • บริการทำความสะอาด
    • HVAC Services
    Others
    • Nonprofit Organization
    • สำนักงานสิ่งแวดล้อม
    • ร้านเช่าป้ายโฆษณา
    • การถ่ายภาพ
    • ร้านเช่าจักรยาน
    • ตัวแทนจำหน่ายซอฟต์แวร์
    Browse all Industries
  • คอมมูนิตี้
    ศึกษา
    • บทเรียน
    • เอกสารกำกับโปรแกรม
    • การรับรอง
    • การฝึกอบรม
    • บล็อก
    • พอดแคสต์
    เพิ่มศักยภาพให้กับการศึกษา
    • โปรแกรมการศึกษา
    • Scale Up! Business Game
    • เยี่ยมชม Odoo
    รับซอฟต์แวร์
    • ดาวน์โหลด
    • เปรียบเทียบรุ่น
    • เผยแพร่
    ทำงานร่วมกัน
    • Github
    • ฟอรั่ม
    • ระบบการจัดงานอีเวนต์
    • การแปล
    • ร่วมเป็นพาร์ทเนอร์
    • Services for Partners
    • ลงทะเบียนเพื่อสร้างบัญชีบริษัทของคุณ
    รับบริการ
    • ค้นหาพาร์ทเนอร์
    • ค้นหานักบัญชี
    • พบกับที่ปรึกษา
    • บริการติดตั้งระบบเพื่อใช้งาน
    • ข้อมูลอ้างอิงลูกค้า
    • การสนับสนุน
    • อัปเกรด
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    รับการสาธิต
  • ราคา
  • ช่วยเหลือ

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

  • ลูกค้าสัมพันธ์
  • e-Commerce
  • ระบบบัญชี
  • สินค้าคงคลัง
  • PoS
  • โปรเจกต์
  • MRP
All apps
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

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]

ติดตาม

รับการแจ้งเตือนเมื่อมีกิจกรรมในโพสต์นี้

คำถามนี้ถูกตั้งค่าสถานะ
odoo10
5 ตอบกลับ
15054 มุมมอง
อวตาร
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
อวตาร
ละทิ้ง
kaiserkos
ผู้เขียน

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

อวตาร
iuv.li
คำตอบที่ดีที่สุด

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
อวตาร
ละทิ้ง
อวตาร
Ryan Tran
คำตอบที่ดีที่สุด

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
อวตาร
ละทิ้ง
อวตาร
kaiserkos
ผู้เขียน คำตอบที่ดีที่สุด

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
อวตาร
ละทิ้ง
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

อวตาร
Anusha
คำตอบที่ดีที่สุด

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
อวตาร
ละทิ้ง
อวตาร
Niyas Raphy (Walnut Software Solutions)
คำตอบที่ดีที่สุด

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
อวตาร
ละทิ้ง
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!

ลงชื่อ
Related Posts ตอบกลับ มุมมอง กิจกรรม
Create schedule action For sending emails
odoo10
อวตาร
อวตาร
อวตาร
2
ก.ค. 25
6368
How to send messages that are not shown in chatter? แก้ไขแล้ว
odoo10
อวตาร
อวตาร
อวตาร
2
ต.ค. 25
8750
How to ORDER BY? [Odoo 10] แก้ไขแล้ว
odoo10
อวตาร
อวตาร
2
พ.ย. 24
29641
Dynamic domain functionality - possible to change domain of a field in another model with onchange? (Odoo 10) แก้ไขแล้ว
odoo10
อวตาร
อวตาร
อวตาร
2
พ.ค. 24
8346
Change state of other module
odoo10
อวตาร
อวตาร
อวตาร
อวตาร
3
มี.ค. 24
7761
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • Github
  • Runbot
  • การแปล
บริการ
  • โฮสติ้ง odoo.sh เซิร์ฟเวอร์
  • การสนับสนุน
  • อัปเกรด
  • การพัฒนาที่กำหนดเอง
  • การศึกษา
  • ค้นหานักบัญชี
  • ค้นหาพาร์ทเนอร์
  • ร่วมเป็นพาร์ทเนอร์
เกี่ยวกับเรา
  • บริษัทของเรา
  • ทรัพย์สินในรูปของเครื่องหมายการค้า
  • ติดต่อเรา
  • งาน
  • ระบบการจัดงานอีเวนต์
  • พอดแคสต์
  • บล็อก
  • ลูกค้า
  • กฎหมาย • ความเป็นส่วนตัว
  • ความปลอดภัย
الْعَرَبيّة 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 เป็นชุดแอปธุรกิจแบบเปิดที่ครอบคลุมทุกความต้องการของบริษัทของคุณ อาธิ CRM eCommerce ระบบบัญชี ระบบสินค้าคงคลัง ระบบการขายหน้าร้าน โปรเจกต์ และ อีกมากมาย

ความเหนือกว่าอันเป็นเอกลักษณ์ของ Odoo คือการใช้งานที่ง่ายดายและผสานการทำงานอย่างสมบูรณ์แบบในเวลาเดียวกัน

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