删除制造订单处排程相关的部分,排程模块架构改造完成

This commit is contained in:
mgw
2023-08-25 10:43:22 +08:00
parent eda57036bd
commit 7e071151a8
5 changed files with 236 additions and 251 deletions

View File

@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import re import re
from datetime import datetime, timedelta
from odoo import api, fields, models, _ from odoo import api, fields, models, _
@@ -15,66 +14,6 @@ class MrpProduction(models.Model):
model_file = fields.Binary('模型文件', related='product_id.model_file') model_file = fields.Binary('模型文件', related='product_id.model_file')
schedule_state = fields.Selection([('未排', '未排'), ('已排', '已排')], schedule_state = fields.Selection([('未排', '未排'), ('已排', '已排')],
string='排程状态', default='未排') string='排程状态', default='未排')
# state = fields.Selection(selection_add=[('未排程', '未排程'), ('已排程', '已排程')])
# 生产线
production_line_id = fields.Many2one('sf.production.line', string='生产线')
state = fields.Selection([
('draft', 'Draft'),
('confirmed', 'Confirmed'),
('未排程', '未排程'), ('已排程', '已排程'),
('progress', 'In Progress'),
('to_close', 'To Close'),
('done', 'Done'),
('cancel', 'Cancelled')], string='State',
compute='_compute_state', copy=False, index=True, readonly=True,
store=True, tracking=True,
help=" * Draft: The MO is not confirmed yet.\n"
" * Confirmed: The MO is confirmed, the stock rules and the reordering of the components are trigerred.\n"
" * In Progress: The production has started (on the MO or on the WO).\n"
" * To Close: The production is done, the MO has to be closed.\n"
" * Done: The MO is closed, the stock moves are posted. \n"
" * Cancelled: The MO has been cancelled, can't be confirmed anymore.")
@api.depends('company_id', 'date_planned_start', 'is_planned', 'product_id')
def _compute_date_planned_finished(self):
pass
# 当不设置计划结束时间时,增加计算计划结束时间的方法,根据采购周期加缓冲期两个值来算就可以了
def action_view_production_schedule(self):
self.ensure_one()
if self.date_planned_start and self.date_planned_finished:
return None
elif self.date_planned_start and not self.date_planned_finished:
# 如果没有给出计划结束时间,则计划结束时间为计划开始时间+采购周期+缓冲期
# 采购周期
purchase_cycle = 3
# 缓冲期
buffer_period = 1
# 计划结束时间 = 计划开始时间 + 采购周期 + 缓冲期
self.date_planned_finished = self.date_planned_start + timedelta(days=purchase_cycle) + timedelta(
days=buffer_period)
self.state = '已排程'
return self.date_planned_finished
else:
return None
# if self.plan_start_time and self.plan_end_time:
# return None
# elif self.plan_start_time and not self.plan_end_time:
# # 如果没有给出计划结束时间,则计划结束时间为计划开始时间+采购周期+缓冲期
# # 采购周期
# purchase_cycle = 3
# # 缓冲期
# buffer_period = 1
# # 计划结束时间 = 计划开始时间 + 采购周期 + 缓冲期
# self.plan_end_time = self.plan_start_time + timedelta(days=purchase_cycle) + timedelta(days=buffer_period)
# return self.plan_end_time
# else:
# return None
def cancel_plan(self):
self.ensure_one()
self.date_planned_finished = None
self.state = 'confirmed'
@api.depends('request_ids') @api.depends('request_ids')
def _compute_maintenance_count(self): def _compute_maintenance_count(self):
@@ -400,7 +339,7 @@ class MrpProduction(models.Model):
current_sequence += 1 current_sequence += 1
if work.name == '获取CNC加工程序': if work.name == '获取CNC加工程序':
work.button_start() work.button_start()
#work.fetchCNC() # work.fetchCNC()
# 创建工单并进行排序 # 创建工单并进行排序
def _create_workorder(self): def _create_workorder(self):

View File

