mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[IMP] stock_secondary_unit: Remove unnecessary code. Always compute as field.
TT26606
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
{
|
||||
"name": "Stock Secondary Unit",
|
||||
"summary": "Get product quantities in a secondary unit",
|
||||
"version": "13.0.1.0.1",
|
||||
"version": "13.0.1.1.0",
|
||||
"development_status": "Production/Stable",
|
||||
"category": "stock",
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Copyright 2018 Tecnativa - Sergio Teruel
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
from odoo import fields, models
|
||||
from odoo import api, fields, models
|
||||
from odoo.tools.float_utils import float_round
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ class StockProductSecondaryUnit(models.AbstractModel):
|
||||
digits="Product Unit of Measure",
|
||||
)
|
||||
|
||||
@api.depends("stock_secondary_uom_id")
|
||||
def _compute_secondary_unit_qty_available(self):
|
||||
for product in self:
|
||||
if not product.stock_secondary_uom_id:
|
||||
@@ -35,15 +36,7 @@ class ProductTemplate(models.Model):
|
||||
comodel_name="product.secondary.unit", string="Second unit for inventory"
|
||||
)
|
||||
|
||||
def _compute_quantities(self):
|
||||
super()._compute_quantities()
|
||||
self._compute_secondary_unit_qty_available()
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = ["product.product", "stock.product.secondary.unit"]
|
||||
_name = "product.product"
|
||||
|
||||
def _compute_quantities(self):
|
||||
super()._compute_quantities()
|
||||
self._compute_secondary_unit_qty_available()
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
/>
|
||||
</span>
|
||||
<span class="o_stat_text">
|
||||
<field name="stock_secondary_uom_id" />
|
||||
<field name="stock_secondary_uom_id" readonly="1" />
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user