Skip to content

Commit 6f279fd

Browse files
committed
Merge PR #1309 into 16.0
Signed-off-by hparfr
2 parents a5a4541 + 6b8ea8d commit 6f279fd

15 files changed

+705
-0
lines changed

sale_line_returned_qty/README.rst

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
======================
2+
Sale Line Returned Qty
3+
======================
4+
5+
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6+
!! This file is generated by oca-gen-addon-readme !!
7+
!! changes will be overwritten. !!
8+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9+
10+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
11+
:target: https://odoo-community.org/page/development-status
12+
:alt: Beta
13+
.. |badge2| image:: https://img.shields.io/badge/licence-LGPL--3-blue.png
14+
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
15+
:alt: License: LGPL-3
16+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github
17+
:target: https://github.com/OCA/stock-logistics-workflow/tree/16.0/sale_line_returned_qty
18+
:alt: OCA/stock-logistics-workflow
19+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20+
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-sale_line_returned_qty
21+
:alt: Translate me on Weblate
22+
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23+
:target: https://runbot.odoo-community.org/runbot/154/16.0
24+
:alt: Try me on Runbot
25+
26+
|badge1| |badge2| |badge3| |badge4| |badge5|
27+
28+
This module adds the returned quantity of sale order lines as a computed field.
29+
30+
**Table of contents**
31+
32+
.. contents::
33+
:local:
34+
35+
Bug Tracker
36+
===========
37+
38+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/issues>`_.
39+
In case of trouble, please check there if your issue has already been reported.
40+
If you spotted it first, help us smashing it by providing a detailed and welcomed
41+
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20sale_line_returned_qty%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
42+
43+
Do not contact contributors directly about support or help with technical issues.
44+
45+
Credits
46+
=======
47+
48+
Authors
49+
~~~~~~~
50+
51+
* ForgeFlow
52+
53+
Contributors
54+
~~~~~~~~~~~~
55+
56+
* `ForgeFlow <https://www.forgeflow.com>`_:
57+
58+
* Jordi Masvidal
59+
60+
Maintainers
61+
~~~~~~~~~~~
62+
63+
This module is maintained by the OCA.
64+
65+
.. image:: https://odoo-community.org/logo.png
66+
:alt: Odoo Community Association
67+
:target: https://odoo-community.org
68+
69+
OCA, or the Odoo Community Association, is a nonprofit organization whose
70+
mission is to support the collaborative development of Odoo features and
71+
promote its widespread use.
72+
73+
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/16.0/sale_line_returned_qty>`_ project on GitHub.
74+
75+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

sale_line_returned_qty/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com)
2+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
3+
4+
{
5+
"name": "Sale Line Returned Qty",
6+
"summary": "Track returned quantity of sale order lines.",
7+
"version": "16.0.1.0.0",
8+
"category": "Sales",
9+
"website": "https://github.com/OCA/stock-logistics-workflow",
10+
"author": "ForgeFlow, Odoo Community Association (OCA)",
11+
"license": "LGPL-3",
12+
"installable": True,
13+
"depends": ["sale_stock"],
14+
"data": ["views/sale_order_views.xml"],
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_line_returned_qty
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 15.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: sale_line_returned_qty
17+
#: model_terms:ir.ui.view,arch_db:sale_line_returned_qty.view_order_form
18+
msgid "Returned"
19+
msgstr ""
20+
21+
#. module: sale_line_returned_qty
22+
#: model:ir.model.fields,field_description:sale_line_returned_qty.field_sale_order_line__qty_returned
23+
msgid "Returned Qty"
24+
msgstr ""
25+
26+
#. module: sale_line_returned_qty
27+
#: model:ir.model,name:sale_line_returned_qty.model_sale_order_line
28+
msgid "Sales Order Line"
29+
msgstr ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import sale_order_line
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2022 ForgeFlow S.L. (https://www.forgeflow.com)
2+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
3+
4+
from odoo import api, fields, models
5+
6+
7+
class SaleOrderLine(models.Model):
8+
_inherit = "sale.order.line"
9+
10+
qty_returned = fields.Float(
11+
compute="_compute_qty_returned",
12+
string="Returned Qty",
13+
store=True,
14+
readonly=True,
15+
compute_sudo=True,
16+
digits="Product Unit of Measure",
17+
default=0.0,
18+
copy=False,
19+
)
20+
21+
@api.depends(
22+
"move_ids.state",
23+
"move_ids.scrapped",
24+
"move_ids.product_uom_qty",
25+
"move_ids.product_uom",
26+
)
27+
def _compute_qty_returned(self):
28+
for line in self:
29+
qty = 0.0
30+
if line.qty_delivered_method == "stock_move":
31+
_, incoming_moves = line._get_outgoing_incoming_moves()
32+
for move in incoming_moves:
33+
if move.state != "done":
34+
continue
35+
qty += move.product_uom._compute_quantity(
36+
move.product_uom_qty,
37+
line.product_uom,
38+
rounding_method="HALF-UP",
39+
)
40+
line.qty_returned = qty
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
* `ForgeFlow <https://www.forgeflow.com>`_:
2+
3+
* Jordi Masvidal
4+
* Pau Sanchez (pau.sanchez@qubiq.es)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This module adds the quantity returned field in the lines of the sale. The quantity appears if a return delivery note is created and validated.
Loading

0 commit comments

Comments
 (0)