From c7d5fbd9123b11b6ca372d89052e9416c313cc1c Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Wed, 13 Feb 2013 18:54:50 +0530 Subject: [PATCH 1/8] [IMP] Added message post when the 'Products Received' in PO. bzr revid: psa@tinyerp.com-20130213132450-jwq7nvast54vcg9m --- addons/purchase/purchase.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index e76bf4a0358..357f5b27fd6 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -673,6 +673,7 @@ class purchase_order(osv.osv): def picking_done(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'shipped':1,'state':'approved'}, context=context) + self.message_post(cr, uid, ids, body=_("Products Received."), context=context) return True def copy(self, cr, uid, id, default=None, context=None): From 0558ed61d986a7a8a134e06ddeeb5262fb3346e2 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 14 Feb 2013 11:38:46 +0530 Subject: [PATCH 2/8] [IMP] Added message post for 'Invoice Received' when the invoice is validated in PO. bzr revid: psa@tinyerp.com-20130214060846-xed5pskiv0cw40tn --- addons/purchase/purchase.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 357f5b27fd6..e276ce0c48f 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -1188,4 +1188,13 @@ class mail_compose_message(osv.Model): self.pool.get('purchase.order').signal_send_rfq(cr, uid, [context['default_res_id']]) return super(mail_compose_message, self).send_mail(cr, uid, ids, context=context) +class account_invoice(osv.Model): + _inherit = 'account.invoice' + + def invoice_validate(self, cr, uid, ids, context=None): + po_ids = self.pool.get('purchase.order').search(cr,uid,[('invoice_ids','in',ids)],context) + res = super(account_invoice, self).invoice_validate(cr, uid, ids, context=None) + self.pool.get('purchase.order').message_post(cr, uid, po_ids, body=_("Invoice Received."), context=context) + return res + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 89d45ad9ecddcce6ed7f2e28209d9db210a333a7 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 14 Feb 2013 12:06:55 +0530 Subject: [PATCH 3/8] [IMP] Added message post for 'Invoice Paid.' when the invoice is paid in PO. bzr revid: psa@tinyerp.com-20130214063655-15kjqgc67fwcqw9f --- addons/purchase/purchase.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index e276ce0c48f..4ddc2bc9eb8 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -557,6 +557,7 @@ class purchase_order(osv.osv): def invoice_done(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'approved'}, context=context) + self.message_post(cr, uid, ids, body=_("Invoice Paid."), context=context) return True def has_stockable_product(self, cr, uid, ids, *args): From b581d6525317b01676f2a5d54ffd2c215e4d3276 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Thu, 14 Feb 2013 15:17:24 +0530 Subject: [PATCH 4/8] [IMP] Combined the second message posts in one. bzr revid: psa@tinyerp.com-20130214094724-vwxhd13erdhwmk3m --- addons/purchase/purchase.py | 3 ++- addons/purchase/purchase_data.xml | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 4ddc2bc9eb8..a6a5f3e75de 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -163,6 +163,7 @@ class purchase_order(osv.osv): 'state': { 'purchase.mt_rfq_confirmed': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'confirmed', 'purchase.mt_rfq_approved': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'approved', + 'purchase.mt_rfq_invoice_paid': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done', }, } _columns = { @@ -557,7 +558,7 @@ class purchase_order(osv.osv): def invoice_done(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'approved'}, context=context) - self.message_post(cr, uid, ids, body=_("Invoice Paid."), context=context) + # self.message_post(cr, uid, ids, body=_("Invoice Paid."), context=context) return True def has_stockable_product(self, cr, uid, ids, *args): diff --git a/addons/purchase/purchase_data.xml b/addons/purchase/purchase_data.xml index ceb43ba281a..a08e221053e 100644 --- a/addons/purchase/purchase_data.xml +++ b/addons/purchase/purchase_data.xml @@ -60,6 +60,10 @@ purchase.order - + + Invoice Paid + + purchase.order + From f8e78b68c664c9547e4e2cd32d97aacf4c5e40fc Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 15 Feb 2013 16:51:17 +0530 Subject: [PATCH 5/8] [IMP] Removed little bit code for concating the message_post. bzr revid: psa@tinyerp.com-20130215112117-v6jwvl2p6f2goczz --- addons/purchase/purchase.py | 3 +-- addons/purchase/purchase_data.xml | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index a6a5f3e75de..ec4fc5c9dcf 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -163,7 +163,6 @@ class purchase_order(osv.osv): 'state': { 'purchase.mt_rfq_confirmed': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'confirmed', 'purchase.mt_rfq_approved': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'approved', - 'purchase.mt_rfq_invoice_paid': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done', }, } _columns = { @@ -1192,7 +1191,7 @@ class mail_compose_message(osv.Model): class account_invoice(osv.Model): _inherit = 'account.invoice' - + def invoice_validate(self, cr, uid, ids, context=None): po_ids = self.pool.get('purchase.order').search(cr,uid,[('invoice_ids','in',ids)],context) res = super(account_invoice, self).invoice_validate(cr, uid, ids, context=None) diff --git a/addons/purchase/purchase_data.xml b/addons/purchase/purchase_data.xml index a08e221053e..ceb43ba281a 100644 --- a/addons/purchase/purchase_data.xml +++ b/addons/purchase/purchase_data.xml @@ -60,10 +60,6 @@ purchase.order - - Invoice Paid - - purchase.order - + From 070fd0a00d2a960606aeb4ce2072695bc7c26173 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 15 Feb 2013 17:29:21 +0530 Subject: [PATCH 6/8] [IMP] Message post when the invoice is paid. bzr revid: psa@tinyerp.com-20130215115921-vbeaw8tnx3d65yll --- addons/purchase/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index ec4fc5c9dcf..d63048be1fd 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -557,7 +557,7 @@ class purchase_order(osv.osv): def invoice_done(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'approved'}, context=context) - # self.message_post(cr, uid, ids, body=_("Invoice Paid."), context=context) + self.message_post(cr, uid, ids, body=_("Invoice Paid."), context=context) return True def has_stockable_product(self, cr, uid, ids, *args): From 72aa23664aa9e906a291caa6df26e4057da03c63 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 15 Feb 2013 19:06:35 +0530 Subject: [PATCH 7/8] [IMP] Added message post for the Purchase Order done. bzr revid: psa@tinyerp.com-20130215133635-yc25srcgf07zmawv --- addons/purchase/purchase.py | 1 + addons/purchase/purchase_data.xml | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index d63048be1fd..6eb5dd7961a 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -163,6 +163,7 @@ class purchase_order(osv.osv): 'state': { 'purchase.mt_rfq_confirmed': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'confirmed', 'purchase.mt_rfq_approved': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'approved', + 'purchase.mt_rfq_done': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'done', }, } _columns = { diff --git a/addons/purchase/purchase_data.xml b/addons/purchase/purchase_data.xml index ceb43ba281a..66e64926e49 100644 --- a/addons/purchase/purchase_data.xml +++ b/addons/purchase/purchase_data.xml @@ -60,6 +60,11 @@ purchase.order + + Purchase Order Done + + purchase.order + From 3c1af23aae436aa7894ef650fff921d627d53e1e Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 15 Feb 2013 19:09:55 +0530 Subject: [PATCH 8/8] Removed Invoice paid message post. bzr revid: psa@tinyerp.com-20130215133955-rl08108crvw2bbvg --- addons/purchase/purchase.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 6eb5dd7961a..fa26b23c280 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -558,7 +558,6 @@ class purchase_order(osv.osv): def invoice_done(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state':'approved'}, context=context) - self.message_post(cr, uid, ids, body=_("Invoice Paid."), context=context) return True def has_stockable_product(self, cr, uid, ids, *args):