diff --git a/stock_available_immediately/__init__.py b/stock_available_immediately/__init__.py index 867607b7d..46f811108 100755 --- a/stock_available_immediately/__init__.py +++ b/stock_available_immediately/__init__.py @@ -17,3 +17,5 @@ # along with this program. If not, see . # ############################################################################## + +from . import product diff --git a/stock_available_immediately/product.py b/stock_available_immediately/product.py new file mode 100644 index 000000000..491e44d1d --- /dev/null +++ b/stock_available_immediately/product.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright 2010-2012 Camptocamp SA +# Copyright (C) 2011 Akretion Sébastien BEAU +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp import models + + +class Product(models.Model): + """Subtract incoming qty from immediately_usable_qty""" + _inherit = 'product.product' + + 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