108 lines
4.1 KiB
Python
108 lines
4.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
import logging
|
|
from odoo import fields, models
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
# 材料
|
|
class MrsProductionMaterials(models.Model):
|
|
_name = 'sf.production.materials'
|
|
_description = '材料'
|
|
|
|
materials_no = fields.Char("编码")
|
|
name = fields.Char('名称')
|
|
partner_ids = fields.Many2many('res.partner', 'materials_ids', '加工工厂')
|
|
materials_model_ids = fields.One2many('sf.materials.model', 'materials_id', '材料型号')
|
|
remark = fields.Text("备注")
|
|
active = fields.Boolean('有效', default=True)
|
|
|
|
|
|
# 材料型号
|
|
class MrsMaterialModel(models.Model):
|
|
_name = 'sf.materials.model'
|
|
_description = '材料型号'
|
|
|
|
materials_no = fields.Char("编码")
|
|
materials_num = fields.Char("编码号")
|
|
name = fields.Char('型号名')
|
|
need_h = fields.Boolean("热处理", default="false")
|
|
mf_materia_post = fields.Char("热处理后密度")
|
|
density = fields.Float("密度(kg/m³)")
|
|
materials_id = fields.Many2one('sf.production.materials', "材料名")
|
|
remark = fields.Text("备注")
|
|
gain_way = fields.Selection(
|
|
[("自加工", "自加工"), ("外协", "外协"), ("采购", "采购")],
|
|
default="", string="获取方式")
|
|
supplier_ids = fields.One2many('sf.supplier.sort', 'materials_model_id', string='供应商')
|
|
active = fields.Boolean('有效', default=True)
|
|
|
|
|
|
# 工艺 编码,名称,备注
|
|
class MrsProductionProcess(models.Model):
|
|
_name = 'sf.production.process'
|
|
_description = '表面工艺'
|
|
|
|
process_encode = fields.Char("编码")
|
|
name = fields.Char('名称')
|
|
remark = fields.Text("备注")
|
|
processing_order_ids = fields.One2many('sf.processing.order', 'production_process_id', string='工序')
|
|
partner_process_ids = fields.Many2many('res.partner', 'process_ids', '加工工厂')
|
|
active = fields.Boolean('有效', default=True)
|
|
parameter_ids = fields.One2many('sf.production.process.parameter', 'process_id', string='可选参数')
|
|
|
|
|
|
class MrsProcessingTechnology(models.Model):
|
|
_name = 'sf.processing.technology'
|
|
_description = '加工工艺'
|
|
|
|
name = fields.Char('名称', index=True)
|
|
remark = fields.Text('备注', index=True)
|
|
process_encode = fields.Char("编码")
|
|
processing_order_ids = fields.Many2many('sf.processing.order', 'sf_associated_processes',
|
|
index=True, string='工序')
|
|
active = fields.Boolean('有效', default=True)
|
|
|
|
|
|
class MrsProcessingOrder(models.Model):
|
|
_name = 'sf.processing.order'
|
|
_description = '工序'
|
|
sequence = fields.Integer('Sequence')
|
|
processing_technology_ids = fields.Many2many('sf.processing.technology', 'sf_associated_processes',
|
|
index=True, string='加工工艺')
|
|
production_process_id = fields.Many2one('sf.production.process', string="表面工艺")
|
|
|
|
|
|
class Tray(models.Model):
|
|
_name = 'sf.tray'
|
|
_description = '托盘'
|
|
|
|
code = fields.Char('编码', copy=False)
|
|
name = fields.Char('名称')
|
|
state = fields.Selection(
|
|
[("空闲", "空闲"), ("占用", "占用"), ("报损", "报损")],
|
|
default="空闲", string="状态")
|
|
active = fields.Boolean('有效', default=True)
|
|
|
|
|
|
class SupplierSort(models.Model):
|
|
_name = 'sf.supplier.sort'
|
|
_description = '供应商排序'
|
|
|
|
sequence = fields.Integer('Sequence')
|
|
partner_id = fields.Many2one('res.partner', domain="[('is_company', '=', True),('supplier_rank', '!=', 0)]")
|
|
materials_model_id = fields.Many2one('sf.materials.model')
|
|
|
|
_sql_constraints = [
|
|
('supplier_sort_uniq', 'unique (partner_id,materials_model_id)', '排序不能重复!')
|
|
]
|
|
|
|
class MrsProductionProcessParameter(models.Model):
|
|
_name = 'sf.production.process.parameter'
|
|
_description = '可选参数'
|
|
name = fields.Char('参数名')
|
|
active = fields.Boolean('有效', default=True)
|
|
price = fields.Float('单价')
|
|
process_id = fields.Many2one('sf.production.process', string='表面工艺')
|
|
materials_model_ids = fields.Many2many('sf.materials.model', 'applicable_material', string='适用材料')
|
|
code = fields.Char("编码") |