[16.0][IMP] purchase_work_acceptance_todo: rebuild as pure base.automation module - #1218
Open
madara1150 wants to merge 8 commits into
Open
[16.0][IMP] purchase_work_acceptance_todo: rebuild as pure base.automation module#1218madara1150 wants to merge 8 commits into
madara1150 wants to merge 8 commits into
Conversation
…ation module ย้ายการแจ้งเตือน Todo ของ work.acceptance จาก Python override ไปใช้ base.automation ให้ตรงกับ pattern เดียวกับที่ทำใน agx_approval_*_todo (#1210) - เพิ่ม data/base_automation.xml: 3 rules 1. แจ้ง Todo แต่ละผู้ตรวจสอบเมื่อ state → in_review 2. ล้าง Todo ของผู้ตรวจสอบเมื่อ tier.review.status ออกจาก pending (รองรับทั้ง accept/reject) 3. ล้าง Todo ทั้งหมดเมื่อ state ออกจาก in_review (safety net) - ลบ models/res_users.py (systray filter ซ้อนกับ base_tier_validation_hide_systray) - ลด models/work_acceptance.py เหลือเพียง override _notify_review_requested → pass เพื่อ suppress OCA default subscribe/message_post - อัปเดต depends ให้ตรง: purchase_work_acceptance_tier_validation + base_automation
…tier.review field ที่ถูกต้องบน tier.review คือ 'model' ไม่ใช่ 'res_model'
…trigger ผิด OCA request_validation() สร้าง tier.review หลังจาก write(state='in_review') ดังนั้น on_write บน work.acceptance.state จะ fire ตอนที่ review_ids ยังว่าง แก้: เปลี่ยน automation_notify_wa_review_requested เป็น on_create บน tier.review แทน เพื่อให้ reviewer_ids พร้อมแล้วตอน fire
…วจรับ ใช้ review.done_by.id แทน review.reviewer_ids.ids เพื่อให้ลบ Todo เฉพาะของ reviewer ที่กดจริง ไม่ใช่ทั้งคณะกรรมการ
…ivity_feedback เมื่อกรรมการตรวจรับแล้ว ให้ mark activity เป็น done แทนการลบทิ้ง เพื่อให้มี log ปรากฏใน chatter ว่าดำเนินการแล้ว
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.
สรุปการเปลี่ยนแปลง
ย้ายการแจ้งเตือน Todo ของ
work.acceptanceจาก Python override ไปใช้base.automationให้ตรงกับ pattern เดียวกับที่ทำในagx_approval_*_todoใน #1210เหตุผล
โมดูล
purchase_work_acceptance_todoเดิมใช้ Python override 4 method เพื่อจัดการ Todo activity:_notify_review_requested— schedule Todo ต่อ reviewer_validate_tier/_rejected_tier—activity_feedbackเมื่อรับรอง/ปฏิเสธwrite— unlink activities เมื่อออกจากin_reviewres_users.review_user_count— ซ่อน WA จาก OCA tier systrayการเปลี่ยนแปลง
เพิ่ม
data/base_automation.xml— 3 rules ครอบคลุม lifecycle ทั้งหมด:automation_notify_wa_review_requestedwork.acceptance.state→in_reviewautomation_clear_wa_review_on_tier_resolvedtier.review.statusออกจากpending(WA เท่านั้น)status=approvedทั้งสองกรณี)automation_clear_wa_review_on_state_exitwork.acceptance.stateออกจากin_reviewลด
models/work_acceptance.py— เหลือเพียง_notify_review_requested→returnเพื่อ suppress OCA default subscribe/message_postไม่ให้ซ้อนกับ automationลบ
models/res_users.py—review_user_countoverride ซ้ำซ้อนกับbase_tier_validation_hide_systrayที่ติดตั้งไว้แล้วอัปเดต
__manifest__.py— depends:purchase_work_acceptance_tier_validation,mail_activity_todo,base_automationการทดสอบ
purchase_work_acceptance_todoaccept