[IMP] Improve code for delivered products.
bzr revid: bth@tinyerp.com-20130214074858-n1wfbt6zmxsee37f
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user