From a2798d40306f5a646d7338cf832cfdcad7f3d5be Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Sat, 6 Dec 2008 18:48:05 +0530 Subject: [PATCH] initial bug-fix for the voucher entry bzr revid: mga@tinyerp.com-20081206131805-p352xscr1ccxeyh6 --- addons/account_voucher/account_report.xml | 23 ++++++++------- .../account_voucher_wizard.xml | 4 +-- .../account_voucher_workflow.xml | 4 +-- .../account_voucher/report/report_voucher.rml | 2 +- addons/account_voucher/voucher.py | 28 ++++++++----------- addons/account_voucher/voucher_view.xml | 4 +-- 6 files changed, 30 insertions(+), 35 deletions(-) diff --git a/addons/account_voucher/account_report.xml b/addons/account_voucher/account_report.xml index 134581c8816..d19ba827348 100755 --- a/addons/account_voucher/account_report.xml +++ b/addons/account_voucher/account_report.xml @@ -1,9 +1,9 @@ - + - - + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/addons/account_voucher/account_voucher_wizard.xml b/addons/account_voucher/account_voucher_wizard.xml index ffe7b25c87c..9557ffb4f4f 100644 --- a/addons/account_voucher/account_voucher_wizard.xml +++ b/addons/account_voucher/account_voucher_wizard.xml @@ -1,5 +1,5 @@ - + - \ No newline at end of file + \ No newline at end of file diff --git a/addons/account_voucher/account_voucher_workflow.xml b/addons/account_voucher/account_voucher_workflow.xml index 0299c79997d..9609e105444 100644 --- a/addons/account_voucher/account_voucher_workflow.xml +++ b/addons/account_voucher/account_voucher_workflow.xml @@ -1,5 +1,5 @@ - + @@ -72,4 +72,4 @@ open_voucher - \ No newline at end of file + \ No newline at end of file diff --git a/addons/account_voucher/report/report_voucher.rml b/addons/account_voucher/report/report_voucher.rml index 685983045ae..c4c210551c5 100755 --- a/addons/account_voucher/report/report_voucher.rml +++ b/addons/account_voucher/report/report_voucher.rml @@ -180,7 +180,7 @@ - [[ (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