[10.0][MIG] stock_available & stock_available_immediately (#219)

This commit is contained in:
SodexisTeam
2016-11-25 12:20:18 +05:30
committed by Florian da Costa
parent 46ebc6c7e6
commit 7454d8e84e
7 changed files with 56 additions and 51 deletions

View File

@@ -1,3 +1,8 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
==========================================================
Ignore planned receptions in quantity available to promise
==========================================================
@@ -6,9 +11,29 @@ which includes both planned outgoing and incoming goods.
This module will subtract the planned receptions from the quantity available to
promise.
Usage
=====
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/153/10.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/stock-logistics-warehouse/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
Contributors
------------
@@ -20,12 +45,14 @@ Contributors
Maintainer
----------
.. image:: http://odoo-community.org/logo.png
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: http://odoo-community.org
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit http://odoo-community.org.
To contribute to this module, please visit https://odoo-community.org.

View File

@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# © 2014 Camptocamp, Akretion, Numérigraphe, Sodexis
# Copyright 2014 Camptocamp, Akretion, Numérigraphe
# Copyright 2016 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import product_product

View File

@@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
# © 2014 Camptocamp, Akretion, Numérigraphe, Sodexis
# Copyright 2014 Camptocamp, Akretion, Numérigraphe
# Copyright 2016 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Ignore planned receptions in quantity available to promise",
"version": "9.0.1.1.0",
"version": "10.0.1.0.0",
"depends": ["stock_available"],
"author": "Camptocamp,Sodexis,Odoo Community Association (OCA)",
"license": "AGPL-3",

View File

@@ -1,24 +1,9 @@
# -*- 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
# Copyright 2014 Camptocamp, Akretion, Numérigraphe
# Copyright 2016 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, api
from odoo import models, api
class ProductTemplate(models.Model):
@@ -26,10 +11,10 @@ class ProductTemplate(models.Model):
@api.multi
@api.depends('virtual_available', 'incoming_qty')
def _immediately_usable_qty(self):
def _compute_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()
super(ProductTemplate, self)._compute_immediately_usable_qty()
for tmpl in self:
tmpl.immediately_usable_qty -= tmpl.incoming_qty

View File

@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-
# © 2014 Camptocamp, Akretion, Numérigraphe, Sodexis
# Copyright 2014 Camptocamp, Akretion, Numérigraphe
# Copyright 2016 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models
from odoo import models, api
class Product(models.Model):
@@ -11,10 +12,10 @@ class Product(models.Model):
@api.multi
@api.depends('virtual_available', 'incoming_qty')
def _immediately_usable_qty(self):
def _compute_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()
super(ProductProduct, self)._compute_immediately_usable_qty()
for prod in self:
prod.immediately_usable_qty -= prod.incoming_qty

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -1,23 +1,9 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Therp BV <http://therp.nl>
#
# 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.tests.common import TransactionCase
# Copyright 2014 Camptocamp, Akretion, Numérigraphe
# Copyright 2016 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
class TestStockLogisticsWarehouse(TransactionCase):
@@ -118,3 +104,7 @@ the variations in stock, both on product and template"""
stockMoveOutA.action_done()
compare_product_usable_qty(productA, 1)
compare_product_usable_qty(templateAB, 4)
# Potential Qty is set as 0.0 by default
self.assertEquals(templateAB.potential_qty, 0.0)
self.assertEquals(productA.potential_qty, 0.0)