1、序列号模型对象添加rfid字段且rfid仅在产品为刀柄时展示,序列号模型添加规格字段,且添加自动根据对应产品类型不同计算出其值,产品为夹具时看板展示其规格的值;2、在采购入库流程,录入序列号的过程界面添加录入rfid字段,当产品是刀柄时需录入刀柄的rfid,并在验证通过后刀柄的序列号中带有rfid码;
This commit is contained in:
@@ -222,6 +222,22 @@ class ProductionLot(models.Model):
|
|||||||
_name = 'stock.lot'
|
_name = 'stock.lot'
|
||||||
_inherit = ['stock.lot', 'printing.utils']
|
_inherit = ['stock.lot', 'printing.utils']
|
||||||
|
|
||||||
|
rfid = fields.Char('Rfid', readonly=True)
|
||||||
|
product_material_name = fields.Char('刀具产品物料名称', related='product_id.cutting_tool_material_id.name')
|
||||||
|
product_specification = fields.Char('规格', compute='_compute_product_specification', store=True)
|
||||||
|
|
||||||
|
@api.depends('product_id')
|
||||||
|
def _compute_product_specification(self):
|
||||||
|
for stock in self:
|
||||||
|
if stock:
|
||||||
|
if stock.product_id:
|
||||||
|
if stock.product_id.categ_id.name in '刀具':
|
||||||
|
stock.product_specification = stock.product_id.specification_id.name
|
||||||
|
elif stock.product_id.categ_id.name in '夹具':
|
||||||
|
stock.product_specification = stock.product_id.specification_fixture_id.name
|
||||||
|
else:
|
||||||
|
stock.product_specification = stock.product_id.default_code
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def generate_lot_names1(self, display_name, first_lot, count):
|
def generate_lot_names1(self, display_name, first_lot, count):
|
||||||
"""Generate `lot_names` from a string."""
|
"""Generate `lot_names` from a string."""
|
||||||
|
|||||||
@@ -422,7 +422,8 @@
|
|||||||
|
|
||||||
<div name="product_specification_id" class="mt-1">
|
<div name="product_specification_id" class="mt-1">
|
||||||
规格:
|
规格:
|
||||||
<field name="specification_id"></field>
|
<field name="specification_id"/>
|
||||||
|
<field name="specification_fixture_id"/>
|
||||||
</div>
|
</div>
|
||||||
<t t-if="record.default_code.value">[<field name="default_code"/>]
|
<t t-if="record.default_code.value">[<field name="default_code"/>]
|
||||||
</t>
|
</t>
|
||||||
|
|||||||
@@ -13,6 +13,12 @@
|
|||||||
<button string="打印二维码" name="print_single_method" type="object" class="btn-primary"/>
|
<button string="打印二维码" name="print_single_method" type="object" class="btn-primary"/>
|
||||||
</header>
|
</header>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='product_id']" position="before">
|
||||||
|
<field name="rfid"/>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='product_id']" position="after">
|
||||||
|
<field name="product_specification"/>
|
||||||
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -424,6 +424,8 @@ class Sf_stock_move_line(models.Model):
|
|||||||
# lot_qr_code = fields.Binary(string='二维码', compute='_compute_lot_qr_code', store=True)
|
# lot_qr_code = fields.Binary(string='二维码', compute='_compute_lot_qr_code', store=True)
|
||||||
lot_qr_code = fields.Binary(string='二维码', compute='_compute_lot_qr_code', store=True)
|
lot_qr_code = fields.Binary(string='二维码', compute='_compute_lot_qr_code', store=True)
|
||||||
|
|
||||||
|
rfid = fields.Char('Rfid')
|
||||||
|
|
||||||
def action_revert_inventory(self):
|
def action_revert_inventory(self):
|
||||||
# 检查用户是否有执行操作的权限
|
# 检查用户是否有执行操作的权限
|
||||||
if not self.env.user.has_group('sf_warehouse.group_sf_stock_user'):
|
if not self.env.user.has_group('sf_warehouse.group_sf_stock_user'):
|
||||||
@@ -742,6 +744,12 @@ class SfStockPicking(models.Model):
|
|||||||
if line.current_location_id:
|
if line.current_location_id:
|
||||||
line.current_location_id.product_sn_id = False
|
line.current_location_id.product_sn_id = False
|
||||||
line.current_location_id.location_status = '空闲'
|
line.current_location_id.location_status = '空闲'
|
||||||
|
|
||||||
|
for move in self.move_ids:
|
||||||
|
if move and move.product_id.cutting_tool_material_id.name in '刀柄':
|
||||||
|
for item in move.move_line_nosuggest_ids:
|
||||||
|
if item:
|
||||||
|
self.env['stock.lot'].search([('name', '=', item.lot_name)]).write({'rfid': item.rfid})
|
||||||
return res
|
return res
|
||||||
|
|
||||||
# def print_all_barcode(self):
|
# def print_all_barcode(self):
|
||||||
@@ -932,7 +940,24 @@ class SfStockScrap(models.Model):
|
|||||||
|
|
||||||
class CustomStockMove(models.Model):
|
class CustomStockMove(models.Model):
|
||||||
_name = 'stock.move'
|
_name = 'stock.move'
|
||||||
_inherit = ['stock.move', 'printing.utils']
|
_inherit = ['stock.move', 'printing.utils', 'barcodes.barcode_events_mixin']
|
||||||
|
|
||||||
|
def on_barcode_scanned(self, barcode):
|
||||||
|
"""
|
||||||
|
采购入库扫码绑定Rfid码
|
||||||
|
"""
|
||||||
|
for record in self:
|
||||||
|
if record:
|
||||||
|
if '刀柄' in record.product_id.cutting_tool_material_id.name:
|
||||||
|
for move_line_nosuggest_id in record.move_line_nosuggest_ids:
|
||||||
|
if move_line_nosuggest_id.rfid:
|
||||||
|
if move_line_nosuggest_id.rfid == barcode:
|
||||||
|
raise ValidationError('该刀柄的rfid已经录入,请勿重复录入!!!')
|
||||||
|
else:
|
||||||
|
move_line_nosuggest_id.sudo().rfid = barcode
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise ValidationError('该产品不是刀柄!!!')
|
||||||
|
|
||||||
def action_assign_serial_show_details(self):
|
def action_assign_serial_show_details(self):
|
||||||
# 首先执行原有逻辑
|
# 首先执行原有逻辑
|
||||||
|
|||||||
@@ -31,15 +31,16 @@
|
|||||||
<field name="current_location_id" force_save="1"/>
|
<field name="current_location_id" force_save="1"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//field[@name='location_dest_id']" position="after">
|
<xpath expr="//field[@name='location_dest_id']" position="after">
|
||||||
<field name="destination_location_id" />
|
<field name="destination_location_id"/>
|
||||||
<!-- <field name="location_dest_id_product_type"/> -->
|
<!-- <field name="location_dest_id_product_type"/> -->
|
||||||
<!-- <field name="location_dest_id"/> -->
|
<!-- <field name="location_dest_id"/> -->
|
||||||
<field name="location_dest_id_value" invisible="1"/>
|
<field name="location_dest_id_value" invisible="1"/>
|
||||||
<!-- <button name="button_test" string="测试" type="object" class="oe_highlight"/> -->
|
<!-- <button name="button_test" string="测试" type="object" class="oe_highlight"/> -->
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
<record id="sf_stock_move_line_form" model="ir.ui.view">
|
<record id="sf_stock_move_line_form" model="ir.ui.view">
|
||||||
<field name="name">sf.stock.move.line.form</field>
|
<field name="name">sf.stock.move.line.form</field>
|
||||||
<field name="model">stock.move.line</field>
|
<field name="model">stock.move.line</field>
|
||||||
@@ -63,6 +64,9 @@
|
|||||||
<field name="model">stock.move.line</field>
|
<field name="model">stock.move.line</field>
|
||||||
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree"/>
|
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='lot_name']" position="after">
|
||||||
|
<field name="rfid"/>
|
||||||
|
</xpath>
|
||||||
<xpath expr="//field[@name='product_uom_id']" position="after">
|
<xpath expr="//field[@name='product_uom_id']" position="after">
|
||||||
<field name="lot_qr_code" widget="image"/>
|
<field name="lot_qr_code" widget="image"/>
|
||||||
<button name="print_single_method" string="打印编码" type="object" class="oe_highlight"/>
|
<button name="print_single_method" string="打印编码" type="object" class="oe_highlight"/>
|
||||||
@@ -103,10 +107,10 @@
|
|||||||
groups="sf_warehouse.group_sf_stock_user" data-hotkey="k"/>
|
groups="sf_warehouse.group_sf_stock_user" data-hotkey="k"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<!-- <xpath expr="//form//sheet//notebook//page//field[@name='move_ids_without_package']" position="before"> -->
|
<!-- <xpath expr="//form//sheet//notebook//page//field[@name='move_ids_without_package']" position="before"> -->
|
||||||
<!-- <field name="check_in" invisible="True"/> -->
|
<!-- <field name="check_in" invisible="True"/> -->
|
||||||
<!-- <button name="print_all_barcode" string="打印所有编码" type="object" attrs="{'invisible': [('check_in', '!=', 'IN')]}"/> -->
|
<!-- <button name="print_all_barcode" string="打印所有编码" type="object" attrs="{'invisible': [('check_in', '!=', 'IN')]}"/> -->
|
||||||
<!-- </xpath> -->
|
<!-- </xpath> -->
|
||||||
|
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -145,11 +149,23 @@
|
|||||||
<field name="model">stock.move</field>
|
<field name="model">stock.move</field>
|
||||||
<field name="inherit_id" ref="stock.view_stock_move_operations"/>
|
<field name="inherit_id" ref="stock.view_stock_move_operations"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<!-- <xpath expr="//form//field[@name='move_line_ids']" position="before"> -->
|
<!-- <xpath expr="//form//field[@name='move_line_ids']" position="before"> -->
|
||||||
<!-- <button name="print_all_barcode" type="object" string="打印所有编码"/> -->
|
<!-- <button name="print_all_barcode" type="object" string="打印所有编码"/> -->
|
||||||
<!-- </xpath> -->
|
<!-- </xpath> -->
|
||||||
<xpath expr="//form//field[@name='product_id']" position="before">
|
<xpath expr="//form//field[@name='product_id']" position="before">
|
||||||
<button name="print_all_barcode" type="object" string="打印所有编码" class="oe_highlight"/> -->
|
<button name="print_all_barcode" type="object" string="打印所有编码" class="oe_highlight"/>
|
||||||
|
-->
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="mrp_subcontracting_view_stock_move_barcode_scanned" model="ir.ui.view">
|
||||||
|
<field name="name">mrp.subcontracting.stock.move.barcode.scanned.form</field>
|
||||||
|
<field name="model">stock.move</field>
|
||||||
|
<field name="inherit_id" ref="stock.view_stock_move_nosuggest_operations"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='move_line_nosuggest_ids']" position="before">
|
||||||
|
<field name="_barcode_scanned" widget="barcode_handler"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
Reference in New Issue
Block a user