From ae143371ccb3b3f6d3fcbb4efb502afe53acbdc6 Mon Sep 17 00:00:00 2001 From: mekot-odoo Date: Thu, 12 Feb 2026 10:27:26 +0530 Subject: [PATCH 1/4] [IMP] purchase: add global discount support on RFQ lines This commit introduces a global discount mechanism that allows users to apply a percentage or fixed amount discount across all RFQ lines in a single action, improving usability and efficiency. --- purchase_discount/__init__.py | 2 ++ purchase_discount/__manifest__.py | 16 ++++++++++ purchase_discount/models/__init__.py | 1 + purchase_discount/models/purchase_order.py | 15 ++++++++++ .../security/ir.model.access.csv | 2 ++ .../views/purchase_order_view.xml | 21 ++++++++++++++ purchase_discount/wizard/__init__.py | 1 + .../wizard/purchase_order_discount.py | 29 +++++++++++++++++++ .../wizard/purchase_order_discount.xml | 26 +++++++++++++++++ 9 files changed, 113 insertions(+) create mode 100644 purchase_discount/__init__.py create mode 100644 purchase_discount/__manifest__.py create mode 100644 purchase_discount/models/__init__.py create mode 100644 purchase_discount/models/purchase_order.py create mode 100644 purchase_discount/security/ir.model.access.csv create mode 100644 purchase_discount/views/purchase_order_view.xml create mode 100644 purchase_discount/wizard/__init__.py create mode 100644 purchase_discount/wizard/purchase_order_discount.py create mode 100644 purchase_discount/wizard/purchase_order_discount.xml diff --git a/purchase_discount/__init__.py b/purchase_discount/__init__.py new file mode 100644 index 00000000000..9b4296142f4 --- /dev/null +++ b/purchase_discount/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizard diff --git a/purchase_discount/__manifest__.py b/purchase_discount/__manifest__.py new file mode 100644 index 00000000000..48eb7689372 --- /dev/null +++ b/purchase_discount/__manifest__.py @@ -0,0 +1,16 @@ +{ + "name": "purchase discount", + "version": "1.0.0", + "depends": ["base", "purchase"], + "author": "Mehul Kotak", + "category": "Task-1", + "description": "This perfrom global discount in purchase", + "license": "LGPL-3", + "application": True, + "installable": True, + "data": [ + "security/ir.model.access.csv", + "views/purchase_order_view.xml", + "wizard/purchase_order_discount.xml", + ], +} diff --git a/purchase_discount/models/__init__.py b/purchase_discount/models/__init__.py new file mode 100644 index 00000000000..9f03530643d --- /dev/null +++ b/purchase_discount/models/__init__.py @@ -0,0 +1 @@ +from . import purchase_order diff --git a/purchase_discount/models/purchase_order.py b/purchase_discount/models/purchase_order.py new file mode 100644 index 00000000000..9cc21bf6e56 --- /dev/null +++ b/purchase_discount/models/purchase_order.py @@ -0,0 +1,15 @@ +from odoo import models + + +class PurchaseOrder(models.Model): + _inherit = "purchase.order" + + def action_purchase_global_discount(self): + self.ensure_one() + return { + "name": "Discount", + "type": "ir.actions.act_window", + "res_model": "purchase.order.discount", + "view_mode": "form", + "target": "new", + } diff --git a/purchase_discount/security/ir.model.access.csv b/purchase_discount/security/ir.model.access.csv new file mode 100644 index 00000000000..b02746d58d8 --- /dev/null +++ b/purchase_discount/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_purchase_order_discount,access_purchase_order_discount,model_purchase_order_discount,base.group_user,1,1,1,1 diff --git a/purchase_discount/views/purchase_order_view.xml b/purchase_discount/views/purchase_order_view.xml new file mode 100644 index 00000000000..be7f6e497ff --- /dev/null +++ b/purchase_discount/views/purchase_order_view.xml @@ -0,0 +1,21 @@ + + + + purchase.order.view.form.discount + purchase.order + + + + + + + +