[IMP] add total amount and flag to know if the deposit have been reconcile, the best will be to add a workflow

This commit is contained in:
Sebastien Beau
2014-02-03 08:44:59 +01:00
parent df3295f78c
commit e3265020e7
2 changed files with 14 additions and 2 deletions

View File

@@ -30,13 +30,22 @@ class account_check_deposit(orm.Model):
def sum_amount(self, cr, uid, ids, name, args, context=None):
res = {}
total = 0
for deposit in self.browse(cr, uid, ids, context=context):
total = 0
for line in deposit.check_payment_ids:
total += line.debit
res[deposit.id]= total
return res
def _is_reconcile(self, cr, uid, ids, name, args, context=None):
res = {}
for deposit in self.browse(cr, uid, ids, context=context):
res[deposit.id] = False
if deposit.move_id:
for line in deposit.move_id.line_id:
if line.debit > 0 and line.reconcile_id:
res[deposit.id] = True
return res
_columns = {
'name': fields.char('Name', size=64, required=True, readonly=True,
@@ -73,7 +82,8 @@ class account_check_deposit(orm.Model):
'company_id': fields.many2one('res.company', 'Company', required=True,
change_default=True, readonly=True,
states={'draft':[('readonly',False)]}),
'total_amount': fields.function(sum_amount, string ="total amount"),
'total_amount': fields.function(sum_amount, string ="total amount", type="float"),
'is_reconcile': fields.function(_is_reconcile, string ="Reconcile", type="boolean"),
}
_defaults = {

View File

@@ -89,6 +89,8 @@
<field name="deposit_date"/>
<field name="state"/>
<field name="move_id"/>
<field name="total_amount"/>
<field name="is_reconcile"/>
</tree>
</field>
</record>