[IMP]Improved code

bzr revid: pan@tinyerp.com-20130306132608-6xm6w5ft9mgms8v5
This commit is contained in:
Anand Patel (OpenERP) 2013-03-06 18:56:08 +05:30
parent 5a8497ddeb
commit 51a3c7a9a8
2 changed files with 9 additions and 14 deletions

View File

@ -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:

View File

@ -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