1、优化货位看板的更换货位功能、添加按编码搜索功能;

This commit is contained in:
yuxianghui
2024-04-19 13:39:17 +08:00
parent 25ee2136c3
commit 80f0284c3c
2 changed files with 35 additions and 29 deletions

View File

@@ -422,11 +422,12 @@ class FunctionalToolAssembly(models.Model):
@api.depends('integral_freight_barcode') @api.depends('integral_freight_barcode')
def _compute_integral_product_id(self): def _compute_integral_product_id(self):
for item in self: for item in self:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.integral_freight_barcode)]) if item.integral_freight_barcode:
if location: location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.integral_freight_barcode)])
item.integral_product_id = location.product_id.id if location:
else: item.integral_product_id = location.product_id.id
item.integral_product_id = False else:
item.integral_product_id = False
# =================刀片型号============= # =================刀片型号=============
blade_freight_barcode = fields.Char('刀片货位') blade_freight_barcode = fields.Char('刀片货位')
@@ -441,11 +442,12 @@ class FunctionalToolAssembly(models.Model):
@api.depends('blade_freight_barcode') @api.depends('blade_freight_barcode')
def _compute_blade_product_id(self): def _compute_blade_product_id(self):
for item in self: for item in self:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.blade_freight_barcode)]) if item.integral_freight_barcode:
if location: location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.blade_freight_barcode)])
item.blade_product_id = location.product_id.id if location:
else: item.blade_product_id = location.product_id.id
item.blade_product_id = False else:
item.blade_product_id = False
# ==============刀杆型号================ # ==============刀杆型号================
bar_freight_barcode = fields.Char('刀杆货位') bar_freight_barcode = fields.Char('刀杆货位')
@@ -460,11 +462,12 @@ class FunctionalToolAssembly(models.Model):
@api.depends('bar_freight_barcode') @api.depends('bar_freight_barcode')
def _compute_bar_product_id(self): def _compute_bar_product_id(self):
for item in self: for item in self:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.bar_freight_barcode)]) if item.integral_freight_barcode:
if location: location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.bar_freight_barcode)])
item.bar_product_id = location.product_id.id if location:
else: item.bar_product_id = location.product_id.id
item.bar_product_id = False else:
item.bar_product_id = False
# =============刀盘型号================ # =============刀盘型号================
pad_freight_barcode = fields.Char('刀盘货位') pad_freight_barcode = fields.Char('刀盘货位')
@@ -479,11 +482,12 @@ class FunctionalToolAssembly(models.Model):
@api.depends('pad_freight_barcode') @api.depends('pad_freight_barcode')
def _compute_pad_product_id(self): def _compute_pad_product_id(self):
for item in self: for item in self:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.pad_freight_barcode)]) if item.integral_freight_barcode:
if location: location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.pad_freight_barcode)])
item.pad_product_id = location.product_id.id if location:
else: item.pad_product_id = location.product_id.id
item.pad_product_id = False else:
item.pad_product_id = False
# ==============刀柄型号============== # ==============刀柄型号==============
handle_freight_rfid = fields.Char('刀柄Rfid', compute='_compute_handle_product_id', store=True) handle_freight_rfid = fields.Char('刀柄Rfid', compute='_compute_handle_product_id', store=True)
@@ -519,11 +523,12 @@ class FunctionalToolAssembly(models.Model):
@api.depends('chuck_freight_barcode') @api.depends('chuck_freight_barcode')
def _compute_chuck_product_id(self): def _compute_chuck_product_id(self):
for item in self: for item in self:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.chuck_freight_barcode)]) if item.integral_freight_barcode:
if location: location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.chuck_freight_barcode)])
item.chuck_product_id = location.product_id.id if location:
else: item.chuck_product_id = location.product_id.id
item.chuck_product_id = False else:
item.chuck_product_id = False
# ==================待删除字段================== # ==================待删除字段==================
blade_name = fields.Char('') blade_name = fields.Char('')

View File

@@ -129,16 +129,16 @@
<form string="Shelf Location" create="0"> <form string="Shelf Location" create="0">
<header> <header>
<button string="货位变更" <button string="货位变更"
name="%(sf_warehouse.sf_shelf_location_wizard_act)d" name="%(sf_warehouse.sf_shelf_location_wizard_act)d"
type="action" type="action"
context="{'default_name':name, context="{'default_name':name,
'default_current_name':name, 'default_current_name':name,
'default_current_shelf_id':shelf_id, 'default_current_shelf_id':shelf_id,
'default_current_location_id':location_id, 'default_current_location_id':location_id,
'default_current_barcode':barcode, 'default_current_barcode':barcode,
'default_current_product_id':product_id, 'default_current_product_id':product_id,
}" }"
class="btn-primary"/> class="btn-primary" attrs="{'invisible':[('location_status','!=','占用')]}"/>
<field name="location_status" invisible="1"/> <field name="location_status" invisible="1"/>
<button string="禁用货位" name="action_location_status_disable" type="object" <button string="禁用货位" name="action_location_status_disable" type="object"
class="oe_highlight" class="oe_highlight"
@@ -245,6 +245,7 @@
<field name="model">sf.shelf.location</field> <field name="model">sf.shelf.location</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="货位"> <search string="货位">
<field name="barcode"/>
<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"/> -->