Files
stock-logistics-warehouse/stock_available_immediately/product.py
Lionel Sausin f2560f3311 [IMP] Decouple the quantity for templates and variants
There are cases where we dot NOT want to simply sum the quantities of all the
variants. For example when dealing with manufacturing capacities, we may have
to chose between variants because we can't make ALL of them with the same
components.

So instead of a simple non-modular implementation, we'll let each module define
his own implementation of how to compute the product template's quantity
available for sale.

Conflicts:
	stock_available/__openerp__.py
	stock_available_immediately/__openerp__.py
2021-03-16 17:10:32 +01:00

21 lines
694 B
Python

# -*- coding: utf-8 -*-
# © 2014 Camptocamp, Akretion, Numérigraphe, Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models
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
This is the same implementation as for templates."""
super(ProductProduct, self)._immediately_usable_qty()
for prod in self:
prod.immediately_usable_qty -= prod.incoming_qty