From 16f5ff1ab893d98fdf092fb9e838de850369051e Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Wed, 4 Jun 2025 17:20:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../models/inherit_res_groups.py | 3 + .../views/inherit_res_groups_views.xml | 1 + yuthon_notice/views/yuthon_notice_views.xml | 1 + yuthon_purchase/data/purchase_data.xml | 8 + .../models/inherit_purchase_order.py | 12 +- yuthon_purchase/models/purchase_low_orders.py | 2 +- .../models/purchase_service_orders.py | 2 +- .../views/inherit_purchase_order_views.xml | 272 ++++++++++++++++-- .../views/purchase_low_orders_views.xml | 5 + .../views/purchase_service_orders_views.xml | 5 + 10 files changed, 281 insertions(+), 30 deletions(-) diff --git a/yuthon_hr_employee/models/inherit_res_groups.py b/yuthon_hr_employee/models/inherit_res_groups.py index 82f87872d..6a2719c04 100644 --- a/yuthon_hr_employee/models/inherit_res_groups.py +++ b/yuthon_hr_employee/models/inherit_res_groups.py @@ -17,6 +17,9 @@ class ResGroups(models.Model): users_to_unlink2 = self.users.filtered(lambda user: user.name != '叶华峰') self.write({'users': [(3, user.id) for user in users_to_unlink]}) self.write({'users': [(3, user.id) for user in users_to_unlink2]}) + + + def domain_unlink(self): self.write({'users_ids': [(5, 0, 0)]}) self.write({'employee_ids': [(5, 0, 0)]}) self.write({'department_ids': [(5, 0, 0)]}) diff --git a/yuthon_hr_employee/views/inherit_res_groups_views.xml b/yuthon_hr_employee/views/inherit_res_groups_views.xml index 679631c1a..ee7e52a3a 100644 --- a/yuthon_hr_employee/views/inherit_res_groups_views.xml +++ b/yuthon_hr_employee/views/inherit_res_groups_views.xml @@ -11,6 +11,7 @@
diff --git a/yuthon_notice/views/yuthon_notice_views.xml b/yuthon_notice/views/yuthon_notice_views.xml index e7d09b342..bf7fbc9a7 100644 --- a/yuthon_notice/views/yuthon_notice_views.xml +++ b/yuthon_notice/views/yuthon_notice_views.xml @@ -62,6 +62,7 @@ + diff --git a/yuthon_purchase/data/purchase_data.xml b/yuthon_purchase/data/purchase_data.xml index 277fcbfcd..44543f675 100644 --- a/yuthon_purchase/data/purchase_data.xml +++ b/yuthon_purchase/data/purchase_data.xml @@ -8,6 +8,14 @@ + + 采购订单编号 + purchase_order_sequence_code + CG%(y)s%(month)s%(day)s + 3 + + + 服务采购单编号 purchase_service_orders_code diff --git a/yuthon_purchase/models/inherit_purchase_order.py b/yuthon_purchase/models/inherit_purchase_order.py index c0990f1c6..da9bf322b 100644 --- a/yuthon_purchase/models/inherit_purchase_order.py +++ b/yuthon_purchase/models/inherit_purchase_order.py @@ -5,16 +5,26 @@ from odoo import api, fields, models class PurchaseOrder(models.Model): _name = 'purchase.order' _inherit = ['purchase.order', 'soong.workflow.mixin'] + _description = '采购订单' + code = fields.Char(string="流水号", + default=lambda self: self.env['ir.sequence'].next_by_code('purchase_order_sequence_code')) company_id = fields.Many2one('res.company', string="公司", default=lambda self: self.env.company) user_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user) department_id = fields.Many2one(related='user_id.employee_id.department_id', string="部门") start_date = fields.Date(string="申请日期", default=fields.Date.today) - code = fields.Char(string="合同编号") reason_text = fields.Text(string='申请事由') document_ids = fields.Many2many('ir.attachment', string="附件") + urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度', + default='normal') + active = fields.Boolean('Active', default=True, tracking=True) purchase_order_models_ids = fields.One2many('purchase.order.pay.line', 'purchase_id', string="付款详情") + def _get_default_name_title(self): + return self._description if self._description else self._name + + name_title = fields.Char(default=_get_default_name_title, string="标题") + class PurchaseOrderPayLine(models.Model): _name = "purchase.order.pay.line" diff --git a/yuthon_purchase/models/purchase_low_orders.py b/yuthon_purchase/models/purchase_low_orders.py index 28aeebb82..77bf1ea2c 100644 --- a/yuthon_purchase/models/purchase_low_orders.py +++ b/yuthon_purchase/models/purchase_low_orders.py @@ -5,7 +5,7 @@ from odoo import api, fields, models class PurchaseLowOrders(models.Model): _name = 'purchase.low.orders' _description = '低值易耗采购单' - _inherit = ['soong.workflow.mixin'] + _inherit = ['soong.workflow.mixin', 'mail.thread', 'mail.activity.mixin'] name = fields.Char(string="标题") code = fields.Char(string="合同编号", default=lambda self: self.env['ir.sequence'].next_by_code('purchase_low_orders_code')) diff --git a/yuthon_purchase/models/purchase_service_orders.py b/yuthon_purchase/models/purchase_service_orders.py index 89205d89d..b265269ad 100644 --- a/yuthon_purchase/models/purchase_service_orders.py +++ b/yuthon_purchase/models/purchase_service_orders.py @@ -5,7 +5,7 @@ from odoo import api, fields, models class PurchaseServiceOrders(models.Model): _name = 'purchase.service.orders' _description = '服务采购单' - _inherit = ['soong.workflow.mixin'] + _inherit = ['soong.workflow.mixin', 'mail.thread', 'mail.activity.mixin'] name = fields.Char(string="标题") code = fields.Char(string="合同编号", default=lambda self: self.env['ir.sequence'].next_by_code('purchase_service_orders_code')) diff --git a/yuthon_purchase/views/inherit_purchase_order_views.xml b/yuthon_purchase/views/inherit_purchase_order_views.xml index 7fb959295..ac06cebd6 100644 --- a/yuthon_purchase/views/inherit_purchase_order_views.xml +++ b/yuthon_purchase/views/inherit_purchase_order_views.xml @@ -5,33 +5,251 @@ purchase.order - - - - - - - - - - - 1 - - - 1 - - - - - - - - - - - - - + +
+ + + + + + + + + + + + + +
+

+ +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +