diff --git a/sf_dlm_management/views/product_template_management_view.xml b/sf_dlm_management/views/product_template_management_view.xml
index 453de6a3..94fc6b45 100644
--- a/sf_dlm_management/views/product_template_management_view.xml
+++ b/sf_dlm_management/views/product_template_management_view.xml
@@ -10,6 +10,7 @@
+
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 24ac58b2..9deba53d 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -57,7 +57,7 @@ class MrpProduction(models.Model):
production_line_state = fields.Selection([('待上产线', '待上产线'), ('已上产线', '已上产线'), ('已下产线', '已下产线')],
string='上/下产线', default='待上产线')
- manual_quotation = fields.Boolean('人工编程', default=False)
+ manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
@api.depends(
'move_raw_ids.state', 'move_raw_ids.quantity_done', 'move_finished_ids.state',
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index c9d72b79..a2da9d7c 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -46,7 +46,7 @@ class ResMrpWorkOrder(models.Model):
], string="工序类型")
results = fields.Char('结果')
- manual_quotation = fields.Boolean('人工编程', default=False)
+ manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
@api.onchange('users_ids')
def get_user_permissions(self):
diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py
index 57ad0eaa..52f1fc9d 100644
--- a/sf_manufacturing/models/product_template.py
+++ b/sf_manufacturing/models/product_template.py
@@ -521,6 +521,9 @@ class ResProductMo(models.Model):
string='注册状态', default='未注册')
industry_code = fields.Char('行业编码', readonly=True)
+ # bfm下单
+ manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
+
@api.constrains('tool_length')
def _check_tool_length_size(self):
if self.tool_length > 1000000:
diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py
index 379ff199..05523194 100644
--- a/sf_sale/models/sale_order.py
+++ b/sf_sale/models/sale_order.py
@@ -142,12 +142,6 @@ class ResaleOrderLine(models.Model):
check_status = fields.Selection(related='order_id.check_status')
-class ProductTemplate(models.Model):
- _inherit = 'product.template'
-
- manual_quotation = fields.Boolean('人工编程', default=False)
-
-
class RePurchaseOrder(models.Model):
_inherit = 'purchase.order'
diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py
index 9ff18ebe..718a5877 100644
--- a/sf_warehouse/models/model.py
+++ b/sf_warehouse/models/model.py
@@ -191,6 +191,7 @@ class SfLocation(models.Model):
# return res
# 生成货位
+
def create_location(self):
"""
当仓库类型为货架时,自动生成其下面的货位,数量为货架层数*层数容量
@@ -429,7 +430,6 @@ class ShelfLocation(models.Model):
}
return action
-
# # 仓库类别(selection:库区、库位、货位)
# location_type = fields.Selection([
# ('货架', '货架'),
@@ -516,6 +516,19 @@ class ShelfLocation(models.Model):
else:
raise UserError("该库位无产品")
+ @api.model_create_multi
+ def create(self, vals_list):
+ # 编码重复校验
+ barcode_list = []
+ for val in vals_list:
+ location = self.search([('barcode', '=', val['barcode'])])
+ if location:
+ barcode_list.append(val['name'])
+ if barcode_list:
+ raise UserError("货位编码【%s】存在重复" % barcode_list)
+ records = super(ShelfLocation, self).create(vals_list)
+ return records
+
class Sf_stock_move_line(models.Model):
_name = 'stock.move.line'
@@ -812,35 +825,42 @@ class Sf_stock_move_line(models.Model):
destination_location_id = fields.Many2one(
'sf.shelf.location', string='目标货位')
- @api.onchange('destination_location_id')
- def _compute_destination_location_id(self):
+ def compute_destination_location_id(self):
for record in self:
+ obj = self.env['sf.shelf.location'].search([('name', '=',
+ self.destination_location_id.name)])
+ # if obj.product_id and obj.product_id != record.product_id:
+ # # 判断货位产品和将入到该货位的产品是否是同一种
+ # raise ValidationError(
+ # '【%s】产品和【%s】货位的【%s】产品不同,请重新选择【%s】产品的货位!!!' %
+ # (record.product_id, obj.name, obj.product_id, record.product_id))
if record.lot_id:
shelf_location_obj = self.env['sf.shelf.location'].search(
[('product_sn_id', '=', record.lot_id.id)])
if shelf_location_obj:
shelf_location_obj.product_sn_id = False
- # obj = self.env['sf.shelf.location'].search([('location_id', '=',
- # self.destination_location_id.id)])
- obj = self.env['sf.shelf.location'].search([('name', '=',
- self.destination_location_id.name)])
if obj:
obj.product_sn_id = record.lot_id.id
- else:
- pass
else:
- obj = self.env['sf.shelf.location'].search([('name', '=',
- self.destination_location_id.name)])
if obj:
obj.product_sn_id = record.lot_id.id
else:
- obj = self.env['sf.shelf.location'].search([('name', '=',
- self.destination_location_id.name)])
if obj:
obj.product_id = record.product_id.id
# obj.location_status = '占用'
obj.product_num += record.reserved_uom_qty
+ @api.onchange('destination_location_id')
+ def _check_destination_location_id(self):
+ for item in self:
+ if item:
+ line_destination_location_ids = []
+ for obj in item.picking_id.move_line_ids:
+ if obj.destination_location_id:
+ line_destination_location_ids.append(obj.destination_location_id.barcode)
+ if item.destination_location_id.barcode in line_destination_location_ids:
+ raise ValidationError('【%s】货位已经被占用,请重新选择!!!' % item.destination_location_id.barcode)
+
class SfStockPicking(models.Model):
_inherit = 'stock.picking'
@@ -863,12 +883,15 @@ class SfStockPicking(models.Model):
res = super(SfStockPicking, self).button_validate()
for line in self.move_line_ids:
if line:
+ # 调用入库方法进行入库
+ line.compute_destination_location_id()
if line.current_location_id:
if line.current_location_id.product_sn_id:
line.current_location_id.product_sn_id = False
# line.current_location_id.location_status = '空闲'
line.current_location_id.product_num = 0
+ # 对入库作业的刀柄和托盘进行Rfid绑定校验
for move in self.move_ids:
if move and move.product_id.cutting_tool_material_id.name == '刀柄' or '托盘' in (
move.product_id.fixture_material_id.name or ''):
diff --git a/sf_warehouse/views/change_stock_move_views.xml b/sf_warehouse/views/change_stock_move_views.xml
index 7af154b7..519eca85 100644
--- a/sf_warehouse/views/change_stock_move_views.xml
+++ b/sf_warehouse/views/change_stock_move_views.xml
@@ -19,7 +19,7 @@
+ '=', there_is_no_sn)]" options="{'no_create': True,'no_create_edit':True}"/>
diff --git a/sf_warehouse/views/shelf_location.xml b/sf_warehouse/views/shelf_location.xml
index d736f89c..ff8f54b2 100644
--- a/sf_warehouse/views/shelf_location.xml
+++ b/sf_warehouse/views/shelf_location.xml
@@ -126,7 +126,7 @@
Shelf Location form
sf.shelf.location
-