From f088d75d6fe7ca73f2a5adf65cbc5c742a9aa980 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 5 Jun 2012 19:01:40 +0530 Subject: [PATCH] [IMP]account_voucher : added a class in button of inherited view , added a openchater for reconcile bzr revid: mma@tinyerp.com-20120605133140-36mp7y50z3wwzq5s --- addons/account_voucher/account_voucher.py | 16 +++++++++++++--- .../account_voucher_pay_invoice.xml | 8 +++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 7b99209b3b5..f478902cb5d 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -1250,14 +1250,18 @@ class account_voucher(osv.osv): 'state': 'posted', 'number': name, }) - message = _("voucher '%s' is posted.") % name + + message = _("%s '%s' is posted.") % (self._get_document_type(voucher.type),name) self.message_append_note(cr, uid, [voucher.id], body=message, context=context) if voucher.journal_id.entry_posted: move_pool.post(cr, uid, [move_id], context={}) # We automatically reconcile the account move lines. + reconcile = False for rec_ids in rec_list_ids: if len(rec_ids) >= 2: - move_line_pool.reconcile_partial(cr, uid, rec_ids, writeoff_acc_id=voucher.writeoff_acc_id.id, writeoff_period_id=voucher.period_id.id, writeoff_journal_id=voucher.journal_id.id) + reconcile = move_line_pool.reconcile_partial(cr, uid, rec_ids, writeoff_acc_id=voucher.writeoff_acc_id.id, writeoff_period_id=voucher.period_id.id, writeoff_journal_id=voucher.journal_id.id) + if reconcile: + self.reconcile_send_note(cr, uid, [voucher.id], context=context) return True def create(self, cr, uid, vals, context=None): @@ -1287,12 +1291,18 @@ class account_voucher(osv.osv): type_dict = { 'payment': 'Supplier Payment', 'purchase': 'Purchase Receipt', + 'sale': 'Sales Receipt', + 'receipt': 'Customer Payment', } - return type_dict.get(type, 'Invoice') + return type_dict.get(type, 'payment') def create_send_note(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): self.message_append_note(cr, uid, [obj.id],body=_("%s created.") % (self._get_document_type(obj.type)), context=context) + + def reconcile_send_note(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids, context=context): + self.message_append_note(cr, uid, [obj.id],body=_("%s Reconciled.") % (self._get_document_type(obj.type)), context=context) account_voucher() diff --git a/addons/account_voucher/account_voucher_pay_invoice.xml b/addons/account_voucher/account_voucher_pay_invoice.xml index 87201b5c3bd..0000b1b20f7 100644 --- a/addons/account_voucher/account_voucher_pay_invoice.xml +++ b/addons/account_voucher/account_voucher_pay_invoice.xml @@ -18,9 +18,11 @@ form - + +
+
+