1、功能刀具拆解单拆解流程优化;2、优化货位看板显示;
This commit is contained in:
@@ -847,43 +847,48 @@ class FunctionalToolDismantle(models.Model):
|
||||
if self.dismantle_cause in ['寿命到期报废', '崩刀报废']:
|
||||
# 除刀柄外物料报废 入库到Scrap
|
||||
if self.integral_product_id:
|
||||
self.integral_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
|
||||
self.integral_product_id.dismantle_stock_moves(False, self.integral_lot_id, location,
|
||||
location_dest_scrap)
|
||||
elif self.blade_product_id:
|
||||
self.blade_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
|
||||
self.blade_product_id.dismantle_stock_moves(False, self.blade_lot_id, location, location_dest_scrap)
|
||||
if self.bar_product_id:
|
||||
self.bar_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
|
||||
self.bar_product_id.dismantle_stock_moves(False, self.bar_lot_id, location, location_dest_scrap)
|
||||
elif self.pad_product_id:
|
||||
self.pad_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
|
||||
self.pad_product_id.dismantle_stock_moves(False, self.pad_lot_id, location, location_dest_scrap)
|
||||
if self.chuck_product_id:
|
||||
self.chuck_product_id.dismantle_stock_moves(False, location, location_dest_scrap)
|
||||
self.chuck_product_id.dismantle_stock_moves(False, self.chuck_lot_id, location, location_dest_scrap)
|
||||
# ===========功能刀具[磨削]拆解==============
|
||||
elif self.dismantle_cause in ['刀具需磨削']:
|
||||
location_dest = self.env['stock.location'].search([('name', '=', '磨削房')])
|
||||
# 除刀柄外物料拆解 入库到具体库位
|
||||
if self.integral_product_id:
|
||||
self.integral_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
elif self.blade_product_id:
|
||||
self.blade_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
if self.bar_product_id:
|
||||
self.bar_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
elif self.pad_product_id:
|
||||
self.pad_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
if self.chuck_product_id:
|
||||
self.chuck_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
# ==============功能刀具[更换]拆解==============
|
||||
elif self.dismantle_cause in ['更换为其他刀具']:
|
||||
# 除刀柄外物料拆解 入库到具体库位
|
||||
# elif self.dismantle_cause in ['刀具需磨削']:
|
||||
# location_dest = self.env['stock.location'].search([('name', '=', '磨削房')])
|
||||
# # 除刀柄外物料拆解 入库到具体库位
|
||||
# if self.integral_product_id:
|
||||
# self.integral_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
# elif self.blade_product_id:
|
||||
# self.blade_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
# if self.bar_product_id:
|
||||
# self.bar_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
# elif self.pad_product_id:
|
||||
# self.pad_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
# if self.chuck_product_id:
|
||||
# self.chuck_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||
# ==============功能刀具[更换,磨削]拆解==============
|
||||
elif self.dismantle_cause in ['更换为其他刀具', '刀具需磨削']:
|
||||
# 除刀柄外物料拆解 入库到具体货位
|
||||
if self.integral_freight_id:
|
||||
self.integral_product_id.dismantle_stock_moves(self.integral_freight_id.barcode, location,
|
||||
self.integral_product_id.dismantle_stock_moves(self.integral_freight_id, self.integral_lot_id, location,
|
||||
location_dest)
|
||||
elif self.blade_freight_id:
|
||||
self.blade_product_id.dismantle_stock_moves(self.blade_freight_id.barcode, location, location_dest)
|
||||
self.blade_product_id.dismantle_stock_moves(self.blade_freight_id, self.blade_lot_id, location,
|
||||
location_dest)
|
||||
if self.bar_freight_id:
|
||||
self.bar_product_id.dismantle_stock_moves(self.bar_freight_id.barcode, location, location_dest)
|
||||
self.bar_product_id.dismantle_stock_moves(self.bar_freight_id, self.bar_lot_id, location,
|
||||
location_dest)
|
||||
elif self.pad_freight_id:
|
||||
self.pad_product_id.dismantle_stock_moves(self.pad_freight_id.barcode, location, location_dest)
|
||||
self.pad_product_id.dismantle_stock_moves(self.pad_freight_id, self.pad_lot_id, location,
|
||||
location_dest)
|
||||
if self.chuck_freight_id:
|
||||
self.chuck_product_id.dismantle_stock_moves(self.chuck_freight_id.barcode, location, location_dest)
|
||||
self.chuck_product_id.dismantle_stock_moves(self.chuck_freight_id, self.chuck_lot_id, location,
|
||||
location_dest)
|
||||
# ===============删除功能刀具的Rfid字段的值, 赋值给Rfid(已拆解)字段=====
|
||||
self.functional_tool_id.write({
|
||||
'rfid_dismantle': self.functional_tool_id.rfid,
|
||||
@@ -904,7 +909,7 @@ class FunctionalToolDismantle(models.Model):
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = 'product.product'
|
||||
|
||||
def dismantle_stock_moves(self, shelf_location_barcode, location_id, location_dest_id):
|
||||
def dismantle_stock_moves(self, shelf_location_id, lot_id, location_id, location_dest_id):
|
||||
# 创建功能刀具拆解单产品库存移动记录
|
||||
stock_move_id = self.env['stock.move'].sudo().create({
|
||||
'name': '功能刀具拆解',
|
||||
@@ -914,16 +919,12 @@ class ProductProduct(models.Model):
|
||||
'product_uom_qty': 1.00,
|
||||
'state': 'done'
|
||||
})
|
||||
if shelf_location_barcode:
|
||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', shelf_location_barcode)])
|
||||
location.product_num = location.product_num + 1
|
||||
else:
|
||||
location = self.env['sf.shelf.location']
|
||||
# 创建移动历史记录
|
||||
stock_move_line_id = self.env['stock.move.line'].sudo().create({
|
||||
'product_id': self.id,
|
||||
'lot_id': lot_id.id,
|
||||
'move_id': stock_move_id.id,
|
||||
'current_location_id': location.id,
|
||||
'destination_location_id': shelf_location_id.id,
|
||||
'install_tool_time': fields.Datetime.now(),
|
||||
'qty_done': 1.0,
|
||||
'state': 'done',
|
||||
|
||||
@@ -847,8 +847,8 @@
|
||||
<field name="handle_brand_id" string="品牌"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="handle_lot_id" string="序列号"/>
|
||||
<field name="handle_rfid" string="Rfid"/>
|
||||
<field name="handle_lot_id" string="序列号"/>
|
||||
<field name="scrap_boolean" string="是否报废"
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['寿命到期报废','崩刀报废'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
||||
</group>
|
||||
@@ -861,11 +861,12 @@
|
||||
<field name="chuck_brand_id" string="品牌"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="chuck_lot_id" string="批次"/>
|
||||
<field name="chuck_freight_id" string="目标货位"
|
||||
<field name="chuck_freight_id" string="目标货位" placeholder="请选择"
|
||||
options="{'no_create': True,'no_create_edit':True}"
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具', '刀具需磨削'])], 'readonly': [('state', '=', '已拆解')],
|
||||
'required': [('chuck_lot_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具', '刀具需磨削'])]}"/>
|
||||
<field name="chuck_lot_id" string="批次"
|
||||
attrs="{'required': [('chuck_product_id', '!=', False)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
@@ -877,11 +878,12 @@
|
||||
<field name="integral_brand_id" string="品牌"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="integral_lot_id" string="批次"/>
|
||||
<field name="integral_freight_id" string="目标货位"
|
||||
<field name="integral_freight_id" string="目标货位" placeholder="请选择"
|
||||
options="{'no_create': True,'no_create_edit':True}"
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具', '刀具需磨削'])], 'readonly': [('state', '=', '已拆解')],
|
||||
'required': [('integral_lot_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具', '刀具需磨削'])]}"/>
|
||||
<field name="integral_lot_id" string="批次"
|
||||
attrs="{'required': [('integral_product_id', '!=', False)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
@@ -893,11 +895,12 @@
|
||||
<field name="blade_brand_id" string="品牌"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="blade_lot_id" string="批次"/>
|
||||
<field name="blade_freight_id" string="目标货位"
|
||||
<field name="blade_freight_id" string="目标货位" placeholder="请选择"
|
||||
options="{'no_create': True,'no_create_edit':True}"
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具', '刀具需磨削'])], 'readonly': [('state', '=', '已拆解')],
|
||||
'required': [('blade_lot_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具', '刀具需磨削'])]}"/>
|
||||
<field name="blade_lot_id" string="批次"
|
||||
attrs="{'required': [('blade_product_id', '!=', False)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="刀杆" attrs="{'invisible': [('bar_product_id', '=', False)]}">
|
||||
@@ -907,11 +910,12 @@
|
||||
<field name="bar_brand_id" string="品牌"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="bar_lot_id" string="批次"/>
|
||||
<field name="bar_freight_id" string="目标货位"
|
||||
<field name="bar_freight_id" string="目标货位" placeholder="请选择"
|
||||
options="{'no_create': True,'no_create_edit':True}"
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具', '刀具需磨削'])], 'readonly': [('state', '=', '已拆解')],
|
||||
'required': [('bar_lot_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具', '刀具需磨削'])]}"/>
|
||||
<field name="bar_lot_id" string="批次"
|
||||
attrs="{'required': [('bar_product_id', '!=', False)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="刀盘" attrs="{'invisible': [('pad_product_id', '=', False)]}">
|
||||
@@ -921,11 +925,12 @@
|
||||
<field name="pad_brand_id" string="品牌"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="pad_lot_id" string="批次"/>
|
||||
<field name="pad_freight_id" string="目标货位"
|
||||
<field name="pad_freight_id" string="目标货位" placeholder="请选择"
|
||||
options="{'no_create': True,'no_create_edit':True}"
|
||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具', '刀具需磨削'])], 'readonly': [('state', '=', '已拆解')],
|
||||
'required': [('pad_lot_id', '!=', False), ('dismantle_cause', 'in', ['更换为其他刀具', '刀具需磨削'])]}"/>
|
||||
<field name="pad_lot_id" string="批次"
|
||||
attrs="{'required': [('pad_product_id', '!=', False)]}"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -335,8 +335,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
|
||||
|
||||
# =================夹头型号==============
|
||||
chuck_freight_barcode_id = fields.Many2one('sf.shelf.location', string='夹头货位',
|
||||
domain="[('product_id.cutting_tool_material_id.name', '=', '刀盘'),('product_num', '>', 0)]")
|
||||
chuck_freight_lot_id = fields.Many2one('sf.shelf.location.lot', string='刀盘批次',
|
||||
domain="[('product_id.cutting_tool_material_id.name', '=', '夹头'),('product_num', '>', 0)]")
|
||||
chuck_freight_lot_id = fields.Many2one('sf.shelf.location.lot', string='夹头批次',
|
||||
domain="[('shelf_location_id', '=', chuck_freight_barcode_id)]")
|
||||
chuck_product_id = fields.Many2one('product.product', string='夹头名称', compute='_compute_chuck_product_id',
|
||||
store=True)
|
||||
@@ -826,18 +826,12 @@ class ProductProduct(models.Model):
|
||||
stock_move_line_id = self.env['stock.move.line'].sudo().create({
|
||||
'product_id': self.id,
|
||||
'move_id': stock_move_id.id,
|
||||
'lot_id': lot_id.id,
|
||||
'lot_id': lot_id.lot_id.id,
|
||||
'current_location_id': shelf_location_barcode_id.id,
|
||||
'install_tool_time': fields.Datetime.now(),
|
||||
'qty_done': 1.0,
|
||||
'state': 'done',
|
||||
})
|
||||
if shelf_location_barcode_id.product_num > 0:
|
||||
shelf_location_barcode_id.product_num = shelf_location_barcode_id.product_num - 1
|
||||
else:
|
||||
raise ValidationError(
|
||||
'【%s】货位的【%s】产品库存数量为零,请采购入库后再重新组装!' % (
|
||||
shelf_location_barcode_id.barcode, shelf_location_barcode_id.product_id.name))
|
||||
return stock_move_id, stock_move_line_id
|
||||
|
||||
|
||||
|
||||
@@ -172,11 +172,11 @@
|
||||
<field name="product_id"/>
|
||||
<field name="product_sn_id" options="{'no_create': True}"
|
||||
attrs="{'invisible': [('product_sn_ids', '!=', [])]}"/>
|
||||
<field name="product_sn_ids" readonly="1"
|
||||
<field name="product_sn_ids"
|
||||
attrs="{'invisible': [('product_sn_ids', '=', [])]}">
|
||||
<tree>
|
||||
<field name="lot_id"/>
|
||||
<field name="qty"/>
|
||||
<tree edit="1" create="0" delete="0" editable="bottom">
|
||||
<field name="lot_id" readonly="1"/>
|
||||
<field name="qty" readonly="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
<field name="product_num" readonly="1"/>
|
||||
|
||||
Reference in New Issue
Block a user