Skip to content

Commit

Permalink
Merge PR OCA#1595 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by EmilioPascual
  • Loading branch information
OCA-git-bot committed May 17, 2024
2 parents dc1231b + 9ef5226 commit 3292129
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 25 deletions.
34 changes: 18 additions & 16 deletions stock_customer_deposit/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
======================
Expand Down Expand Up @@ -148,6 +149,7 @@ Contributors
- 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/>`__)

Maintainers
-----------
Expand Down
10 changes: 5 additions & 5 deletions stock_customer_deposit/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions stock_customer_deposit/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -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/))
1 change: 1 addition & 0 deletions stock_customer_deposit/readme/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


13 changes: 9 additions & 4 deletions stock_customer_deposit/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
: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.
Expand Down Expand Up @@ -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 }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -463,6 +464,7 @@ <h1><a class="toc-backref" href="#toc-entry-3">Usage</a></h1>
than you have in the deposit.</li>
<li>If you try to confirm the order with more quantity than you have in
deposit, a validation error will show.</li>
<li>Check the deposit line has 100% discount.</li>
</ol>
</div>
<div class="section" id="known-issues-roadmap">
Expand Down Expand Up @@ -495,12 +497,15 @@ <h2><a class="toc-backref" href="#toc-entry-8">Contributors</a></h2>
<li>Emilio Pascual (<a class="reference external" href="https://www.moduon.team/">Moduon</a>)</li>
<li>Rafael Blasco (<a class="reference external" href="https://www.moduon.team/">Moduon</a>)</li>
<li>Gelo Joga (<a class="reference external" href="https://www.moduon.team/">Moduon</a>)</li>
<li>Eduardo de Miguel (<a class="reference external" href="https://www.moduon.team/">Moduon</a>)</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-9">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
Expand Down
5 changes: 5 additions & 0 deletions stock_customer_deposit/tests/test_deliver_customer_deposit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 3292129

Please sign in to comment.