From 51a3c7a9a8d0f73e649abfee19ebe14295def7c1 Mon Sep 17 00:00:00 2001 From: "Anand Patel (OpenERP)" Date: Wed, 6 Mar 2013 18:56:08 +0530 Subject: [PATCH 1/2] [IMP]Improved code bzr revid: pan@tinyerp.com-20130306132608-6xm6w5ft9mgms8v5 --- addons/sale/sale.py | 14 -------------- addons/sale_stock/stock.py | 9 +++++++++ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 19f9e9ff857..374b7cb6c17 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1013,7 +1013,6 @@ class mail_compose_message(osv.Model): class account_invoice(osv.Model): _inherit = 'account.invoice' - def confirm_paid(self, cr, uid, ids, context=None): sale_order_obj = self.pool.get('sale.order') res = super(account_invoice, self).confirm_paid(cr, uid, ids, context=context) @@ -1021,17 +1020,4 @@ class account_invoice(osv.Model): sale_order_obj.message_post(cr, uid, so_ids, body=_("Invoice paid"), context=context) return res - -class stock_picking(osv.osv): - _inherit = 'stock.picking' - - def action_done(self, cr, uid, ids, context=None): - """ Changes picking state to done. This method is called at the end of - the workflow by the activity "done". - """ - for record in self.browse(cr, uid, ids, context): - if record.type == "out" and record.sale_id: - self.pool.get('sale.order').message_post(cr, uid, [record.sale_id.id], body=_("Products delivered"), context=context) - return super(stock_picking, self).action_done(cr, uid, ids, context=context) - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/sale_stock/stock.py b/addons/sale_stock/stock.py index 93acf8579f5..27e7fa8c29b 100644 --- a/addons/sale_stock/stock.py +++ b/addons/sale_stock/stock.py @@ -119,6 +119,15 @@ class stock_picking(osv.osv): 'invoice_ids': [(4, invoice_id)], }) return super(stock_picking, self)._invoice_hook(cursor, user, picking, invoice_id) + + def action_done(self, cr, uid, ids, context=None): + """ Changes picking state to done. This method is called at the end of + the workflow by the activity "done". + """ + for record in self.browse(cr, uid, ids, context): + if record.type == "out" and record.sale_id: + self.pool.get('sale.order').message_post(cr, uid, [record.sale_id.id], body=_("Products delivered"), context=context) + return super(stock_picking, self).action_done(cr, uid, ids, context=context) # Redefinition of the new field in order to update the model stock.picking.out in the orm # FIXME: this is a temporary workaround because of a framework bug (ref: lp996816). It should be removed as soon as From 9d3a03cb4438cca0f0183776bc6341cb96252eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 7 Mar 2013 10:51:04 +0100 Subject: [PATCH 2/2] [FIX] Fixed missing import. bzr revid: tde@openerp.com-20130307095104-b2gur1h4wqm4q2sn --- addons/sale_stock/stock.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/sale_stock/stock.py b/addons/sale_stock/stock.py index 27e7fa8c29b..e1070998ae8 100644 --- a/addons/sale_stock/stock.py +++ b/addons/sale_stock/stock.py @@ -20,6 +20,7 @@ ############################################################################## from openerp.osv import fields, osv +from openerp.tools.translate import _ class stock_move(osv.osv): _inherit = 'stock.move'