修改货架货位关联移动历史调拨单关联
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
import logging
|
||||
from odoo import api, fields, models
|
||||
from odoo.osv import expression
|
||||
@@ -223,6 +224,23 @@ class ShelfLocation(models.Model):
|
||||
_description = '货架货位'
|
||||
_order = 'name'
|
||||
|
||||
# current_location_id = fields.Many2one('sf.shelf.location', string='当前位置')
|
||||
# # 目的位置
|
||||
# destination_location_id = fields.Many2one('sf.shelf.location', string='目的位置')
|
||||
current_move_ids = fields.One2many('stock.move.line', 'current_location_id', '当前位置调拨单')
|
||||
destination_move_ids = fields.One2many('stock.move.line', 'destination_location_id', '目标位置调拨单')
|
||||
storage_time = fields.Datetime('入库时间', compute='_compute_location_status')
|
||||
|
||||
@api.depends('location_status')
|
||||
def _compute_location_status(self):
|
||||
for record in self:
|
||||
if record.location_status == '占用':
|
||||
record.storage_time = datetime.datetime.now()
|
||||
if record.location_status == '空闲':
|
||||
record.storage_time = False
|
||||
else:
|
||||
pass
|
||||
|
||||
name = fields.Char('名称', required=True, size=20)
|
||||
barcode = fields.Char('编码', copy=False, size=15)
|
||||
|
||||
@@ -452,7 +470,7 @@ class SfStockPicking(models.Model):
|
||||
if line:
|
||||
if line.current_location_id:
|
||||
line.current_location_id.product_sn_id = False
|
||||
line.current_location_id = False
|
||||
line.current_location_id.location_status = '空闲'
|
||||
return res
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user