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:
committed by
Jesús Alan Ramos Rodríguez
parent
ff5d37777f
commit
0d8bb06a64
@@ -1,6 +1,6 @@
|
|||||||
# Copyright 2018 Tecnativa - Sergio Teruel
|
# Copyright 2018 Tecnativa - Sergio Teruel
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# 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
|
from odoo.tools.float_utils import float_round
|
||||||
|
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@ class StockProductSecondaryUnit(models.AbstractModel):
|
|||||||
digits="Product Unit of Measure",
|
digits="Product Unit of Measure",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@api.depends("stock_secondary_uom_id")
|
||||||
def _compute_secondary_unit_qty_available(self):
|
def _compute_secondary_unit_qty_available(self):
|
||||||
for product in self:
|
for product in self:
|
||||||
if not product.stock_secondary_uom_id:
|
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"
|
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):
|
class ProductProduct(models.Model):
|
||||||
_inherit = ["product.product", "stock.product.secondary.unit"]
|
_inherit = ["product.product", "stock.product.secondary.unit"]
|
||||||
_name = "product.product"
|
_name = "product.product"
|
||||||
|
|
||||||
def _compute_quantities(self):
|
|
||||||
super()._compute_quantities()
|
|
||||||
self._compute_secondary_unit_qty_available()
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
<span class="o_stat_text">
|
<span class="o_stat_text">
|
||||||
<field name="stock_secondary_uom_id" />
|
<field name="stock_secondary_uom_id" readonly="1" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user