1、优化刀具组装单、刀具组装单弹窗、刀具拆解单,添加除刀柄外刀具物料按批次号进行管理;优化界面布局,优化组装流程;

This commit is contained in:
yuxianghui
2024-06-03 17:34:47 +08:00
parent a7102c81d4
commit 67c4f64d08
6 changed files with 201 additions and 201 deletions

View File

@@ -401,8 +401,9 @@ class FunctionalToolAssembly(models.Model):
return categories.browse(functional_tool_type_ids) return categories.browse(functional_tool_type_ids)
# 刀具物料信息 # 刀具物料信息
# ==============整体式刀具型号============ # ==============整体式刀具型号=============
integral_freight_barcode = fields.Char('整体式刀具货位') integral_freight_barcode_id = fields.Many2one('sf.shelf.location', string='整体式刀具货位')
integral_lot_id = fields.Many2one('stock.lot', string='整体式刀具批次')
integral_product_id = fields.Many2one('product.product', string='整体式刀具名称', integral_product_id = fields.Many2one('product.product', string='整体式刀具名称',
compute='_compute_integral_product_id', store=True) compute='_compute_integral_product_id', store=True)
cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号', cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号',
@@ -412,19 +413,15 @@ class FunctionalToolAssembly(models.Model):
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌',
related='integral_product_id.brand_id') related='integral_product_id.brand_id')
@api.depends('integral_freight_barcode') @api.depends('integral_freight_barcode_id')
def _compute_integral_product_id(self): def _compute_integral_product_id(self):
for item in self: for item in self:
if item.integral_freight_barcode: if item.integral_freight_barcode_id:
location = self.env['sf.shelf.location'].sudo().search( item.integral_product_id = item.integral_freight_barcode_id.product_id.id
[('barcode', '=', item.integral_freight_barcode)])
if location:
item.integral_product_id = location.product_id.id
else:
item.integral_product_id = False
# =================刀片型号============= # =================刀片型号=============
blade_freight_barcode = fields.Char('刀片货位') blade_freight_barcode_id = fields.Many2one('sf.shelf.location', string='刀片货位')
blade_lot_id = fields.Many2one('stock.lot', string='刀片批次')
blade_product_id = fields.Many2one('product.product', string='刀片名称', compute='_compute_blade_product_id', blade_product_id = fields.Many2one('product.product', string='刀片名称', compute='_compute_blade_product_id',
store=True) store=True)
cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号', cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号',
@@ -433,18 +430,15 @@ class FunctionalToolAssembly(models.Model):
related='blade_product_id.specification_id') related='blade_product_id.specification_id')
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', related='blade_product_id.brand_id') sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', related='blade_product_id.brand_id')
@api.depends('blade_freight_barcode') @api.depends('blade_freight_barcode_id')
def _compute_blade_product_id(self): def _compute_blade_product_id(self):
for item in self: for item in self:
if item.blade_freight_barcode: if item.blade_freight_barcode_id:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.blade_freight_barcode)]) item.blade_product_id = item.blade_freight_barcode_id.product_id.id
if location:
item.blade_product_id = location.product_id.id
else:
item.blade_product_id = False
# ==============刀杆型号================ # ==============刀杆型号================
bar_freight_barcode = fields.Char('刀杆货位') bar_freight_barcode_id = fields.Many2one('sf.shelf.location', string='刀杆货位')
bar_lot_id = fields.Many2one('stock.lot', string='刀杆批次')
bar_product_id = fields.Many2one('product.product', string='刀杆名称', compute='_compute_bar_product_id', bar_product_id = fields.Many2one('product.product', string='刀杆名称', compute='_compute_bar_product_id',
store=True) store=True)
cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号', cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号',
@@ -453,18 +447,15 @@ class FunctionalToolAssembly(models.Model):
related='bar_product_id.specification_id') related='bar_product_id.specification_id')
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', related='bar_product_id.brand_id') sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', related='bar_product_id.brand_id')
@api.depends('bar_freight_barcode') @api.depends('bar_freight_barcode_id')
def _compute_bar_product_id(self): def _compute_bar_product_id(self):
for item in self: for item in self:
if item.bar_freight_barcode: if item.bar_freight_barcode_id:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.bar_freight_barcode)]) item.bar_product_id = item.bar_freight_barcode_id.product_id.id
if location:
item.bar_product_id = location.product_id.id
else:
item.bar_product_id = False
# =============刀盘型号================ # =============刀盘型号================
pad_freight_barcode = fields.Char('刀盘货位') pad_freight_barcode_id = fields.Many2one('sf.shelf.location', string='刀盘货位')
pad_lot_id = fields.Many2one('stock.lot', string='刀盘批次')
pad_product_id = fields.Many2one('product.product', string='刀盘名称', compute='_compute_pad_product_id', pad_product_id = fields.Many2one('product.product', string='刀盘名称', compute='_compute_pad_product_id',
store=True) store=True)
cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号', cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号',
@@ -473,15 +464,11 @@ class FunctionalToolAssembly(models.Model):
related='pad_product_id.specification_id') related='pad_product_id.specification_id')
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', related='pad_product_id.brand_id') sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', related='pad_product_id.brand_id')
@api.depends('pad_freight_barcode') @api.depends('pad_freight_barcode_id')
def _compute_pad_product_id(self): def _compute_pad_product_id(self):
for item in self: for item in self:
if item.pad_freight_barcode: if item.pad_freight_barcode_id:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.pad_freight_barcode)]) item.pad_product_id = item.pad_freight_barcode_id.product_id.id
if location:
item.pad_product_id = location.product_id.id
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)
@@ -505,7 +492,8 @@ class FunctionalToolAssembly(models.Model):
item.handle_freight_rfid = False item.handle_freight_rfid = False
# ==============夹头型号============== # ==============夹头型号==============
chuck_freight_barcode = fields.Char('夹头货位') chuck_freight_barcode_id = fields.Many2one('sf.shelf.location', string='夹头货位')
chuck_lot_id = fields.Many2one('stock.lot', string='夹头批次')
chuck_product_id = fields.Many2one('product.product', string='夹头名称', compute='_compute_chuck_product_id', chuck_product_id = fields.Many2one('product.product', string='夹头名称', compute='_compute_chuck_product_id',
store=True) store=True)
cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号', cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号',
@@ -514,17 +502,18 @@ class FunctionalToolAssembly(models.Model):
related='chuck_product_id.specification_id') related='chuck_product_id.specification_id')
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', related='chuck_product_id.brand_id') sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', related='chuck_product_id.brand_id')
@api.depends('chuck_freight_barcode') @api.depends('chuck_freight_barcode_id')
def _compute_chuck_product_id(self): def _compute_chuck_product_id(self):
for item in self: for item in self:
if item.chuck_freight_barcode: if item.chuck_freight_barcode_id:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', item.chuck_freight_barcode)]) item.chuck_product_id = item.chuck_freight_barcode_id.product_id.id
if location:
item.chuck_product_id = location.product_id.id
else:
item.chuck_product_id = False
# ==================待删除字段================== # ==================待删除字段==================
integral_freight_barcode = fields.Char('整体式刀具货位')
blade_freight_barcode = fields.Char('刀片货位')
bar_freight_barcode = fields.Char('刀杆货位')
pad_freight_barcode = fields.Char('刀盘货位')
chuck_freight_barcode = fields.Char('夹头货位')
blade_name = fields.Char('') blade_name = fields.Char('')
integral_name = fields.Char('') integral_name = fields.Char('')
blade_code_id = fields.Many2one('stock.lot', '刀片序列号') blade_code_id = fields.Many2one('stock.lot', '刀片序列号')
@@ -721,6 +710,8 @@ class FunctionalToolDismantle(models.Model):
related='handle_product_id.cutting_tool_model_id') related='handle_product_id.cutting_tool_model_id')
handle_brand_id = fields.Many2one('sf.machine.brand', string='刀柄品牌', related='handle_product_id.brand_id') handle_brand_id = fields.Many2one('sf.machine.brand', string='刀柄品牌', related='handle_product_id.brand_id')
handle_rfid = fields.Char(string='刀柄Rfid', compute='_compute_functional_tool_num', store=True) handle_rfid = fields.Char(string='刀柄Rfid', compute='_compute_functional_tool_num', store=True)
handle_lot_id = fields.Many2one('stock.lot', string='刀柄序列号', compute='_compute_functional_tool_num',
store=True)
scrap_boolean = fields.Boolean(string='刀柄是否报废', default=False) scrap_boolean = fields.Boolean(string='刀柄是否报废', default=False)
# 整体式 # 整体式
@@ -730,6 +721,8 @@ class FunctionalToolDismantle(models.Model):
related='integral_product_id.cutting_tool_model_id') related='integral_product_id.cutting_tool_model_id')
integral_brand_id = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', integral_brand_id = fields.Many2one('sf.machine.brand', string='整体式刀具品牌',
related='integral_product_id.brand_id') related='integral_product_id.brand_id')
integral_lot_id = fields.Many2one('stock.lot', string='整体式刀具批次', compute='_compute_functional_tool_num',
store=True)
integral_freight_id = fields.Many2one('sf.shelf.location', '整体式刀具目标货位', integral_freight_id = fields.Many2one('sf.shelf.location', '整体式刀具目标货位',
domain="[('product_id', 'in', (integral_product_id, False))]") domain="[('product_id', 'in', (integral_product_id, False))]")
@@ -739,6 +732,7 @@ class FunctionalToolDismantle(models.Model):
blade_type_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号', blade_type_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号',
related='blade_product_id.cutting_tool_model_id') related='blade_product_id.cutting_tool_model_id')
blade_brand_id = fields.Many2one('sf.machine.brand', string='刀片品牌', related='blade_product_id.brand_id') blade_brand_id = fields.Many2one('sf.machine.brand', string='刀片品牌', related='blade_product_id.brand_id')
blade_lot_id = fields.Many2one('stock.lot', string='刀片批次', compute='_compute_functional_tool_num', store=True)
blade_freight_id = fields.Many2one('sf.shelf.location', '刀片目标货位', blade_freight_id = fields.Many2one('sf.shelf.location', '刀片目标货位',
domain="[('product_id', 'in', (blade_product_id, False))]") domain="[('product_id', 'in', (blade_product_id, False))]")
@@ -748,6 +742,7 @@ class FunctionalToolDismantle(models.Model):
bar_type_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号', bar_type_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号',
related='bar_product_id.cutting_tool_model_id') related='bar_product_id.cutting_tool_model_id')
bar_brand_id = fields.Many2one('sf.machine.brand', string='刀杆品牌', related='bar_product_id.brand_id') bar_brand_id = fields.Many2one('sf.machine.brand', string='刀杆品牌', related='bar_product_id.brand_id')
bar_lot_id = fields.Many2one('stock.lot', string='刀杆批次', compute='_compute_functional_tool_num', store=True)
bar_freight_id = fields.Many2one('sf.shelf.location', '刀杆目标货位', bar_freight_id = fields.Many2one('sf.shelf.location', '刀杆目标货位',
domain="[('product_id', 'in', (bar_product_id, False))]") domain="[('product_id', 'in', (bar_product_id, False))]")
@@ -757,6 +752,7 @@ class FunctionalToolDismantle(models.Model):
pad_type_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号', pad_type_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号',
related='pad_product_id.cutting_tool_model_id') related='pad_product_id.cutting_tool_model_id')
pad_brand_id = fields.Many2one('sf.machine.brand', string='刀盘品牌', related='pad_product_id.brand_id') pad_brand_id = fields.Many2one('sf.machine.brand', string='刀盘品牌', related='pad_product_id.brand_id')
pad_lot_id = fields.Many2one('stock.lot', string='刀盘批次', compute='_compute_functional_tool_num', store=True)
pad_freight_id = fields.Many2one('sf.shelf.location', '刀盘目标货位', pad_freight_id = fields.Many2one('sf.shelf.location', '刀盘目标货位',
domain="[('product_id', 'in', (pad_product_id, False))]") domain="[('product_id', 'in', (pad_product_id, False))]")
@@ -766,6 +762,7 @@ class FunctionalToolDismantle(models.Model):
chuck_type_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号', chuck_type_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号',
related='chuck_product_id.cutting_tool_model_id') related='chuck_product_id.cutting_tool_model_id')
chuck_brand_id = fields.Many2one('sf.machine.brand', string='夹头品牌', related='chuck_product_id.brand_id') chuck_brand_id = fields.Many2one('sf.machine.brand', string='夹头品牌', related='chuck_product_id.brand_id')
chuck_lot_id = fields.Many2one('stock.lot', string='夹头批次', compute='_compute_functional_tool_num', store=True)
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))]")
@@ -789,12 +786,20 @@ class FunctionalToolDismantle(models.Model):
item.rfid = item.functional_tool_id.rfid item.rfid = item.functional_tool_id.rfid
item.handle_rfid = item.functional_tool_id.rfid item.handle_rfid = item.functional_tool_id.rfid
# 产品
item.handle_product_id = item.functional_tool_id.functional_tool_name_id.handle_product_id.id item.handle_product_id = item.functional_tool_id.functional_tool_name_id.handle_product_id.id
item.integral_product_id = item.functional_tool_id.functional_tool_name_id.integral_product_id.id item.integral_product_id = item.functional_tool_id.functional_tool_name_id.integral_product_id.id
item.blade_product_id = item.functional_tool_id.functional_tool_name_id.blade_product_id.id item.blade_product_id = item.functional_tool_id.functional_tool_name_id.blade_product_id.id
item.bar_product_id = item.functional_tool_id.functional_tool_name_id.bar_product_id.id item.bar_product_id = item.functional_tool_id.functional_tool_name_id.bar_product_id.id
item.pad_product_id = item.functional_tool_id.functional_tool_name_id.pad_product_id.id item.pad_product_id = item.functional_tool_id.functional_tool_name_id.pad_product_id.id
item.chuck_product_id = item.functional_tool_id.functional_tool_name_id.chuck_product_id.id item.chuck_product_id = item.functional_tool_id.functional_tool_name_id.chuck_product_id.id
# 批次/序列号
item.handle_lot_id = item.functional_tool_id.functional_tool_name_id.handle_code_id.id
item.integral_lot_id = item.functional_tool_id.functional_tool_name_id.integral_lot_id.id
item.blade_lot_id = item.functional_tool_id.functional_tool_name_id.blade_lot_id.id
item.bar_lot_id = item.functional_tool_id.functional_tool_name_id.bar_lot_id.id
item.pad_lot_id = item.functional_tool_id.functional_tool_name_id.pad_lot_id.id
item.chuck_lot_id = item.functional_tool_id.functional_tool_name_id.chuck_lot_id.id
else: else:
item.tool_groups_id = False item.tool_groups_id = False
item.tool_type_id = False item.tool_type_id = False
@@ -810,6 +815,13 @@ class FunctionalToolDismantle(models.Model):
item.pad_product_id = False item.pad_product_id = False
item.chuck_product_id = False item.chuck_product_id = False
item.handle_lot_id = False
item.integral_lot_id = False
item.blade_lot_id = False
item.bar_lot_id = False
item.pad_lot_id = False
item.chuck_lot_id = False
def confirmation_disassembly(self): def confirmation_disassembly(self):
logging.info('%s刀具确认开始拆解' % self.dismantle_cause) logging.info('%s刀具确认开始拆解' % self.dismantle_cause)
if self.functional_tool_id.functional_tool_status == '已拆除': if self.functional_tool_id.functional_tool_status == '已拆除':

