From 833bd987a114c11a08ff71a0e6f3fd3f0165762f Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Fri, 8 Aug 2025 16:07:18 +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 --- yuthon_purchase/__manifest__.py | 6 +- yuthon_purchase/models/__init__.py | 2 +- .../models/inherit_purchase_order.py | 43 --- .../models/purchase_fixed_assets.py | 59 ++++ yuthon_purchase/models/purchase_low_orders.py | 26 +- .../models/purchase_service_orders.py | 26 +- yuthon_purchase/security/ir.model.access.csv | 7 + .../views/inherit_purchase_order_views.xml | 263 ------------------ .../views/purchase_fixed_assets_views.xml | 96 +++++++ .../views/purchase_low_orders_views.xml | 31 +-- .../views/purchase_service_orders_views.xml | 29 +- yuthon_work_brand/views/purchase_menus.xml | 27 +- 12 files changed, 234 insertions(+), 381 deletions(-) delete mode 100644 yuthon_purchase/models/inherit_purchase_order.py create mode 100644 yuthon_purchase/models/purchase_fixed_assets.py delete mode 100644 yuthon_purchase/views/inherit_purchase_order_views.xml create mode 100644 yuthon_purchase/views/purchase_fixed_assets_views.xml diff --git a/yuthon_purchase/__manifest__.py b/yuthon_purchase/__manifest__.py index ff335f5d2..6f868e07d 100644 --- a/yuthon_purchase/__manifest__.py +++ b/yuthon_purchase/__manifest__.py @@ -10,9 +10,9 @@ 'data': [ 'security/ir.model.access.csv', 'data/purchase_data.xml', - 'views/inherit_purchase_order_views.xml', - # 'views/purchase_low_orders_views.xml', - # 'views/purchase_service_orders_views.xml', + 'views/purchase_fixed_assets_views.xml', + 'views/purchase_low_orders_views.xml', + 'views/purchase_service_orders_views.xml', 'views/menu.xml', ], 'installable': True, diff --git a/yuthon_purchase/models/__init__.py b/yuthon_purchase/models/__init__.py index 9311d5a07..28bd0f1b4 100644 --- a/yuthon_purchase/models/__init__.py +++ b/yuthon_purchase/models/__init__.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- -from . import inherit_purchase_order +from . import purchase_fixed_assets from . import purchase_low_orders from . import purchase_service_orders \ No newline at end of file diff --git a/yuthon_purchase/models/inherit_purchase_order.py b/yuthon_purchase/models/inherit_purchase_order.py deleted file mode 100644 index 5d42be6d5..000000000 --- a/yuthon_purchase/models/inherit_purchase_order.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- -from odoo import api, fields, models - - -class PurchaseOrder(models.Model): - _name = 'purchase.order' - _inherit = ['purchase.order', 'soong.workflow.mixin'] - _description = '采购订单' - - purchase_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="部门") - date_order = fields.Datetime(string="订单日期") - date_planned = fields.Datetime(string="预计到货日期") - start_date = fields.Date(string="申请日期", default=fields.Date.today) - 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) - pay_way = fields.Selection([('onetime', '一次性'), ('installment', '分期')], string='付款方式', default='onetime') - # purchase_order_models_ids = fields.One2many('purchase.order.pay.line', 'purchase_id', string="付款详情") - work_end = fields.Boolean(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" -# _description = "付款详情" -# -# purchase_id = fields.Many2one('purchase.order', string="关联采购单") -# low_id = fields.Many2one('purchase.low.orders', string="关联低值易耗采购单") -# service_id = fields.Many2one('purchase.service.orders', string="关联服务采购单") -# payment_stage = fields.Char(string="付款阶段") -# amount = fields.Char(string="比例/金额") -# payment_date = fields.Date(string="付款日期") -# remake = fields.Char(string="条件") \ No newline at end of file diff --git a/yuthon_purchase/models/purchase_fixed_assets.py b/yuthon_purchase/models/purchase_fixed_assets.py new file mode 100644 index 000000000..f94071a4f --- /dev/null +++ b/yuthon_purchase/models/purchase_fixed_assets.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +from odoo import api, fields, models + + +class PurchaseFixedAssets(models.Model): + _name = 'purchase.fixed.assets' + _description = '固定资产采购单' + _inherit = ['soong.workflow.mixin'] + + purchase_code = fields.Char(string="流水号", + default=lambda self: self.env['ir.sequence'].next_by_code('purchase_order_sequence_code')) + name = fields.Char(string="名称") + 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="部门") + partner_id = fields.Many2one('res.partner', string="供应商") + date_order = fields.Datetime(string="订单日期") + date_planned = fields.Datetime(string="预计到货日期") + start_date = fields.Date(string="申请日期", default=fields.Date.today) + 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) + pay_way = fields.Selection([('onetime', '一次性'), ('installment', '分期')], string='付款方式', default='onetime') + purchase_order_models_ids = fields.One2many('purchase.order.pay.line', 'purchase_id', string="付款详情") + fixed_ids = fields.One2many('purchase.fixed.line', 'purchase_id', string="采购明细") + work_end = fields.Boolean(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" + _description = "付款详情" + + purchase_id = fields.Many2one('purchase.fixed.assets', string="关联采购单") + low_id = fields.Many2one('purchase.low.orders', string="关联低值易耗采购单") + service_id = fields.Many2one('purchase.service.orders', string="关联服务采购单") + payment_stage = fields.Char(string="付款阶段") + amount = fields.Char(string="比例/金额") + payment_date = fields.Date(string="付款日期") + remake = fields.Char(string="条件") + + +class PurchaseFixedLine(models.Model): + _name = 'purchase.fixed.line' + _description = '固定资产采购单明细' + + purchase_id = fields.Many2one('purchase.fixed.assets', string="关联采购单") + name = fields.Char(string="物品名称") + brand = fields.Char(string="品牌") + specs = fields.Char(string="规格") + number = fields.Integer(string="数量") + unit = fields.Char(string="单位") + price = fields.Float(string="单价") \ No newline at end of file diff --git a/yuthon_purchase/models/purchase_low_orders.py b/yuthon_purchase/models/purchase_low_orders.py index f8a8465cb..28aeebb82 100644 --- a/yuthon_purchase/models/purchase_low_orders.py +++ b/yuthon_purchase/models/purchase_low_orders.py @@ -22,8 +22,8 @@ class PurchaseLowOrders(models.Model): default='normal') work_end = fields.Boolean(string="结束") active = fields.Boolean('Active', default=True, tracking=True) - # low_line_ids = fields.One2many('purchase.low.line', 'purchase_id', string="采购明细") - # purchase_ids = fields.One2many('purchase.order.pay.line', 'low_id', string="采购单") + low_line_ids = fields.One2many('purchase.low.line', 'purchase_id', string="采购明细") + purchase_ids = fields.One2many('purchase.order.pay.line', 'low_id', string="采购单") def _get_default_name_title(self): return self._description if self._description else self._name @@ -31,17 +31,17 @@ class PurchaseLowOrders(models.Model): name_title = fields.Char(default=_get_default_name_title) -# class PurchaseLowLine(models.Model): -# _name = 'purchase.low.line' -# _description = '低值易耗采购单明细' -# -# purchase_id = fields.Many2one('purchase.low.orders', string="关联采购单") -# name = fields.Char(string="物品名称") -# brand = fields.Char(string="品牌") -# specs = fields.Char(string="规格") -# number = fields.Integer(string="数量") -# unit = fields.Char(string="单位") -# price = fields.Float(string="单价") +class PurchaseLowLine(models.Model): + _name = 'purchase.low.line' + _description = '低值易耗采购单明细' + + purchase_id = fields.Many2one('purchase.low.orders', string="关联采购单") + name = fields.Char(string="物品名称") + brand = fields.Char(string="品牌") + specs = fields.Char(string="规格") + number = fields.Integer(string="数量") + unit = fields.Char(string="单位") + price = fields.Float(string="单价") diff --git a/yuthon_purchase/models/purchase_service_orders.py b/yuthon_purchase/models/purchase_service_orders.py index 76da10af0..82c6ab052 100644 --- a/yuthon_purchase/models/purchase_service_orders.py +++ b/yuthon_purchase/models/purchase_service_orders.py @@ -29,8 +29,8 @@ class PurchaseServiceOrders(models.Model): default='normal') work_end = fields.Boolean(string="结束") active = fields.Boolean('Active', default=True, tracking=True) - # service_line_ids = fields.One2many('purchase.service.line', 'service_id', string="采购明细") - # purchase_ids = fields.One2many('purchase.order.pay.line', 'service_id', string="采购单") + service_line_ids = fields.One2many('purchase.service.line', 'service_id', string="采购明细") + purchase_ids = fields.One2many('purchase.order.pay.line', 'service_id', string="采购单") def _get_default_name_title(self): return self._description if self._description else self._name @@ -38,17 +38,17 @@ class PurchaseServiceOrders(models.Model): name_title = fields.Char(default=_get_default_name_title) -# class PurchaseServiceLine(models.Model): -# _name = 'purchase.service.line' -# _description = '服务采购单明细' -# -# service_id = fields.Many2one('purchase.service.orders', string="关联采购单") -# name = fields.Char(string="服务项目") -# frequency = fields.Char(string='频次') -# fee = fields.Float(string="费用") -# unit = fields.Char(string="单位") -# partyB = fields.Many2one('res.partner', string="供应商") -# price = fields.Float(string="单价") +class PurchaseServiceLine(models.Model): + _name = 'purchase.service.line' + _description = '服务采购单明细' + + service_id = fields.Many2one('purchase.service.orders', string="关联采购单") + name = fields.Char(string="服务项目") + frequency = fields.Char(string='频次') + fee = fields.Float(string="费用") + unit = fields.Char(string="单位") + partyB = fields.Many2one('res.partner', string="供应商") + price = fields.Float(string="单价") diff --git a/yuthon_purchase/security/ir.model.access.csv b/yuthon_purchase/security/ir.model.access.csv index 97dd8b917..f301afc11 100644 --- a/yuthon_purchase/security/ir.model.access.csv +++ b/yuthon_purchase/security/ir.model.access.csv @@ -1 +1,8 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_purchase_fixed_assets,purchase_fixed_assets,model_purchase_fixed_assets,,1,1,1,1 +access_purchase_fixed_line, purchase_fixed_line,model_purchase_fixed_line,,1,1,1,1 +access_purchase_order_pay_line,purchase_order_pay_line,model_purchase_order_pay_line,,1,1,1,1 +access_purchase_low_orders, purchase_low_orders,model_purchase_low_orders,,1,1,1,1 +access_purchase_service_orders, purchase_service_orders,model_purchase_service_orders,,1,1,1,1 +access_purchase_low_line, purchase_low_line,model_purchase_low_line,,1,1,1,1 +access_purchase_service_line, purchase_service_line,model_purchase_service_line,,1,1,1,1 \ No newline at end of file diff --git a/yuthon_purchase/views/inherit_purchase_order_views.xml b/yuthon_purchase/views/inherit_purchase_order_views.xml deleted file mode 100644 index 6853cc66e..000000000 --- a/yuthon_purchase/views/inherit_purchase_order_views.xml +++ /dev/null @@ -1,263 +0,0 @@ - - - - purchase.order.form.inherit - purchase.order - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/yuthon_purchase/views/purchase_fixed_assets_views.xml b/yuthon_purchase/views/purchase_fixed_assets_views.xml new file mode 100644 index 000000000..d61a84fa5 --- /dev/null +++ b/yuthon_purchase/views/purchase_fixed_assets_views.xml @@ -0,0 +1,96 @@ + + + + purchase.fixed.assets.tree + purchase.fixed.assets + + + + + + + + + purchase.fixed.assets.form + purchase.fixed.assets + +
+ + + + + + + + + + + + + +
+

+ +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + 固定资产采购单 + purchase.fixed.assets + tree,form + +
diff --git a/yuthon_purchase/views/purchase_low_orders_views.xml b/yuthon_purchase/views/purchase_low_orders_views.xml index 0c9eb0565..3e2f61c99 100644 --- a/yuthon_purchase/views/purchase_low_orders_views.xml +++ b/yuthon_purchase/views/purchase_low_orders_views.xml @@ -57,19 +57,6 @@ - - - - - - - - - - - - - @@ -79,6 +66,19 @@ + + + + + + + + + + + + + @@ -92,11 +92,6 @@ -
- - - -
diff --git a/yuthon_purchase/views/purchase_service_orders_views.xml b/yuthon_purchase/views/purchase_service_orders_views.xml index 8a4a994e0..131294abd 100644 --- a/yuthon_purchase/views/purchase_service_orders_views.xml +++ b/yuthon_purchase/views/purchase_service_orders_views.xml @@ -77,17 +77,6 @@ - - - - - - - - - - - @@ -98,6 +87,19 @@ + + + + + + + + + + + + + @@ -111,11 +113,6 @@ -
- - - -
diff --git a/yuthon_work_brand/views/purchase_menus.xml b/yuthon_work_brand/views/purchase_menus.xml index 5dea712c3..a75f2bcf5 100644 --- a/yuthon_work_brand/views/purchase_menus.xml +++ b/yuthon_work_brand/views/purchase_menus.xml @@ -13,21 +13,26 @@ parent="purchase_menus_order_root" action="purchase.purchase_rfq" sequence="1"/> - - - - - - - - - - - + + +