[FIX] fix the problem of partial payment and purchase invoice will go to paid status even if the price is 0 in product.
bzr revid: nco@tinyerp.com-20121204100106-64i2borf2dyj8jt8
This commit is contained in:
@@ -674,6 +674,9 @@ class account_invoice(osv.osv):
|
||||
return super(account_invoice, self).copy(cr, uid, id, default, context)
|
||||
|
||||
def test_paid(self, cr, uid, ids, *args):
|
||||
for inv in self.browse(cr, uid, ids):
|
||||
if inv.amount_total == 0.0:
|
||||
return True
|
||||
res = self.move_line_id_payment_get(cr, uid, ids)
|
||||
if not res:
|
||||
return False
|
||||
@@ -851,6 +854,8 @@ class account_invoice(osv.osv):
|
||||
if context is None:
|
||||
context = {}
|
||||
for inv in self.browse(cr, uid, ids, context=context):
|
||||
if inv.amount_total == 0.0:
|
||||
continue
|
||||
if not inv.journal_id.sequence_id:
|
||||
raise osv.except_osv(_('Error!'), _('Please define sequence on the journal related to this invoice.'))
|
||||
if not inv.invoice_line:
|
||||
@@ -1037,6 +1042,8 @@ class account_invoice(osv.osv):
|
||||
self.write(cr, uid, ids, {})
|
||||
|
||||
for obj_inv in self.browse(cr, uid, ids, context=context):
|
||||
if obj_inv.amount_total == 0.0:
|
||||
continue
|
||||
id = obj_inv.id
|
||||
invtype = obj_inv.type
|
||||
number = obj_inv.number
|
||||
|
||||
@@ -596,7 +596,7 @@ class account_voucher(osv.osv):
|
||||
This function returns True if the line is considered as noise and should not be displayed
|
||||
"""
|
||||
if line.reconcile_partial_id:
|
||||
sign = 1 if ttype == 'receipt' else -1
|
||||
sign = 1 if ttype in ['payment', 'receipt'] else -1
|
||||
if currency_id == line.currency_id.id:
|
||||
if line.amount_residual_currency * sign <= 0:
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user