View File

@@ -46,8 +46,8 @@
</header> </header>
<sheet> <sheet>
<div class="oe_button_box" name="button_box"> <div class="oe_button_box" name="button_box">
<button name="button_safe_inventory_id" string="更新功能刀具关联的安全库存记录" <!-- <button name="button_safe_inventory_id" string="更新功能刀具关联的安全库存记录"-->
type="object" class="btn-primary"/> <!-- type="object" class="btn-primary"/>-->
<button class="oe_stat_button" groups="sf_base.group_sf_mrp_user" <button class="oe_stat_button" groups="sf_base.group_sf_mrp_user"
name="open_functional_tool_warning" name="open_functional_tool_warning"
icon="fa-list-ul" icon="fa-list-ul"
@@ -115,7 +115,7 @@
options="{'no_create': True, 'no_quick_create': True}"/> options="{'no_create': True, 'no_quick_create': True}"/>
<field name="cutting_tool_cutterhead_model_id" <field name="cutting_tool_cutterhead_model_id"
options="{'no_create': True, 'no_quick_create': True}"/> options="{'no_create': True, 'no_quick_create': True}"/>
<field name="safe_inventory_id" readonly="0"/> <field name="safe_inventory_id" invisible="1"/>
</group> </group>
<group> <group>
<field name="image" nolabel="1" widget="image"/> <field name="image" nolabel="1" widget="image"/>

