[ADD]Reconcile function which return the full or partial reconcile depending on which is setted for the move line

bzr revid: dle@openerp.com-20121122092302-rji8z8bgbb3p8k14
This commit is contained in:
Denis Ledoux dle@openerp.com 2012-11-22 10:23:02 +01:00
parent 0c695e9436
commit bf093ee617
2 changed files with 12 additions and 3 deletions

View File

@ -477,6 +477,15 @@ class account_move_line(osv.osv):
result.append(line.id)
return result
def _get_reconcile(self, cr, uid, ids,name, unknow_none, context=None):
res = dict.fromkeys(ids, False)
for line in self.browse(cr, uid, ids, context=context):
if line.reconcile_id:
res[line.id] = str(line.reconcile_id.name)
elif line.reconcile_partial_id:
res[line.id] = str(line.reconcile_partial_id.name)
return res
_columns = {
'name': fields.char('Name', size=64, required=True),
'quantity': fields.float('Quantity', digits=(16,2), help="The optional quantity expressed by this line, eg: number of product sold. The quantity is not a legal requirement but is very useful for some reports."),
@ -491,6 +500,7 @@ class account_move_line(osv.osv):
'statement_id': fields.many2one('account.bank.statement', 'Statement', help="The bank statement used for bank reconciliation", select=1),
'reconcile_id': fields.many2one('account.move.reconcile', 'Reconcile', readonly=True, ondelete='set null', select=2),
'reconcile_partial_id': fields.many2one('account.move.reconcile', 'Partial Reconcile', readonly=True, ondelete='set null', select=2),
'reconcile': fields.function(_get_reconcile, type='char', string='Reconcile'),
'amount_currency': fields.float('Amount Currency', help="The amount expressed in an optional other currency if it is a multi-currency entry.", digits_compute=dp.get_precision('Account')),
'amount_residual_currency': fields.function(_amount_residual, string='Residual Amount', multi="residual", help="The residual amount on a receivable or payable of a journal entry expressed in its currency (maybe different of the company currency)."),
'amount_residual': fields.function(_amount_residual, string='Residual Amount', multi="residual", help="The residual amount on a receivable or payable of a journal entry expressed in the company currency."),

View File

@ -1003,8 +1003,7 @@
<field name="move_id" required="0"/>
<field name="debit" sum="Total Debit"/>
<field name="credit" sum="Total Credit"/>
<field name="reconcile_partial_id"/>
<field name="reconcile_id"/>
<field name="reconcile"/>
<field name="invoice" invisible="1"/>
<field name="amount_currency" readonly="True" invisible="not context.get('currency',False)"/>
<field name="currency_id" readonly="True" invisible="not context.get('currency',False)" />
@ -1183,7 +1182,7 @@
<field name="search_view_id" ref="view_account_move_line_filter"/>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to register a new journal item.
Select the period and the journal you want to fill.
</p><p>
This view can be used by accountants in order to quickly record
entries in OpenERP. If you want to record a supplier invoice,