[FIX]: receivable, payable voucher do the same journal entry like, receivable, payable invoice

bzr revid: mga@tinyerp.com-20100730184845-5w4ogkp1msqblcbq
This commit is contained in:
Mantavya Gajjar 2010-07-31 00:18:45 +05:30
parent f41257d03a
commit 23f707e063
3 changed files with 30 additions and 13 deletions

View File

@ -54,13 +54,13 @@
<tree toolbar="True" colors="red:(date&lt;=current_date);black:(date&gt;current_date)" string="Analytic account">
<field name="name"/>
<field name="code"/>
<field name="quantity"/>
<field name="quantity_max"/>
<field name="debit"/>
<field name="credit"/>
<field name="balance"/>
<field name="company_currency_id"/>
<!-- <field name="date"/>-->
<!-- <field name="debit"/>-->
<!-- <field name="credit"/>-->
<!-- <field name="quantity"/>-->
<!-- <field name="quantity_max"/>-->
<!-- <field name="parent_id" invisible="1"/>-->
<!-- <field name="type" invisible="1"/>-->
<!-- <field name="partner_id" invisible="1"/>-->

View File

@ -269,8 +269,16 @@ class account_voucher(osv.osv):
continue
journal = journal_pool.browse(cr, uid, inv.journal_id.id)
if journal.sequence_id:
name = sequence_pool.get_id(cr, uid, journal.sequence_id.id)
if inv.type in ('journal_pur_voucher', 'journal_sale_vou'):
if journal.invoice_sequence_id:
name = sequence_pool.get_id(cr, uid, journal.invoice_sequence_id.id)
else:
raise osv.except_osv(_('Error !'), _('Please define invoice sequence on %s journal !' % (journal.name)))
else:
if journal.sequence_id:
name = sequence_pool.get_id(cr, uid, journal.sequence_id.id)
else:
raise osv.except_osv(_('Error !'), _('Please define sequence on journal !'))
ref = False
if inv.type in ('journal_pur_voucher', 'bank_rec_voucher', 'rec_voucher'):
@ -462,25 +470,24 @@ class account_voucher_line(osv.osv):
account_id = False
partner = partner_pool.browse(cr, uid, partner_id)
balance = 0.0
if type1 in ('rec_voucher','bank_rec_voucher', 'journal_voucher'):
if type1 in ('rec_voucher', 'bank_rec_voucher', 'journal_voucher'):
account_id = partner.property_account_receivable.id
balance = partner.credit
ttype = 'cr'
elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') :
elif type1 in ('pay_voucher', 'bank_pay_voucher', 'journal_voucher') :
account_id = partner.property_account_payable.id
balance = partner.debit
ttype = 'dr'
elif type1 in ('journal_sale_vou') :
account_id = partner.property_account_receivable.id
balance = partner.credit
ttype = 'dr'
elif type1 in ('journal_pur_voucher') :
account_id = partner.property_account_payable.id
balance = partner.debit
ttype = 'cr'
if company.currency_id != currency:

View File

@ -40,13 +40,15 @@ class account_invoice(osv.osv):
@return: Returns a list of ids based on search domain
"""
if not context:
context = {}
ttype = context.get('ttype', False)
if ttype and ttype in ('rec_voucher', 'bank_rec_voucher'):
args += [('type','in', ['out_invoice', 'in_refund'])]
elif ttype and ttype in ('pay_voucher', 'bank_pay_voucher'):
args += [('type','in', ['in_invoice', 'out_refund'])]
elif ttype and ttype in('journal_sale_vou', 'journal_pur_voucher', 'journal_voucher'):
raise osv.except_osv(_('Invalid action !'), _('You can not reconcile sales, purchase, or journal entry with invoice !'))
raise osv.except_osv(_('Invalid action !'), _('You can not reconcile sales, purchase, or journal voucher with invoice !'))
args += [('type','=', 'do_not_allow_search')]
res = super(account_invoice, self).search(cr, user, args, offset, limit, order, context, count)
@ -84,8 +86,16 @@ class account_voucher(osv.osv):
continue
journal = journal_pool.browse(cr, uid, inv.journal_id.id)
if journal.sequence_id:
name = sequence_pool.get_id(cr, uid, journal.sequence_id.id)
if inv.type in ('journal_pur_voucher', 'journal_sale_vou'):
if journal.invoice_sequence_id:
name = sequence_pool.get_id(cr, uid, journal.invoice_sequence_id.id)
else:
raise osv.except_osv(_('Error !'), _('Please define invoice sequence on %s journal !' % (journal.name)))
else:
if journal.sequence_id:
name = sequence_pool.get_id(cr, uid, journal.sequence_id.id)
else:
raise osv.except_osv(_('Error !'), _('Please define sequence on journal !'))
ref = False
if inv.type in ('journal_pur_voucher', 'bank_rec_voucher', 'rec_voucher'):