40
40
'type_for_register': lambda *a: 'none',
43
def name_get(self, cr, uid, ids, context={}):
45
Give only code account for each id given by ids
47
res = self.pool.get('account.account').read(cr, uid, ids, ['code'], context=context)
48
return [(int(x['id']), x['code']) for x in res]
52
45
class account_move(osv.osv):
75
68
res[move.id] = "%s,%s"%(prev._table_name, prev.id)
71
def _reconcile_compute(self, cr, uid, ids, name, args, context, where =''):
72
# UF-418: Add a new column to show the reconcile or partial reconcile value in the Journal Entries list
75
# get the ids of the reconcile or partially reconcile lines
76
cr.execute( 'SELECT move_id, case when reconcile_partial_id is null then reconcile_id else reconcile_partial_id end '\
77
'FROM account_move_line '\
78
'WHERE move_id IN %s ', (tuple(ids),))
79
result = dict(cr.fetchall())
80
rec_pool = self.pool.get('account.move.reconcile')
83
result.setdefault(id, None)
84
# from each reconcile or partially reconcile id, get the name and amount in case of partially reconcile
86
# this logic is taken from account_move_reconcile.name_get
87
r = rec_pool.browse(cr, uid, result[id], context=context)
88
total = reduce(lambda y,t: (t.debit or 0.0) - (t.credit or 0.0) + y, r.line_partial_ids, 0.0)
90
result[id] = '%s (%.2f)' % (r.name, total)
79
96
'partner_type': fields.function(_get_third_parties_from_move_line, string="Third Parties", selection=[('account.bank.statement', 'Register'), ('hr.employee', 'Employee'),
80
97
('res.partner', 'Partner')], size=128, readonly="1", type="reference", method=True),
98
'reconcile_id': fields.function(_reconcile_compute, method=True, string='Reconcile', type='char'),