/** * 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|スクラップ(Scrap)処理と補充フロー – Raqqa

Odoo MRP|スクラップ(Scrap)処理と補充フロー

🎯 目的

製造中に発生した不良品・破損品などを「Scrap(廃棄)」し、その補充を 購買(Buy)ルート在庫移動(Transfer) によって行う流れを管理する。


✅ スクラップ補充の一連の流れ(基本編)

1. 事前設定

  • 在庫 > 設定 > 倉庫 > One Step(1ステップ製造) に設定
  • プロダクト設定 > ルートに「BUY(購買)」を指定
    • 構成部品に対して有効にする

2. 製造オーダー作成とスクラップ処理

  1. 製造モジュール > 製造オーダー(MO)作成
  2. MO画面で 「Scrap」ボタン をクリック
  3. ポップアップで以下を入力:
    • 廃棄する構成部品のプロダクト
    • 数量
    • 「Replenish quantities(補充)」にチェック → 自動で補充が起動
  4. 「Scrap Products」ボタンをクリック
  5. スクラップされた構成部品がNot Availableに変化(在庫不足)

3. 自動購買オーダーの生成と受領

  • MOの「Purchases(スマートボタン)」から関連するPOを確認
  • [Receive Product] > [Validate] を実行して入庫処理
  • 構成部品のステータスが「Available」に変わる(製造続行可能)

🔄 応用編:2段階/3段階製造でのスクラップ補充

  • 多段階BOMを用いた製造(例:サブアセンブリあり)では、
    • スクラップ発生後、[Transfers(スマートボタン)] が表示されることがある
    • 製品の補充が**社内移動(Internal Transfer)**になるケース
  • 必要に応じて製造や補充の指示が中間品単位で別MOまたは調達に分岐

📌 まとめ:スクラップ処理における補充ルートの自動起動

項目内容
対象操作製造中の部品スクラップと補充
トリガーScrap時に「Replenish quantities」にチェック
補充方法BUYルートが設定されていれば、自動でPO生成
在庫反映受領後に製造オーダーの部品がAvailableに変化
多段階製造必要に応じてTransferや追加MOで補充


Comments

コメントを残す

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