计划模块增加跟踪消息组件,form视图增加归档取消归档按钮,增加归档未归档的筛选项目

This commit is contained in:
mgw
2023-11-23 10:21:42 +08:00
parent 6fed64ba2a
commit f77691251e
2 changed files with 40 additions and 3 deletions

View File

@@ -11,6 +11,7 @@ from odoo.exceptions import UserError, ValidationError
class sf_production_plan(models.Model):
_name = 'sf.production.plan'
_description = 'sf_production_plan'
_inherit = ['mail.thread']
_order = 'create_date desc'
state = fields.Selection([
@@ -20,6 +21,7 @@ class sf_production_plan(models.Model):
('finished', '已完成')
], string='工单状态', tracking=True)
name = fields.Char(string='工单编号')
active = fields.Boolean(string='已归档', default=True)
# selected = fields.Boolean(default=False)
# order_number = fields.Char(string='订单号')
order_deadline = fields.Datetime(string='订单交期')
@@ -49,6 +51,26 @@ class sf_production_plan(models.Model):
sequence = fields.Integer(string='序号', copy=False, readonly=True, index=True)
current_operation_name = fields.Char(string='当前工序名称', size=64, default='生产计划')
# @api.model
# def _search(self, args, offset=0, limit=None, order=None, count=False, access_rights_uid=None):
# """
# 默认修改筛选
# """
# return super(sf_production_plan, self.with_context(active_test=False))._search(
# args, offset, limit, order, count, access_rights_uid)
def archive(self):
"""
归档
"""
self.write({'active': False})
def unarchive(self):
"""
取消归档
"""
self.write({'active': True})
@api.model
def get_import_templates(self):
"""returns the xlsx import template file"""

View File

@@ -6,9 +6,6 @@
<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="state" widget="badge" decoration-warning="state == 'draft'" decoration-success="state == 'done'"/>
<field name="name"/>
<field name="origin"/>
@@ -33,6 +30,9 @@
<!-- <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" options='{"calendar_view": true, "date_begin": "2020-01-01", "date_end": "2020-12-31"}' groups="sf_base.group_plan_dispatch"/>
<button string="取消排程" name="cancel_production_schedule" type="object" class="oe_highlight" groups="sf_base.group_plan_dispatch"/>
<button name="archive" type="object" string="归档" icon="fa-archive" class="oe_highlight" attrs="{'invisible': [('active', '=', False)]}"/>
<button name="unarchive" type="object" string="取消归档" icon="fa-archive" class="oe_highlight" attrs="{'invisible': [('active', '=', True)]}"/>
<!-- <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,done,processing,finished"/>
@@ -45,6 +45,7 @@
</div>
<group>
<group string="基本信息">
<field name="active" invisible="1"/>
<field name="production_id" widget="many2one_button"/>
<field name="product_id"/>
<field name="origin"/>
@@ -60,6 +61,17 @@
<field name="actual_end_time"/>
<field name="state"/>
<field name="shift" widget="time"/>
<!-- Chatter -->
<!-- <div class="oe_chatter"> -->
<!-- <field name="message_follower_ids" widget="mail_followers"/> -->
<!-- <field name="message_ids" widget="mail_thread"/> -->
<!-- <field name="activity_ids"/> -->
<!-- </div> -->
<div class="oe_chatter">
<field name="message_follower_ids"/>
<field name="message_ids"/>
</div>
</group>
<!-- <group string="规格信息" col="1"> -->
<!-- <group col="3"> -->
@@ -104,6 +116,9 @@
<field name="model">sf.production.plan</field>
<field name="arch" type="xml">
<search string="订单计划">
<!-- Your other filters go here -->
<filter name="archived" string="已归档" domain="[('active','=',False)]"/>
<filter name="not archived" string="未归档" domain="[('active','=',True)]"/>
<field name="name"/>
<field name="product_qty"/>
<field name="date_planned_start"/>