优化刀具产品
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import json
|
||||
import requests
|
||||
from datetime import date
|
||||
from odoo import fields, models, api
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
|
||||
|
||||
class CuttingToolMaterial(models.Model):
|
||||
@@ -113,6 +110,24 @@ class CuttingToolModel(models.Model):
|
||||
feed_per_tooth_ids = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz(整体式刀具)')
|
||||
feed_per_tooth_ids_3 = fields.One2many('sf.feed.per.tooth', 'standard_library_id', '每齿走刀量fz(刀片)')
|
||||
material_model_id = fields.Many2one('sf.materials.model', '材料型号')
|
||||
|
||||
@api.onchange('cutting_tool_material_id')
|
||||
def _get_code(self):
|
||||
if self.is_cloud is False:
|
||||
today = date.today().strftime("%Y%m%d")
|
||||
today_code = 'T-DJWL-%s-%s' % (self.cutting_tool_material_id.code, today)
|
||||
cutting_tool_model = self.search(
|
||||
[('code', 'ilike', today_code), ('is_cloud', '=', False),
|
||||
('active', 'in', [True, False])],
|
||||
limit=1,
|
||||
order="id desc")
|
||||
if not cutting_tool_model:
|
||||
num = "%03d" % 1
|
||||
else:
|
||||
m = int(today_code[-3:]) + 1
|
||||
num = "%03d" % m
|
||||
return "%s%s" % (today_code, num)
|
||||
|
||||
# 适用夹头型号可以多选
|
||||
# chuck_ids = fields.Many2many(
|
||||
# 'sf.cutting_tool.standard.library',
|
||||
|
||||
@@ -10,6 +10,7 @@ class ToolMaterialsBasicParameters(models.Model):
|
||||
standard_library_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀具标准库')
|
||||
cutting_tool_type = fields.Char(related='standard_library_id.cutting_tool_type', string='刀具物料类型',
|
||||
store=True)
|
||||
is_cloud = fields.Boolean(related='standard_library_id.is_cloud', string='云端数据')
|
||||
|
||||
# 整体式刀具参数
|
||||
total_length = fields.Float('总长度(mm)')
|
||||
@@ -170,8 +171,6 @@ class FeedPerTooth(models.Model):
|
||||
feed_per_tooth = fields.Char('每齿走刀量 (mm/z)', size=20)
|
||||
active = fields.Boolean(string='有效', default=True)
|
||||
|
||||
|
||||
|
||||
# @api.depends('product_template_id')
|
||||
# def _compute_product_template_id(self):
|
||||
# if self.product_template_id is not None:
|
||||
|
||||
Reference in New Issue
Block a user