diff --git a/stock_quant_manual_assign/README.rst b/stock_quant_manual_assign/README.rst index 951dfa0829ef..06840b0a1e4e 100644 --- a/stock_quant_manual_assign/README.rst +++ b/stock_quant_manual_assign/README.rst @@ -1,13 +1,37 @@ -.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg - :target: http://www.gnu.org/licenses/agpl - :alt: License: AGPL-3 - =============================== Stock - Manual Quant Assignment =============================== +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github + :target: https://github.com/OCA/stock-logistics-warehouse/tree/11.0/stock_quant_manual_assign + :alt: OCA/stock-logistics-warehouse +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/stock-logistics-warehouse-11-0/stock-logistics-warehouse-11-0-stock_quant_manual_assign + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/153/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This module allows you to manually change the automatic quant selection. +**Table of contents** + +.. contents:: + :local: + Usage ===== @@ -17,46 +41,52 @@ To use this module, you need to: #. Open the wizard with the button "Manual Quants". #. Select the quants to assign (reserve), then Confirm. -.. 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/11.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. +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 `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= -Images ------- +Authors +~~~~~~~ -* Odoo Community Association: `Icon `_. +* AvanzOSC +* Tecnativa +* Eficent +* Fanha Giang Contributors ------------- +~~~~~~~~~~~~ * Mikel Arregi * Pedro M. Baeza * Ana Juaristi * Oihane Crucelaegui * Fanha Giang +* `Tecnativa `_: -Maintainer ----------- + * Vicent Cubells + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :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. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/stock-logistics-warehouse `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/stock_quant_manual_assign/__init__.py b/stock_quant_manual_assign/__init__.py index cc3cf15e7bb3..40272379f721 100644 --- a/stock_quant_manual_assign/__init__.py +++ b/stock_quant_manual_assign/__init__.py @@ -1,5 +1 @@ -# -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## from . import wizard diff --git a/stock_quant_manual_assign/__manifest__.py b/stock_quant_manual_assign/__manifest__.py index 733228d53d2d..a442a715d83d 100644 --- a/stock_quant_manual_assign/__manifest__.py +++ b/stock_quant_manual_assign/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2015 Mikel Arregi - AvanzOSC # Copyright 2016 Tecnativa - Pedro M. Baeza # Copyright 2017 Eficent - Jordi Ballester diff --git a/stock_quant_manual_assign/readme/CONTRIBUTORS.rst b/stock_quant_manual_assign/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000000..c551e9c6b2cb --- /dev/null +++ b/stock_quant_manual_assign/readme/CONTRIBUTORS.rst @@ -0,0 +1,8 @@ +* Mikel Arregi +* Pedro M. Baeza +* Ana Juaristi +* Oihane Crucelaegui +* Fanha Giang +* `Tecnativa `_: + + * Vicent Cubells diff --git a/stock_quant_manual_assign/readme/DESCRIPTION.rst b/stock_quant_manual_assign/readme/DESCRIPTION.rst new file mode 100644 index 000000000000..59ef2218ceea --- /dev/null +++ b/stock_quant_manual_assign/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows you to manually change the automatic quant selection. diff --git a/stock_quant_manual_assign/readme/USAGE.rst b/stock_quant_manual_assign/readme/USAGE.rst new file mode 100644 index 000000000000..433722ecda4f --- /dev/null +++ b/stock_quant_manual_assign/readme/USAGE.rst @@ -0,0 +1,5 @@ +To use this module, you need to: + +#. Click on the tags icon at the end of move line. +#. Open the wizard with the button "Manual Quants". +#. Select the quants to assign (reserve), then Confirm. diff --git a/stock_quant_manual_assign/static/description/index.html b/stock_quant_manual_assign/static/description/index.html new file mode 100644 index 000000000000..4b73bcd243eb --- /dev/null +++ b/stock_quant_manual_assign/static/description/index.html @@ -0,0 +1,440 @@ + + + + + + +Stock - Manual Quant Assignment + + + +
+

Stock - Manual Quant Assignment

+ + +

Beta License: AGPL-3 OCA/stock-logistics-warehouse Translate me on Weblate Try me on Runbot

+

This module allows you to manually change the automatic quant selection.

+

Table of contents

+ +
+

Usage

+

To use this module, you need to:

+
    +
  1. Click on the tags icon at the end of move line.
  2. +
  3. Open the wizard with the button “Manual Quants”.
  4. +
  5. Select the quants to assign (reserve), then Confirm.
  6. +
