This is a phrase used in a situation where people need to calm down. In this particular phrase , beans represents the harsh feelings or the feelings of anger. Putting the beans in the pantry represents the harsh feelings being put aside until they can be further resolved.
Greta: I hate you!
Natalie: Toes too (look it up)
Bradley: Guys, PUT THE BEANS IN THE PANTRY!
Greta: You're right Bradley
Natalie: Lets stay friends