diff --git a/sale_order_general_discount/README.rst b/sale_order_general_discount/README.rst index 2456cf24345..d631786161e 100644 --- a/sale_order_general_discount/README.rst +++ b/sale_order_general_discount/README.rst @@ -28,12 +28,14 @@ Sale Order General Discount |badge1| |badge2| |badge3| |badge4| |badge5| -This module allows to set a general discount in a sales order. This general -discount is set to each line order in the standard `discount` field. +This module allows to set a general discount in a sales order. This +general discount is set to each line order in the standard discount +field. You can configure: - * a default general discount on customers - * On each product define if general discount is applied + +- a default general discount on customers +- On each product define if general discount is applied **Table of contents** @@ -43,19 +45,19 @@ You can configure: Installation ============ -You need to install sale_management module for accessing the needed menus. +You need to install sale_management module for accessing the needed +menus. Usage ===== To use this module, you need to: -#. Create a sale order and set a discount, - this discount will be set in all lines. -#. You can set a discount in a partner. -#. On product you can define if you - apply general discount on sale order line - linked to that product +1. Create a sale order and set a discount, this discount will be set in + all lines. +2. You can set a discount in a partner. +3. On product you can define if you apply general discount on sale order + line linked to that product Bug Tracker =========== @@ -71,23 +73,23 @@ Credits ======= Authors -~~~~~~~ +------- * Tecnativa Contributors -~~~~~~~~~~~~ +------------ -* `Tecnativa `_: +- `Tecnativa `__: - * Sergio Teruel - * Stefan Ungureanu + - Sergio Teruel + - Stefan Ungureanu -* Raf Ven -* Sudhir Arya +- Raf Ven +- Sudhir Arya Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. diff --git a/sale_order_general_discount/readme/CONTRIBUTORS.md b/sale_order_general_discount/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..88f7cbcfcb5 --- /dev/null +++ b/sale_order_general_discount/readme/CONTRIBUTORS.md @@ -0,0 +1,5 @@ +- [Tecnativa](https://www.tecnativa.com): + - Sergio Teruel \<\> + - Stefan Ungureanu \<\> +- Raf Ven \<\> +- Sudhir Arya \<\> diff --git a/sale_order_general_discount/readme/CONTRIBUTORS.rst b/sale_order_general_discount/readme/CONTRIBUTORS.rst deleted file mode 100644 index ef09abf24b9..00000000000 --- a/sale_order_general_discount/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,7 +0,0 @@ -* `Tecnativa `_: - - * Sergio Teruel - * Stefan Ungureanu - -* Raf Ven -* Sudhir Arya diff --git a/sale_order_general_discount/readme/DESCRIPTION.md b/sale_order_general_discount/readme/DESCRIPTION.md new file mode 100644 index 00000000000..f9539cbb76b --- /dev/null +++ b/sale_order_general_discount/readme/DESCRIPTION.md @@ -0,0 +1,7 @@ +This module allows to set a general discount in a sales order. This +general discount is set to each line order in the standard discount +field. + +You can configure: +- a default general discount on customers +- On each product define if general discount is applied diff --git a/sale_order_general_discount/readme/DESCRIPTION.rst b/sale_order_general_discount/readme/DESCRIPTION.rst deleted file mode 100644 index 88bd66fae3e..00000000000 --- a/sale_order_general_discount/readme/DESCRIPTION.rst +++ /dev/null @@ -1,6 +0,0 @@ -This module allows to set a general discount in a sales order. This general -discount is set to each line order in the standard `discount` field. - -You can configure: - * a default general discount on customers - * On each product define if general discount is applied diff --git a/sale_order_general_discount/readme/INSTALL.rst b/sale_order_general_discount/readme/INSTALL.md similarity index 85% rename from sale_order_general_discount/readme/INSTALL.rst rename to sale_order_general_discount/readme/INSTALL.md index 4da360f7c83..5e1d649b89c 100644 --- a/sale_order_general_discount/readme/INSTALL.rst +++ b/sale_order_general_discount/readme/INSTALL.md @@ -1 +1,2 @@ -You need to install sale_management module for accessing the needed menus. +You need to install sale_management module for accessing the needed +menus. diff --git a/sale_order_general_discount/readme/USAGE.md b/sale_order_general_discount/readme/USAGE.md new file mode 100644 index 00000000000..db909f04a1d --- /dev/null +++ b/sale_order_general_discount/readme/USAGE.md @@ -0,0 +1,7 @@ +To use this module, you need to: + +1. Create a sale order and set a discount, this discount will be set in + all lines. +2. You can set a discount in a partner. +3. On product you can define if you apply general discount on sale + order line linked to that product diff --git a/sale_order_general_discount/readme/USAGE.rst b/sale_order_general_discount/readme/USAGE.rst deleted file mode 100644 index 2c58d327897..00000000000 --- a/sale_order_general_discount/readme/USAGE.rst +++ /dev/null @@ -1,8 +0,0 @@ -To use this module, you need to: - -#. Create a sale order and set a discount, - this discount will be set in all lines. -#. You can set a discount in a partner. -#. On product you can define if you - apply general discount on sale order line - linked to that product diff --git a/sale_order_general_discount/static/description/index.html b/sale_order_general_discount/static/description/index.html index baa03fd4432..735a4787302 100644 --- a/sale_order_general_discount/static/description/index.html +++ b/sale_order_general_discount/static/description/index.html @@ -370,16 +370,14 @@

