[FIX] Account: Customer / Supplier Journal item does not includes Refund journals
lp bug: https://launchpad.net/bugs/698188 fixed bzr revid: mra@mra-laptop-20110107103851-c1is63wymlpx05br
This commit is contained in:
parent
75a74aa0a9
commit
c21328f83c
|
@ -102,9 +102,9 @@ class account_move_line(osv.osv):
|
||||||
|
|
||||||
def _amount_residual(self, cr, uid, ids, field_names, args, context=None):
|
def _amount_residual(self, cr, uid, ids, field_names, args, context=None):
|
||||||
"""
|
"""
|
||||||
This function returns the residual amount on a receivable or payable account.move.line.
|
This function returns the residual amount on a receivable or payable account.move.line.
|
||||||
By default, it returns an amount in the currency of this journal entry (maybe different
|
By default, it returns an amount in the currency of this journal entry (maybe different
|
||||||
of the company currency), but if you pass 'residual_in_company_currency' = True in the
|
of the company currency), but if you pass 'residual_in_company_currency' = True in the
|
||||||
context then the returned amount will be in company currency.
|
context then the returned amount will be in company currency.
|
||||||
"""
|
"""
|
||||||
res = {}
|
res = {}
|
||||||
|
@ -116,13 +116,13 @@ class account_move_line(osv.osv):
|
||||||
'amount_residual': 0.0,
|
'amount_residual': 0.0,
|
||||||
'amount_residual_currency': 0.0,
|
'amount_residual_currency': 0.0,
|
||||||
}
|
}
|
||||||
|
|
||||||
if move_line.reconcile_id:
|
if move_line.reconcile_id:
|
||||||
continue
|
continue
|
||||||
if not move_line.account_id.type in ('payable', 'receivable'):
|
if not move_line.account_id.type in ('payable', 'receivable'):
|
||||||
#this function does not suport to be used on move lines not related to payable or receivable accounts
|
#this function does not suport to be used on move lines not related to payable or receivable accounts
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if move_line.currency_id:
|
if move_line.currency_id:
|
||||||
move_line_total = move_line.amount_currency
|
move_line_total = move_line.amount_currency
|
||||||
sign = move_line.amount_currency < 0 and -1 or 1
|
sign = move_line.amount_currency < 0 and -1 or 1
|
||||||
|
@ -950,6 +950,13 @@ class account_move_line(osv.osv):
|
||||||
#Restrict the list of journal view in search view
|
#Restrict the list of journal view in search view
|
||||||
if view_type == 'search' and result['fields'].get('journal_id', False):
|
if view_type == 'search' and result['fields'].get('journal_id', False):
|
||||||
result['fields']['journal_id']['selection'] = journal_pool.name_search(cr, uid, '', [], context=context)
|
result['fields']['journal_id']['selection'] = journal_pool.name_search(cr, uid, '', [], context=context)
|
||||||
|
ctx = context.copy()
|
||||||
|
if context.get('journal_type', False) == 'sale':
|
||||||
|
ctx.update({'journal_type': 'sale_refund'})
|
||||||
|
result['fields']['journal_id']['selection'] += journal_pool.name_search(cr, uid, '', [], context=ctx)
|
||||||
|
elif context.get('journal_type', False) == 'purchase':
|
||||||
|
ctx.update({'journal_type': 'purchase_refund'})
|
||||||
|
result['fields']['journal_id']['selection'] += journal_pool.name_search(cr, uid, '', [], context=ctx)
|
||||||
return result
|
return result
|
||||||
if context.get('view_mode', False):
|
if context.get('view_mode', False):
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue