mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
product_available improvements
* fix the dependencies for the computed field * use api.multi instead of api.one to avoid calling super()._immediately_usable_qty in a loop (this improves perfs on a tree view display)
This commit is contained in:
committed by
Víctor Martínez
parent
e5a878f1c5
commit
7e0c51aecb
@@ -9,8 +9,10 @@ class Product(models.Model):
|
||||
"""Subtract incoming qty from immediately_usable_qty"""
|
||||
_inherit = 'product.product'
|
||||
|
||||
@api.multi
|
||||
@api.depends('virtual_available', 'incoming_qty')
|
||||
def _immediately_usable_qty(self):
|
||||
"""Ignore the incoming goods in the quantity available to promise"""
|
||||
super(Product, self)._immediately_usable_qty()
|
||||
for product in self:
|
||||
product.immediately_usable_qty -= product.incoming_qty
|
||||
super(ProductProduct, self)._immediately_usable_qty()
|
||||
for prod in self:
|
||||
prod.immediately_usable_qty -= prod.incoming_qty
|
||||
|
||||
Reference in New Issue
Block a user