[IMP] Improve code for delivered products.

bzr revid: bth@tinyerp.com-20130214074858-n1wfbt6zmxsee37f
This commit is contained in:
Bhumi Thakkar (Open ERP)
2013-02-14 13:18:58 +05:30
parent 09b12ce248
commit 0bbfaec315
2 changed files with 16 additions and 7 deletions
+14 -1
View File
@@ -20,6 +20,7 @@
##############################################################################
from openerp.osv import fields, osv
from openerp.tools.translate import _
class stock_move(osv.osv):
_inherit = 'stock.move'
@@ -41,7 +42,19 @@ class stock_picking(osv.osv):
_defaults = {
'sale_id': False
}
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".
@return: True
"""
for record in self.browse(cr, uid, ids, context):
if record.type == "out" and record.sale_id:
for sale in self.pool.get('sale.order').browse(cr, uid, [record.sale_id.id], context):
sale.message_post(body=_("Products <b>Delivered</b>"))
return super(stock_picking, self).action_done(cr, uid, ids, context=context)
def get_currency_id(self, cursor, user, picking):
if picking.sale_id:
return picking.sale_id.pricelist_id.currency_id.id
+2 -6
View File
@@ -874,14 +874,10 @@ class stock_picking(osv.osv):
This method is called at the end of the workflow by the activity "done".
@return: True
"""
"""
self.write(cr, uid, ids, {'state': 'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S')})
for record in self.browse(cr, uid, ids, context):
if record.type == "out":
for sale in self.pool.get('sale.order').browse(cr, uid, [record.sale_id.id], context):
sale.message_post(body=_("Products <b>Delivered</b>"))
return True
def action_move(self, cr, uid, ids, context=None):
"""Process the Stock Moves of the Picking