修改胚料部分
This commit is contained in:
@@ -51,10 +51,10 @@ class MrpProduction(models.Model):
|
||||
|
||||
def action_generate_serial(self):
|
||||
self.ensure_one()
|
||||
self.lot_producing_id = self.env['stock.production.lot'].create({
|
||||
self.lot_producing_id = self.env['stock.lot'].create({
|
||||
'product_id': self.product_id.id,
|
||||
'company_id': self.company_id.id,
|
||||
'name': self.env['stock.production.lot']._get_next_serial(self.company_id, self.product_id) or self.env[
|
||||
'name': self.env['stock.lot']._get_next_serial(self.company_id, self.product_id) or self.env[
|
||||
'ir.sequence'].next_by_code('stock.lot.serial'),
|
||||
})
|
||||
if self.move_finished_ids.filtered(lambda m: m.product_id == self.product_id).move_line_ids:
|
||||
|
||||
@@ -40,24 +40,24 @@ class ResMrpRoutingWorkcenter(models.Model):
|
||||
return self.env.cr.dictfetchall()[0].get('workcenter_id')
|
||||
|
||||
|
||||
class ModelTypeRoutingSort(models.Model):
|
||||
_name = 'sf.model.type.routing.sort'
|
||||
_description = '工序排序'
|
||||
|
||||
sequence = fields.Integer('Sequence')
|
||||
route_workcenter_id = fields.Many2one('mrp.routing.workcenter')
|
||||
is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat')
|
||||
routing_type = fields.Selection([
|
||||
('获取CNC加工程序', '获取CNC加工程序'),
|
||||
('装夹', '装夹'),
|
||||
('前置三元定位检测', '前置三元定位检测'),
|
||||
('CNC加工', 'CNC加工'),
|
||||
('后置三元质量检测', '后置三元质量检测'),
|
||||
('解除装夹', '解除装夹'),
|
||||
], string="工序类型", related='route_workcenter_id.routing_type')
|
||||
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
||||
model_type_id = fields.Many2one('sf.model.type')
|
||||
|
||||
_sql_constraints = [
|
||||
('route_model_type_uniq', 'unique (route_workcenter_id,model_type_id)', '工序不能重复!')
|
||||
]
|
||||
# class ModelTypeRoutingSort(models.Model):
|
||||
# _name = 'sf.model.type.routing.sort'
|
||||
# _description = '工序排序'
|
||||
#
|
||||
# sequence = fields.Integer('Sequence')
|
||||
# route_workcenter_id = fields.Many2one('mrp.routing.workcenter')
|
||||
# is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat')
|
||||
# routing_type = fields.Selection([
|
||||
# ('获取CNC加工程序', '获取CNC加工程序'),
|
||||
# ('装夹', '装夹'),
|
||||
# ('前置三元定位检测', '前置三元定位检测'),
|
||||
# ('CNC加工', 'CNC加工'),
|
||||
# ('后置三元质量检测', '后置三元质量检测'),
|
||||
# ('解除装夹', '解除装夹'),
|
||||
# ], string="工序类型", related='route_workcenter_id.routing_type')
|
||||
# workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
|
||||
# model_type_id = fields.Many2one('sf.model.type')
|
||||
#
|
||||
# _sql_constraints = [
|
||||
# ('route_model_type_uniq', 'unique (route_workcenter_id,model_type_id)', '工序不能重复!')
|
||||
# ]
|
||||
|
||||
@@ -241,7 +241,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
'material_type_code': cnc.env['sf.materials.model'].search(
|
||||
[('id', '=', cnc.product_id.materials_type_id.id)]).materials_no,
|
||||
'machining_precision': cnc.product_id.model_machining_precision,
|
||||
'embryo_long': cnc.product_id.bom_ids.bom_line_ids.product_id.long,
|
||||
'embryo_long': cnc.product_id.bom_ids.bom_line_ids.product_id.length,
|
||||
'embryo_height': cnc.product_id.bom_ids.bom_line_ids.product_id.height,
|
||||
'embryo_width': cnc.product_id.bom_ids.bom_line_ids.product_id.width
|
||||
# 'factory_code': self.env.user.company_id.partner_id.
|
||||
@@ -345,7 +345,7 @@ class CNCprocessing(models.Model):
|
||||
|
||||
# mrs下发编程单创建CNC加工
|
||||
def cnc_processing_create(self, obj):
|
||||
workorder = self.env['mrp.workorder'].search([('production_id.name', '=', obj['manufacturing_order_no']),
|
||||
workorder = self.env['mrp.workorder'].search([('production_id.name', '=', obj['production_order_no']),
|
||||
('processing_panel', '=', obj['processing_panel']),
|
||||
('routing_type', '=', 'CNC加工')])
|
||||
vals = {
|
||||
|
||||
@@ -181,7 +181,7 @@ class StockRule(models.Model):
|
||||
|
||||
|
||||
class ProductionLot(models.Model):
|
||||
_inherit = 'stock.production.lot'
|
||||
_inherit = 'stock.lot'
|
||||
|
||||
@api.model
|
||||
def generate_lot_names1(self, display_name, first_lot, count):
|
||||
@@ -217,10 +217,10 @@ class ProductionLot(models.Model):
|
||||
def _get_next_serial(self, company, product):
|
||||
"""Return the next serial number to be attributed to the product."""
|
||||
if product.tracking == "serial":
|
||||
last_serial = self.env['stock.production.lot'].search(
|
||||
last_serial = self.env['stock.lot'].search(
|
||||
[('company_id', '=', company.id), ('product_id', '=', product.id)],
|
||||
limit=1, order='id DESC')
|
||||
if last_serial:
|
||||
return self.env['stock.production.lot'].generate_lot_names1(product.display_name, last_serial.name, 2)[
|
||||
return self.env['stock.lot'].generate_lot_names1(product.display_name, last_serial.name, 2)[
|
||||
1]
|
||||
return "%s-%03d" % (product.display_name, 1)
|
||||
|
||||
Reference in New Issue
Block a user