From 975870333a1dcebc10be81f67dd03f532778ef73 Mon Sep 17 00:00:00 2001 From: Marc Durepos Date: Tue, 9 Sep 2025 14:57:21 -0400 Subject: [PATCH] [MIG] bemade_stock_quant_valuation to 18.0 --- bemade_stock_quant_valuation/__init__.py | 1 + bemade_stock_quant_valuation/__manifest__.py | 35 +++++++++++++++++++ .../models/__init__.py | 1 + .../models/stock_quant.py | 20 +++++++++++ .../views/stock_account_views.xml | 19 ++++++++++ 5 files changed, 76 insertions(+) create mode 100644 bemade_stock_quant_valuation/__init__.py create mode 100644 bemade_stock_quant_valuation/__manifest__.py create mode 100644 bemade_stock_quant_valuation/models/__init__.py create mode 100644 bemade_stock_quant_valuation/models/stock_quant.py create mode 100644 bemade_stock_quant_valuation/views/stock_account_views.xml diff --git a/bemade_stock_quant_valuation/__init__.py b/bemade_stock_quant_valuation/__init__.py new file mode 100644 index 0000000..0650744 --- /dev/null +++ b/bemade_stock_quant_valuation/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/bemade_stock_quant_valuation/__manifest__.py b/bemade_stock_quant_valuation/__manifest__.py new file mode 100644 index 0000000..0c648ba --- /dev/null +++ b/bemade_stock_quant_valuation/__manifest__.py @@ -0,0 +1,35 @@ +# +# Bemade Inc. +# +# Copyright (C) September 2023 Bemade Inc. (). +# Author: Marc Durepos (Contact : marc@bemade.org) +# +# This program is under the terms of the Odoo Proprietary License v1.0 (OPL-1) +# It is forbidden to publish, distribute, sublicense, or sell copies of the Software +# or modified copies of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# +{ + "name": "Stock Quant Valuation", + "version": "18.0.1.0.0", + "summary": """ + Adds valuation to stock quant for better inventory adjustment management' + """, + "description": "", + "category": "Inventory", + "author": "Bemade Inc.", + "website": "https://www.bemade.org", + "license": "OPL-1", + "depends": ["stock_account"], + "data": ["views/stock_account_views.xml"], + "demo": [], + "installable": True, + "auto_install": False, +} diff --git a/bemade_stock_quant_valuation/models/__init__.py b/bemade_stock_quant_valuation/models/__init__.py new file mode 100644 index 0000000..70f8e6c --- /dev/null +++ b/bemade_stock_quant_valuation/models/__init__.py @@ -0,0 +1 @@ +from . import stock_quant diff --git a/bemade_stock_quant_valuation/models/stock_quant.py b/bemade_stock_quant_valuation/models/stock_quant.py new file mode 100644 index 0000000..5e679d3 --- /dev/null +++ b/bemade_stock_quant_valuation/models/stock_quant.py @@ -0,0 +1,20 @@ +from odoo import models, fields, api + + +class StockQuant(models.Model): + _inherit = 'stock.quant' + + value_unit = fields.Float(related='product_id.standard_price', readonly=True, + groups='stock.group_stock_manager', digits='Product Price') + value_difference = fields.Float(compute='_compute_difference_value', + help='The value of the difference between the ' + 'quantity on hand and the counted ' + 'quantity.', + groups='stock.group_stock_manager', + digits='Product Price', + store=True) + + @api.depends('inventory_diff_quantity', 'value_unit') + def _compute_difference_value(self): + for rec in self.filtered(lambda r: r.inventory_quantity is not None): + rec.value_difference = rec.value_unit * rec.inventory_diff_quantity diff --git a/bemade_stock_quant_valuation/views/stock_account_views.xml b/bemade_stock_quant_valuation/views/stock_account_views.xml new file mode 100644 index 0000000..59bffa3 --- /dev/null +++ b/bemade_stock_quant_valuation/views/stock_account_views.xml @@ -0,0 +1,19 @@ + + + + + stock.quant.inventory.list.editable.inherit + stock.quant + + + + + + + + + + + + + \ No newline at end of file