[IMP] account : sequences

you can reduce the code with smth like this: (inv_type in ('out_invoice', 'out_refund')) and 'sale' or (inv_type in ('in_invoice', 'in_refund')) and 'purchase'