Skip to content

[16.0][ADD] budget_transfer_portal: customer portal for budget transfers - #1133

Open
n3n wants to merge 2 commits into
16.0from
16.0-add-budget_transfer_portal
Open

[16.0][ADD] budget_transfer_portal: customer portal for budget transfers#1133
n3n wants to merge 2 commits into
16.0from
16.0-add-budget_transfer_portal

Conversation

@n3n

@n3n n3n commented Aug 18, 2026

Copy link
Copy Markdown
Member

Adds two new modules.

budget_transfer_portal — exposes budget.transfer on the customer portal via portal.mixin: a list at /my/budget-transfers and a per-record page at /my/budget-transfer/<id> that previews the งปม.303 PDF (from budget_transfer_pdf) inline, with download/print buttons and chatter, following the existing disbursement portal pattern. Access is token- or ACL-based through the stock portal helpers, and the list degrades to empty for users without model access.

budget_transfer_portal_sarabun_access — lets e-Saraban approval-route participants open a transfer's portal link by identity (no shared token) by overriding _document_check_access to admit a reached recipient or the sender of any linked หนังสือ. This is done at the controller rather than via an ir.rule, which would otherwise clamp budget users' unrestricted row access.

Static-checked only (pyflakes/py_compile/xmllint); not yet run in a live Odoo instance.


วิธี Manual Test

เตรียม

  • ติดตั้งโมดูล budget_transfer_portal (ลากมา deps: budget_transfer, budget_transfer_pdf, portal)
  • มี budget.transfer อย่างน้อย 1 รายการ (มี from/to lines ครบ) โดยฟิลด์ ผู้รับผิดชอบ (user_id) เป็น user ที่ทดสอบได้
  • ให้ user ที่ทดสอบ login เข้าหน้า Portal ได้ (มี Portal/Internal access)

1) budget_transfer_portal — เจ้าของ/ผู้มีสิทธิ์งบประมาณ

  1. Login เป็น budget user (เจ้าของ transfer) → เข้า /my
    • ✅ เห็น tile "โอน/เปลี่ยนแปลงงบประมาณ" พร้อมจำนวนรายการ
  2. คลิก tile → ไปหน้า /my/budget-transfers
    • ✅ เห็นตาราง: เลขที่ / วันที่ / ส่วนงาน / จำนวนเงิน / สถานะ และ sort (Date/Reference/Amount) + pager ทำงาน
  3. คลิกเลขที่รายการ → หน้า /my/budget-transfer/<id>
    • ✅ เห็น PDF งปม.303 แสดง preview แบบ inline ใน iframe
    • ✅ ปุ่ม ดาวน์โหลด โหลดไฟล์ Budget Transfer-<เลขที่>.pdf
    • ✅ ปุ่ม พิมพ์ เปิด PDF ในแท็บใหม่
    • ✅ เห็นกล่อง ประวัติ (chatter) และส่งข้อความได้
  4. คัดลอกลิงก์ที่มี ?access_token=... ไปเปิดในหน้าต่าง incognito (ไม่ login)
    • ✅ เปิดดูได้ด้วย token; ลองลบ token ออก → ควรถูก redirect ไป /my

2) budget_transfer_portal_sarabun_access — ผู้อยู่ในเส้นทางอนุมัติ

  1. ติดตั้งเพิ่ม budget_transfer_portal_sarabun_access (deps: budget_transfer_portal, budget_transfer_sarabun)
  2. ส่ง transfer เข้า e-Saraban ให้เดินเรื่อง (state sent) จนหนังสือ reach ผู้อนุมัติในเส้นทาง
  3. Login เป็น ผู้อนุมัติในเส้นทาง ที่ ไม่ใช่ budget user → เปิดลิงก์ /my/budget-transfer/<id> โดยไม่ใส่ access_token
    • ✅ เปิดดูหน้า + PDF ได้ (เพราะเป็นผู้ที่หนังสือ reach ถึง)
    • ตรวจ regression: ถ้า ถอนโมดูลนี้ออก ผู้อนุมัติคนเดิมเปิดลิงก์ไม่มี token → ต้องโดน redirect ไป /my
  4. Login เป็น user ที่ ไม่เกี่ยวข้อง กับเส้นทาง และไม่มีสิทธิ์งบประมาณ → เปิดลิงก์ไม่มี token
    • ✅ ต้องถูก redirect ไป /my (เข้าไม่ได้)
  5. (ตรวจว่า budget user ยังทำงานปกติ) Login เป็น budget manager → หน้า /my/budget-transfers ยังเห็นรายการครบเหมือนเดิม (โมดูลนี้ไม่ได้ไปจำกัดสิทธิ์เดิม)

n3n added 2 commits August 19, 2026 02:07
Expose budget.transfer on the customer portal via portal.mixin: a list at
/my/budget-transfers and a per-record page at /my/budget-transfer/<id> that
previews the งปม.303 PDF (budget_transfer_pdf) inline, with download/print and
chatter. Access is token- or ACL-based through the stock portal helpers.
Let e-Saraban approval-route participants open a budget transfer's portal link
by identity (no shared token). Overrides _document_check_access so a reached
recipient or the sender of any linked หนังสือ is allowed in; avoids an ir.rule,
which would clamp budget users' unrestricted row access.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant