计划模块后端优化
This commit is contained in:
@@ -19,7 +19,7 @@ class sf_production_plan(models.Model):
|
|||||||
('done', '已排程'),
|
('done', '已排程'),
|
||||||
('processing', '加工中'),
|
('processing', '加工中'),
|
||||||
('finished', '已完成')
|
('finished', '已完成')
|
||||||
], string='工单状态', tracking=True)
|
], string='状态', tracking=True)
|
||||||
|
|
||||||
state_order = fields.Integer(compute='_compute_state_order', store=True)
|
state_order = fields.Integer(compute='_compute_state_order', store=True)
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ class sf_production_plan(models.Model):
|
|||||||
|
|
||||||
_order = 'state_order asc, write_date desc'
|
_order = 'state_order asc, write_date desc'
|
||||||
|
|
||||||
name = fields.Char(string='工单编号')
|
name = fields.Char(string='制造订单')
|
||||||
active = fields.Boolean(string='已归档', default=True)
|
active = fields.Boolean(string='已归档', default=True)
|
||||||
# selected = fields.Boolean(default=False)
|
# selected = fields.Boolean(default=False)
|
||||||
# order_number = fields.Char(string='订单号')
|
# order_number = fields.Char(string='订单号')
|
||||||
@@ -52,7 +52,7 @@ class sf_production_plan(models.Model):
|
|||||||
schedule_setting = fields.Selection([
|
schedule_setting = fields.Selection([
|
||||||
('reverse', '倒排'), ('positive', '顺排')], string='排程设置', default='reverse')
|
('reverse', '倒排'), ('positive', '顺排')], string='排程设置', default='reverse')
|
||||||
product_id = fields.Many2one('product.product', '关联产品')
|
product_id = fields.Many2one('product.product', '关联产品')
|
||||||
origin = fields.Char(string='订单号')
|
origin = fields.Char(string='销售订单')
|
||||||
# # 加工时长
|
# # 加工时长
|
||||||
# process_time = fields.Float(string='加工时长', digits=(16, 2))
|
# process_time = fields.Float(string='加工时长', digits=(16, 2))
|
||||||
# 实际加工时长、实际开始时间、实际结束时间
|
# 实际加工时长、实际开始时间、实际结束时间
|
||||||
|
|||||||
@@ -17,18 +17,18 @@
|
|||||||
decoration-danger="state == 'finished'"/>
|
decoration-danger="state == 'finished'"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="origin"/>
|
<field name="origin"/>
|
||||||
<field name="order_deadline"/>
|
<field name="order_deadline" widget="date"/>
|
||||||
<field name="product_qty"/>
|
<field name="product_qty"/>
|
||||||
<field name="production_line_id"/>
|
<field name="production_line_id"/>
|
||||||
<field name="date_planned_start"/>
|
<field name="date_planned_start"/>
|
||||||
<field name="date_planned_finished"/>
|
<field name="date_planned_finished"/>
|
||||||
<field name="actual_start_time"/>
|
<field name="actual_start_time" optional='hide'/>
|
||||||
<field name="actual_end_time"/>
|
<field name="actual_end_time" optional='hide'/>
|
||||||
<field name="actual_process_time"/>
|
<field name="actual_process_time" optional='hide'/>
|
||||||
<field name="schedule_setting"/>
|
<field name="schedule_setting" optional='hide'/>
|
||||||
<button name="do_production_schedule" class="btn schedule_done" string="生产排程" type="object"
|
<!-- <button name="do_production_schedule" class="btn schedule_done" string="生产排程" type="object" -->
|
||||||
attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('actual_start_time', '!=', False)]}"
|
<!-- attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('actual_start_time', '!=', False)]}" -->
|
||||||
groups="sf_base.group_plan_dispatch"/>
|
<!-- groups="sf_base.group_plan_dispatch"/> -->
|
||||||
<button name="cancel_production_schedule" class="btn schedule_cancel" string="取消排程" type="object"
|
<button name="cancel_production_schedule" class="btn schedule_cancel" string="取消排程" type="object"
|
||||||
attrs="{'invisible': ['|', ('state', '!=', 'done'), ('actual_start_time', '!=', False)]}"
|
attrs="{'invisible': ['|', ('state', '!=', 'done'), ('actual_start_time', '!=', False)]}"
|
||||||
groups="sf_base.group_plan_dispatch"/>
|
groups="sf_base.group_plan_dispatch"/>
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
<field name="product_id"/>
|
<field name="product_id"/>
|
||||||
<field name="origin"/>
|
<field name="origin"/>
|
||||||
<field name="product_qty"/>
|
<field name="product_qty"/>
|
||||||
<field name="order_deadline"/>
|
<field name="order_deadline" widget="date"/>
|
||||||
<!-- <field name="process_time"/> -->
|
<!-- <field name="process_time"/> -->
|
||||||
<field name="schedule_setting"/>
|
<field name="schedule_setting"/>
|
||||||
<field name="production_line_id" domain="[('name', 'ilike', 'CNC')]"/>
|
<field name="production_line_id" domain="[('name', 'ilike', 'CNC')]"/>
|
||||||
@@ -152,16 +152,27 @@
|
|||||||
<field name="model">sf.production.plan</field>
|
<field name="model">sf.production.plan</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<search string="订单计划">
|
<search string="订单计划">
|
||||||
|
|
||||||
<!-- Your other filters go here -->
|
<!-- Your other filters go here -->
|
||||||
<filter name="archived" string="已归档" domain="[('active','=',False)]"/>
|
<!-- <filter name="archived" string="已归档" domain="[('active','=',False)]"/> -->
|
||||||
<filter name="not archived" string="未归档" domain="[('active','=',True)]"/>
|
<!-- <filter name="not archived" string="未归档" domain="[('active','=',True)]"/> -->
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="product_qty"/>
|
<field name="product_qty"/>
|
||||||
<field name="date_planned_start"/>
|
|
||||||
<field name="date_planned_finished"/>
|
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<searchpanel class="account_root">
|
<filter string="待排程" name="draft" domain="[('state','=','draft')]"/>
|
||||||
<field name="state" icon="fa-filter"/>
|
<filter string="已排程" name="done" domain="[('state','=','done')]"/>
|
||||||
|
<filter string="加工中" name="processing" domain="[('state','=','processing')]"/>
|
||||||
|
<filter string="已完成" name="finished" domain="[('state','=','finished')]"/>
|
||||||
|
<group expand="0" string="Group By">
|
||||||
|
<filter name="group_by_state" string="状态" domain="[]" context="{'group_by': 'state'}"/>
|
||||||
|
</group>
|
||||||
|
<group expand="0" string="Group By">
|
||||||
|
<filter name="group_by_production_line_id" string="生产线" domain="[]" context="{'group_by': 'production_line_id'}"/>
|
||||||
|
</group>
|
||||||
|
<searchpanel>
|
||||||
|
<!-- <field name="state" icon="fa-filter"/> -->
|
||||||
|
<field name="production_line_id" select="multi" string="生产线" icon="fa-building" enable_counters="1"/>
|
||||||
|
<field name="state" select="multi" string="状态" icon="fa-building" enable_counters="1"/>
|
||||||
</searchpanel>
|
</searchpanel>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
@@ -188,30 +199,41 @@
|
|||||||
<field name="date_planned_start"/>
|
<field name="date_planned_start"/>
|
||||||
<field name="date_planned_finished"/>
|
<field name="date_planned_finished"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
|
<field name="origin"/>
|
||||||
|
<field name="order_deadline"/>
|
||||||
|
<field name="product_id"/>
|
||||||
<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="origin"/>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<strong>结束时间:</strong>
|
<strong>制造订单号:</strong>
|
||||||
<t t-out="userTimezoneStopDate.format('L LTS')"/>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<strong>名称:</strong>
|
|
||||||
<t t-out="name"/>
|
<t t-out="name"/>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<strong>订单交期:</strong>
|
||||||
|
<t t-out="order_deadline"/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<strong>产品名称:</strong>
|
||||||
|
<t t-out="product_id"/>
|
||||||
|
</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-out="state"/>
|
<t t-out="userTimezoneStartDate.format('L LTS')"/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<strong>计划结束时间:</strong>
|
||||||
|
<t t-out="userTimezoneStopDate.format('L LTS')"/>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -246,6 +268,7 @@
|
|||||||
<field name="type">ir.actions.act_window</field>
|
<field name="type">ir.actions.act_window</field>
|
||||||
<field name="res_model">sf.production.plan</field>
|
<field name="res_model">sf.production.plan</field>
|
||||||
<field name="view_mode">tree,gantt,form</field>
|
<field name="view_mode">tree,gantt,form</field>
|
||||||
|
<field name="context">{'search_default_group_by_state': 1, 'search_default_draft': 1, 'display_complete': True}</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
|
|||||||
Reference in New Issue
Block a user