(Manual rebase+cleanup of PR #720 at 7e9faa6)
bzr revid: office@erpsystems.ro-20121213073744-g0dh73t3q3q1rn2a