Ensure that orders always contain a valid billing address #3

Closed
opened 2021-11-20 11:15:21 +00:00 by ungleich-gitea · 0 comments

I had to patch the current code for the Bill class as follows:

    @property
    def billing_address(self):
        orders = Order.objects.filter(bill=self)
        # The genrate_for method makes sure all the orders of a bill share the
        # same billing address. TODO: It would be nice to enforce that somehow...
        if orders:
            return orders[0].billing_address
        else:
            return None

Correct way of fixing is to disallow an order to be created without having a valid billing address

I had to patch the current code for the Bill class as follows: ``` @property def billing_address(self): orders = Order.objects.filter(bill=self) # The genrate_for method makes sure all the orders of a bill share the # same billing address. TODO: It would be nice to enforce that somehow... if orders: return orders[0].billing_address else: return None ``` Correct way of fixing is to disallow an order to be created without having a valid billing address
fnux was assigned by ungleich-gitea 2021-11-20 11:15:21 +00:00
nico closed this issue 2022-02-15 08:46:53 +00:00
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: uncloud/uncloud#3
No description provided.