+
+
+

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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • AvanzOSC
  • +
  • Tecnativa
  • +
  • Eficent
  • +
  • Fanha Giang
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/stock-logistics-warehouse project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/stock_quant_manual_assign/tests/__init__.py b/stock_quant_manual_assign/tests/__init__.py index ba4c7dd5c19a..5193a99e4d4c 100644 --- a/stock_quant_manual_assign/tests/__init__.py +++ b/stock_quant_manual_assign/tests/__init__.py @@ -1,5 +1 @@ -# -*- coding: utf-8 -*- -# (c) 2015 Oihane Crucelaegui - AvanzOSC -# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html - from . import test_stock_quant_manual_assign diff --git a/stock_quant_manual_assign/tests/test_stock_quant_manual_assign.py b/stock_quant_manual_assign/tests/test_stock_quant_manual_assign.py index 2fdd0270ed66..33ae1cc8e707 100644 --- a/stock_quant_manual_assign/tests/test_stock_quant_manual_assign.py +++ b/stock_quant_manual_assign/tests/test_stock_quant_manual_assign.py @@ -1,9 +1,8 @@ -# -*- coding: utf-8 -*- -# (c) 2015 Oihane Crucelaegui - AvanzOSC +# Copyright 2015 Oihane Crucelaegui - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo.tests.common import TransactionCase -from odoo import exceptions +from odoo.exceptions import ValidationError class TestStockQuantManualAssign(TransactionCase): @@ -70,7 +69,7 @@ def test_quant_assign_wizard_constraint(self): 'None of the quants must have been selected') self.assertEqual(wizard.lines_qty, 0.0, 'None selected must give 0') - with self.assertRaises(exceptions.ValidationError): + with self.assertRaises(ValidationError): wizard.write({'quants_lines': [(1, wizard.quants_lines[:1].id, {'selected': True, 'qty': 500})]}) @@ -91,6 +90,7 @@ def test_quant_manual_assign(self): self.assertEqual(wizard.lines_qty, 150.0) self.assertEqual(wizard.move_qty, 250.0) wizard.assign_quants() + self.assertAlmostEqual(len(self.move.move_line_ids), 2.0) def test_quant_assign_wizard_after_availability_check(self): self.move._action_assign() @@ -105,3 +105,4 @@ def test_quant_assign_wizard_after_availability_check(self): self.assertEqual(wizard.move_qty, 100.0) self.assertEqual(len(wizard.quants_lines.filtered('selected')), len(self.move.move_line_ids)) + self.assertAlmostEqual(len(self.move.move_line_ids), 3.0) diff --git a/stock_quant_manual_assign/wizard/__init__.py b/stock_quant_manual_assign/wizard/__init__.py index a7dec37e7485..781c26d93427 100644 --- a/stock_quant_manual_assign/wizard/__init__.py +++ b/stock_quant_manual_assign/wizard/__init__.py @@ -1,5 +1 @@ -# -*- coding: utf-8 -*- -############################################################################## -# For copyright and license notices, see __openerp__.py file in root directory -############################################################################## from . import assign_manual_quants diff --git a/stock_quant_manual_assign/wizard/assign_manual_quants.py b/stock_quant_manual_assign/wizard/assign_manual_quants.py index cf3bf55e3b6f..9b3bc675eb16 100644 --- a/stock_quant_manual_assign/wizard/assign_manual_quants.py +++ b/stock_quant_manual_assign/wizard/assign_manual_quants.py @@ -1,6 +1,5 @@ -# -*- coding: utf-8 -*- -# (c) 2015 Mikel Arregi - AvanzOSC -# (c) 2015 Oihane Crucelaegui - AvanzOSC +# Copyright 2015 Mikel Arregi - AvanzOSC +# Copyright 2015 Oihane Crucelaegui - AvanzOSC # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html from odoo import _, api, fields, models @@ -53,14 +52,15 @@ def assign_quants(self): precision_digits=precision_digits) > 0: available_quantity = quant._get_available_quantity( move.product_id, - move.location_id, + line.location_id, lot_id=line.lot_id) if float_compare(available_quantity, 0.0, precision_digits=precision_digits) <= 0: continue move._update_reserved_quantity(line.qty, available_quantity, - move.location_id, + line.location_id, lot_id=line.lot_id, strict=True) + if move.has_move_lines: for ml in move.move_line_ids: ml.qty_done = ml.product_qty