View File

@@ -601,13 +601,14 @@
<field name="sf_tool_brand_id_5" string="品牌"/> <field name="sf_tool_brand_id_5" string="品牌"/>
</group> </group>
</group> </group>
<group col="1" attrs="{'invisible': [('chuck_freight_barcode', '=', False)]}"> <group col="1" attrs="{'invisible': [('chuck_freight_barcode_id', '=', False)]}">
<div> <div>
<separator string="夹头:" style="font-size: 13px;"/> <separator string="夹头:" style="font-size: 13px;"/>
</div> </div>
<group> <group>
<group> <group>
<field name="chuck_freight_barcode" string="货位"/> <field name="chuck_freight_barcode_id" string="货位"/>
<field name="chuck_lot_id" string="批次"/>
<field name="chuck_product_id" string="名称"/> <field name="chuck_product_id" string="名称"/>
<field name="cutting_tool_cutterhead_model_id" string="型号"/> <field name="cutting_tool_cutterhead_model_id" string="型号"/>
<field name="chuck_specification_id" string="规格"/> <field name="chuck_specification_id" string="规格"/>
@@ -619,24 +620,27 @@
<group> <group>
<group col="1"> <group col="1">
<group col="1" <group col="1"
attrs="{'invisible': [('integral_freight_barcode', '=', False)]}"> attrs="{'invisible': [('integral_freight_barcode_id', '=', False)]}">
<div> <div>
<separator string="整体式刀具:" style="font-size: 13px;"/> <separator string="整体式刀具:" style="font-size: 13px;"/>
</div> </div>
<group> <group>
<field name="integral_freight_barcode" string="货位"/> <field name="integral_freight_barcode_id" string="货位"/>
<field name="integral_lot_id" string="批次"/>
<field name="integral_product_id" string="名称"/> <field name="integral_product_id" string="名称"/>
<field name="cutting_tool_integral_model_id" string="型号"/> <field name="cutting_tool_integral_model_id" string="型号"/>
<field name="integral_specification_id" string="规格"/> <field name="integral_specification_id" string="规格"/>
<field name="sf_tool_brand_id_1" string="品牌"/> <field name="sf_tool_brand_id_1" string="品牌"/>
</group> </group>
</group> </group>
<group col="1" attrs="{'invisible': [('blade_freight_barcode', '=', False)]}"> <group col="1"
attrs="{'invisible': [('blade_freight_barcode_id', '=', False)]}">
<div> <div>
<separator string="刀片:" style="font-size: 13px;"/> <separator string="刀片:" style="font-size: 13px;"/>
</div> </div>
<group> <group>
<field name="blade_freight_barcode" string="货位"/> <field name="blade_freight_barcode_id" string="货位"/>
<field name="blade_lot_id" string="批次"/>
<field name="blade_product_id" string="名称"/> <field name="blade_product_id" string="名称"/>
<field name="cutting_tool_blade_model_id" string="型号"/> <field name="cutting_tool_blade_model_id" string="型号"/>
<field name="blade_specification_id" string="规格"/> <field name="blade_specification_id" string="规格"/>
@@ -645,13 +649,14 @@
</group> </group>
</group> </group>
<group col="1"> <group col="1">
<group col="1" attrs="{'invisible': [('bar_freight_barcode', '=', False)]}"> <group col="1" attrs="{'invisible': [('bar_freight_barcode_id', '=', False)]}">
<div> <div>
<separator string="刀杆:" style="font-size: 13px;"/> <separator string="刀杆:" style="font-size: 13px;"/>
</div> </div>
<group> <group>
<group> <group>
<field name="bar_freight_barcode" string="货位"/> <field name="bar_freight_barcode_id" string="货位"/>
<field name="bar_lot_id" string="批次"/>
<field name="bar_product_id" string="名称"/> <field name="bar_product_id" string="名称"/>
<field name="cutting_tool_cutterbar_model_id" string="型号"/> <field name="cutting_tool_cutterbar_model_id" string="型号"/>
<field name="bar_specification_id" string="规格"/> <field name="bar_specification_id" string="规格"/>
@@ -659,13 +664,14 @@
</group> </group>
</group> </group>
</group> </group>
<group col="1" attrs="{'invisible': [('pad_freight_barcode', '=', False)]}"> <group col="1" attrs="{'invisible': [('pad_freight_barcode_id', '=', False)]}">
<div> <div>
<separator string="刀盘:" style="font-size: 13px;"/> <separator string="刀盘:" style="font-size: 13px;"/>
</div> </div>
<group> <group>
<group> <group>
<field name="pad_freight_barcode" string="货位"/> <field name="pad_freight_barcode_id" string="货位"/>
<field name="pad_lot_id" string="批次"/>
<field name="pad_product_id" string="名称"/> <field name="pad_product_id" string="名称"/>
<field name="cutting_tool_cutterpad_model_id" string="型号"/> <field name="cutting_tool_cutterpad_model_id" string="型号"/>
<field name="pad_specification_id" string="规格"/> <field name="pad_specification_id" string="规格"/>
@@ -841,6 +847,7 @@
<field name="handle_brand_id" string="品牌"/> <field name="handle_brand_id" string="品牌"/>
</group> </group>
<group> <group>
<field name="handle_lot_id" string="序列号"/>
<field name="handle_rfid" string="Rfid"/> <field name="handle_rfid" string="Rfid"/>
<field name="scrap_boolean" string="是否报废" <field name="scrap_boolean" string="是否报废"
attrs="{'invisible': [('dismantle_cause', 'not in', ['寿命到期报废','崩刀报废'])], 'readonly': [('state', '=', '已拆解')]}"/> attrs="{'invisible': [('dismantle_cause', 'not in', ['寿命到期报废','崩刀报废'])], 'readonly': [('state', '=', '已拆解')]}"/>
@@ -854,10 +861,11 @@
<field name="chuck_brand_id" string="品牌"/> <field name="chuck_brand_id" string="品牌"/>
</group> </group>
<group> <group>
<field name="chuck_lot_id" string="批次"/>
<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', ['更换为其他刀具'])]}"/> 'required': [('chuck_lot_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具', '刀具需磨削'])]}"/>
</group> </group>
</group> </group>
</group> </group>
@@ -869,11 +877,11 @@
<field name="integral_brand_id" string="品牌"/> <field name="integral_brand_id" string="品牌"/>
</group> </group>
<group> <group>
<field name="integral_lot_id" string="批次"/>
<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', ['更换为其他刀具'])]}"/> 'required': [('integral_lot_id', '!=', False),('dismantle_cause', 'in', ['更换为其他刀具', '刀具需磨削'])]}"/>
</group> </group>
</group> </group>
</group> </group>
@@ -885,10 +893,11 @@
<field name="blade_brand_id" string="品牌"/> <field name="blade_brand_id" string="品牌"/>
</group> </group>
<group> <group>
<field name="blade_lot_id" string="批次"/>
<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', ['更换为其他刀具'])]}"/> 'required': [('blade_lot_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)]}">
@@ -898,10 +907,11 @@
<field name="bar_brand_id" string="品牌"/> <field name="bar_brand_id" string="品牌"/>
</group> </group>
<group> <group>
<field name="bar_lot_id" string="批次"/>
<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', ['更换为其他刀具'])]}"/> 'required': [('bar_lot_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)]}">
@@ -911,10 +921,11 @@
<field name="pad_brand_id" string="品牌"/> <field name="pad_brand_id" string="品牌"/>
</group> </group>
<group> <group>
<field name="pad_lot_id" string="批次"/>
<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_product_id', '!=', False), ('dismantle_cause', 'in', ['更换为其他刀具'])]}"/> 'required': [('pad_lot_id', '!=', False), ('dismantle_cause', 'in', ['更换为其他刀具', '刀具需磨削'])]}"/>
</group> </group>
</group> </group>
</group> </group>