Sale Order General Discount

!! source digest: sha256:a4eeadfa3e2fc4ad9f54244dc002a32d12938c91207c4f729001730ca727a156 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Production/Stable License: AGPL-3 OCA/sale-workflow Translate me on Weblate Try me on Runboat

-

This module allows to set a general discount in a sales order. This general -discount is set to each line order in the standard discount field.

-
-
You can configure:
-
    +

    This module allows to set a general discount in a sales order. This +general discount is set to each line order in the standard discount +field.

    +

    You can configure:

    +
    • a default general discount on customers
    • On each product define if general discount is applied
    -
-

Table of contents

    @@ -396,18 +394,18 @@

    Sale Order General Discount

Installation

-

You need to install sale_management module for accessing the needed menus.

+

You need to install sale_management module for accessing the needed +menus.

Usage

To use this module, you need to:

    -
  1. Create a sale order and set a discount, -this discount will be set in all lines.
  2. +
  3. Create a sale order and set a discount, this discount will be set in +all lines.
  4. You can set a discount in a partner.
  5. -
  6. On product you can define if you -apply general discount on sale order line -linked to that product
  7. +
  8. On product you can define if you apply general discount on sale order +line linked to that product
diff --git a/sale_stock_picking_validation_blocking/README.rst b/sale_stock_picking_validation_blocking/README.rst new file mode 100644 index 00000000000..967974682e9 --- /dev/null +++ b/sale_stock_picking_validation_blocking/README.rst @@ -0,0 +1,98 @@ +====================================== +Sale Stock Picking Validation Blocking +====================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:343c9cd796a930fc9ea44912fb913d685021f39974f0cb15f02bf6634edd9dff + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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%2Fsale--workflow-lightgray.png?logo=github + :target: https://github.com/OCA/sale-workflow/tree/17.0/sale_stock_picking_validation_blocking + :alt: OCA/sale-workflow +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_stock_picking_validation_blocking + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=17.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module adds the opportunity to prevent the validation of linked +delivery orders from a sale order. The delivery order is still created +when the sale order is confirmed, therefore the stock is reserved but +can not be send until approval. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +To block validation of stock picking from sale orders, you need to: + +1. Open the form view of a sale order (in status Sale Order or Locked). +2. Click on the button Block Delivery Validation. +3. The delivery validation is now blocked, the Validate button will not + appear on the related pickings. + +To unblock validation of stock picking from sale orders, you need to: + +1. Open the form view of a "delivery validation blocked" sale order (in + status Sale Order or Locked). +2. Click on the button Unblock Delivery Validation. +3. The delivery validation is not blocked anymore, the Validate button + will appear on the related pickings. + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* ACSONE SA/NV + +Contributors +------------ + +- Quentin Groulard +- Kevin Khao kevin.khao@gmail.com + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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/sale-workflow `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/sale_stock_picking_validation_blocking/__init__.py b/sale_stock_picking_validation_blocking/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/sale_stock_picking_validation_blocking/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/sale_stock_picking_validation_blocking/__manifest__.py b/sale_stock_picking_validation_blocking/__manifest__.py new file mode 100644 index 00000000000..45a4b182df9 --- /dev/null +++ b/sale_stock_picking_validation_blocking/__manifest__.py @@ -0,0 +1,15 @@ +# Copyright 2020 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Sale Stock Picking Validation Blocking", + "summary": """ + This module adds the opportunity to prevent + the validation of delivery order from the SO.""", + "version": "17.0.1.0.0", + "license": "AGPL-3", + "author": "ACSONE SA/NV,Odoo Community Association (OCA)", + "website": "https://github.com/OCA/sale-workflow", + "depends": ["sale_stock"], + "data": ["views/sale_order.xml", "views/stock_picking.xml"], +} diff --git a/sale_stock_picking_validation_blocking/i18n/sale_stock_picking_validation_blocking.pot b/sale_stock_picking_validation_blocking/i18n/sale_stock_picking_validation_blocking.pot new file mode 100644 index 00000000000..472c97cd839 --- /dev/null +++ b/sale_stock_picking_validation_blocking/i18n/sale_stock_picking_validation_blocking.pot @@ -0,0 +1,55 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * sale_stock_picking_validation_blocking +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: sale_stock_picking_validation_blocking +#: model_terms:ir.ui.view,arch_db:sale_stock_picking_validation_blocking.sale_order_form_view +msgid "Block Delivery Validation" +msgstr "" + +#. module: sale_stock_picking_validation_blocking +#: model:ir.model.fields,field_description:sale_stock_picking_validation_blocking.field_sale_order__picking_validation_blocked +msgid "Delivery Validation Blocked" +msgstr "" + +#. module: sale_stock_picking_validation_blocking +#: model:ir.model,name:sale_stock_picking_validation_blocking.model_sale_order +msgid "Sales Order" +msgstr "" + +#. module: sale_stock_picking_validation_blocking +#: model:ir.model,name:sale_stock_picking_validation_blocking.model_stock_picking +msgid "Transfer" +msgstr "" + +#. module: sale_stock_picking_validation_blocking +#: model_terms:ir.ui.view,arch_db:sale_stock_picking_validation_blocking.sale_order_form_view +msgid "Unblock Delivery Validation" +msgstr "" + +#. module: sale_stock_picking_validation_blocking +#: model:ir.model.fields,field_description:sale_stock_picking_validation_blocking.field_stock_picking__validation_blocked_by_so +msgid "Validation Blocked by SO" +msgstr "" + +#. module: sale_stock_picking_validation_blocking +#: code:addons/sale_stock_picking_validation_blocking/models/stock_picking.py:0 +#, python-format +msgid "Validation is blocked by SO for picking %s" +msgstr "" + +#. module: sale_stock_picking_validation_blocking +#: model_terms:ir.ui.view,arch_db:sale_stock_picking_validation_blocking.stock_picking_form_view +msgid "Warning: The validation of this picking is prevented by sale order" +msgstr "" diff --git a/sale_stock_picking_validation_blocking/models/__init__.py b/sale_stock_picking_validation_blocking/models/__init__.py new file mode 100644 index 00000000000..c0b4257cf63 --- /dev/null +++ b/sale_stock_picking_validation_blocking/models/__init__.py @@ -0,0 +1,2 @@ +from . import sale_order +from . import stock_picking diff --git a/sale_stock_picking_validation_blocking/models/sale_order.py b/sale_stock_picking_validation_blocking/models/sale_order.py new file mode 100644 index 00000000000..9417839dd6f --- /dev/null +++ b/sale_stock_picking_validation_blocking/models/sale_order.py @@ -0,0 +1,34 @@ +# Copyright 2020 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + picking_validation_blocked = fields.Boolean( + readonly=True, tracking=True, string="Delivery Validation Blocked" + ) + hide_button_picking_validation_blocked = fields.Boolean( + "Display the picking validation buttons", + help="Technical field to determine whether the " + "picking validation buttons should be displayed", + compute="_compute_hide_picking_validation_blocked", + compute_sudo=True, + ) + + @api.depends("picking_validation_blocked", "state", "delivery_count") + def _compute_hide_picking_validation_blocked(self): + for rec in self: + rec.hide_button_picking_validation_blocked = ( + rec.state != "sale" + or not self.env.user.has_group("sales_team.group_sale_manager") + or rec.delivery_count == 0 + ) + + def action_block_picking_validation(self): + self.write({"picking_validation_blocked": True}) + + def action_unblock_picking_validation(self): + self.write({"picking_validation_blocked": False}) diff --git a/sale_stock_picking_validation_blocking/models/stock_picking.py b/sale_stock_picking_validation_blocking/models/stock_picking.py new file mode 100644 index 00000000000..c82f3cc21d3 --- /dev/null +++ b/sale_stock_picking_validation_blocking/models/stock_picking.py @@ -0,0 +1,23 @@ +# Copyright 2020 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import _, fields, models +from odoo.exceptions import ValidationError + + +class StockPicking(models.Model): + _inherit = "stock.picking" + + validation_blocked_by_so = fields.Boolean( + related="sale_id.picking_validation_blocked", + store=True, + string="Validation Blocked by SO", + ) + + def button_validate(self): + for picking in self: + if picking.validation_blocked_by_so: + raise ValidationError( + _("Validation is blocked by SO for picking %s" % picking.name) + ) + return super().button_validate() diff --git a/sale_stock_picking_validation_blocking/pyproject.toml b/sale_stock_picking_validation_blocking/pyproject.toml new file mode 100644 index 00000000000..4231d0cccb3 --- /dev/null +++ b/sale_stock_picking_validation_blocking/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/sale_stock_picking_validation_blocking/readme/CONTRIBUTORS.md b/sale_stock_picking_validation_blocking/readme/CONTRIBUTORS.md new file mode 100644 index 00000000000..c7e5ddeffbb --- /dev/null +++ b/sale_stock_picking_validation_blocking/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Quentin Groulard \<\> +- Kevin Khao diff --git a/sale_stock_picking_validation_blocking/readme/DESCRIPTION.md b/sale_stock_picking_validation_blocking/readme/DESCRIPTION.md new file mode 100644 index 00000000000..7ca85d56596 --- /dev/null +++ b/sale_stock_picking_validation_blocking/readme/DESCRIPTION.md @@ -0,0 +1,4 @@ +This module adds the opportunity to prevent the validation of linked +delivery orders from a sale order. The delivery order is still created +when the sale order is confirmed, therefore the stock is reserved but +can not be send until approval. diff --git a/sale_stock_picking_validation_blocking/readme/USAGE.md b/sale_stock_picking_validation_blocking/readme/USAGE.md new file mode 100644 index 00000000000..85bf3715e80 --- /dev/null +++ b/sale_stock_picking_validation_blocking/readme/USAGE.md @@ -0,0 +1,14 @@ +To block validation of stock picking from sale orders, you need to: + +1. Open the form view of a sale order (in status Sale Order or Locked). +2. Click on the button Block Delivery Validation. +3. The delivery validation is now blocked, the Validate button will not + appear on the related pickings. + +To unblock validation of stock picking from sale orders, you need to: + +1. Open the form view of a "delivery validation blocked" sale order (in + status Sale Order or Locked). +2. Click on the button Unblock Delivery Validation. +3. The delivery validation is not blocked anymore, the Validate button + will appear on the related pickings. diff --git a/sale_stock_picking_validation_blocking/static/description/icon.png b/sale_stock_picking_validation_blocking/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/sale_stock_picking_validation_blocking/static/description/icon.png differ diff --git a/sale_stock_picking_validation_blocking/static/description/index.html b/sale_stock_picking_validation_blocking/static/description/index.html new file mode 100644 index 00000000000..968fa91b1ad --- /dev/null +++ b/sale_stock_picking_validation_blocking/static/description/index.html @@ -0,0 +1,446 @@ + + + + + +Sale Stock Picking Validation Blocking + + + +
+

