From 30604268374296c43f777c86eb5026d2427c11d1 Mon Sep 17 00:00:00 2001 From: arkp-odoo Date: Wed, 23 Jul 2025 17:58:04 +0530 Subject: [PATCH] [ADD] inventory: Improve stock info and UI in product form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before: Users could easily get confused or make mistakes when managing stock, especially in multi-company environments. Important actions like updating quantity on hand were hard to find, and the interface didn’t clearly guide safe workflows. After: The interface now better supports new users by reducing confusion and make stock workflows safer. Risky actions are hidden if not appropriate, visual clarity helps users avoid errors and understand inventory status more easily. task-4965098 --- quantity_on_hand/__init__.py | 2 + quantity_on_hand/__manifest__.py | 10 +++ quantity_on_hand/models/__init__.py | 2 + quantity_on_hand/models/product_template.py | 12 ++++ .../views/product_template_views.xml | 68 +++++++++++++++++++ 5 files changed, 94 insertions(+) create mode 100644 quantity_on_hand/__init__.py create mode 100644 quantity_on_hand/__manifest__.py create mode 100644 quantity_on_hand/models/__init__.py create mode 100644 quantity_on_hand/models/product_template.py create mode 100644 quantity_on_hand/views/product_template_views.xml diff --git a/quantity_on_hand/__init__.py b/quantity_on_hand/__init__.py new file mode 100644 index 00000000000..d581b39cea7 --- /dev/null +++ b/quantity_on_hand/__init__.py @@ -0,0 +1,2 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. +from . import models diff --git a/quantity_on_hand/__manifest__.py b/quantity_on_hand/__manifest__.py new file mode 100644 index 00000000000..d837e1eaeaa --- /dev/null +++ b/quantity_on_hand/__manifest__.py @@ -0,0 +1,10 @@ +{ + 'name': 'Quantity on hand', + 'version': '1.0', + 'depends': ['stock'], + 'installable': True, + 'data': [ + 'views/product_template_views.xml', + ], + 'license': 'LGPL-3', +} diff --git a/quantity_on_hand/models/__init__.py b/quantity_on_hand/models/__init__.py new file mode 100644 index 00000000000..fedc66d3d45 --- /dev/null +++ b/quantity_on_hand/models/__init__.py @@ -0,0 +1,2 @@ +# Part of Odoo. See LICENSE file for full copyright and licensing details. +from . import product_template diff --git a/quantity_on_hand/models/product_template.py b/quantity_on_hand/models/product_template.py new file mode 100644 index 00000000000..889e51895d5 --- /dev/null +++ b/quantity_on_hand/models/product_template.py @@ -0,0 +1,12 @@ +from odoo import api, fields, models + + +class ProductTemplate(models.Model): + _inherit = 'product.template' + + is_multicompany = fields.Boolean(compute="_compute_is_multicompany") + + @api.depends('company_id') + def _compute_is_multicompany(self): + for record in self: + record.is_multicompany = len(self.env.user.company_ids) > 1 diff --git a/quantity_on_hand/views/product_template_views.xml b/quantity_on_hand/views/product_template_views.xml new file mode 100644 index 00000000000..f9056e0fcf8 --- /dev/null +++ b/quantity_on_hand/views/product_template_views.xml @@ -0,0 +1,68 @@ + + + + product.template.form.custom.inherit + product.template + + + + + 1 + + + + 1 + + + + virtual_available < 0 + virtual_available == 0 + + + + Forecasted + + + + + + + + + + + 1 + + + + + + + product.template.common.form.inherit + product.template + + + + type == 'consu' + + + + + + + + + + + + +