feat(plating): Sub 4 — Check All / Clear All buttons + fix QA-005 PDF logo render

- New bulk-toggle actions on fp.contract.review flip all 10 checklist
  items in Section 2.0 (and all 11 in Section 3.0) in one click.
  Rendered as "Check All" / "Clear All" buttons above each checklist.
  User can still tick boxes individually. Buttons hide once the
  section is signed (locked).
- Fix QA-005 PDF: replaced `to_text(...)` (not in QWeb context) with
  `image_data_uri(...)` for the company logo embed. PDF now renders
  with the full colour ENTECH logo (render size 103 KB).
- Smoke test extended: 5 new assertions covering bulk-toggle on/off
  and locked-section guard. 17/17 pass on entech.

fusion_plating_quality → 19.0.2.1.0

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-04-22 21:50:18 -04:00
parent 21da526aa7
commit 5d9c78f8ce
5 changed files with 127 additions and 2 deletions

View File

@@ -135,6 +135,45 @@ if demo_user:
else:
print('[SKIP] No demo user for non-roster check')
# ---- Bulk-toggle (Check All / Clear All) buttons ----------------------
part4 = Part.create({
'partner_id': cust.id,
'part_number': 'SUB4-SMOKE-004',
'revision': 'A',
})
part4.action_start_contract_review()
part4.invalidate_recordset()
rev4 = part4.x_fc_contract_review_id
rev4.action_check_all_section_20()
for f in rev4._SECTION_20_CHECKLIST:
assert rev4[f] is True, f'{f} should be True after Check All'
print('[OK] Section 2.0 Check All ticks all 10 boxes')
rev4.action_clear_all_section_20()
for f in rev4._SECTION_20_CHECKLIST:
assert rev4[f] is False, f'{f} should be False after Clear All'
print('[OK] Section 2.0 Clear All clears all 10 boxes')
rev4.action_check_all_section_30()
for f in rev4._SECTION_30_CHECKLIST:
assert rev4[f] is True, f'{f} should be True after Check All'
print('[OK] Section 3.0 Check All ticks all 11 boxes')
rev4.action_clear_all_section_30()
for f in rev4._SECTION_30_CHECKLIST:
assert rev4[f] is False, f'{f} should be False after Clear All'
print('[OK] Section 3.0 Clear All clears all 11 boxes')
# Lock section 2.0, bulk toggle should refuse
rev4.with_user(admin).action_sign_section_20()
try:
rev4.action_check_all_section_20()
assert False, 'bulk toggle should fail on locked section'
except Exception as e:
assert 'locked' in str(e).lower() or 'signed' in str(e).lower()
print('[OK] Bulk toggle blocked on locked section')
# ---- QWeb render -------------------------------------------------------
report = env.ref('fusion_plating_quality.action_report_contract_review')
pdf_bytes, mime = report._render_qweb_pdf('fusion_plating_quality.report_contract_review_qa005', [review.id])