Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/整体式刀具能力参数补充

This commit is contained in:
yuxianghui
2023-09-06 16:48:43 +08:00
3 changed files with 104 additions and 56 deletions

View File

@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*-
import base64
import json, requests
from odoo import models, fields, api, _
from datetime import datetime, timedelta
from odoo.exceptions import UserError, ValidationError
import json, requests, logging
# sf排程
class sf_production_plan(models.Model):
@@ -15,6 +13,7 @@ class sf_production_plan(models.Model):
_description = 'sf_production_plan'
name = fields.Char(string='名称')
# selected = fields.Boolean(default=False)
production_id = fields.Many2one('mrp.production', '关联制造订单')
product_qty = fields.Float(string='数量', digits='Product Unit of Measure', required=True, default=0.0)
date_planned_start = fields.Datetime(string='计划开始时间', required=True, index=True, copy=False,
@@ -146,6 +145,9 @@ class sf_production_plan(models.Model):
# 当不设置计划结束时间时,增加计算计划结束时间的方法,根据采购周期加缓冲期两个值来算就可以了
def do_production_schedule(self):
if not self.production_line_id:
raise ValidationError("未选择生产线")
else:
aa = self.env['mrp.production'].sudo().search([('name', '=', self.name)])
workorder_time = 0
print(aa.workorder_ids)
@@ -240,6 +242,7 @@ class sf_production_plan(models.Model):
except Exception as e:
raise UserError(e)
# # sf生产排程
# class sf_produce_plan(models.Model):
# _name = 'sf.produce.plan'
@@ -266,3 +269,10 @@ class sf_production_plan(models.Model):
# plan_end_time = plan_start_time + pl_time
# return plan_end_time
#
# 机台作业计划
class machine_work_schedule(models.Model):
_name = 'sf.machine.schedule'
_description = '机台作业计划'
name = fields.Char(string='机台名')

View File

@@ -1,5 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sf_production_plan,sf.production.plan,model_sf_production_plan,base.group_user,1,1,1,1
access_sf_machine_schedule,sf.machine.schedule,model_sf_machine_schedule,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_sf_production_plan sf.production.plan model_sf_production_plan base.group_user 1 1 1 1
3 access_sf_machine_schedule sf.machine.schedule model_sf_machine_schedule base.group_user 1 1 1 1
4
5
6

View File

@@ -6,6 +6,7 @@
<field name="model">sf.production.plan</field>
<field name="arch" type="xml">
<tree string="订单计划">
<!-- <field name="selected" widget="boolean_toggle"/> -->
<!-- sequence、pl_no、pl_name、quantity、plan_start_time、plan_end_time、actual_start_time、actual_end_time、state、create_uid、create_date -->
<!-- <field name="sequence"/> -->
<field name="name"/>
@@ -25,9 +26,10 @@
<field name="arch" type="xml">
<form string="订单计划">
<header>
<button string="执行排程" name="do_production_schedule" type="object" class="oe_highlight" icon="fa-step-forward"/>
<button string="销售单" name="test_sale_order" type="object" class="oe_highlight"/>
<button string="测试流程" name="liucheng_cs" type="object" class="oe_highlight"/>
<!-- <button string="执行排程" name="do_production_schedule" type="object" class="oe_highlight" icon="fa-step-forward"/> -->
<button string="执行排程" name="do_production_schedule" type="object" class="oe_highlight"/>
<!-- <button string="销售单" name="test_sale_order" type="object" class="oe_highlight"/> -->
<!-- <button string="测试流程" name="liucheng_cs" type="object" class="oe_highlight"/> -->
<!-- <field name="state" widget="statusbar" statusbar_visible="draft,produce"/> -->
</header>
<sheet>
@@ -212,6 +214,18 @@
<!-- </gantt> -->
<!-- </field> -->
<!-- </record> -->
<record id="sf_machine_schedule_tree" model="ir.ui.view">
<field name="name">sf.machine.schedule.tree</field>
<field name="model">sf.machine.schedule</field>
<field name="arch" type="xml">
<tree string="机台作业计划">
<field name="name"/>
</tree>
</field>
</record>
<record id="sf_production_plan_action" model="ir.actions.act_window">
<field name="name">制造订单生产计划</field>
<field name="type">ir.actions.act_window</field>
@@ -254,6 +268,22 @@
<field name="view_mode">tree,form</field>
</record>
<record model="ir.actions.act_window" id="action_machine_work_schedule">
<!-- 自定义额外的动作 -->
<field name="name">机台作业计划</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sf.machine.schedule</field>
<field name="view_mode">tree</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
暂无机台作业计划
</p>
<p>
跟进请求的处理,并且和合作者沟通。
</p>
</field>
</record>
<menuitem
id="mrp_custom_menu"
name="制造订单"
@@ -275,6 +305,13 @@
action="sf_production_plan_action1"
parent="sf_production_plan_menu"
/>
<menuitem
id="machine_work_schedule"
name="机台作业计划"
sequence="200"
action="action_machine_work_schedule"
parent="sf_production_plan_menu"
/>
<!-- --><!-- 在现有菜单结构后面加入自定义的动作 -->