From f77691251ebb524d1c674b0e359b71b840334d30 Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Thu, 23 Nov 2023 10:21:42 +0800
Subject: [PATCH] =?UTF-8?q?=E8=AE=A1=E5=88=92=E6=A8=A1=E5=9D=97=E5=A2=9E?=
=?UTF-8?q?=E5=8A=A0=E8=B7=9F=E8=B8=AA=E6=B6=88=E6=81=AF=E7=BB=84=E4=BB=B6?=
=?UTF-8?q?=EF=BC=8Cform=E8=A7=86=E5=9B=BE=E5=A2=9E=E5=8A=A0=E5=BD=92?=
=?UTF-8?q?=E6=A1=A3=E5=8F=96=E6=B6=88=E5=BD=92=E6=A1=A3=E6=8C=89=E9=92=AE?=
=?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=BD=92=E6=A1=A3=E6=9C=AA=E5=BD=92?=
=?UTF-8?q?=E6=A1=A3=E7=9A=84=E7=AD=9B=E9=80=89=E9=A1=B9=E7=9B=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_plan/models/custom_plan.py | 22 ++++++++++++++++++++++
sf_plan/views/view.xml | 21 ++++++++++++++++++---
2 files changed, 40 insertions(+), 3 deletions(-)
diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py
index 5fba575f..075c7e21 100644
--- a/sf_plan/models/custom_plan.py
+++ b/sf_plan/models/custom_plan.py
@@ -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"""
diff --git a/sf_plan/views/view.xml b/sf_plan/views/view.xml
index c2faf029..ee3d441d 100644
--- a/sf_plan/views/view.xml
+++ b/sf_plan/views/view.xml
@@ -6,9 +6,6 @@
sf.production.plan
-
-
-
@@ -33,6 +30,9 @@
+
+
+
@@ -45,6 +45,7 @@
+
@@ -60,6 +61,17 @@
+
+
+
+
+
+
+
+
+
+
+
@@ -104,6 +116,9 @@
sf.production.plan
+
+
+