custom queryset method to bulk update customer balance

This commit is contained in:
imperosol
2024-11-05 19:40:59 +01:00
parent 97ea1763f1
commit b091fee035
6 changed files with 595 additions and 519 deletions

View File

@ -123,7 +123,7 @@ def merge_users(u1: User, u2: User) -> User:
c_dest, created = Customer.get_or_create(u1)
c_src.refillings.update(customer=c_dest)
c_src.buyings.update(customer=c_dest)
c_dest.recompute_amount()
Customer.objects.filter(pk=c_dest.pk).update_amount()
if created:
# swap the account numbers, so that the user keep
# the id he is accustomed to