Files
stock-logistics-warehouse/stock_available_immediately/product.py
2015-03-02 17:27:55 +01:00

37 lines
1.5 KiB
Python

# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright 2010-2012 Camptocamp SA
# Copyright (C) 2011 Akretion Sébastien BEAU <sebastien.beau@akretion.com>
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp import models, fields, api
class ProductTemplate(models.Model):
"""Subtract incoming qty from immediately_usable_qty"""
_inherit = 'product.template'
@api.depends('virtual_available')
def _product_available(self):
"""Ignore the incoming goods in the quantity available to promise"""
super(ProductTemplate, self)._product_available()
for product in self:
product.immediately_usable_qty -= product.incoming_qty
immediately_usable_qty = fields.Float(compute='_product_available')