diff --git a/stock_available_immediately/__init__.py b/stock_available_immediately/__init__.py index 5678916ad..4fce57c9b 100644 --- a/stock_available_immediately/__init__.py +++ b/stock_available_immediately/__init__.py @@ -2,4 +2,5 @@ # © 2014 Camptocamp, Akretion, Numérigraphe, Sodexis # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from . import product +from . import product_product +from . import product_template diff --git a/stock_available_immediately/__openerp__.py b/stock_available_immediately/__openerp__.py index 5894ba55c..f246cad5a 100644 --- a/stock_available_immediately/__openerp__.py +++ b/stock_available_immediately/__openerp__.py @@ -4,7 +4,7 @@ { "name": "Ignore planned receptions in quantity available to promise", - "version": "9.0.1.0.0", + "version": "9.0.1.1.0", "depends": ["stock_available"], "author": "Camptocamp,Sodexis,Odoo Community Association (OCA)", "license": "AGPL-3", diff --git a/stock_available_immediately/models/product_template.py b/stock_available_immediately/models/product_template.py new file mode 100644 index 000000000..d8cd5ed34 --- /dev/null +++ b/stock_available_immediately/models/product_template.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# This module is copyright (C) 2014 Numérigraphe SARL. All Rights Reserved. +# +# 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, api + + +class ProductTemplate(models.Model): + _inherit = 'product.template' + + @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 variants.""" + super(ProductTemplate, self)._immediately_usable_qty() + for tmpl in self: + tmpl.immediately_usable_qty -= tmpl.incoming_qty diff --git a/stock_available_immediately/product.py b/stock_available_immediately/product.py index 845ef63e7..93200460f 100644 --- a/stock_available_immediately/product.py +++ b/stock_available_immediately/product.py @@ -12,7 +12,9 @@ class Product(models.Model): @api.multi @api.depends('virtual_available', 'incoming_qty') def _immediately_usable_qty(self): - """Ignore the incoming goods in the quantity available to promise""" + """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