From 206a6383f01354417813d5d077dea20467b3ed29 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Mon, 4 Jun 2012 18:34:38 +0530 Subject: [PATCH 1/5] [IMP]account_voucher :Improved menu tip, added group,and added OpenChatter in voucher bzr revid: mma@tinyerp.com-20120604130438-26yoyil4pmzllg8b --- addons/account/account_invoice_view.xml | 10 ++++---- addons/account_voucher/account_voucher.py | 24 +++++++++++++++++++ .../account_voucher_pay_invoice.xml | 2 +- .../voucher_payment_receipt_view.xml | 15 +++++++----- .../voucher_sales_purchase_view.xml | 10 +++++--- 5 files changed, 46 insertions(+), 15 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 8254d5183be..957960cceaa 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -144,7 +144,7 @@
-
- + @@ -180,7 +180,7 @@ - + @@ -471,7 +471,7 @@ [('type','=','in_invoice')] {'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase'} - With Supplier Invoices you can enter and manage invoices issued by your suppliers. OpenERP can also generate draft invoices automatically from purchase orders or receipts. This way, you can control the invoice from your supplier according to what you purchased or received. + Click here to create Supplier invoice.you can control the invoice from your supplier according to what you purchased or received. OpenERP can also generate draft invoices automatically from purchase orders or receipts. @@ -510,7 +510,7 @@ [('type','=','in_refund')] {'default_type': 'in_refund', 'type': 'in_refund', 'journal_type': 'purchase_refund'} - With Supplier Refunds you can manage the credit notes you receive from your suppliers. A refund is a document that credits an invoice completely or partially. You can easily generate refunds and reconcile them directly from the invoice form. + Click here to create a new supplier refund.Track Refund you receive from your supplier. You can also generate refunds and reconcile them directly from the invoice form diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 9ca30aed099..7b99209b3b5 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -250,6 +250,7 @@ class account_voucher(osv.osv): _name = 'account.voucher' _description = 'Accounting Voucher' + _inherit = ['mail.thread'] _order = "date desc, id desc" # _rec_name = 'number' _columns = { @@ -1249,6 +1250,8 @@ class account_voucher(osv.osv): 'state': 'posted', 'number': name, }) + message = _("voucher '%s' is posted.") % 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. @@ -1257,6 +1260,12 @@ class account_voucher(osv.osv): 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) return True + def create(self, cr, uid, vals, context=None): + voucher = super(account_voucher, self).create(cr, uid, vals, context=context) + if voucher: + self.create_send_note(cr, uid, [voucher], context=context) + return voucher + def copy(self, cr, uid, id, default={}, context=None): default.update({ 'state': 'draft', @@ -1270,6 +1279,21 @@ class account_voucher(osv.osv): default['date'] = time.strftime('%Y-%m-%d') return super(account_voucher, self).copy(cr, uid, id, default, context) + # -------------------------------------- + # OpenChatter methods and notifications + # -------------------------------------- + + def _get_document_type(self, type): + type_dict = { + 'payment': 'Supplier Payment', + 'purchase': 'Purchase Receipt', + } + return type_dict.get(type, 'Invoice') + + 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) + account_voucher() class account_voucher_line(osv.osv): diff --git a/addons/account_voucher/account_voucher_pay_invoice.xml b/addons/account_voucher/account_voucher_pay_invoice.xml index da669ad04ee..87201b5c3bd 100644 --- a/addons/account_voucher/account_voucher_pay_invoice.xml +++ b/addons/account_voucher/account_voucher_pay_invoice.xml @@ -19,7 +19,7 @@ diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 5ceee46b2cd..2b4fcbc61b5 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -145,7 +145,7 @@
-
- + diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 2b4fcbc61b5..781946e0374 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -188,8 +188,8 @@ - - + +
@@ -204,8 +204,8 @@ - - + + diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml index 1896af20c32..50ea81fd441 100644 --- a/addons/account_voucher/voucher_sales_purchase_view.xml +++ b/addons/account_voucher/voucher_sales_purchase_view.xml @@ -239,7 +239,7 @@ - + From f088d75d6fe7ca73f2a5adf65cbc5c742a9aa980 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 5 Jun 2012 19:01:40 +0530 Subject: [PATCH 3/5] [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 - + +
+
+
From 6f43cc8642d27eaac068c8c20248bdcb280a7988 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Wed, 6 Jun 2012 11:06:38 +0530 Subject: [PATCH 4/5] [IMP]account_voucher :improve typo bzr revid: mma@tinyerp.com-20120606053638-f5a4sw2xqmvpjcep --- addons/account_voucher/account_voucher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index f478902cb5d..382e865def6 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -1302,7 +1302,7 @@ class account_voucher(osv.osv): 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) + self.message_append_note(cr, uid, [obj.id],body=_("%s reconciled.") % (self._get_document_type(obj.type)), context=context) account_voucher() From c7705bda5df910dc0c4d69043f3ad1dd92e05759 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Wed, 6 Jun 2012 18:00:01 +0530 Subject: [PATCH 5/5] [IMP]account_voucher :improve menu tip bzr revid: mma@tinyerp.com-20120606123001-0d2s7uk9hwpv867a --- addons/account/account_invoice_view.xml | 8 ++++++-- addons/account_voucher/voucher_sales_purchase_view.xml | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 405b05817f0..2f85b72ef3b 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -465,7 +465,9 @@ [('type','=','in_invoice')] {'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase'} - Click here to create Supplier invoice.you can control the invoice from your supplier according to what you purchased or received. OpenERP can also generate draft invoices automatically from purchase orders or receipts. + Click here to create Supplier invoice. + <p> + you can control the invoice from your supplier according to what you purchased or received. OpenERP can also generate draft invoices automatically from purchase orders or receipts. @@ -504,7 +506,9 @@ [('type','=','in_refund')] {'default_type': 'in_refund', 'type': 'in_refund', 'journal_type': 'purchase_refund'} - Click here to create a new supplier refund.Track Refund you receive from your supplier. You can also generate refunds and reconcile them directly from the invoice form + Click here to create a new supplier refund. + <p> + Track Refund you receive from your supplier. You can also generate refunds and reconcile them directly from the invoice form diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml index a9a11092b53..497281fdd3c 100644 --- a/addons/account_voucher/voucher_sales_purchase_view.xml +++ b/addons/account_voucher/voucher_sales_purchase_view.xml @@ -294,7 +294,9 @@ current - Click here to create a Purchase Receipt.When the purchase receipt is confirmed, you can record the supplier payment related to this Purchase receipt. + Click here to create a Purchase Receipt. + <p> + When the purchase receipt is confirmed, you can record the supplier payment related to this Purchase receipt.