[16.0][IMP] disbursement: รวม smart button ของ DR เป็นปุ่มเดียว - #1262
Merged
Merged
Conversation
รวม smart button 3 ปุ่มบนฟอร์ม disbursement.request ที่เปิด account.move เหมือนกัน (action_view_bill / action_view_payment_moves / action_view_cash_revenue_handover) เป็นปุ่ม "ใบสำคัญบัญชี" ปุ่มเดียวที่ รวม vendor bill + payment journal entries + cash & revenue handover ให้ เปิด tree ของ account.move ทั้งหมดในหน้าเดียว - disbursement_finance_kmitl: เพิ่ม related_move_ids/count compute และ action_view_related_moves; เพิ่ม dep บน disbursement_cash_revenue_handover - disbursement_accounting_kmitl: ลบปุ่ม action_view_bill และ method - disbursement_cash_revenue_handover: ลบวิว/ปุ่ม action_view_cash_revenue_handover และ method (ลบไฟล์ views/disbursement_request_views.xml)
The removed ใบตั้งหนี้ smart button was the only place rendering bill_count in this view, but the Create Bill / Return to Verification buttons above still reference bill_count in their attrs. Odoo's view validator requires the field to be present — re-add it as an invisible marker inside the button_box xpath.
…มาที่นี่ด้วย introspection รอบก่อน smart button รวมอยู่ที่ disbursement_finance_kmitl และผูก 3 field รวมกัน (bill_ids | payment_move_ids | cash_revenue_handover_move_ids) ต้อง depend บน disbursement_cash_revenue_handover เพื่อให้ compute เห็น field ครบ ย้ายมาที่ disbursement_accounting_kmitl แทน และหา account.move จากฝั่ง move ขึ้นมา — introspect Many2one บน account.move._fields ที่ชี้ disbursement.request แล้ว OR ทั้งหมดใน domain เดียว ทำให้: - ไม่ต้อง depend cross-module (finance → handover ถูกถอนออก) - โมดูลปลายทางที่เพิ่ม linking field ใหม่บน account.move ถูกเก็บ อัตโนมัติโดยไม่ต้องแก้โค้ดตรงนี้ label ปุ่มเปลี่ยนเป็น "รายการบันทึกบัญชี" Cleanup ต่อเนื่องใน finance: ลบ payment_move_ids/count ที่ไม่มีใครใช้แล้ว (ปุ่มถูกลบตั้งแต่รอบก่อน) และ trigger payment_ids.move_id บน compute
หลัง unified smart button คุมทุก move แล้ว, ปุ่ม/count เดิมไม่ถูกอ้าง: - cash_revenue_handover_count (+ compute) - bill_draft_count, bill_status_display (+ บรรทัดใน _compute_bill_count) เก็บ dead code ทิ้ง และรวม comment/docstring ที่ซ้ำของ related_move_ids ให้ field อธิบาย *why*, docstring ของ _related_move_domain อธิบาย *how* อย่างละที่
coreichamp
approved these changes
Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
disbursement.request(ใบตั้งหนี้, รายการล้างหนี้, Cash & Revenue Handover) ที่ล้วนเปิดaccount.moveให้เป็นปุ่ม "ใบสำคัญบัญชี" ปุ่มเดียวในdisbursement_finance_kmitl— กดแล้วเห็น bill + payment moves + handover ในหน้า tree เดียวrelated_move_ids/related_move_countและaction_view_related_movesใน finance bridge, และเพิ่ม dep บนdisbursement_cash_revenue_handoverเพื่อให้ compute เห็น field ครบaction_view_bill,action_view_payment_moves,action_view_cash_revenue_handover) และลบไฟล์ view ของ handover ที่กลายเป็นว่างเปล่าTest plan
account.moveมี record ครบ 3 ประเภท