[FIX] Account : USer will be notified for unreconciling partial reconcilatins if he tries to cancel the invoice
bzr revid: jma@tinyerp.com-20100512104158-uvbap84l2jnzcnsz
This commit is contained in:
parent
0b8c46b909
commit
72bd05b3c2
|
@ -581,7 +581,8 @@ class account_move_line(osv.osv):
|
||||||
if line.reconcile_partial_id:
|
if line.reconcile_partial_id:
|
||||||
for line2 in line.reconcile_partial_id.line_partial_ids:
|
for line2 in line.reconcile_partial_id.line_partial_ids:
|
||||||
if not line2.reconcile_id:
|
if not line2.reconcile_id:
|
||||||
merges.append(line2.id)
|
if line2.id not in merges:
|
||||||
|
merges.append(line2.id)
|
||||||
total += (line2.debit or 0.0) - (line2.credit or 0.0)
|
total += (line2.debit or 0.0) - (line2.credit or 0.0)
|
||||||
merges_rec.append(line.reconcile_partial_id.id)
|
merges_rec.append(line.reconcile_partial_id.id)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -922,7 +922,12 @@ class account_invoice(osv.osv):
|
||||||
# will be automatically deleted too
|
# will be automatically deleted too
|
||||||
account_move_obj.unlink(cr, uid, [i['move_id'][0]])
|
account_move_obj.unlink(cr, uid, [i['move_id'][0]])
|
||||||
if i['payment_ids']:
|
if i['payment_ids']:
|
||||||
self.pool.get('account.move.line').write(cr, uid, i['payment_ids'], {'reconcile_partial_id': False})
|
account_move_line_obj = self.pool.get('account.move.line')
|
||||||
|
pay_ids = account_move_line_obj.browse(cr, uid , i['payment_ids'])
|
||||||
|
for move_line in pay_ids:
|
||||||
|
if move_line.reconcile_partial_id and move_line.reconcile_partial_id.line_partial_ids:
|
||||||
|
raise osv.except_osv(_('Error !'), _('You cannot cancel the Invoice which is Partially Paid! You need to unreconcile concerned payment entries!'))
|
||||||
|
|
||||||
self.write(cr, uid, ids, {'state':'cancel', 'move_id':False})
|
self.write(cr, uid, ids, {'state':'cancel', 'move_id':False})
|
||||||
self._log_event(cr, uid, ids,-1.0, 'Cancel Invoice')
|
self._log_event(cr, uid, ids,-1.0, 'Cancel Invoice')
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -29,11 +29,17 @@ class account_unreconcile(osv.osv_memory):
|
||||||
obj_move_reconcile = self.pool.get('account.move.reconcile')
|
obj_move_reconcile = self.pool.get('account.move.reconcile')
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
recs = obj_move_line.read(cr, uid, context['active_ids'], ['reconcile_id',])
|
recs = pool.get('account.move.line').read(cr, uid, data['ids'], ['reconcile_id','reconcile_partial_id'])
|
||||||
recs = filter(lambda x: x['reconcile_id'], recs)
|
unlink_ids = []
|
||||||
rec_ids = [rec['reconcile_id'][0] for rec in recs]
|
full_recs = filter(lambda x: x['reconcile_id'], recs)
|
||||||
if len(rec_ids):
|
rec_ids = [rec['reconcile_id'][0] for rec in full_recs]
|
||||||
obj_move_reconcile.unlink(cr, uid, rec_ids)
|
part_recs = filter(lambda x: x['reconcile_partial_id'], recs)
|
||||||
|
part_rec_ids = [rec['reconcile_partial_id'][0] for rec in part_recs]
|
||||||
|
unlink_ids += rec_ids
|
||||||
|
unlink_ids += part_rec_ids
|
||||||
|
|
||||||
|
if len(unlink_ids):
|
||||||
|
pooler.get_pool(cr.dbname).get('account.move.reconcile').unlink(cr, uid, unlink_ids)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
account_unreconcile()
|
account_unreconcile()
|
||||||
|
@ -44,10 +50,11 @@ class account_unreconcile_reconcile(osv.osv_memory):
|
||||||
|
|
||||||
def trans_unrec_reconcile(self, cr, uid, ids, context=None):
|
def trans_unrec_reconcile(self, cr, uid, ids, context=None):
|
||||||
obj_move_reconcile = self.pool.get('account.move.reconcile')
|
obj_move_reconcile = self.pool.get('account.move.reconcile')
|
||||||
|
rec_ids = context['active_ids']
|
||||||
if context is None:
|
if context is None:
|
||||||
context = {}
|
context = {}
|
||||||
if len(rec_ids):
|
if len(rec_ids):
|
||||||
obj_move_reconcile.unlink(cr, uid, context['active_ids'])
|
obj_move_reconcile.unlink(cr, uid, rec_ids)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
account_unreconcile_reconcile()
|
account_unreconcile_reconcile()
|
||||||
|
|
Loading…
Reference in New Issue