flectra/addons/stock/wizard/stock_overprocessed_transfer.py

25 lines
910 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2018-01-16 11:34:37 +01:00
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
2018-01-16 11:34:37 +01:00
from flectra import api, fields, models, _
from flectra.exceptions import UserError
class StockOverProcessedTransfer(models.TransientModel):
_name = 'stock.overprocessed.transfer'
picking_id = fields.Many2one('stock.picking')
overprocessed_product_name = fields.Char(compute='_compute_overprocessed_product_name',
readonly=True)
@api.multi
def _compute_overprocessed_product_name(self):
for wizard in self:
moves = wizard.picking_id._get_overprocessed_stock_moves()
wizard.overprocessed_product_name = moves[0].product_id.display_name
@api.multi
def action_confirm(self):
self.ensure_one()
return self.picking_id.with_context(skip_overprocessed_check=True).button_validate()