From 84d0f1ff53ff51ebba9e955490d4a682922feebb Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 4 Jun 2012 12:43:01 +0530 Subject: [PATCH 01/23] [IMP] account : Added groups to Journal. bzr revid: mdi@tinyerp.com-20120604071301-xt518arvb3sdlrcj --- addons/account/account_invoice_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 8254d5183be..832cdbd250d 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -276,7 +276,7 @@ - + From 21498e1caf29adb979eec771a3578f1d26d08297 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 4 Jun 2012 15:54:38 +0530 Subject: [PATCH 02/23] [IMP] account : Added groups to unit of measure. bzr revid: mdi@tinyerp.com-20120604102438-pbf9mjmgp3gbhlso --- addons/account/account_invoice_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 832cdbd250d..97218719812 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -37,7 +37,7 @@ - + @@ -56,7 +56,7 @@ From 4f96a9d0a55ba01370c653dc0699970a1e4d340c Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 4 Jun 2012 16:21:28 +0530 Subject: [PATCH 04/23] [IMP] account : Highlighted the buttons. bzr revid: mdi@tinyerp.com-20120604105128-en20tnlo7rigs0f9 --- addons/account/account_invoice_view.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index a06405f7227..b3d51f9bb4b 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -260,9 +260,10 @@
- From 25332dbe1d34ac9263c792d8fe611edc5aa43485 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 4 Jun 2012 16:45:19 +0530 Subject: [PATCH 06/23] [IMP] account_voucher : revert the changes. bzr revid: mdi@tinyerp.com-20120604111519-1rp90h30yrf5uvvh --- addons/account_voucher/account_voucher_pay_invoice.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_voucher/account_voucher_pay_invoice.xml b/addons/account_voucher/account_voucher_pay_invoice.xml index 8703abad9e2..41d21c4bf38 100644 --- a/addons/account_voucher/account_voucher_pay_invoice.xml +++ b/addons/account_voucher/account_voucher_pay_invoice.xml @@ -8,7 +8,7 @@ From 3800d8fd6ec28e3edcfb067ad2aa75727f2b3641 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 4 Jun 2012 17:01:38 +0530 Subject: [PATCH 07/23] [IMP] account : Improved the menutips of customer invoice. bzr revid: mdi@tinyerp.com-20120604113138-19f5fphbnla93756 --- addons/account/account_invoice_view.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index b3d51f9bb4b..f01cc6fd0d6 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -444,7 +444,11 @@ [('type','=','out_invoice')] {'default_type':'out_invoice', 'type':'out_invoice', 'journal_type': 'sale'} - With Customer Invoices you can create and manage sales invoices issued to your customers. OpenERP can also generate draft invoices automatically from sales orders or deliveries. You should only confirm them before sending them to your customers. + + Click here to create a new Invoice. + <p> + The Invoice can be generated automatically from a sale order or a delivery order. The invoice can be send by email. + From 015459f045b046e7a9d001b9e5c9bcc4ac0e1f87 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Tue, 5 Jun 2012 11:20:13 +0530 Subject: [PATCH 08/23] [IMP] account_voucher : Improved the menu tips for customer payment. bzr revid: mdi@tinyerp.com-20120605055013-t0fjym92knocj4gy --- addons/account_voucher/voucher_payment_receipt_view.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 5ceee46b2cd..9e71977a510 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -431,7 +431,11 @@ current - Sales payment allows you to register the payments you receive from your customers. In order to record a payment, you must enter the customer, the payment method (=the journal) and the payment amount. OpenERP will propose to you automatically the reconciliation of this payment with the open invoices or sales receipts. + + Click on create to register a payment. + <p> + Enter the customer and the payment method and then, either create manually a payment record or OpenERP will propose to you automatically the reconciliation of this payment with the open invoices or sales receipts. + From 3db7d5f66c36da11a8d5ddb7ec6ec606f1450dcb Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Tue, 5 Jun 2012 11:26:44 +0530 Subject: [PATCH 09/23] [IMP] account_voucher : Addedd a groups to some fields. bzr revid: mdi@tinyerp.com-20120605055644-o63hq3757qcbkzps --- addons/account_voucher/voucher_payment_receipt_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index 9e71977a510..f1013e1a9c3 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -345,8 +345,8 @@ - - + + From c7f98142d573aa394d40e3172d1b1468d8990e38 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Tue, 5 Jun 2012 17:54:57 +0530 Subject: [PATCH 10/23] [IMP] account_voucher : Added OpenChatter Notification and highlighted the button. bzr revid: mdi@tinyerp.com-20120605122457-pkbwld5kr04z9wl4 --- addons/account_voucher/account_voucher.py | 61 ++++++++++++++++++- .../account_voucher/account_voucher_view.xml | 3 + .../voucher_payment_receipt_view.xml | 8 ++- .../voucher_sales_purchase_view.xml | 6 ++ 4 files changed, 76 insertions(+), 2 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 9ca30aed099..f361a1ac494 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -248,10 +248,41 @@ class account_voucher(osv.osv): res[voucher.id] = voucher.amount / rate return res + # ----------------------------------------- + # OpenChatter notifications and need_action + # ----------------------------------------- + + def _get_document_type(self, type): + type_dict = { + 'sale': 'Sales Receipt', + 'purchase': 'Purchase Receipt', + 'payment': 'Supplier Payment', + 'receipt': 'Customer Payment', + } + return type_dict.get(type, 'Voucher') + + def create(self, cr, uid, vals, context=None): + res = super(account_voucher, self).create(cr, uid, vals, context) + self.create_send_note(cr, uid, [res], context=context) + return res + + 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 posted_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 is posted.") % (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 is reconciled.") % (self._get_document_type(obj.type)), context=context) + _name = 'account.voucher' _description = 'Accounting Voucher' _order = "date desc, id desc" # _rec_name = 'number' + _inherit = ['mail.thread'] _columns = { 'type':fields.selection([ ('sale','Sale'), @@ -556,7 +587,7 @@ class account_voucher(osv.osv): @return: Returns a dict which contains new values, and context """ def _remove_noise_in_o2m(): - """if the line is partially reconciled, then we must pay attention to display it only once and + """if the line is partially reconciled, then we must pay attention to display it only once and in the good o2m. This function returns True if the line is considered as noise and should not be displayed """ @@ -780,6 +811,7 @@ class account_voucher(osv.osv): def proforma_voucher(self, cr, uid, ids, context=None): self.action_move_line_create(cr, uid, ids, context=context) + self.posted_send_note(cr, uid, ids, context=context) return {'type': 'ir.actions.act_window_close'} def action_cancel_draft(self, cr, uid, ids, context=None): @@ -1521,4 +1553,31 @@ def resolve_o2m_operations(cr, uid, target_osv, operations, fields, context): return results +class account_move_line(osv.osv): + _inherit = 'account.move.line' + + def get_voucher_ids(self, cr, uid, ids, context=None): + voucher_obj = self.pool.get('account.voucher') + move_lines = self.browse(cr, uid, ids, context=context) + moves = [] + for move in move_lines: + moves.append(move.move_id.id) + + voucher_ids = voucher_obj.search(cr, uid, [('move_id', 'in', moves)], context=context) + return voucher_ids + + def reconcile(self, cr, uid, ids, type='auto', writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False, context=None): + voucher_obj = self.pool.get('account.voucher') + res = super(account_move_line, self).reconcile(cr, uid, ids, type=type, writeoff_acc_id=writeoff_acc_id, writeoff_period_id=writeoff_period_id, writeoff_journal_id=writeoff_journal_id, context=context) + voucher_ids = self.get_voucher_ids(cr, uid, ids, context=context) + voucher_obj.reconcile_send_note(cr, uid, voucher_ids, context=context) + return res + + def reconcile_partial(self, cr, uid, ids, type='auto', context=None, writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False): + voucher_obj = self.pool.get('account.voucher') + res = super(account_move_line, self).reconcile_partial(cr, uid, ids, type=type, context=context, writeoff_acc_id=writeoff_acc_id, writeoff_period_id=writeoff_period_id, writeoff_journal_id=writeoff_journal_id) + voucher_ids = self.get_voucher_ids(cr, uid, ids, context=context) + return res + +account_move_line() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml index a1ff581006b..45dc77d6f65 100644 --- a/addons/account_voucher/account_voucher_view.xml +++ b/addons/account_voucher/account_voucher_view.xml @@ -112,6 +112,9 @@ +
+ +
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index f1013e1a9c3..1eb2a62133e 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -261,6 +261,9 @@ +
+ +
@@ -299,7 +302,7 @@
- + +
+
+
diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml index 013dd50c91a..776b6f55097 100644 --- a/addons/account_voucher/voucher_sales_purchase_view.xml +++ b/addons/account_voucher/voucher_sales_purchase_view.xml @@ -178,7 +178,11 @@ current - When you sell products to a customer, you can give him a sales receipt or an invoice. When the sales receipt is confirmed, it creates journal items automatically and you can record the customer payment related to this sales receipt. + + Click here to create a sale receipt. + <p> + When the sales receipt is confirmed, you can record the customer payment related to this sales receipt. + From 2c8df77f1f0875505f1ec33c78c9dd3442cc0c00 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Wed, 6 Jun 2012 14:39:26 +0530 Subject: [PATCH 15/23] [IMP] account_voucher : removed the icon from a button. bzr revid: mdi@tinyerp.com-20120606090926-s6wupsqyobp2wfff --- addons/account_voucher/account_voucher_pay_invoice.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_voucher/account_voucher_pay_invoice.xml b/addons/account_voucher/account_voucher_pay_invoice.xml index bd7654b2277..f289ab5ae41 100644 --- a/addons/account_voucher/account_voucher_pay_invoice.xml +++ b/addons/account_voucher/account_voucher_pay_invoice.xml @@ -9,7 +9,7 @@
-
From b5b392274c6329637348f4ad4e54b8e7625214d5 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Wed, 6 Jun 2012 15:08:47 +0530 Subject: [PATCH 16/23] [IMP] account_voucher : Added a group and highlighted the buttons. bzr revid: mdi@tinyerp.com-20120606093847-zv2jvmvla2uemuyi --- addons/account_voucher/account_voucher.py | 2 +- addons/account_voucher/voucher_sales_purchase_view.xml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index f361a1ac494..1f5a4f29653 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -354,7 +354,7 @@ class account_voucher(osv.osv): 'amount': _get_amount, 'type':_get_type, 'state': 'draft', - 'pay_now': 'pay_later', + 'pay_now': 'pay_now', 'name': '', 'date': lambda *a: time.strftime('%Y-%m-%d'), 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c), diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml index 776b6f55097..e4d51bb7a7e 100644 --- a/addons/account_voucher/voucher_sales_purchase_view.xml +++ b/addons/account_voucher/voucher_sales_purchase_view.xml @@ -82,8 +82,8 @@
-
From d639e9e7fb8e4721f3a9c094758105ec92165efa Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Thu, 7 Jun 2012 17:09:34 +0530 Subject: [PATCH 20/23] [IMP] account_voucher : Improved the code. bzr revid: mdi@tinyerp.com-20120607113934-jllzdcjjg53f4f05 --- 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 11842c91296..e30819ef322 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -259,7 +259,7 @@ class account_voucher(osv.osv): 'payment': 'Supplier Payment', 'receipt': 'Customer Payment', } - return type_dict.get(type, 'Voucher') + return type_dict.get(type, 'Payment') def create(self, cr, uid, vals, context=None): res = super(account_voucher, self).create(cr, uid, vals, context=context) From c2858548bc52860228bd2e3bf647b4514538c3fb Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 11 Jun 2012 16:45:06 +0530 Subject: [PATCH 21/23] [IMP] account : Added m2m tag to tax field. bzr revid: mdi@tinyerp.com-20120611111506-2g6kb7x2vka142dg --- addons/account/account_invoice_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 41b4bc6f2a6..1092d2950a8 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -292,7 +292,7 @@ - + @@ -311,7 +311,7 @@