def add_new_item(full_inventory): """ Add new item to inventory """ # TODO: this should clearly not be a constant or a global item_code = input("Enter item code: ") item_description = input("Enter item description: ") item_rental_price = input("Enter item rental price: ") # Get price from the market prices module item_price = market_prices.get_latest_price(item_code) is_furniture = input("Is this item a piece of furniture? (Y/N): ") if is_furniture.lower() == "y": item_material = input("Enter item material: ") item_size = input("Enter item size (S,M,L,XL): ") new_item = furniture.Furniture(item_code, item_description, item_price, item_rental_price, item_material, item_size) else: is_electric_appliance = input("Is this item an electric appliance? (Y/N): ") if is_electric_appliance.lower() == "y": item_brand = input("Enter item brand: ") item_voltage = input("Enter item voltage: ") new_item = electric_appliances.ElectricAppliances(item_code, item_description, item_price, item_rental_price, item_brand, item_voltage) else: new_item = inventory.Inventory(item_code, item_description, item_price, item_rental_price) full_inventory[item_code] = new_item.return_dictionary() print("New inventory item added")
def add_new_item(): """Adds a new item to the inventory based on user-inputted item code, description, and rental price. """ # global __full_inventory__ item_code = input("Enter item code: ") item_description = input("Enter item description: ") item_rental_price = input("Enter item rental price: ") # Get price from the market prices module item_price = market_prices.get_latest_price(item_code) is_furniture = input("Is this item a piece of furniture? (Y/N): ") if is_furniture.lower() == "y": item_material = input("Enter item material: ") item_size = input("Enter item size (S,M,L,XL): ") new_item = furniture.Furniture(item_code, item_description, item_price, item_rental_price, item_material, item_size) else: is_electric_appliance = input("Is this item an electric " "appliance? (Y/N): ") if is_electric_appliance.lower() == "y": item_brand = input("Enter item brand: ") item_voltage = input("Enter item voltage: ") new_item = electric_appliances.ElectricAppliances( item_code, item_description, item_price, item_rental_price, item_brand, item_voltage) else: new_item = inventory.Inventory(item_code, item_description, item_price, item_rental_price) __full_inventory__[item_code] = new_item.return_as_dictionary() print("New inventory item added")
def add_new_item(): """add new individual item """ item_code = input("Enter item code: ") item_description = input("Enter item description: ") item_rental_price = input("Enter item rental price: ") # Get price from the market prices module item_price = market_prices.get_latest_price(item_code) is_furniture = input("Is this item a piece of furniture? (Y/N): ") if is_furniture.lower() == "y": item_material = input("Enter item material: ") item_size = input("Enter item size (S,M,L,XL): ") new_item = furniture_class.Furniture(item_code, item_description, item_price, item_rental_price, item_material, item_size) else: is_electric_appliance = input("Is this item an electric" " appliance? (Y/N): ") if is_electric_appliance.lower() == "y": item_brand = input("Enter item brand: ") item_voltage = input("Enter item voltage: ") new_item = electric_appliances.ElectricAppliances( item_code, item_description, item_price, item_rental_price, item_brand, item_voltage) else: new_item = inventory_class.Inventory(item_code, item_description, item_price, item_rental_price) FULL_INVENTORY[item_code] = new_item.return_as_dictionary() print("New inventory item added") return FULL_INVENTORY