Make stock_available_mrp compatible with other modules like stock_available_immediately

This commit is contained in:
Florian da Costa
2019-07-06 17:31:36 +02:00
committed by Víctor Martínez
parent 779c73a3ae
commit 047485dbbb
4 changed files with 2 additions and 17 deletions

View File

@@ -2,4 +2,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import product_product
from . import product_template

View File

@@ -109,6 +109,7 @@ class ProductProduct(models.Model):
bom_id = product.bom_id
potential_qty = (bom_id.product_qty * components_potential_qty)
potential_qty = potential_qty > 0.0 and potential_qty or 0.0
# We want to respect the rounding factor of the potential_qty
# Rounding down as we want to be pesimistic.

View File

@@ -1,16 +0,0 @@
# Copyright 2014 Numérigraphe SARL
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, api
class ProductTemplate(models.Model):
_inherit = 'product.template'
@api.multi
def _compute_available_quantities_dict(self):
res = super(ProductTemplate, self)._compute_available_quantities_dict()
for template in self.filtered('bom_ids'):
res[template.id]['immediately_usable_qty'] =\
template.virtual_available + res[template.id]['potential_qty']
return res

View File

@@ -3,3 +3,4 @@
* many thanks to Graeme Gellatly for his advice and code review
* Laurent Mignon <laurent.mignon@acsone.eu>
* Cédric Pigeon <cedric.pigeon@acsone.eu>
* Florian da Costa <florian.dacosta@akretion.com>