Sale Stock Picking Validation Blocking

+ + +

Beta License: AGPL-3 OCA/sale-workflow Translate me on Weblate Try me on Runboat

+

This module adds the opportunity to prevent the validation of linked +delivery orders from a sale order. The delivery order is still created +when the sale order is confirmed, therefore the stock is reserved but +can not be send until approval.

+

Table of contents

+ +
+

Usage

+

To block validation of stock picking from sale orders, you need to:

+
    +
  1. Open the form view of a sale order (in status Sale Order or Locked).
  2. +
  3. Click on the button Block Delivery Validation.
  4. +
  5. The delivery validation is now blocked, the Validate button will not +appear on the related pickings.
  6. +
+

To unblock validation of stock picking from sale orders, you need to:

+
    +
  1. Open the form view of a “delivery validation blocked” sale order (in +status Sale Order or Locked).
  2. +
  3. Click on the button Unblock Delivery Validation.
  4. +
  5. The delivery validation is not blocked anymore, the Validate button +will appear on the related pickings.
  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 to smash it by providing a detailed and welcomed +feedback.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • ACSONE SA/NV
  • +
+
+
+

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/sale-workflow project on GitHub.

+

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

+
+
+
+ + diff --git a/sale_stock_picking_validation_blocking/tests/__init__.py b/sale_stock_picking_validation_blocking/tests/__init__.py new file mode 100644 index 00000000000..a64b0d449d2 --- /dev/null +++ b/sale_stock_picking_validation_blocking/tests/__init__.py @@ -0,0 +1 @@ +from . import test_sale_stock diff --git a/sale_stock_picking_validation_blocking/tests/test_sale_stock.py b/sale_stock_picking_validation_blocking/tests/test_sale_stock.py new file mode 100644 index 00000000000..80cf07433df --- /dev/null +++ b/sale_stock_picking_validation_blocking/tests/test_sale_stock.py @@ -0,0 +1,44 @@ +# Copyright 2020 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo.exceptions import ValidationError +from odoo.tests.common import TransactionCase + + +class TestSaleStock(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + partner = cls.env.ref("base.res_partner_1") + product = cls.env.ref("product.product_delivery_01") + cls.sale_order = cls.env["sale.order"].create( + { + "partner_id": partner.id, + "order_line": [ + ( + 0, + 0, + { + "name": product.name, + "product_id": product.id, + "product_uom_qty": 10.0, + "product_uom": product.uom_id.id, + }, + ) + ], + } + ) + + def test_sale_stock_picking_validation_blocked(self): + self.assertTrue(self.sale_order.hide_button_picking_validation_blocked) + self.sale_order.action_confirm() + self.assertFalse(self.sale_order.hide_button_picking_validation_blocked) + picking = self.sale_order.picking_ids + picking.move_ids.write({"quantity": 1}) + self.assertFalse(self.sale_order.picking_validation_blocked) + self.sale_order.action_block_picking_validation() + self.assertTrue(self.sale_order.picking_validation_blocked) + with self.assertRaises(ValidationError): + picking.button_validate() + self.sale_order.action_unblock_picking_validation() + picking.button_validate() diff --git a/sale_stock_picking_validation_blocking/views/sale_order.xml b/sale_stock_picking_validation_blocking/views/sale_order.xml new file mode 100644 index 00000000000..a9a5cee60f5 --- /dev/null +++ b/sale_stock_picking_validation_blocking/views/sale_order.xml @@ -0,0 +1,36 @@ + + + + + + sale.order.form (in sale_stock_picking_validation_blocking) + sale.order + + + + + + + + + + + diff --git a/sale_stock_picking_validation_blocking/views/stock_picking.xml b/sale_stock_picking_validation_blocking/views/stock_picking.xml new file mode 100644 index 00000000000..8add62993b8 --- /dev/null +++ b/sale_stock_picking_validation_blocking/views/stock_picking.xml @@ -0,0 +1,28 @@ + + + + + stock.picking.form (in sale_stock_picking_validation_blocking) + stock.picking + + + + + + + + +