So both A and B trip odometers are working, the car is otherwise OK, the speedo is working, but the main odometer is not? Interesting. Taken together these things imply the connection to the gearbox is OK, the ECU is OK, and disconnecting the battery itself should not give you this effect (the battery is disconnected routinely for service, replacement, etc.).
I would suspect either the connection to the instruments behind the cluster or another electrical problem, maybe with the odometer itself.