@@ -16,7 +16,6 @@
</xpath> </xpath>
<xpath expr="//field[@name='product_id']" position="after"> <xpath expr="//field[@name='product_id']" position="after">
<field name="product_qty" sum="Total Qty" string="数量" readonly="1" optional="show"/> <field name="product_qty" sum="Total Qty" string="数量" readonly="1" optional="show"/>
<field name="production_line_id"/>
</xpath> </xpath>
<xpath expr="//field[@name='product_qty']" position="after"> <xpath expr="//field[@name='product_qty']" position="after">
<field name="product_uom_id" string="计量单位" options="{'no_open':True,'no_create':True}" groups="uom.group_uom" optional="show"/> <field name="product_uom_id" string="计量单位" options="{'no_open':True,'no_create':True}" groups="uom.group_uom" optional="show"/>
@@ -43,36 +42,35 @@
decoration-warning="reservation_state != 'assigned' and components_availability_state in ('expected', 'available')" decoration-warning="reservation_state != 'assigned' and components_availability_state in ('expected', 'available')"
decoration-danger="reservation_state != 'assigned' and components_availability_state == 'late'"/> decoration-danger="reservation_state != 'assigned' and components_availability_state == 'late'"/>
</xpath> </xpath>
<xpath expr="//field[@name='state']" position="after"> <!-- <xpath expr="//field[@name='state']" position="after"> -->
<button name="action_view_production_schedule" string="生产排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','已排程','progress','done','to_close'])]}"/> <!-- <button name="action_view_production_schedule" string="生产排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','已排程','progress','done','to_close'])]}"/> -->
<button name="cancel_plan" string="取消排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','progress','done','to_close','confirmed'])]}"/> <!-- <button name="cancel_plan" string="取消排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','progress','done','to_close','confirmed'])]}"/> -->
</xpath>
</field>
</record>
<record id="custom_mrp_production_form_view" model="ir.ui.view">
<field name="name">custom.mrp.production.form</field>
<field name="model">mrp.production</field>
<field name="inherit_id" ref="mrp.mrp_production_form_view"/>
<field name="arch" type="xml">
<xpath expr="//header//field[@name='state']" position="replace">
<field name="state" widget="statusbar" statusbar_visible="draft,confirmed,已排程,progress,done"/>
</xpath>
<xpath expr="//header" position="inside">
<button name="action_view_production_schedule" string="生产排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','已排程','progress','done','to_close'])]}"/>
<button name="cancel_plan" string="取消排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','progress','done','to_close','confirmed'])]}"/>
</xpath>
<xpath expr="//sheet//group//group//field[@name='product_id']" position="after">
<field name="production_line_id"/>
<!-- <field name="date_deadline"/> -->
<field name="date_planned_finished" string="计划结束时间"/>
</xpath>
<!-- <xpath expr="//sheet//group//group//field[@name='date_planned_start']" position="after"> -->
<!-- <field name="date_planned_finished"/> -->
<!-- </xpath> --> <!-- </xpath> -->
</field> </field>
</record> </record>
<!-- <record id="custom_mrp_production_form_view" model="ir.ui.view"> -->
<!-- <field name="name">custom.mrp.production.form</field> -->
<!-- <field name="model">mrp.production</field> -->
<!-- <field name="inherit_id" ref="mrp.mrp_production_form_view"/> -->
<!-- <field name="arch" type="xml"> -->
<!-- <xpath expr="//header//field[@name='state']" position="replace"> -->
<!-- <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,已排程,progress,done"/> -->
<!-- </xpath> -->
<!-- <xpath expr="//header" position="inside"> -->
<!-- <button name="action_view_production_schedule" string="生产排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','已排程','progress','done','to_close'])]}"/> -->
<!-- <button name="cancel_plan" string="取消排程" type="object" attrs="{'invisible': [('state', 'in', ['draft', 'cancel','progress','done','to_close','confirmed'])]}"/> -->
<!-- </xpath> -->
<!-- <xpath expr="//sheet//group//group//field[@name='product_id']" position="after"> -->
<!-- <field name="production_line_id"/> -->
<!-- <field name="date_planned_finished" string="计划结束时间"/> -->
<!-- </xpath> -->
<!-- <xpath expr="//sheet//group//group//field[@name='date_planned_start']" position="after"> -->
<!-- <field name="date_planned_finished"/> -->
<!-- </xpath> -->
<!-- </field> -->
<!-- </record> -->
<record id="custom_view_mrp_production_filter" model="ir.ui.view"> <record id="custom_view_mrp_production_filter" model="ir.ui.view">
<field name="name">custom.mrp.production.select</field> <field name="name">custom.mrp.production.select</field>
<field name="model">mrp.production</field> <field name="model">mrp.production</field>

