To do what you're looking for, there is no group_by as such, in your place I'd make a list with all the unique combinations of your 2 address fields, For each group, filter the corresponding commands and use update() to assign the specified instance of Bill
You can find more information in the documentation, particularly in the sections on values() and distinct() https://docs.djangoproject.com/en/5.1/ref/models/querysets/
I hope my answer helps solve your problem