コンテンツへスキップ
Odoo メニュー
  • サインイン
  • 無料で15日試す
  • アプリ
    財務
    • 会計
    • 請求
    • 経費
    • スプレッドシート(BI)
    • ドキュメント管理
    • 署名
    販売
    • CRM
    • 販売
    • POS店舗
    • POSレストラン
    • サブスクリプション
    • レンタル
    ウェブサイト
    • ウェブサイトビルダー
    • eコマース
    • ブログ
    • フォーラム
    • ライブチャット
    • eラーニング
    サプライチェーン
    • 在庫
    • 製造
    • 製品ライフサイクル管理 (PLM)
    • 購買
    • 整備
    • 品質
    人事業務
    • 従業員管理
    • 採用
    • 休暇管理
    • 人事評価
    • リファラル
    • フリート
    マーケティング
    • ソーシャルマーケティング
    • メールマーケティング
    • SMSマーケティング
    • イベント
    • マーケティングオートメーション
    • アンケート調査
    サービス
    • プロジェクト管理
    • タイムシート
    • フィールドサービス
    • ヘルプデスク
    • 計画
    • アポイントメント
    生産性向上ツール
    • ディスカッション
    • 承認
    • IoT
    • VoIP
    • ナレッジ
    • WhatsApp
    サードパーティアプリ Odooスタジオ Odooクラウドプラットホーム
  • インダストリー(業種別ソリューション)
    小売
    • 書店
    • アパレルショップ
    • 家具専門店
    • 食料品店
    • 金物店
    • 玩具店
    飲食・ホスピタリティ業界
    • バー・パブ
    • レストラン
    • ファストフード
    • ゲストハウス
    • 飲料販売代理店
    • ホテル
    不動産
    • 不動産会社
    • 建築事務所
    • 建設
    • 不動産管理
    • 造園
    • 住宅所有者組合
    コンサルティング
    • 会計事務所
    • Odooパートナー
    • マーケティングエージェンシー
    • 法律事務所
    • 人材派遣
    • 監査・認証
    製造
    • テキスタイル
    • 金属
    • 家具
    • 飲食
    • 醸造所
    • コーポレートギフト
    ヘルス & フィットネス
    • スポーツクラブ
    • 眼鏡店
    • フィットネスセンター
    • ウェルネス専門家
    • 薬局
    • ヘアサロン
    業種
    • 便利屋
    • IT ハードウェア・サポート
    • 太陽エネルギーシステム
    • 靴メーカー
    • クリーニングサービス
    • 空調設備サービス
    その他
    • 非営利団体
    • 環境機関
    • ビルボードレンタル
    • 写真
    • 自転車リース
    • ソフトウェアリセラー
    すべての業種を見る
  • コミュニティ
    学ぶ
    • チュートリアル
    • ドキュメンテーション
    • 認定
    • トレーニング
    • ブログ
    • ポッドキャスト
    教育サポート
    • 教育プログラム
    • Scale Up! ビジネスゲーム
    • Odooオフィス訪問
    ソフトを入手
    • ダウンロード
    • エディションを比較
    • リリース
    コラボレーション
    • Github
    • フォーラム
    • イベント
    • 翻訳
    • パートナーになる
    • パートナー様向けサービス
    • 会計事務所を登録
    サービス利用
    • パートナー一覧
    • 会計事務所一覧
    • 今すぐ相談する
    • 導入支援サービス
    • お客様一覧
    • サポート
    • アップグレード
    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:

  • CRM
  • e-Commerce
  • 会計
  • 在庫
  • PoS
  • プロジェクト
  • MRP
All apps
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
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 返信
15231 ビュー
アバター
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
アバター
破棄
ディスカッションを楽しんでいますか?読むだけでなく、参加しましょう!

今すぐアカウントを作成して、限定機能を利用したり、素晴らしいコミュニティと交流しましょう!

登録
関連投稿 返信 ビュー 活動
Create schedule action For sending emails
odoo10
アバター
アバター
アバター
2
7月 25
6930
How to send messages that are not shown in chatter? 解決済
odoo10
アバター
アバター
アバター
2
10月 25
9048
How to ORDER BY? [Odoo 10] 解決済
odoo10
アバター
アバター
2
11月 24
29970
Dynamic domain functionality - possible to change domain of a field in another model with onchange? (Odoo 10) 解決済
odoo10
アバター
アバター
アバター
2
5月 24
8593
Change state of other module
odoo10
アバター
アバター
アバター
アバター
3
3月 24
8007
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • 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、eコマース、会計、在庫管理、POS、プロジェクト管理など、企業のさまざまな業務を一つのシステムで管理できる、ベルギー発のオープンソースのERPソフトウェアです。

高機能で使いやすく、完全に統合されたERPとして、ユニークな価値を提供しています。

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