View File

@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from odoo import models, fields, api, _ from odoo import models, fields, api, _
from datetime import datetime, timedelta from datetime import datetime, timedelta
from odoo.exceptions import UserError, ValidationError
# sf排程 # sf排程
@@ -16,10 +17,39 @@ class sf_production_plan(models.Model):
current_operation_name = fields.Char(string='当前工序名称', size=64, default='生产计划') current_operation_name = fields.Char(string='当前工序名称', size=64, default='生产计划')
production_line_id = fields.Many2one('sf.production.line', string='生产线') production_line_id = fields.Many2one('sf.production.line', string='生产线')
# state = fields.Selection([
# ('未排程', '未排程'), ('已排程', '已排程')], string='State', copy=False, index=True, readonly=True,
# store=True, tracking=True)
# 当不设置计划结束时间时,增加计算计划结束时间的方法,根据采购周期加缓冲期两个值来算就可以了
def action_view_production_schedule(self):
self.ensure_one()
if self.date_planned_start and self.date_planned_finished:
return None
elif self.date_planned_start and not self.date_planned_finished:
# 如果没有给出计划结束时间,则计划结束时间为计划开始时间+采购周期+缓冲期
# 采购周期
purchase_cycle = 3
# 缓冲期
buffer_period = 1
# 计划结束时间 = 计划开始时间 + 采购周期 + 缓冲期
self.date_planned_finished = self.date_planned_start + timedelta(days=purchase_cycle) + timedelta(
days=buffer_period)
self.state = '已排程'
return self.date_planned_finished
else:
return None
def cancel_plan(self):
self.ensure_one()
self.date_planned_finished = None
self.state = 'confirmed'
@api.model @api.model
def create(self, vals): def create(self, vals):
if 'sequence' not in vals: if 'sequence' not in vals:
vals['sequence'] = self.env['sf.pl.plan'].search_count([]) + 1 vals['sequence'] = self.env['sf.production.plan'].search_count([]) + 1
return super().create(vals) return super().create(vals)
def unlink(self): def unlink(self):
@@ -32,7 +62,7 @@ class sf_production_plan(models.Model):
# 生成编码 # 生成编码
def _get_pl_no(self): def _get_pl_no(self):
sf_pl_no = self.env['sf.pl.plan'].sudo().search( sf_pl_no = self.env['sf.production.plan'].sudo().search(
[('pl_no', '!=', '')], [('pl_no', '!=', '')],
limit=1, limit=1,
order="id desc") order="id desc")
@@ -56,32 +86,34 @@ class sf_production_plan(models.Model):
return num return num
pl_no = fields.Char(string='坯料编号', required=True, default=_get_pl_no, readonly=True) # pl_no = fields.Char(string='坯料编号', required=True, default=_get_pl_no, readonly=True)
pl_name = fields.Char(string='坯料名称', size=64, required=True) # pl_name = fields.Char(string='坯料名称', size=64, required=True)
material = fields.Many2one('sf.production.materials', string='材质', required=True) # material = fields.Many2one('sf.production.materials', string='材质', required=True)
quantity = fields.Float(string='数量', required=True) quantity = fields.Float(string='数量', required=True)
length = fields.Float(string='长度', required=True) # length = fields.Float(string='长度', required=True)
width = fields.Float(string='宽度', required=True) # width = fields.Float(string='宽度', required=True)
thickness = fields.Float(string='厚度', required=True) # thickness = fields.Float(string='厚度', required=True)
diameter = fields.Float(string='直径', required=True) # diameter = fields.Float(string='直径', required=True)
plan_start_time = fields.Datetime(string='计划开始时间') plan_start_time = fields.Datetime(string='计划开始时间')
plan_end_time = fields.Datetime(string='计划结束时间') plan_end_time = fields.Datetime(string='计划结束时间')
state = fields.Selection([ state = fields.Selection([
('draft', '产出'), ('draft', '排程'),
('produce', '产出'), ('produce', '排程'),
('done', '已产出'),
], string='状态', copy=False, index=True, default='draft') ], string='状态', copy=False, index=True, default='draft')
customer_name = fields.Char(string='客户名称', size=64) # customer_name = fields.Char(string='客户名称', size=64)
order_no = fields.Char(string='订单号', size=64) # order_no = fields.Char(string='订单号', size=64)
line_no = fields.Char(string='行号', size=64) # line_no = fields.Char(string='行号', size=64)
delivery_length = fields.Float(string='交货长度') # delivery_length = fields.Float(string='交货长度')
delivery_width = fields.Float(string='交货宽度') # delivery_width = fields.Float(string='交货宽度')
delivery_thickness = fields.Float(string='交货厚度') # delivery_thickness = fields.Float(string='交货厚度')
delivery_diameter = fields.Float(string='交货直径') # delivery_diameter = fields.Float(string='交货直径')
delivery_quantity = fields.Float(string='交货数量') # delivery_quantity = fields.Float(string='交货数量')
delivery_date = fields.Datetime(string='交货日期', related='plan_end_time', readonly=False, store=True) # delivery_date = fields.Datetime(string='交货日期', related='plan_end_time', readonly=False, store=True)
# 当不设置计划结束时间时,增加计算计划结束时间的方法,根据采购周期加缓冲期两个值来算就可以了 # 当不设置计划结束时间时,增加计算计划结束时间的方法,根据采购周期加缓冲期两个值来算就可以了
def get_plan_end_time(self): def do_production_schedule(self):
if self.production_line_id:
if self.plan_start_time and self.plan_end_time: if self.plan_start_time and self.plan_end_time:
return None return None
elif self.plan_start_time and not self.plan_end_time: elif self.plan_start_time and not self.plan_end_time:
@@ -92,6 +124,7 @@ class sf_production_plan(models.Model):
buffer_period = 1 buffer_period = 1
# 计划结束时间 = 计划开始时间 + 采购周期 + 缓冲期 # 计划结束时间 = 计划开始时间 + 采购周期 + 缓冲期
self.plan_end_time = self.plan_start_time + timedelta(days=purchase_cycle) + timedelta(days=buffer_period) self.plan_end_time = self.plan_start_time + timedelta(days=purchase_cycle) + timedelta(days=buffer_period)
self.state = 'produce'
return self.plan_end_time return self.plan_end_time
else: else:
return None return None
@@ -107,6 +140,13 @@ class sf_production_plan(models.Model):
# # 计划结束时间 = 计划开始时间(是一个datatime) + 采购周期(Float) + 缓冲期(Float) # # 计划结束时间 = 计划开始时间(是一个datatime) + 采购周期(Float) + 缓冲期(Float)
# self.plan_end_time = self.plan_start_time + timedelta(days=purchase_cycle) + timedelta(days=buffer_period) # self.plan_end_time = self.plan_start_time + timedelta(days=purchase_cycle) + timedelta(days=buffer_period)
# return self.plan_end_time # return self.plan_end_time
else:
raise ValidationError('生产线为空!')
def cancel_production_schedule(self):
self.plan_end_time = False
self.state = 'draft'
return self.plan_end_time
# # sf生产排程 # # sf生产排程
# class sf_produce_plan(models.Model): # class sf_produce_plan(models.Model):