View File

@@ -233,7 +233,10 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# 功能刀具组装信息 # 功能刀具组装信息
# ===============整体式刀具型号================= # ===============整体式刀具型号=================
integral_freight_barcode = fields.Char('整体式刀具货位') integral_freight_barcode_id = fields.Many2one('sf.shelf.location', string='整体式刀具货位',
domain="[('product_id.cutting_tool_material_id.name', '=', '整体式刀具'),('product_num', '>', 0)]")
integral_freight_lot_id = fields.Many2one('sf.shelf.location.lot', string='整体式刀具批次',
domain="[('shelf_location_id', '=', integral_freight_barcode_id)]")
integral_product_id = fields.Many2one('product.product', string='整体式刀具名称', integral_product_id = fields.Many2one('product.product', string='整体式刀具名称',
compute='_compute_integral_product_id', store=True) compute='_compute_integral_product_id', store=True)
cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号', cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号',
@@ -243,28 +246,18 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌',
related='integral_product_id.brand_id') related='integral_product_id.brand_id')
@api.depends('integral_freight_barcode') @api.depends('integral_freight_lot_id')
def _compute_integral_product_id(self): def _compute_integral_product_id(self):
if self.integral_freight_barcode: if self.integral_freight_lot_id:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.integral_freight_barcode)]) self.integral_product_id = self.integral_freight_lot_id.lot_id.product_id.id
if location: else:
if not location.product_id: self.integral_product_id = False
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
else:
material_name_id = location.product_id.cutting_tool_material_id
if material_name_id and material_name_id.name == '整体式刀具':
if location.product_num == 0:
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
self.integral_product_id = location.product_id.id
else:
raise ValidationError(
'编码为【%s】的货位存放的产品为【%s】,不是整体式刀具,请重新选择!' % (
location.barcode, location.product_id.name))
else:
raise ValidationError('编码为【%s】的货位不存在!' % self.integral_freight_barcode)
# ===============刀片型号==================== # ===============刀片型号====================
blade_freight_barcode = fields.Char('刀片货位') blade_freight_barcode_id = fields.Many2one('sf.shelf.location', string='刀片货位',
domain="[('product_id.cutting_tool_material_id.name', '=', '刀片'),('product_num', '>', 0)]")
blade_freight_lot_id = fields.Many2one('sf.shelf.location.lot', string='刀片批次',
domain="[('shelf_location_id', '=', blade_freight_barcode_id)]")
blade_product_id = fields.Many2one('product.product', string='刀片名称', compute='_compute_blade_product_id', blade_product_id = fields.Many2one('product.product', string='刀片名称', compute='_compute_blade_product_id',
store=True) store=True)
cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号', cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号',
@@ -273,28 +266,18 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
related='blade_product_id.specification_id') related='blade_product_id.specification_id')
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', related='blade_product_id.brand_id') sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', related='blade_product_id.brand_id')
@api.depends('blade_freight_barcode') @api.depends('blade_freight_lot_id')
def _compute_blade_product_id(self): def _compute_blade_product_id(self):
if self.blade_freight_barcode: if self.blade_freight_lot_id:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.blade_freight_barcode)]) self.blade_product_id = self.blade_freight_lot_id.lot_id.product_id.id
if location: else:
if not location.product_id: self.blade_product_id = False
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
else:
material_name_id = location.product_id.cutting_tool_material_id
if material_name_id and material_name_id.name == '刀片':
if location.product_num == 0:
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
self.blade_product_id = location.product_id.id
else:
raise ValidationError(
'编码为【%s】的货位存放的产品为【%s】,不是刀片,请重新选择!' % (
location.barcode, location.product_id.name))
else:
raise ValidationError('编码为【%s】的货位不存在!' % self.blade_freight_barcode)
# ====================刀杆型号================== # ====================刀杆型号==================
bar_freight_barcode = fields.Char('刀杆货位') bar_freight_barcode_id = fields.Many2one('sf.shelf.location', string='刀杆货位',
domain="[('product_id.cutting_tool_material_id.name', '=', '刀杆'),('product_num', '>', 0)]")
bar_freight_lot_id = fields.Many2one('sf.shelf.location.lot', string='刀杆批次',
domain="[('shelf_location_id', '=', bar_freight_barcode_id)]")
bar_product_id = fields.Many2one('product.product', string='刀杆名称', compute='_compute_bar_product_id', bar_product_id = fields.Many2one('product.product', string='刀杆名称', compute='_compute_bar_product_id',
store=True) store=True)
cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号', cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号',
@@ -303,28 +286,18 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
related='bar_product_id.specification_id') related='bar_product_id.specification_id')
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', related='bar_product_id.brand_id') sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', related='bar_product_id.brand_id')
@api.depends('bar_freight_barcode') @api.depends('bar_freight_lot_id')
def _compute_bar_product_id(self): def _compute_bar_product_id(self):
if self.bar_freight_barcode: if self.bar_freight_lot_id:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.bar_freight_barcode)]) self.bar_product_id = self.bar_freight_lot_id.lot_id.product_id.id
if location: else:
if not location.product_id: self.bar_product_id = False
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
else:
material_name_id = location.product_id.cutting_tool_material_id
if material_name_id and material_name_id.name == '刀杆':
if location.product_num == 0:
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
self.bar_product_id = location.product_id.id
else:
raise ValidationError(
'编码为【%s】的货位存放的产品为【%s】,不是刀杆,请重新选择!' % (
location.barcode, location.product_id.name))
else:
raise ValidationError('编码为【%s】的货位不存在!' % self.bar_freight_barcode)
# ===============刀盘型号=================== # ===============刀盘型号===================
pad_freight_barcode = fields.Char('刀盘货位') pad_freight_barcode_id = fields.Many2one('sf.shelf.location', string='刀盘货位',
domain="[('product_id.cutting_tool_material_id.name', '=', '刀盘'),('product_num', '>', 0)]")
pad_freight_lot_id = fields.Many2one('sf.shelf.location.lot', string='刀盘批次',
domain="[('shelf_location_id', '=', pad_freight_barcode_id)]")
pad_product_id = fields.Many2one('product.product', string='刀盘名称', compute='_compute_pad_product_id', pad_product_id = fields.Many2one('product.product', string='刀盘名称', compute='_compute_pad_product_id',
store=True) store=True)
cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号', cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号',
@@ -333,25 +306,12 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
related='pad_product_id.specification_id') related='pad_product_id.specification_id')
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', related='pad_product_id.brand_id') sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', related='pad_product_id.brand_id')
@api.depends('pad_freight_barcode') @api.depends('pad_freight_lot_id')
def _compute_pad_product_id(self): def _compute_pad_product_id(self):
if self.pad_freight_barcode: if self.pad_freight_lot_id:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.pad_freight_barcode)]) self.pad_product_id = self.pad_freight_lot_id.lot_id.product_id.id
if location: else:
if not location.product_id: self.pad_product_id = False
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
else:
material_name_id = location.product_id.cutting_tool_material_id
if material_name_id and material_name_id.name == '刀盘':
if location.product_num == 0:
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
self.pad_product_id = location.product_id.id
else:
raise ValidationError(
'编码为【%s】的货位存放的产品为【%s】,不是刀盘,请重新选择!' % (
location.barcode, location.product_id.name))
else:
raise ValidationError('编码为【%s】的货位不存在!' % self.pad_freight_barcode)
# ================刀柄型号=============== # ================刀柄型号===============
handle_freight_rfid = fields.Char('刀柄Rfid', compute='_compute_rfid') handle_freight_rfid = fields.Char('刀柄Rfid', compute='_compute_rfid')
@@ -374,7 +334,10 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
self.pad_product_id = False self.pad_product_id = False
# =================夹头型号============== # =================夹头型号==============
chuck_freight_barcode = fields.Char('夹头货位') 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="[('shelf_location_id', '=', chuck_freight_barcode_id)]")
chuck_product_id = fields.Many2one('product.product', string='夹头名称', compute='_compute_chuck_product_id', chuck_product_id = fields.Many2one('product.product', string='夹头名称', compute='_compute_chuck_product_id',
store=True) store=True)
cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号', cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号',
@@ -383,25 +346,12 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
related='chuck_product_id.specification_id') related='chuck_product_id.specification_id')
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', related='chuck_product_id.brand_id') sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', related='chuck_product_id.brand_id')
@api.depends('chuck_freight_barcode') @api.depends('chuck_freight_lot_id')
def _compute_chuck_product_id(self): def _compute_chuck_product_id(self):
if self.chuck_freight_barcode: if self.chuck_freight_lot_id:
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.chuck_freight_barcode)]) self.chuck_product_id = self.chuck_freight_lot_id.lot_id.product_id.id
if location: else:
if not location.product_id: self.chuck_product_id = False
raise ValidationError('编码为【%s】的货位为空货位!' % location.barcode)
else:
material_name_id = location.product_id.cutting_tool_material_id
if material_name_id and material_name_id.name == '夹头':
if location.product_num == 0:
raise ValidationError('编码为【%s】的货位的产品库存数量为0,请重新选择!' % location.barcode)
self.chuck_product_id = location.product_id.id
else:
raise ValidationError(
'编码为【%s】的货位存放的产品为【%s】,不是夹头,请重新选择!' % (
location.barcode, location.product_id.name))
else:
raise ValidationError('编码为【%s】的货位不存在!' % self.chuck_freight_barcode)
# ======================================== # ========================================
def on_barcode_scanned(self, barcode): def on_barcode_scanned(self, barcode):
@@ -423,23 +373,23 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
if location: if location:
material_name = location.product_id.cutting_tool_material_id.name material_name = location.product_id.cutting_tool_material_id.name
if material_name == '夹头': if material_name == '夹头':
record.chuck_freight_barcode = barcode record.chuck_freight_barcode_id = location.id
elif material_name == '整体式刀具': elif material_name == '整体式刀具':
record.integral_freight_barcode = barcode record.integral_freight_barcode_id = location.id
record.blade_freight_barcode = '' record.blade_freight_barcode_id = False
record.bar_freight_barcode = '' record.bar_freight_barcode_id = False
record.pad_freight_barcode = '' record.pad_freight_barcode_id = False
elif material_name == '刀片': elif material_name == '刀片':
record.blade_freight_barcode = barcode record.blade_freight_barcode_id = location.id
record.integral_freight_barcode = '' record.integral_freight_barcode_id = False
elif material_name == '刀杆': elif material_name == '刀杆':
record.bar_freight_barcode = barcode record.bar_freight_barcode_id = location.id
record.integral_freight_barcode = '' record.integral_freight_barcode_id = False
record.pad_freight_barcode = '' record.pad_freight_barcode_id = False
elif material_name == '刀盘': elif material_name == '刀盘':
record.pad_freight_barcode = barcode record.pad_freight_barcode_id = location.id
record.integral_freight_barcode = '' record.integral_freight_barcode_id = False
record.bar_freight_barcode = '' record.bar_freight_barcode_id = False
else: else:
raise ValidationError('扫描的刀具物料不存在,请重新扫描!') raise ValidationError('扫描的刀具物料不存在,请重新扫描!')
else: else:
@@ -550,7 +500,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
else: else:
obj.after_assembly_functional_tool_name = '' obj.after_assembly_functional_tool_name = ''
@api.onchange('integral_freight_barcode') @api.onchange('integral_freight_barcode_id')
def _onchange_after_assembly_functional_tool_diameter(self): def _onchange_after_assembly_functional_tool_diameter(self):
for obj in self: for obj in self:
if obj.integral_product_id: if obj.integral_product_id:
@@ -558,7 +508,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
else: else:
obj.after_assembly_functional_tool_diameter = 0 obj.after_assembly_functional_tool_diameter = 0
@api.onchange('blade_freight_barcode') @api.onchange('blade_freight_barcode_id')
def _onchange_after_assembly_knife_tip_r_angle(self): def _onchange_after_assembly_knife_tip_r_angle(self):
for obj in self: for obj in self:
if obj.blade_product_id: if obj.blade_product_id:
@@ -617,15 +567,20 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
if self.handle_code_id: if self.handle_code_id:
product_id.tool_material_stock_moves(self.handle_code_id, self.assembly_order_code) product_id.tool_material_stock_moves(self.handle_code_id, self.assembly_order_code)
if self.integral_product_id: if self.integral_product_id:
self.integral_product_id.material_stock_moves(self.integral_freight_barcode, self.assembly_order_code) self.integral_product_id.material_stock_moves(self.integral_freight_barcode_id,
self.integral_freight_lot_id, self.assembly_order_code)
if self.blade_product_id: if self.blade_product_id:
self.blade_product_id.material_stock_moves(self.blade_freight_barcode, self.assembly_order_code) self.blade_product_id.material_stock_moves(self.blade_freight_barcode_id,
self.blade_freight_lot_id, self.assembly_order_code)
if self.bar_product_id: if self.bar_product_id:
self.bar_product_id.material_stock_moves(self.bar_freight_barcode, self.assembly_order_code) self.bar_product_id.material_stock_moves(self.bar_freight_barcode_id,
self.bar_freight_lot_id, self.assembly_order_code)
if self.pad_product_id: if self.pad_product_id:
self.pad_product_id.material_stock_moves(self.pad_freight_barcode, self.assembly_order_code) self.pad_product_id.material_stock_moves(self.pad_freight_barcode_id,
self.pad_freight_lot_id, self.assembly_order_code)
if self.chuck_product_id: if self.chuck_product_id:
self.chuck_product_id.material_stock_moves(self.chuck_freight_barcode, self.assembly_order_code) self.chuck_product_id.material_stock_moves(self.chuck_freight_barcode_id,
self.chuck_freight_lot_id, self.assembly_order_code)
# ============================创建功能刀具列表、安全库存记录=============================== # ============================创建功能刀具列表、安全库存记录===============================
# 封装功能刀具数据 # 封装功能刀具数据
@@ -673,12 +628,17 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
'code': self.code, 'code': self.code,
'rfid': self.rfid, 'rfid': self.rfid,
'tool_groups_id': self.after_tool_groups_id.id, 'tool_groups_id': self.after_tool_groups_id.id,
'integral_freight_barcode': self.integral_freight_barcode,
'blade_freight_barcode': self.blade_freight_barcode,
'bar_freight_barcode': self.bar_freight_barcode,
'pad_freight_barcode': self.pad_freight_barcode,
'handle_code_id': self.handle_code_id.id, 'handle_code_id': self.handle_code_id.id,
'chuck_freight_barcode': self.chuck_freight_barcode, 'integral_freight_barcode_id': self.integral_freight_barcode_id.id,
'integral_lot_id': self.integral_freight_lot_id.lot_id.id,
'blade_freight_barcode_id': self.blade_freight_barcode_id.id,
'blade_lot_id': self.blade_freight_lot_id.lot_id.id,
'bar_freight_barcode_id': self.bar_freight_barcode_id.id,
'bar_lot_id': self.bar_freight_lot_id.lot_id.id,
'pad_freight_barcode_id': self.pad_freight_barcode_id.id,
'pad_lot_id': self.pad_freight_lot_id.lot_id.id,
'chuck_freight_barcode_id': self.chuck_freight_barcode_id.id,
'chuck_lot_id': self.chuck_freight_lot_id.lot_id.id,
'after_assembly_functional_tool_name': self.after_assembly_functional_tool_name, 'after_assembly_functional_tool_name': self.after_assembly_functional_tool_name,
'after_assembly_functional_tool_type_id': self.after_assembly_functional_tool_type_id.id, 'after_assembly_functional_tool_type_id': self.after_assembly_functional_tool_type_id.id,
@@ -851,7 +811,7 @@ class ProductProduct(models.Model):
tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, assembly_order_code, False, tool_material.create_stock_quant(location_inventory_id, stock_location_id, None, assembly_order_code, False,
False) False)
def material_stock_moves(self, shelf_location_barcode, assembly_order_code): def material_stock_moves(self, shelf_location_barcode_id, lot_id, assembly_order_code):
# 创建库存移动记录 # 创建库存移动记录
stock_move_id = self.env['stock.move'].sudo().create({ stock_move_id = self.env['stock.move'].sudo().create({
'name': assembly_order_code, 'name': assembly_order_code,
@@ -862,21 +822,22 @@ class ProductProduct(models.Model):
'state': 'done' 'state': 'done'
}) })
location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', shelf_location_barcode)])
# 创建移动历史记录 # 创建移动历史记录
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, 'lot_id': lot_id.id,
'current_location_id': shelf_location_barcode_id.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',
}) })
if location.product_num > 0: if shelf_location_barcode_id.product_num > 0:
location.product_num = location.product_num - 1 shelf_location_barcode_id.product_num = shelf_location_barcode_id.product_num - 1
else: else:
raise ValidationError( raise ValidationError(
'%s】货位的【%s】产品库存数量为零,请采购入库后再重新组装!' % (location.barcode, location.product_id.name)) '%s】货位的【%s】产品库存数量为零,请采购入库后再重新组装!' % (
shelf_location_barcode_id.barcode, shelf_location_barcode_id.product_id.name))
return stock_move_id, stock_move_line_id return stock_move_id, stock_move_line_id

