mirror of
https://github.com/NaN-tic/trytond-stock_external_reception_lot.git
synced 2023-12-14 03:22:54 +01:00
27 lines
906 B
Python
27 lines
906 B
Python
# The COPYRIGHT file at the top level of this repository contains the full
|
|
# copyright notices and license terms.
|
|
from trytond.model import fields
|
|
from trytond.pool import PoolMeta
|
|
from trytond.pyson import Eval
|
|
|
|
__all__ = ['ExternalReceptionLine']
|
|
|
|
|
|
class ExternalReceptionLine(metaclass=PoolMeta):
|
|
__name__ = 'stock.external.reception.line'
|
|
lot_number = fields.Char('Lot Number')
|
|
lot = fields.Many2One('stock.lot', 'Lot', domain=[
|
|
('product', '=', Eval('product')),
|
|
], depends=['product'])
|
|
|
|
@fields.depends('lot')
|
|
def on_change_product(self):
|
|
super(ExternalReceptionLine, self).on_change_product()
|
|
if self.product and self.lot and self.lot.product == self.product:
|
|
return
|
|
self.lot = None
|
|
|
|
def _get_move(self):
|
|
move = super(ExternalReceptionLine, self)._get_move()
|
|
move.lot = self.lot
|
|
return move
|