View File

@@ -1,5 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_sf_pl_plan,sf.pl.plan,model_sf_pl_plan,base.group_user,1,1,1,1 access_sf_production_plan,sf.production.plan,model_sf_production_plan,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_pl_plan access_sf_production_plan sf.pl.plan sf.production.plan model_sf_pl_plan model_sf_production_plan base.group_user 1 1 1 1
3
4
5

View File

@@ -1,101 +1,117 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<data> <data>
<record id="sf_pl_plan_tree" model="ir.ui.view"> <record id="sf_production_plan_tree" model="ir.ui.view">
<field name="name">sf.pl.plan.tree</field> <field name="name">sf.production.plan.tree</field>
<field name="model">sf.pl.plan</field> <field name="model">sf.production.plan</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="坯料预制计划"> <tree string="订单计划">
<!-- sequence、pl_no、pl_name、quantity、plan_start_time、plan_end_time、actual_start_time、actual_end_time、state、create_uid、create_date --> <!-- 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="sequence"/>
<field name="pl_no"/> <field name="name"/>
<field name="pl_name"/>
<field name="quantity"/> <field name="quantity"/>
<field name="plan_start_time"/> <field name="plan_start_time"/>
<field name="plan_end_time"/> <field name="plan_end_time"/>
<field name="state"/> <field name="state"/>
<field name="create_uid" string="创建人"/> <button name="do_production_schedule" string="生产排程" type="object" attrs="{'invisible': [('state', 'not in', ['draft'])]}"/>
<field name="create_date" string="创建时间"/> <button name="cancel_production_schedule" string="取消排程" type="object" attrs="{'invisible': [('state', 'not in', ['produce'])]}"/>
</tree> </tree>
</field> </field>
</record> </record>
<record id="sf_pl_plan_form" model="ir.ui.view"> <record id="sf_production_plan_form" model="ir.ui.view">
<field name="name">sf.pl.plan.form</field> <field name="name">sf.production.plan.form</field>
<field name="model">sf.pl.plan</field> <field name="model">sf.production.plan</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="坯料预制计划"> <form string="订单计划">
<header> <header>
<button string="执行排程" name="get_plan_end_time" type="object" class="oe_highlight"/> <button string="执行排程" name="do_production_schedule" type="object" class="oe_highlight"/>
<field name="state" widget="statusbar" statusbar_visible="draft,produce"/> <field name="state" widget="statusbar" statusbar_visible="draft,produce"/>
</header> </header>
<sheet> <sheet>
<div class="oe_title"> <div class="oe_title">
<h1> <h1>
<field name="pl_no" readonly="1"/> <field name="name" readonly="1"/>
</h1> </h1>
</div> </div>
<group> <group>
<group string="基本信息"> <group string="基本信息">
<field name="pl_no"/> <field name="name"/>
<field name="pl_name"/>
<field name="quantity"/> <field name="quantity"/>
<field name="plan_start_time"/> <field name="plan_start_time"/>
<field name="plan_end_time"/> <field name="plan_end_time"/>
<field name="state"/> <field name="state"/>
<field name="production_line_id"/> <field name="production_line_id"/>
</group> </group>
<group string="规格信息" col="1"> <!-- <group string="规格信息" col="1"> -->
<group col="3"> <!-- <group col="3"> -->
<group> <!-- <group> -->
<field name="length"/> <!-- <field name="length"/> -->
</group> <!-- </group> -->
<group> <!-- <group> -->
<field name="width"/> <!-- <field name="width"/> -->
</group> <!-- </group> -->
<group> <!-- <group> -->
<field name="thickness"/> <!-- <field name="thickness"/> -->
</group> <!-- </group> -->
</group> <!-- </group> -->
<!-- <field name="length"/> --> <!-- <field name="length"/> -->
<!-- <field name="width"/> --> <!-- <field name="width"/> -->
<!-- <field name="thickness"/> --> <!-- <field name="thickness"/> -->
<group> <!-- <group> -->
<field name="diameter"/> <!-- <field name="diameter"/> -->
<field name="material"/> <!-- <field name="material"/> -->
</group> <!-- </group> -->
</group> <!-- </group> -->
<group string="绑定订单"> <!-- <group string="绑定订单"> -->
<field name="customer_name"/> <!-- <field name="customer_name"/> -->
<field name="order_no"/> <!-- <field name="order_no"/> -->
<field name="line_no"/> <!-- <field name="line_no"/> -->
<field name="delivery_length"/> <!-- <field name="delivery_length"/> -->
<field name="delivery_width"/> <!-- <field name="delivery_width"/> -->
<field name="delivery_thickness"/> <!-- <field name="delivery_thickness"/> -->
<field name="delivery_diameter"/> <!-- <field name="delivery_diameter"/> -->
<field name="delivery_quantity"/> <!-- <field name="delivery_quantity"/> -->
<field name="delivery_date"/> <!-- <field name="delivery_date"/> -->
</group> <!-- </group> -->
</group> </group>
</sheet> </sheet>
</form> </form>
</field> </field>
</record> </record>
<record id="sf_pl_plan_gantt" model="ir.ui.view"> <!-- 搜索视图 -->
<field name="name">sf.pl.plan.gantt</field> <record id="sf_production_plan_search" model="ir.ui.view">
<field name="model">sf.pl.plan</field> <field name="name">sf.production.plan.search</field>
<field name="model">sf.production.plan</field>
<field name="arch" type="xml">
<search string="订单计划">
<field name="name"/>
<field name="quantity"/>
<field name="plan_start_time"/>
<field name="plan_end_time"/>
<field name="state"/>
<searchpanel class="account_root">
<field name="state" icon="fa-filter"/>
</searchpanel>
</search>
</field>
</record>
<record id="sf_production_plan_gantt" model="ir.ui.view">
<field name="name">sf.production.plan.gantt</field>
<field name="model">sf.production.plan</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<gantt class="o_mrp_workorder_gantt" date_stop="plan_end_time" date_start="plan_start_time" <gantt class="o_mrp_workorder_gantt" date_stop="plan_end_time" date_start="plan_start_time"
string="制造订单生产计划" default_group_by="production_line_id" create="0" string="制造订单生产计划" default_group_by="production_line_id" create="0"
delete="0" sample="1" delete="0" sample="1"
display_unavailability="1" display_unavailability="1"
color="state" color="production_line_id"
progress_bar="pl_name" decoration-success="state == 'done'"
form_view_id="sf_pl_plan_form"> progress_bar="name"
form_view_id="sf_production_plan_form">
<field name="pl_no"/> <field name="name"/>
<field name="pl_name"/>
<field name="quantity"/> <field name="quantity"/>
<field name="plan_start_time"/> <field name="plan_start_time"/>
<field name="plan_end_time"/> <field name="plan_end_time"/>
@@ -114,21 +130,13 @@
<t t-out="userTimezoneStopDate.format('L LTS')"/> <t t-out="userTimezoneStopDate.format('L LTS')"/>
</li> </li>
<li> <li>
<strong>坯料编号:</strong> <strong>名称:</strong>
<t t-out="pl_no"/> <t t-out="name"/>
</li>
<li>
<strong>坯料名称:</strong>
<t t-out="pl_name"/>
</li> </li>
<li> <li>
<strong>数量:</strong> <strong>数量:</strong>
<t t-out="quantity"/> <t t-out="quantity"/>
</li> </li>
<li>
<strong>材质:</strong>
<t t-out="material"/>
</li>
<li> <li>
<strong>状态:</strong> <strong>状态:</strong>
<t t-out="state"/> <t t-out="state"/>
@@ -149,70 +157,70 @@
<!-- <field name="res_model">sf.pl.plan</field> --> <!-- <field name="res_model">sf.pl.plan</field> -->
<!-- <field name="view_mode">tree,form,gantt</field> --> <!-- <field name="view_mode">tree,form,gantt</field> -->
<!-- </record> --> <!-- </record> -->
<record id="sf_production_gantt_view" model="ir.ui.view"> <!-- <record id="sf_production_gantt_view" model="ir.ui.view"> -->
<field name="name">sf.production.plan.gantt</field> <!-- <field name="name">sf.production.plan.gantt</field> -->
<field name="model">mrp.production</field> <!-- <field name="model">mrp.production</field> -->
<field name="arch" type="xml"> <!-- <field name="arch" type="xml"> -->
<gantt class="o_mrp_workorder_gantt" date_stop="date_planned_finished" date_start="date_planned_start" <!-- <gantt class="o_mrp_workorder_gantt" date_stop="date_planned_finished" date_start="date_planned_start" -->
string="制造订单生产计划" default_group_by="production_line_id" create="0" <!-- string="制造订单生产计划" default_group_by="production_line_id" create="0" -->
delete="0" sample="1" plan="0" <!-- delete="0" sample="1" plan="0" -->
display_unavailability="1" <!-- display_unavailability="1" -->
decoration-success="state == 'done'" <!-- decoration-success="state == 'done'" -->
decoration-secondary="state == 'cancel'" <!-- decoration-secondary="state == 'cancel'" -->
color="production_line_id" <!-- color="production_line_id" -->
progress_bar="state" <!-- progress_bar="state" -->
form_view_id="mrp.mrp_production_form_view"> <!-- form_view_id="mrp.mrp_production_form_view"> -->
<field name="name"/> <!-- <field name="name"/> -->
<field name="product_qty"/> <!-- <field name="product_qty"/> -->
<field name="date_planned_start"/> <!-- <field name="date_planned_start"/> -->
<field name="date_planned_finished" string="计划结束时间"/> <!-- <field name="date_planned_finished" string="计划结束时间"/> -->
<field name="state"/> <!-- <field name="state"/> -->
<templates> <!-- <templates> -->
<div t-name="gantt-popover" class="container-fluid"> <!-- <div t-name="gantt-popover" class="container-fluid"> -->
<div class="row g-0"> <!-- <div class="row g-0"> -->
<div class="col"> <!-- <div class="col"> -->
<ul class="ps-1 mb-0 list-unstyled"> <!-- <ul class="ps-1 mb-0 list-unstyled"> -->
<li> <!-- <li> -->
<strong>开始时间:</strong> <!-- <strong>开始时间:</strong> -->
<t t-out="userTimezoneStartDate.format('L LTS')"/> <!-- <t t-out="userTimezoneStartDate.format('L LTS')"/> -->
</li> <!-- </li> -->
<li> <!-- <li> -->
<strong>结束时间:</strong> <!-- <strong>结束时间:</strong> -->
<t t-out="userTimezoneStopDate.format('L LTS')"/> <!-- <t t-out="userTimezoneStopDate.format('L LTS')"/> -->
</li> <!-- </li> -->
<li> <!-- <li> -->
<strong>数量:</strong> <!-- <strong>数量:</strong> -->
<t t-out="product_qty"/> <!-- <t t-out="product_qty"/> -->
</li> <!-- </li> -->
<li> <!-- <li> -->
<strong>状态:</strong> <!-- <strong>状态:</strong> -->
<t t-if="state === 'cancel'">已取消</t> <!-- <t t-if="state === 'cancel'">已取消</t> -->
<t t-elif="state === 'done'">已完成</t> <!-- <t t-elif="state === 'done'">已完成</t> -->
<t t-elif="state === '已排程'">已排程</t> <!-- <t t-elif="state === '已排程'">已排程</t> -->
<t t-else="">其他状态</t> <!-- <t t-else="">其他状态</t> -->
<!-- <t t-out="state"/> --> <!-- <t t-out="state"/> -->
</li> <!-- </li> -->
</ul> <!-- </ul> -->
</div> <!-- </div> -->
</div> <!-- </div> -->
</div> <!-- </div> -->
</templates> <!-- </templates> -->
</gantt> <!-- </gantt> -->
</field> <!-- </field> -->
</record> <!-- </record> -->
<record id="sf_pl_plan_action" model="ir.actions.act_window"> <record id="sf_production_plan_action" model="ir.actions.act_window">
<field name="name">制造订单生产计划</field> <field name="name">制造订单生产计划</field>
<field name="type">ir.actions.act_window</field> <field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.production</field> <field name="res_model">sf.production.plan</field>
<field name="view_mode">gantt,tree,form</field> <field name="view_mode">gantt,tree,form</field>
</record> </record>
<menuitem <menuitem
id="sf_pl_plan_menu" id="sf_production_plan_menu"
name="制造订单生产计划" name="制造订单生产计划"
parent="mrp_workorder.mrp_workorder_menu_planning" parent="mrp_workorder.mrp_workorder_menu_planning"
sequence="10" sequence="10"
action="sf_pl_plan_action" action="sf_production_plan_action"
/> />
</data> </data>
</odoo> </odoo>