Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/页面优化

# Conflicts:
#	sf_manufacturing/models/stock.py
This commit is contained in:
jinling.yang
2023-09-14 09:46:28 +08:00
19 changed files with 410 additions and 208 deletions

View File

@@ -11,13 +11,18 @@ class ResWorkcenter(models.Model):
production_line_show = fields.Char(string='生产线名称')
machine_tool_id = fields.Many2one('sf.machine_tool', string='机床')
production_line_id = fields.Many2one('sf.production.line', string='生产线')
is_process_outsourcing = fields.Boolean('工艺外协')
users_ids = fields.Many2many("res.users", 'users_workcenter')
equipment_id = fields.Many2one(
'maintenance.equipment', string="设备",
check_company=True)
is_process_outsourcing = fields.Boolean('工艺外协')
users_ids = fields.Many2many("res.users", 'users_workcenter')
equipment_status = fields.Selection(
[("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")],
string="设备状态", compute='_compute_equipment_id')

View File

@@ -189,28 +189,30 @@ class StockRule(models.Model):
'mail.message_origin_link',
values={'self': production, 'origin': origin_production},
subtype_id=self.env.ref('mail.mt_note').id)
# '''
# 创建生产计划
# '''
# # 工单耗时
# workorder_duration = 0
# for workorder in production.workorder_ids:
# workorder_duration += workorder.duration_expected
#
# sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)])
# if sale_order:
# bb = sale_order.deadline_of_delivery
# productions = self.env['sf.production.plan'].with_user(SUPERUSER_ID).sudo().with_company(company_id). \
# create({
# 'name': production.name,
# 'production_id': production.id,
# 'date_planned_start': production.date_planned_start,
# 'origin': production.origin,
# 'product_qty': production.product_qty,
# 'product_id': production.product_id.id,
# 'state': 'draft',
# })
'''
创建生产计划
'''
# 工单耗时
workorder_duration = 0
for workorder in production.workorder_ids:
workorder_duration += workorder.duration_expected
sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)])
if sale_order:
bb = sale_order.deadline_of_delivery
productions = self.env['sf.production.plan'].with_user(SUPERUSER_ID).sudo().with_company(company_id). \
create({
'name': production.name,
'order_deadline': sale_order.deadline_of_delivery,
'production_id': production.id,
'date_planned_start': production.date_planned_start,
'origin': production.origin,
'product_qty': production.product_qty,
'product_id': production.product_id.id,
'state': 'draft',
})
return True

View File

@@ -84,11 +84,11 @@ class FeedPerTooth(models.Model):
cutting_speed = fields.Char('径向切宽 ae(mm)')
machining_method = fields.Selection([('直铣', '直铣'), ('坡铣', '坡铣')], string='加工方式')
materials_type_id = fields.Many2one('sf.materials.model', string='材料型号')
blade_diameter = fields.Float('刃部直径D1(mm)', readonly=True, compute='_compute_product_template_id')
blade_diameter = fields.Float('刃部直径D1(mm)', readonly=True, related='product_template_id.cutting_tool_blade_diameter')
feed_per_tooth = fields.Char('每齿走刀量 (mm/z)')
unit = fields.Char('单位', default='fz')
@api.depends('product_template_id')
def _compute_product_template_id(self):
if self.product_template_id is not None:
self.blade_diameter = self.product_template_id.cutting_tool_blade_diameter
# @api.depends('product_template_id')
# def _compute_product_template_id(self):
# if self.product_template_id is not None:
# self.blade_diameter = self.product_template_id.cutting_tool_blade_diameter