{% extends "core/detail.html" %} {% load seizou_tags seizou_icons purchasing_tags %} {# 発注の詳細: core の詳細 (基本情報と「送った記録」のタブ) の下に明細の表 (相手の出荷の知らせの列と、出荷ごとの「受入を記録する」を含む。受入の link は取消と断られた発注には出さず、数量は知らせのまだ受け入れていない数 (purchasing_tags の notice_rests)) と、seizou どうしで送った発注だけ検収の節。「作成」のときだけ送り直す、「作成」か「断られた」のとき取り消すのボタン。書く入口 (送り直す・取り消す・受入・検収の送り直す) は発注の権限がある人だけ (決め 11-04 00:0x)。明細の表の先頭の「操作」の列は、行ごとの ⋮ のメニュー (受注の明細と同じ形で、右クリックでも同じメニュー。中身は受入の新規登録の 1 項目。出す条件は前のボタンと同じで、出す物が無い行には ⋮ も出さない。表が箱より広い幅でも送らずに押せるように。決め 11-03 17:2x・11-06 22:2x = C22)。頭の右の緑はその伝票で次にする操作 1 つ (UX-2 a。11-06 22:1x。無ければ今のまま): 「作成」は「再送」、ほかは受け入れていない出荷の知らせがあれば「受入を記録する」(行き先は表の一番上の「受入を記録する」と同じ。purchasing_tags の next_receipt。初見テスト R5 の候補 C93)。 #} {# 見出しの帯 (#po-heading)・黄の知らせ (#po-alert)・明細と検収の節 (#po-live)・左のメニューの「受入」の印 (#menu-count-purchasingreceipt_list。小窓で受入を保存した後も印が古いまま残らないように。決め C05-2 = a) は 2 秒ごとに同じ URL を取りに行って入れ替え、前の更新と状態が違う発注の見出しの帯に seizou-changed を付ける (purchasing_tags の live_state)。タブは入れ替えない (選んだタブが基本情報に戻らないように)。取消と受入の入口は小窓で開く (data-modal-form)。小窓で保存した後の seizou:refresh でも 2 秒ごとの取り直しを走らせる (決め 11-05 11:4x。N158b)。明細の箱を横に送っている間 (scrollLeft が 0 でない) と、明細の ⋮ のメニューを開いている間と、字を選んでいる間 (window.getSelection() の字が空でない) は 2 秒ごとに取り直さない。入れ替えると箱が左の端へ戻り、開いたメニューが閉じ、選んだ字が消えるため (発注の一覧の scrollTop と同じ形。C22。字の選びは指示書 11-07 の見つけ GS-01)。 #} {# 2 列 (案 3-D・3-F。N150): 題の上にパンくず「発注 › 番号」(見出しの帯の中。土台の block heading に crumb を渡す)。block content で黄の知らせの次に右の列のカード (purchasing_tags の purchase_order_aside) を置いてから土台を呼ぶ。明細・検収・流れ (#po-live) は土台の全幅の口 block wide (lg 以上は 2 列の上に全幅。C22)。右の列 (#detail-aside) も 2 秒ごとに入れ替える。 #} {# 段の帯 (N151。core/_stage_band.html) は見出しの帯 (#po-heading) の中の、土台の見出し (パンくずの with の後) に置く。2 秒ごとの入れ替えで段も新しくなる。取消の発注には出さない。 #} {# タブの最後の「会話」は connect の会話の枠 (connect/_chat.html。相手の会社とのやり取り = C104。0 件でも書く欄と使えない訳を出すので block tab_empty にも置く)。block main にメモの枠 (#po-live の外。#po-live は 2 秒ごとに入れ替わるので、中に置くとメモの書く枠が消える。社内の書き込みはメモ = 本人の決め CHAT-2・CHAT-4)。 #} {% block heading %}{% live_state object as live %}
{% purchase_order_head_chips object seizou.hide_money as head_chips %}{% with crumb="発注" %}{{ block.super }}{% endwith %}{% load purchasing_timeline %}{% purchase_order_stages object as band %}{% include "core/_stage_band.html" with stages_id="po-stages" %}
{% endblock %} {# 送った発注の変更 (C96): 見出しの右の白の「変更」は、発注の権限があり、変更を送れる発注 (purchasing_tags の can_change_order) だけ。画面の全体で開く (小窓にしない = 明細の表が広いため)。 #} {# 書く入口の 2 つの答え (決め 11-07 21:0x〜21:2x): 「変更」「取消」は金額に関わる操作なので can_write "purchasing.PurchaseOrder" (発注の権限 + 金額の閲覧)。「再送」「受入を記録する」(頭・明細の ⋮・出荷の知らせの横)・検収の「送り直す」は数だけの操作 (決め 6 と 8) なので、受入の新規登録と同じ答え can_write "purchasing.Receipt" (発注の権限だけ。金額の閲覧を見ない) で出す。 #} {# 版が 2 以上で今の版が相手に届いていない間は、頭の右の緑を「再送」にする (取消の版は状態が「取消」でも)。#po-alert に届いていない・相手が断ったの黄色の 1 行 (revision_state の alert)。 #} {# 印刷用の画面と PDF は協力企業への発注書 (金額が主な書面なので金額の閲覧の無い人には出さない。N356)。新しいタブで開く普通の link (請求書の詳細と同じ字と形)。 #} {% block actions %}{% can_write "purchasing.PurchaseOrder" as can_po %}{% if can_po %}{% can_change_order object as can_change %}{% if can_change %}{% icon "pencil" "size-4" %}変更{% endif %}{% endif %} {% if not seizou.hide_money %} {% icon "file" "size-4" %}印刷用の画面 {% icon "download" "size-4" %}PDF {% endif %} {% endblock %} {# 「⋯」の「取消」は「下書き」「断られた」と、「送った」「相手が受け入れた」の発注に出す (一部を出荷した発注にも出し、押して保存すると断りの字が「変更」の道を案内する)。 #} {% block more %}{% can_write "purchasing.PurchaseOrder" as can_po %}{% if can_po %}{% if object.status == "draft" or object.status == "rejected" or object.status == "sent" or object.status == "accepted" %}{% url 'purchasing:purchaseorder_cancel' object.pk as cancel_url %}{% include "core/_detail_more.html" with more_url=cancel_url more_label="取消" more_modal=True %}{% endif %}{% endif %}{% endblock %} {% block edit_button %}{% can_write "purchasing.Receipt" as can_receipt %}{% if can_receipt %}{% revision_state object as revision %}{% if object.status == "draft" or revision and not revision.delivered %}
{% csrf_token %}
{% else %}{% next_receipt object as receipt %}{% if receipt %}{% icon "plus" "size-4" %}受入を記録する{% endif %}{% endif %}{% endif %}{% endblock %} {# 送れなかった「作成」の発注は、送った記録の最後の行 (Outbox の並びは新しい順) の返事を頭の黄の知らせに出す (保存の直後も、送り直すまで)。 #} {# 相手が条件付で受けた・相手が保留した発注は、記録の今の状態を黄の 1 行で出す (知らせの段 5。答えが届くと 2 秒ごとの入れ替えで開いている画面にも出る)。 #} {% block content %}
{% if object.status == "draft" %}{% with last=object.outbox_messages.first %}{% if last and last.response != "受け取った" %} {% endif %}{% endwith %}{% elif object.status == "conditional" %} {% elif object.status == "on_hold" %} {% endif %}{% revision_state object as revision %}{% if revision.alert %} {% endif %}
{% purchase_order_aside object fields seizou.hide_money as aside %}{{ block.super }} {% endblock %} {% block wide %}{% can_write "purchasing.Receipt" as can_receipt %}

明細

{% if not seizou.hide_money %}{% endif %} {# 明細は受入の数 (received_total) と受入の残 (remaining_total) を足した物 (発注の読むだけの property)。 #} {% for line in object.lines_with_received %} {% if not seizou.hide_money %}{% endif %} {% if line.remaining_total < 0 %}{% else %}{% endif %} {# 受けすぎ (受入の数の合計が明細の数量を超えた) の明細は、行の下に黄の知らせ (purchasing_tags の over_receipt_text。受入は止めない)。 #} {% over_receipt_text line as over %}{% if over %}{% endif %} {# 相手の注文回答の明細の答え (条件付受諾の回答単価・回答数量・回答納期。purchasing_tags の reply_line_text。同じ for の中なので問い合わせは増えない)。 #} {% reply_line_text line seizou.hide_money as reply_text %}{% if reply_text %}{% endif %} {% endfor %}
操作 行番号 部品 数量 単位単価 金額受入の数 受入の残 相手からの出荷の知らせ 納期 備考
{% if object.status != "cancelled" and object.status != "rejected" and line.remaining_total > 0 and not line.is_cancelled and can_receipt %}{% endif %} {{ line.line_no }}{% if line.is_cancelled %} 取消{% elif line.line_status_code == "1" %} 追加{% elif line.line_status_code == "3" %} 変更 ({{ line.get_line_status_reason_code_display }}){% endif %} {% master_link line.item %}{% if line.process_id %}工程 {{ line.process.name }}{% endif %}{% if line.quote_no %}見積の番号 {{ line.quote_no }}{% endif %} {{ line.qty|comma }} {{ line.unit }}{{ line.unit_price|yen }} / {{ line.price_unit_text }} {{ line.amount|yen }}{{ line.received_total|comma }}{{ line.remaining_total|comma }}{{ line.remaining_total|comma }}{% with notice=line.shipping_notice %}{% if notice.rows %}{% notice_rests line as rests %}
    {% for entry in rests %}{% with row=entry.notice %}
  • {{ row.shipped_at|date:"Y-m-d" }} ×{{ row.qty_text }}{% if row.order_revision_no < object.revision_no %} 第 {{ row.order_revision_no }} 版の注文への知らせ (今は第 {{ object.revision_no }} 版){% endif %}{% if object.status != "cancelled" and object.status != "rejected" and line.remaining_total > 0 and entry.rest > 0 and not line.is_cancelled and can_receipt %} 受入を記録する{% endif %}
  • {% endwith %}{% endfor %}
{% if notice.count > 1 %}

合計 {{ notice.total_text }}

{% endif %}{% else %}—{% endif %}{% endwith %}
{% if line.due_date %}{{ line.due_date|date:"Y-m-d" }}{% else %}—{% endif %} {{ line.note }}
{% if object.outbox_messages.exists %}

検収 ({{ object.partner.name }} へ送った受入の数)

受入を登録すると、受け入れた数を {{ object.partner.name }} の受注に「検収」として送ります。届いていない物は「送り直す」で送れます。

{% with receipts=object.receipts.all %}{% if receipts %}
{% for receipt in receipts %} {% endfor %}
受入日明細数量検収操作
{{ receipt.received_on|date:"Y-m-d" }} {{ receipt.line.line_no }} {% master_link receipt.line.item %} {{ receipt.qty|comma }} {% with state=receipt.acceptance_state %}{% if receipt.acceptance_sent_at %}{{ state }}{% elif state %}{{ state }}{% else %}—{% endif %}{% endwith %} {% if not receipt.acceptance_sent_at and can_receipt %}
{% csrf_token %}
{% endif %}
{% else %}

受入はまだありません。

{% endif %}{% endwith %}
{% endif %} {% include "purchasing/_timeline.html" %}
{% endblock %} {% block main %}{% if "notes" in seizou.parts %}{% include "notes/_note.html" %}{% endif %}{% endblock %} {% block tab_rows %}{% if tab.related == "chat_messages" %}{% include "connect/_chat.html" with chat_target=object %}{% else %}{{ block.super }}{% endif %}{% endblock %} {% block tab_empty %}{% if tab.related == "chat_messages" %}{% include "connect/_chat.html" with chat_target=object %}{% else %}{{ block.super }}{% endif %}{% endblock %}