From cf7f6002d5c05046ad252ec1cab7cac8ea0900ab Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Sat, 16 Aug 2025 16:48:28 +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 --- .../controllers/home.py | 1 + yuthon_purchase/models/__init__.py | 3 ++- yuthon_purchase/models/inherit_purchase_order.py | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 yuthon_purchase/models/inherit_purchase_order.py diff --git a/sh_backmate_theme_adv_enterprise/controllers/home.py b/sh_backmate_theme_adv_enterprise/controllers/home.py index fab4f2328..4af9a6013 100644 --- a/sh_backmate_theme_adv_enterprise/controllers/home.py +++ b/sh_backmate_theme_adv_enterprise/controllers/home.py @@ -17,6 +17,7 @@ from odoo.addons.web.controllers.home import Home as WebHome MENU_BADGE_MODEL_FUNC_ENUM = { 'base.menu_action_res_users': {'model': 'file.preview.test', 'func': 'get_menu_badge_count'}, 'yuthon_notice.yuthon_notice_menu1': {'model': 'yuthon.notice', 'func': 'get_no_read_count'}, + 'purchase.purchase_order_view_tree': {'model': 'purchase.order', 'func': 'get_no_read_count'}, 'yuthon_property.yuthon_property_rent_list': {'model': 'property.rent.list', 'func': 'get_no_read_count'}, 'yuthon_property.yuthon_property_management_list': {'model': 'property.management.list', 'func': 'get_no_read_count'}, 'yuthon_property.yuthon_property_tariff_list': {'model': 'property.tariff.list', 'func': 'get_no_read_count'}, diff --git a/yuthon_purchase/models/__init__.py b/yuthon_purchase/models/__init__.py index 28bd0f1b4..8ba4ff994 100644 --- a/yuthon_purchase/models/__init__.py +++ b/yuthon_purchase/models/__init__.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- from . import purchase_fixed_assets from . import purchase_low_orders -from . import purchase_service_orders \ No newline at end of file +from . import purchase_service_orders +from . import inherit_purchase_order \ No newline at end of file diff --git a/yuthon_purchase/models/inherit_purchase_order.py b/yuthon_purchase/models/inherit_purchase_order.py new file mode 100644 index 000000000..c2b513f7d --- /dev/null +++ b/yuthon_purchase/models/inherit_purchase_order.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- +from odoo import api, fields, models + + +class InheritPurchaseOrder(models.Model): + _inherit = 'purchase.order' + + def get_no_read_count(self): + domain = [ + ('company_id', '=', self.env.user.company_id.id), + ] + return self.search_count(domain) +