diff --git a/stock_customer_deposit/README.rst b/stock_customer_deposit/README.rst index 9a8fd6b3ad8c..29a533958e4e 100644 --- a/stock_customer_deposit/README.rst +++ b/stock_customer_deposit/README.rst @@ -100,22 +100,23 @@ View Customer deposits: Deliver customer deposits: -1. Go to Sales > Quotation. -2. Create a new quotation. -3. Select customer who has a deposit in your warehouse. -4. In page Other Info choose warehouse where deposit is located. (Only - if multi-warehouse is activated) -5. Smart button **Deposits** with deposits is displayed if the customer - has deposits in the chosen warehouse. -6. Add line with product in deposit. -7. As a product in deposit, a button **Customer deposit** will appear. - If you do not have enough in deposit, button will be grey. If you - click on the button **Customer deposit**, you can view the deposits - for that product. -8. You will only be able to confirm the order if you use less quantity - than you have in the deposit. -9. If you try to confirm the order with more quantity than you have in - deposit, a validation error will show. +1. Go to Sales > Quotation. +2. Create a new quotation. +3. Select customer who has a deposit in your warehouse. +4. In page Other Info choose warehouse where deposit is located. (Only + if multi-warehouse is activated) +5. Smart button **Deposits** with deposits is displayed if the customer + has deposits in the chosen warehouse. +6. Add line with product in deposit. +7. As a product in deposit, a button **Customer deposit** will appear. + If you do not have enough in deposit, button will be grey. If you + click on the button **Customer deposit**, you can view the deposits + for that product. +8. You will only be able to confirm the order if you use less quantity + than you have in the deposit. +9. If you try to confirm the order with more quantity than you have in + deposit, a validation error will show. +10. Check the deposit line has 100% discount. Known issues / Roadmap ====================== @@ -148,6 +149,7 @@ Contributors - Emilio Pascual (`Moduon `__) - Rafael Blasco (`Moduon `__) - Gelo Joga (`Moduon `__) +- Eduardo de Miguel (`Moduon `__) Maintainers ----------- diff --git a/stock_customer_deposit/models/sale_order_line.py b/stock_customer_deposit/models/sale_order_line.py index 9616c92c43ae..695d0bef4346 100644 --- a/stock_customer_deposit/models/sale_order_line.py +++ b/stock_customer_deposit/models/sale_order_line.py @@ -68,13 +68,13 @@ def _compute_deposit_allowed_qty(self): @api.depends( "product_id", "product_uom", "product_uom_qty", "deposit_available_qty" ) - def _compute_price_unit(self): - """Set price_unit to 0 if use_customer_deposit is True because customer paid before - for them.""" - res = super()._compute_price_unit() + def _compute_discount(self): + """Set discount to 100% if use_customer_deposit is True + because customer paid before for them.""" + res = super()._compute_discount() for line in self: if line.deposit_available_qty: - line.price_unit = 0 + line.discount = 100.0 return res @api.depends("qty_invoiced", "qty_delivered", "product_uom_qty", "state") diff --git a/stock_customer_deposit/readme/CONTRIBUTORS.md b/stock_customer_deposit/readme/CONTRIBUTORS.md index 288731831e79..c9b00b653973 100644 --- a/stock_customer_deposit/readme/CONTRIBUTORS.md +++ b/stock_customer_deposit/readme/CONTRIBUTORS.md @@ -1,3 +1,4 @@ - Emilio Pascual ([Moduon](https://www.moduon.team/)) - Rafael Blasco ([Moduon](https://www.moduon.team/)) - Gelo Joga ([Moduon](https://www.moduon.team/)) +- Eduardo de Miguel ([Moduon](https://www.moduon.team/)) diff --git a/stock_customer_deposit/readme/USAGE.md b/stock_customer_deposit/readme/USAGE.md index 6d7c1501c578..13362ac81df5 100644 --- a/stock_customer_deposit/readme/USAGE.md +++ b/stock_customer_deposit/readme/USAGE.md @@ -33,5 +33,6 @@ Deliver customer deposits: 7. As a product in deposit, a button **Customer deposit** will appear. If you do not have enough in deposit, button will be grey. If you click on the button **Customer deposit**, you can view the deposits for that product. 8. You will only be able to confirm the order if you use less quantity than you have in the deposit. 9. If you try to confirm the order with more quantity than you have in deposit, a validation error will show. +10. Check the deposit line has 100% discount. diff --git a/stock_customer_deposit/static/description/index.html b/stock_customer_deposit/static/description/index.html index 5c20e41316c0..4ae9d4a51196 100644 --- a/stock_customer_deposit/static/description/index.html +++ b/stock_customer_deposit/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -463,6 +464,7 @@

Usage

than you have in the deposit.
  • If you try to confirm the order with more quantity than you have in deposit, a validation error will show.
  • +
  • Check the deposit line has 100% discount.
  • @@ -495,12 +497,15 @@

    Contributors

  • Emilio Pascual (Moduon)
  • Rafael Blasco (Moduon)
  • Gelo Joga (Moduon)
  • +
  • Eduardo de Miguel (Moduon)
  • Maintainers

    This module is maintained by the OCA.

    -Odoo Community Association + +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.

    diff --git a/stock_customer_deposit/tests/test_deliver_customer_deposit.py b/stock_customer_deposit/tests/test_deliver_customer_deposit.py index a665427b58f6..1a8cb2b70456 100644 --- a/stock_customer_deposit/tests/test_deliver_customer_deposit.py +++ b/stock_customer_deposit/tests/test_deliver_customer_deposit.py @@ -124,6 +124,11 @@ def test_deliver_customer_deposit_sale_01(self): line.product_uom_qty = qty so = so_form.save() so.action_confirm() + # Check discount on lines + self.assertTrue( + sum(so.mapped("order_line.discount")) > 0.0, + "Discount is not set properly on order lines", + ) for partner, products in self.result_test["sale1"].items(): for product, value in products.items(): self.assertEqual(