View File

@@ -226,13 +226,16 @@
</group> </group>
</group> </group>
<group col="1" <group col="1"
attrs="{'invisible': ['|','|',('blade_freight_barcode', '!=', False),('bar_freight_barcode', '!=', False),('pad_freight_barcode', '!=', False)]}"> attrs="{'invisible': ['|','|',('blade_freight_barcode_id', '!=', False),('bar_freight_barcode_id', '!=', False),('pad_freight_barcode_id', '!=', False)]}">
<div> <div>
<separator string="整体式刀具:" style="font-size: 13px;"/> <separator string="整体式刀具:" style="font-size: 13px;"/>
</div> </div>
<group> <group>
<group> <group>
<field name="integral_freight_barcode" string="货位"/> <field name="integral_freight_barcode_id" options="{'no_create': True}" placeholder="请选择" string="货位"/>
</group>
<group>
<field name="integral_freight_lot_id" options="{'no_create': True}" placeholder="请选择" string="批次"/>
</group> </group>
</group> </group>
<group col="2"> <group col="2">
@@ -246,13 +249,16 @@
</group> </group>
</group> </group>
</group> </group>
<group col="1" attrs="{'invisible': [('integral_freight_barcode', '!=', False)]}"> <group col="1" attrs="{'invisible': [('integral_freight_barcode_id', '!=', False)]}">
<div> <div>
<separator string="刀片:" style="font-size: 13px;"/> <separator string="刀片:" style="font-size: 13px;"/>
</div> </div>
<group> <group>
<group> <group>
<field name="blade_freight_barcode" string="货位"/> <field name="blade_freight_barcode_id" options="{'no_create': True}" placeholder="请选择" string="货位"/>
</group>
<group>
<field name="blade_freight_lot_id" options="{'no_create': True}" placeholder="请选择" string="批次"/>
</group> </group>
</group> </group>
<group col="2"> <group col="2">
@@ -267,13 +273,16 @@
</group> </group>
</group> </group>
<group col="1" <group col="1"
attrs="{'invisible': ['|',('integral_freight_barcode', '!=', False),('pad_freight_barcode', '!=', False)]}"> attrs="{'invisible': ['|',('integral_freight_barcode_id', '!=', False),('pad_freight_barcode_id', '!=', False)]}">
<div> <div>
<separator string="刀杆:" style="font-size: 13px;"/> <separator string="刀杆:" style="font-size: 13px;"/>
</div> </div>
<group> <group>
<group> <group>
<field name="bar_freight_barcode" string="货位"/> <field name="bar_freight_barcode_id" options="{'no_create': True}" placeholder="请选择" string="货位"/>
</group>
<group>
<field name="bar_freight_lot_id" options="{'no_create': True}" placeholder="请选择" string="批次"/>
</group> </group>
</group> </group>
<group col="2"> <group col="2">
@@ -288,13 +297,16 @@
</group> </group>
</group> </group>
<group col="1" <group col="1"
attrs="{'invisible': ['|',('integral_freight_barcode', '!=', False),('bar_freight_barcode', '!=', False)]}"> attrs="{'invisible': ['|',('integral_freight_barcode_id', '!=', False),('bar_freight_barcode_id', '!=', False)]}">
<div> <div>
<separator string="刀盘:" style="font-size: 13px;"/> <separator string="刀盘:" style="font-size: 13px;"/>
</div> </div>
<group> <group>
<group> <group>
<field name="pad_freight_barcode" string="货位"/> <field name="pad_freight_barcode_id" options="{'no_create': True}" placeholder="请选择" string="货位"/>
</group>
<group>
<field name="pad_freight_lot_id" options="{'no_create': True}" placeholder="请选择" string="批次"/>
</group> </group>
</group> </group>
<group col="2"> <group col="2">
@@ -314,7 +326,10 @@
</div> </div>
<group> <group>
<group> <group>
<field name="chuck_freight_barcode" string="货位"/> <field name="chuck_freight_barcode_id" options="{'no_create': True}" placeholder="请选择" string="货位"/>
</group>
<group>
<field name="chuck_freight_lot_id" options="{'no_create': True}" placeholder="请选择" string="批次"/>
</group> </group>
</group> </group>
<group col="2"> <group col="2">

View File

@@ -539,6 +539,7 @@ class SfShelfLocationLot(models.Model):
_name = 'sf.shelf.location.lot' _name = 'sf.shelf.location.lot'
_description = '批次数量' _description = '批次数量'
name = fields.Char('名称', related='lot_id.name')
shelf_location_id = fields.Many2one('sf.shelf.location', string="货位") shelf_location_id = fields.Many2one('sf.shelf.location', string="货位")
lot_id = fields.Many2one('stock.lot', string='批次号') lot_id = fields.Many2one('stock.lot', string='批次号')
qty = fields.Integer('数量') qty = fields.Integer('数量')