The writers have been schizophrenic in the way they've written Andy. They brought him on as an annoying 'bad guy'. Then they ended the Angela thing in a way that made him sympathetic, Erin came along and he became the 'good guy'. Then he was the friendly underdog when he was boss. Then they randomly decided to make him a psychotically unstable jerk this season.
I don't think Jim was being an asshole except that he didn't tell Pam when he first took the job. Otherwise, he was just pursuing a professional goal which unfortunately made things difficult for his family. They did resolve their issues a little too fast, they should have had to actually talk about the job first.
I don't think Jim & Pam would get divorced. It's not the couples who fight who get divorced, it's the couples who avoid each other.
Why did they have Andy disappear for months, was it a plot necessity because Ed Helms was filming a movie? If so why didn't they just have Andy have to leave for some sane reason?