[IMP]: account: Improvement in log messages for invoices
bzr revid: rpa@tinyerp.com-20100720110223-5xkechcz097sfk1w
This commit is contained in:
@@ -220,7 +220,7 @@ class account_invoice(osv.osv):
|
||||
_name = "account.invoice"
|
||||
_description = 'Invoice'
|
||||
_order = "number"
|
||||
_log_create = True
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'origin': fields.char('Source Document', size=64, help="Reference of the document that produced this invoice.", readonly=True, states={'draft':[('readonly',False)]}),
|
||||
@@ -344,6 +344,9 @@ class account_invoice(osv.osv):
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
try:
|
||||
res = super(account_invoice, self).create(cr, uid, vals, context)
|
||||
for inv_id, name in self.name_get(cr, uid, [res], context=context):
|
||||
message = _('Invoice ') + " '" + name + "' "+ _("is waiting for validation.")
|
||||
self.log(cr, uid, inv_id, message)
|
||||
return res
|
||||
except Exception, e:
|
||||
if '"journal_id" viol' in e.args[0]:
|
||||
@@ -354,9 +357,6 @@ class account_invoice(osv.osv):
|
||||
|
||||
def confirm_paid(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state':'paid'}, context=context)
|
||||
for (id, name) in self.name_get(cr, uid, ids):
|
||||
message = _('Document ') + " '" + name + "' "+ _("has been paid.")
|
||||
self.log(cr, uid, id, message)
|
||||
return True
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
@@ -955,8 +955,9 @@ class account_invoice(osv.osv):
|
||||
'WHERE account_move_line.move_id = %s ' \
|
||||
'AND account_analytic_line.move_id = account_move_line.id',
|
||||
(ref, move_id))
|
||||
message = _('Invoice ') + " '" + number + "' "+ _("is confirm")
|
||||
self.log(cr, uid, id, message)
|
||||
for inv_id, name in self.name_get(cr, uid, [id]):
|
||||
message = _('Invoice ') + " '" + name + "' "+ _("is validated.")
|
||||
self.log(cr, uid, inv_id, message)
|
||||
return True
|
||||
|
||||
def action_cancel(self, cr, uid, ids, *args):
|
||||
@@ -1175,9 +1176,15 @@ class account_invoice(osv.osv):
|
||||
if l.account_id.id==src_account_id:
|
||||
line_ids.append(l.id)
|
||||
total += (l.debit or 0.0) - (l.credit or 0.0)
|
||||
|
||||
inv_id, name = self.name_get(cr, uid, [invoice.id], context=context)[0]
|
||||
if (not round(total,self.pool.get('decimal.precision').precision_get(cr, uid, 'Account'))) or writeoff_acc_id:
|
||||
self.log(cr, uid, inv_id, _('Invoice ') + " '" + name + "' "+ _("is totally paid."))
|
||||
self.pool.get('account.move.line').reconcile(cr, uid, line_ids, 'manual', writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context)
|
||||
else:
|
||||
code = invoice.currency_id.code
|
||||
amt = str(pay_amount) + code + ' on ' + str(invoice.amount_total) + code + ' (' + str(total) + code + ' remaining)'
|
||||
self.log(cr, uid, inv_id, _('Invoice ') + " '" + name + "' "+ _("is paid partially: ") + amt)
|
||||
self.pool.get('account.move.line').reconcile_partial(cr, uid, line_ids, 'manual', context)
|
||||
|
||||
# Update the stored value (fields.function), so we write to trigger recompute
|
||||
|
||||
Reference in New Issue
Block a user