32 lines
1.4 KiB
Python
32 lines
1.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
from odoo import fields, models
|
|
|
|
|
|
class sf_technology_design(models.Model):
|
|
_name = 'sf.technology.design'
|
|
_description = "工艺设计"
|
|
|
|
sequence = fields.Integer('序号')
|
|
route_id = fields.Many2one('mrp.routing.workcenter', '工序')
|
|
process_parameters_id = fields.Many2one('sf.production.process.parameter', string='表面工艺参数')
|
|
panel = fields.Char('加工面')
|
|
routing_tag = fields.Selection(related='route_id.routing_tag', string='标签', store=True)
|
|
time_cycle_manual = fields.Float(related='route_id.time_cycle_manual', string='预计时长')
|
|
production_id = fields.Many2one('mrp.production')
|
|
is_auto = fields.Boolean('是否自动生成', default=False)
|
|
active = fields.Boolean('有效', default=True)
|
|
|
|
def json_technology_design_str(self, k, route, i, process_parameter):
|
|
workorders_values_str = [0, '', {
|
|
'route_id': route.id if route.routing_type in ['表面工艺'] else route.route_workcenter_id.id,
|
|
'panel': k,
|
|
'process_parameters_id': False if route.routing_type != '表面工艺' else self.env[
|
|
'sf.production.process.parameter'].search(
|
|
[('id', '=', process_parameter.id)]).id,
|
|
'sequence': i,
|
|
'is_auto': True}]
|
|
return workorders_values_str
|
|
|
|
def unlink_technology_design(self):
|
|
self.active = False
|