Files
manufacture/mrp_production_putaway_strategy/models/mrp_production.py
Jordi Ballester Alomar 386940d389 [9.0][ADD] mrp_production_putaway_strategy (#215)
* [9.0][ADD] mrp_production_putaway_strategy

* small fix

* fixes

* [FIX] travis and readme.

* [FIX] adapt tests to new logic
2017-08-28 14:20:29 +02:00

24 lines
887 B
Python

# -*- coding: utf-8 -*-
# © 2017 Eficent Business and IT Consulting Services S.L.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from openerp import api, models, _
class MrpProduction(models.Model):
_inherit = 'mrp.production'
@api.multi
def action_confirm(self):
for mo in self:
if not mo.move_prod_id:
location = self.env['stock.location'].get_putaway_strategy(
mo.location_dest_id, mo.product_id)
if location:
message = _(
'Applied Putaway strategy to finished products '
'location %s.' % mo.location_dest_id.complete_name)
mo.message_post(message, message_type='comment')
mo.location_dest_id = location
return super(MrpProduction, self).action_confirm()