django-oscar/django-oscar
在 GitHub 查看Cannot switch back from pre-defined benefit/condition to a non-pre-defined one
Open
#3,889 创建于 2022年3月10日
Good first issue☁ Bug
描述
Issue Summary
The current benefit and condition forms don't work properly when switching back to using a non-pre-defined benefit/condition from a pre-defined one.
Steps to Reproduce
- Create an offer with a non-pre-defined benefit or condition.
- Go to the benefit/condition form for that offer and change it to a pre-defined one.
- Go back to the form and try to change it back to a non-pre-defined one.
Instead of switching back, the benefit/condition is still referencing the previous pre-defined one.
Notes
-
On the public sandbox, the form only has pre-defined benefits, but the saving logic is identical and the bug is also present in the
ConditionFormas well: https://github.com/django-oscar/django-oscar/blob/04dd391c900537a61dbb0ae5250ca5c2df6bbc4b/src/oscar/apps/dashboard/offers/forms.py#L137-L143 -
After switching to a pre-defined benefit/condition, the form also displays the other field data that had to be removed back in step 2.
Technical details
- Reproducable on the public sandbox: https://latest.oscarcommerce.com/en-gb/dashboard/offers/