代码注释,前后置检查
This commit is contained in:
@@ -21,6 +21,7 @@ class MrpProduction(models.Model):
|
|||||||
for production in self:
|
for production in self:
|
||||||
production.maintenance_count = len(production.request_ids)
|
production.maintenance_count = len(production.request_ids)
|
||||||
|
|
||||||
|
#维修模块按钮
|
||||||
def button_maintenance_req(self):
|
def button_maintenance_req(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
return {
|
return {
|
||||||
@@ -34,7 +35,7 @@ class MrpProduction(models.Model):
|
|||||||
},
|
},
|
||||||
'domain': [('production_id', '=', self.id)],
|
'domain': [('production_id', '=', self.id)],
|
||||||
}
|
}
|
||||||
|
#打开维修模块请求
|
||||||
def open_maintenance_request_mo(self):
|
def open_maintenance_request_mo(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
action = {
|
action = {
|
||||||
@@ -135,6 +136,7 @@ class MrpProduction(models.Model):
|
|||||||
for workorder in production.workorder_ids:
|
for workorder in production.workorder_ids:
|
||||||
workorder.duration_expected = workorder._get_duration_expected()
|
workorder.duration_expected = workorder._get_duration_expected()
|
||||||
|
|
||||||
|
#在之前的销售单上重新生成制造订单
|
||||||
def create_production1_values(self, production):
|
def create_production1_values(self, production):
|
||||||
production_values_str = {'origin': production.origin,
|
production_values_str = {'origin': production.origin,
|
||||||
'product_id': production.product_id.id,
|
'product_id': production.product_id.id,
|
||||||
@@ -156,6 +158,7 @@ class MrpProduction(models.Model):
|
|||||||
'user_id': production.user_id.id}
|
'user_id': production.user_id.id}
|
||||||
return production_values_str
|
return production_values_str
|
||||||
|
|
||||||
|
#工单排序
|
||||||
def _reset_work_order_sequence1(self, k):
|
def _reset_work_order_sequence1(self, k):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
current_sequence = 1
|
current_sequence = 1
|
||||||
@@ -166,6 +169,7 @@ class MrpProduction(models.Model):
|
|||||||
for a in sfa:
|
for a in sfa:
|
||||||
print(a)
|
print(a)
|
||||||
|
|
||||||
|
#在制造订单上新增工单
|
||||||
def _create_workorder1(self, k):
|
def _create_workorder1(self, k):
|
||||||
for production in self:
|
for production in self:
|
||||||
if not production.bom_id or not production.product_id:
|
if not production.bom_id or not production.product_id:
|
||||||
@@ -229,6 +233,7 @@ class MrpProduction(models.Model):
|
|||||||
work.sequence = current_sequence
|
work.sequence = current_sequence
|
||||||
current_sequence += 1
|
current_sequence += 1
|
||||||
|
|
||||||
|
#创建工单并进行排序
|
||||||
def _create_workorder(self):
|
def _create_workorder(self):
|
||||||
res = self._create_workorder3()
|
res = self._create_workorder3()
|
||||||
self._reset_work_order_sequence()
|
self._reset_work_order_sequence()
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
except:
|
except:
|
||||||
raise UserError("参数计算有误")
|
raise UserError("参数计算有误")
|
||||||
|
|
||||||
|
#拼接工单对象属性值
|
||||||
def json_workorder_str(self, k, production, route):
|
def json_workorder_str(self, k, production, route):
|
||||||
workorders_values_str = [0, '', {
|
workorders_values_str = [0, '', {
|
||||||
'product_uom_id': production.product_uom_id.id,
|
'product_uom_id': production.product_uom_id.id,
|
||||||
@@ -153,7 +154,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
}]
|
}]
|
||||||
return workorders_values_str
|
return workorders_values_str
|
||||||
|
|
||||||
# 工作中心看板按钮
|
# 维修模块按钮
|
||||||
def button_maintenance_req(self):
|
def button_maintenance_req(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
return {
|
return {
|
||||||
@@ -199,6 +200,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
else:
|
else:
|
||||||
raise UserError('托盘码不能为空')
|
raise UserError('托盘码不能为空')
|
||||||
|
|
||||||
|
#托盘扫码绑定
|
||||||
def gettray_auto(self, barcode):
|
def gettray_auto(self, barcode):
|
||||||
if barcode != False:
|
if barcode != False:
|
||||||
values = self.env['sf.tray'].search([("code", "=", barcode)])
|
values = self.env['sf.tray'].search([("code", "=", barcode)])
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class Tray(models.Model):
|
|||||||
else:
|
else:
|
||||||
self.state = '空闲'
|
self.state = '空闲'
|
||||||
|
|
||||||
|
#解绑托盘
|
||||||
def unclamp(self):
|
def unclamp(self):
|
||||||
self.workorder_id = False
|
self.workorder_id = False
|
||||||
self.production_id = False
|
self.production_id = False
|
||||||
|
|||||||
Reference in New Issue
Block a user