mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
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
21 lines
694 B
Python
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
|