def self.create_statement_with_currency(options={}, *args)
o = {:currency_code=>'EUR', :journal=>false, :name=>false}.merge(options)
if not o[:journal] :
currency_id = ResCurrency.find(:first, :domain=>[['code','=',o[:currency_code]]]).id
if currency_id :
journal = AccountJournal.find(:first, :domain=>[['type','=','cash'],['currency','=',currency_id]])
else
raise "!!! --- HELPER ERROR : create_statement_with_currency #{o[:currency_code]} currency not found"
end
else
journal = o[:journal]
end
toreturn = AccountBankStatement.new()
toreturn.journal_id = journal.id
toreturn.create
if o[:name]:
toreturn.name=o[:name]
toreturn.save
end
return toreturn
end