[REF] stock_picking_batch: stock picking to its own file

task-2069646
This commit is contained in:
Simon Lejeune
2020-01-31 10:22:14 +00:00
committed by svs-odoo
parent eaccf27482
commit be169f6a81
3 changed files with 20 additions and 15 deletions
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import stock_picking
from . import stock_picking_batch
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
class StockPicking(models.Model):
_inherit = "stock.picking"
batch_id = fields.Many2one(
'stock.picking.batch', string='Batch Transfer',
check_company=True,
states={'done': [('readonly', True)], 'cancel': [('readonly', True)]},
help='Batch associated to this transfer', copy=False)
def _should_show_transfers(self):
if len(self.batch_id) == 1 and self == self.batch_id.picking_ids:
return False
return super()._should_show_transfers()
@@ -75,18 +75,3 @@ class StockPickingBatch(models.Model):
return self.env.ref('stock_picking_batch.mt_batch_state')
return super(StockPickingBatch, self)._track_subtype(init_values)
class StockPicking(models.Model):
_inherit = "stock.picking"
batch_id = fields.Many2one(
'stock.picking.batch', string='Batch Transfer',
check_company=True,
states={'done': [('readonly', True)], 'cancel': [('readonly', True)]},
help='Batch associated to this transfer', copy=False)
def _should_show_transfers(self):
if len(self.batch_id) == 1 and self == self.batch_id.picking_ids:
return False
return super()._should_show_transfers()