/** * WPML compatibility functions * * @global array $duplicated_posts Array to store the posts being duplicated. * * @package Yoast\WP\Duplicate_Post * @since 3.2 */ add_action( 'admin_init', 'duplicate_post_wpml_init' ); /** * Add handlers for WPML compatibility. */ function duplicate_post_wpml_init() { if ( defined( 'ICL_SITEPRESS_VERSION' ) ) { add_action( 'dp_duplicate_page', 'duplicate_post_wpml_copy_translations', 10, 3 ); add_action( 'dp_duplicate_post', 'duplicate_post_wpml_copy_translations', 10, 3 ); add_action( 'shutdown', 'duplicate_wpml_string_packages', 11 ); } } global $duplicated_posts; // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- Reason: Renaming a global variable is a BC break. $duplicated_posts = []; /** * Copy post translations. * * @global SitePress $sitepress Instance of the Main WPML class. * @global array $duplicated_posts Array of duplicated posts. * * @param int $post_id ID of the copy. * @param WP_Post $post Original post object. * @param string $status Status of the new post. */ function duplicate_post_wpml_copy_translations( $post_id, $post, $status = '' ) { global $sitepress; global $duplicated_posts; remove_action( 'dp_duplicate_page', 'duplicate_post_wpml_copy_translations', 10 ); remove_action( 'dp_duplicate_post', 'duplicate_post_wpml_copy_translations', 10 ); $current_language = $sitepress->get_current_language(); $trid = $sitepress->get_element_trid( $post->ID ); if ( ! empty( $trid ) ) { $translations = $sitepress->get_element_translations( $trid ); $new_trid = $sitepress->get_element_trid( $post_id ); foreach ( $translations as $code => $details ) { if ( $code !== $current_language ) { if ( $details->element_id ) { $translation = get_post( $details->element_id ); if ( ! $translation ) { continue; } $new_post_id = duplicate_post_create_duplicate( $translation, $status ); if ( ! is_wp_error( $new_post_id ) ) { $sitepress->set_element_language_details( $new_post_id, 'post_' . $translation->post_type, $new_trid, $code, $current_language ); } } } } // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- Reason: see above. $duplicated_posts[ $post->ID ] = $post_id; } } /** * Duplicate string packages. * * @global array() $duplicated_posts Array of duplicated posts. */ function duplicate_wpml_string_packages() { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- Reason: renaming the function would be a BC-break. global $duplicated_posts; foreach ( $duplicated_posts as $original_post_id => $duplicate_post_id ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- Reason: using WPML native filter. $original_string_packages = apply_filters( 'wpml_st_get_post_string_packages', false, $original_post_id ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- Reason: using WPML native filter. $new_string_packages = apply_filters( 'wpml_st_get_post_string_packages', false, $duplicate_post_id ); if ( is_array( $original_string_packages ) ) { foreach ( $original_string_packages as $original_string_package ) { $translated_original_strings = $original_string_package->get_translated_strings( [] ); foreach ( $new_string_packages as $new_string_package ) { $cache = new WPML_WP_Cache( 'WPML_Package' ); $cache->flush_group_cache(); $new_strings = $new_string_package->get_package_strings(); foreach ( $new_strings as $new_string ) { if ( isset( $translated_original_strings[ $new_string->name ] ) ) { foreach ( $translated_original_strings[ $new_string->name ] as $language => $translated_string ) { do_action( // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals -- Reason: using WPML native filter. 'wpml_add_string_translation', $new_string->id, $language, $translated_string['value'], $translated_string['status'] ); } } } } } } } } Odoo MRPにおける 副産品(By-Products) の設定と運用フロー – Raqqa

Odoo MRPにおける 副産品(By-Products) の設定と運用フロー

🏭 Odoo MRP|副産品(By-Products)の設定と利用方法

🎯 概要

副産品(By-Products)とは、製造プロセスの中で主製品と同時に得られる付随的な製品です。
例:木材の加工で出る「おがくず」や、牛乳加工で得られる「ホエイ」など。


✅ 副産品を使うための設定と操作フロー

① 機能の有効化

  • 製造 > 設定 > 副産品(By-Products) にチェックを入れて有効化

② BOM(部品表)への副産品登録

  1. 製造 > 部品表(BOM)を作成または編集
  2. 画面に「副産品(By-Products)」タブが表示される
  3. 「追加(Add)」で以下を入力:
    • 副産品(Product):生成される副産物を選択
    • 数量(Quantity):一度の製造で生まれる副産品の数量
    • 生産工程(Operation):どの工程で発生するか(複数ワークステップがある場合)

③ 製造オーダーと副産品の生成

  1. 製造オーダー(MO)を作成し、ワークオーダーを実行
  2. 該当する ワークオーダーが完了すると、副産品が自動的に在庫に追加される
  3. BOMの「副産品」タブの Produced チェックボックスが ON に切り替わる(処理済み)

📦 副産品の在庫影響

項目内容
在庫変動主製品と同時に、副産品も所定数量が在庫に追加される
トラッキング副産品にもロットやシリアル番号の設定が可能(必要に応じて)
利用方法副産品を再利用・販売・廃棄など、後工程に活用可能

💡 補足ポイント

  • 副産品は販売可能な製品として登録しておくことが推奨
  • 工程を指定できるため、複数工程があるBOMでも柔軟に副産品の発生を管理できる
  • 会計上、副産品の価値を主製品から分離する処理は必要に応じてカスタマイズ

✅ まとめフロー

1. 副産品機能ON

2. BOMに副産品を追加

3. 製造オーダー作成

4. 対象ワークオーダー完了

5. 副産品が在庫に自動追加、Producedにチェック


Comments

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です