1、优化功能刀具拆解后,不同情况下生成的刀具物料的位移记录;添加拆解成功后拆解成功的刀具日志;添加当拆解原因是【更换为其他刀具】时,目标货位必填;2、货位看板添加按产品搜索功能
This commit is contained in:
@@ -769,6 +769,15 @@ class FunctionalToolDismantle(models.Model):
|
|||||||
chuck_freight_id = fields.Many2one('sf.shelf.location', '夹头目标货位',
|
chuck_freight_id = fields.Many2one('sf.shelf.location', '夹头目标货位',
|
||||||
domain="[('product_id', 'in', (chuck_product_id, False))]")
|
domain="[('product_id', 'in', (chuck_product_id, False))]")
|
||||||
|
|
||||||
|
@api.onchange('functional_tool_id')
|
||||||
|
def _onchange_freight(self):
|
||||||
|
for item in self:
|
||||||
|
item.integral_freight_id = False
|
||||||
|
item.blade_freight_id = False
|
||||||
|
item.bar_freight_id = False
|
||||||
|
item.pad_freight_id = False
|
||||||
|
item.chuck_freight_id = False
|
||||||
|
|
||||||
@api.depends('functional_tool_id')
|
@api.depends('functional_tool_id')
|
||||||
def _compute_functional_tool_num(self):
|
def _compute_functional_tool_num(self):
|
||||||
for item in self:
|
for item in self:
|
||||||
@@ -807,7 +816,7 @@ class FunctionalToolDismantle(models.Model):
|
|||||||
raise ValidationError('Rfid为【%s】的功能刀具已经拆解,请勿重复操作!' % self.functional_tool_id.rfid_dismantle)
|
raise ValidationError('Rfid为【%s】的功能刀具已经拆解,请勿重复操作!' % self.functional_tool_id.rfid_dismantle)
|
||||||
location = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
|
location = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
|
||||||
location_dest = self.env['stock.location'].search([('name', '=', '刀具房')])
|
location_dest = self.env['stock.location'].search([('name', '=', '刀具房')])
|
||||||
# =================刀柄是否报废拆解=======
|
# =================刀柄是否[报废]拆解=======
|
||||||
location_dest_scrap = self.env['stock.location'].search([('name', '=', 'Scrap')])
|
location_dest_scrap = self.env['stock.location'].search([('name', '=', 'Scrap')])
|
||||||
if self.handle_rfid:
|
if self.handle_rfid:
|
||||||
lot = self.env['stock.lot'].sudo().search([('rfid', '=', self.handle_rfid)])
|
lot = self.env['stock.lot'].sudo().search([('rfid', '=', self.handle_rfid)])
|
||||||
@@ -822,34 +831,34 @@ class FunctionalToolDismantle(models.Model):
|
|||||||
# 刀柄不报废 入库到刀具房
|
# 刀柄不报废 入库到刀具房
|
||||||
lot.create_stock_quant(location, location_dest, functional_tool_assembly.id, '功能刀具拆解',
|
lot.create_stock_quant(location, location_dest, functional_tool_assembly.id, '功能刀具拆解',
|
||||||
functional_tool_assembly, functional_tool_assembly.tool_groups_id)
|
functional_tool_assembly, functional_tool_assembly.tool_groups_id)
|
||||||
# ==============功能刀具报废拆解================
|
# ==============功能刀具[报废]拆解================
|
||||||
if self.dismantle_cause in ['寿命到期报废', '崩刀报废']:
|
if self.dismantle_cause in ['寿命到期报废', '崩刀报废']:
|
||||||
# 除刀柄外物料报废 入库到Scrap
|
# 除刀柄外物料报废 入库到Scrap
|
||||||
if self.integral_freight_id:
|
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, location, location_dest_scrap)
|
||||||
elif self.blade_freight_id:
|
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, location, location_dest_scrap)
|
||||||
if self.bar_freight_id:
|
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, location, location_dest_scrap)
|
||||||
elif self.pad_freight_id:
|
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, location, location_dest_scrap)
|
||||||
if self.chuck_freight_id:
|
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, location, location_dest_scrap)
|
||||||
# ===========功能刀具磨削拆解==============
|
# ===========功能刀具[磨削]拆解==============
|
||||||
elif self.dismantle_cause in ['刀具需磨削']:
|
elif self.dismantle_cause in ['刀具需磨削']:
|
||||||
location_dest = self.env['stock.location'].search([('name', '=', '磨削房')])
|
location_dest = self.env['stock.location'].search([('name', '=', '磨削房')])
|
||||||
# 除刀柄外物料拆解 入库到具体库位
|
# 除刀柄外物料拆解 入库到具体库位
|
||||||
if self.integral_freight_id:
|
if self.integral_product_id:
|
||||||
self.integral_product_id.dismantle_stock_moves(False, location, location_dest)
|
self.integral_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||||
elif self.blade_freight_id:
|
elif self.blade_product_id:
|
||||||
self.blade_product_id.dismantle_stock_moves(False, location, location_dest)
|
self.blade_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||||
if self.bar_freight_id:
|
if self.bar_product_id:
|
||||||
self.bar_product_id.dismantle_stock_moves(False, location, location_dest)
|
self.bar_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||||
elif self.pad_freight_id:
|
elif self.pad_product_id:
|
||||||
self.pad_product_id.dismantle_stock_moves(False, location, location_dest)
|
self.pad_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||||
if self.chuck_freight_id:
|
if self.chuck_product_id:
|
||||||
self.chuck_product_id.dismantle_stock_moves(False, location, location_dest)
|
self.chuck_product_id.dismantle_stock_moves(False, location, location_dest)
|
||||||
# ==============功能刀具更换拆解==============
|
# ==============功能刀具[更换]拆解==============
|
||||||
elif self.dismantle_cause in ['更换为其他刀具']:
|
elif self.dismantle_cause in ['更换为其他刀具']:
|
||||||
# 除刀柄外物料拆解 入库到具体库位
|
# 除刀柄外物料拆解 入库到具体库位
|
||||||
if self.integral_freight_id:
|
if self.integral_freight_id:
|
||||||
@@ -877,7 +886,7 @@ class FunctionalToolDismantle(models.Model):
|
|||||||
'rfid': '',
|
'rfid': '',
|
||||||
'state': '已拆解'
|
'state': '已拆解'
|
||||||
})
|
})
|
||||||
logging.info('刀具拆解成功!')
|
logging.info('【%s】刀具拆解成功!' % self.name)
|
||||||
|
|
||||||
|
|
||||||
class ProductProduct(models.Model):
|
class ProductProduct(models.Model):
|
||||||
@@ -897,12 +906,12 @@ class ProductProduct(models.Model):
|
|||||||
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', shelf_location_barcode)])
|
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', shelf_location_barcode)])
|
||||||
location.product_num = location.product_num + 1
|
location.product_num = location.product_num + 1
|
||||||
else:
|
else:
|
||||||
location = False
|
location = self.env['sf.shelf.location']
|
||||||
# 创建移动历史记录
|
# 创建移动历史记录
|
||||||
stock_move_line_id = self.env['stock.move.line'].sudo().create({
|
stock_move_line_id = self.env['stock.move.line'].sudo().create({
|
||||||
'product_id': self.id,
|
'product_id': self.id,
|
||||||
'move_id': stock_move_id.id,
|
'move_id': stock_move_id.id,
|
||||||
'current_location_id': location.id or False,
|
'current_location_id': location.id,
|
||||||
'install_tool_time': fields.Datetime.now(),
|
'install_tool_time': fields.Datetime.now(),
|
||||||
'qty_done': 1.0,
|
'qty_done': 1.0,
|
||||||
'state': 'done',
|
'state': 'done',
|
||||||
|
|||||||
@@ -846,7 +846,8 @@
|
|||||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['寿命到期报废','崩刀报废'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
attrs="{'invisible': [('dismantle_cause', 'not in', ['寿命到期报废','崩刀报废'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group string="夹头" attrs="{'invisible': [('chuck_product_id', '=', False)]}">
|
<group string="夹头"
|
||||||
|
attrs="{'invisible': [('chuck_product_id', '=', False)]}">
|
||||||
<group>
|
<group>
|
||||||
<field name="chuck_product_id" string="名称"/>
|
<field name="chuck_product_id" string="名称"/>
|
||||||
<field name="chuck_type_id" string="型号"/>
|
<field name="chuck_type_id" string="型号"/>
|
||||||
@@ -855,7 +856,8 @@
|
|||||||
<group>
|
<group>
|
||||||
<field name="chuck_freight_id" string="目标货位"
|
<field name="chuck_freight_id" string="目标货位"
|
||||||
options="{'no_create': True,'no_create_edit':True}"
|
options="{'no_create': True,'no_create_edit':True}"
|
||||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')],
|
||||||
|
'required': [('chuck_product_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具'])]}"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
@@ -869,7 +871,8 @@
|
|||||||
<group>
|
<group>
|
||||||
<field name="integral_freight_id" string="目标货位"
|
<field name="integral_freight_id" string="目标货位"
|
||||||
options="{'no_create': True,'no_create_edit':True}"
|
options="{'no_create': True,'no_create_edit':True}"
|
||||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')],
|
||||||
|
'required': [('integral_product_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具'])]}"/>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
@@ -884,7 +887,8 @@
|
|||||||
<group>
|
<group>
|
||||||
<field name="blade_freight_id" string="目标货位"
|
<field name="blade_freight_id" string="目标货位"
|
||||||
options="{'no_create': True,'no_create_edit':True}"
|
options="{'no_create': True,'no_create_edit':True}"
|
||||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')],
|
||||||
|
'required': [('blade_product_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具'])]}"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group string="刀杆" attrs="{'invisible': [('bar_product_id', '=', False)]}">
|
<group string="刀杆" attrs="{'invisible': [('bar_product_id', '=', False)]}">
|
||||||
@@ -896,7 +900,8 @@
|
|||||||
<group>
|
<group>
|
||||||
<field name="bar_freight_id" string="目标货位"
|
<field name="bar_freight_id" string="目标货位"
|
||||||
options="{'no_create': True,'no_create_edit':True}"
|
options="{'no_create': True,'no_create_edit':True}"
|
||||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')],
|
||||||
|
'required': [('bar_product_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具'])]}"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<group string="刀盘" attrs="{'invisible': [('pad_product_id', '=', False)]}">
|
<group string="刀盘" attrs="{'invisible': [('pad_product_id', '=', False)]}">
|
||||||
@@ -908,7 +913,8 @@
|
|||||||
<group>
|
<group>
|
||||||
<field name="pad_freight_id" string="目标货位"
|
<field name="pad_freight_id" string="目标货位"
|
||||||
options="{'no_create': True,'no_create_edit':True}"
|
options="{'no_create': True,'no_create_edit':True}"
|
||||||
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')]}"/>
|
attrs="{'invisible': [('dismantle_cause', 'not in', ['更换为其他刀具'])], 'readonly': [('state', '=', '已拆解')],
|
||||||
|
'required': [('pad_freight_id', '!=', False), ('dismantle_cause', 'in', ['更换为其他刀具'])]}"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
@@ -246,6 +246,7 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<search string="货位">
|
<search string="货位">
|
||||||
<field name="barcode"/>
|
<field name="barcode"/>
|
||||||
|
<field name="product_id"/>
|
||||||
<searchpanel class="account_root">
|
<searchpanel class="account_root">
|
||||||
<!-- <field name="location_type" icon="fa-filter"/> -->
|
<!-- <field name="location_type" icon="fa-filter"/> -->
|
||||||
<!-- <field name="location_id" select="multi" icon="fa-filter"/> -->
|
<!-- <field name="location_id" select="multi" icon="fa-filter"/> -->
|
||||||
|
|||||||
Reference in New Issue
Block a user