|
- [[ (move_ids.partner_id and move_ids.partner_id.name) or '']] :
+ [[ (move_ids.partner_id and move_ids.partner_id.name) or 'Account']] :
[[ move_ids.account_id.name ]]
[[ get_ref(voucher.id,move_ids) ]]
|
diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py
index 873d6c19668..10b3862f3c8 100755
--- a/addons/account_voucher/voucher.py
+++ b/addons/account_voucher/voucher.py
@@ -29,6 +29,16 @@ from mx.DateTime import RelativeDateTime
from tools import config
+type2journal = {
+ 'rec_voucher':'cash',
+ 'bank_rec_voucher':'cash',
+ 'pay_voucher': 'cash',
+ 'bank_pay_voucher':'cash',
+ 'cont_voucher':'cash',
+ 'journal_sale_voucher':'sale',
+ 'journal_pur_voucher':'purchase'
+}
+
class account_voucher(osv.osv):
def _get_period(self, cr, uid, context):
periods = self.pool.get('account.period').find(cr, uid)
@@ -45,9 +55,9 @@ class account_voucher(osv.osv):
return [('none', 'Free Reference')]
def _get_journal(self, cr, uid, context):
- type_inv = context #.get('type', 'rec_voucher')
- type2journal = {'rec_voucher': 'cash', 'bank_rec_voucher': 'cash','pay_voucher': 'cash','bank_pay_voucher': 'cash', 'cont_voucher': 'cash','journal_sale_voucher': 'sale','journal_pur_voucher': 'purchase' }
+ type_inv = context.get('type', 'rec_voucher')
journal_obj = self.pool.get('account.journal')
+ res = False
res = journal_obj.search(cr, uid, [('type', '=', type2journal.get(type_inv, 'cash'))], limit=1)
if res:
return res[0]
@@ -99,18 +109,6 @@ class account_voucher(osv.osv):
'move_ids':fields.many2many('account.move.line', 'voucher_id', 'account_id', 'rel_account_move', 'Real Entry'),
}
-# def get_bank(self, cr, uid, context={}):
-# type = context.get('type', 'bank_payment')
-# journal = self.pool.get('account.journal')
-# if type == 'bank_payment':
-# id = journal.search(cr, uid, [('name','ilike','Bank')])
-# return id
-# elif type == 'cash_payment':
-# id = journal.search(cr, uid, [('name','ilike','Cash')])
-# return id
-#
-# return 3
-
_defaults = {
#'journal_id':get_bank,
'state': lambda *a: 'draft',
@@ -123,8 +121,6 @@ class account_voucher(osv.osv):
self.pool.get('res.users').browse(cr, uid, uid,
context=context).company_id.id,
'currency_id': _get_currency,
-
-
}
def _get_analytic_lines(self, cr, uid, id):
diff --git a/addons/account_voucher/voucher_view.xml b/addons/account_voucher/voucher_view.xml
index a1f6907c701..872d831fa79 100755
--- a/addons/account_voucher/voucher_view.xml
+++ b/addons/account_voucher/voucher_view.xml
@@ -1,5 +1,5 @@
-
+
account.voucher.tree
@@ -293,4 +293,4 @@
-
\ No newline at end of file
+
\ No newline at end of file