def create_office(business, addresses, office_type): office = Office() office.office_type = office_type office.addresses = addresses if business.offices is None: business.offices = [] business.offices.append(office)
def create_office(business: Business, addresses: list, office_type: str): """Create office and link it to business.""" office = Office() office.office_type = office_type office.addresses = addresses if business.offices is None: business.offices = [] business.offices.append(office)
def create_office(business, office_type, addresses) -> Office: """Create a new office for incorporation.""" office = Office() office.office_type = office_type office.addresses = [] # Iterate addresses and add to this office for k, v in addresses.items(): address = create_address(v, k) address.business_id = business.id if address: office.addresses.append(address) return office