Skip to content

Fix critical sale and backup integrity bugs#63

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-9277
Draft

Fix critical sale and backup integrity bugs#63
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-9277

Conversation

@cursor

@cursor cursor Bot commented Jun 15, 2026

Copy link
Copy Markdown

修复多处高影响正确性问题:

  • 销售详情页 GET 不再自动改写已持久化金额,避免余额流水/会员消费与销售单金额不一致。
  • 销售明细删除改为 POST + CSRF,并在事务内锁定销售单、明细和库存后恢复库存,避免误触发和并发库存虚增。
  • 销售明细页使用视图传入的 items 并提交 POST 删除表单。
  • 备份恢复页面上下文和确认字段与模板对齐;新增删除备份确认模板。
  • 媒体恢复先暂存校验再替换 MEDIA_ROOT,避免复制失败时清空现有媒体。
  • 日志下载/删除审计记录使用 nullable content_type,避免外键错误导致 500。

验证:

  • . .venv/bin/activate && mkdir -p /workspace/logs && python manage.py test inventory.tests.test_sale_status inventory.tests.test_views.BackupViewSecurityTest inventory.tests.test_sales_balance_payment inventory.tests.test_services.MemberServiceTest
  • . .venv/bin/activate && mkdir -p /workspace/logs && python manage.py test inventory.tests.test_models

两个测试命令均通过,仅保留既有 staticfiles.W004 警告。

Open in Web View Automation 

Co-authored-by: Xianist Lab <zhtyyx@users.noreply.github.com>
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