diff --git a/stock_available_immediately/README.rst b/stock_available_immediately/README.rst index 957dd59db..540678a5e 100644 --- a/stock_available_immediately/README.rst +++ b/stock_available_immediately/README.rst @@ -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 +`_. 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 `_. + 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. \ No newline at end of file diff --git a/stock_available_immediately/__init__.py b/stock_available_immediately/__init__.py index 4fce57c9b..e1a1a2e8e 100644 --- a/stock_available_immediately/__init__.py +++ b/stock_available_immediately/__init__.py @@ -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 diff --git a/stock_available_immediately/__openerp__.py b/stock_available_immediately/__openerp__.py index f246cad5a..5844931c6 100644 --- a/stock_available_immediately/__openerp__.py +++ b/stock_available_immediately/__openerp__.py @@ -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", diff --git a/stock_available_immediately/models/product_template.py b/stock_available_immediately/models/product_template.py index d8cd5ed34..ab89a602f 100644 --- a/stock_available_immediately/models/product_template.py +++ b/stock_available_immediately/models/product_template.py @@ -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 . -# -############################################################################## +# 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 diff --git a/stock_available_immediately/product.py b/stock_available_immediately/product.py index 93200460f..5df94fc85 100644 --- a/stock_available_immediately/product.py +++ b/stock_available_immediately/product.py @@ -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 diff --git a/stock_available_immediately/static/description/icon.png b/stock_available_immediately/static/description/icon.png new file mode 100644 index 000000000..3a0328b51 Binary files /dev/null and b/stock_available_immediately/static/description/icon.png differ diff --git a/stock_available_immediately/tests/test_stock_available_immediately.py b/stock_available_immediately/tests/test_stock_available_immediately.py index be9f43006..0cfccf411 100644 --- a/stock_available_immediately/tests/test_stock_available_immediately.py +++ b/stock_available_immediately/tests/test_stock_available_immediately.py @@ -1,23 +1,9 @@ # -*- coding: utf-8 -*- -############################################################################## -# -# Copyright (C) 2015 Therp BV -# -# 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.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)