Skip to content

Commit 595bf65

Browse files
[MIG] stock_return_request: Migration to version 18.0
1 parent fdb17ce commit 595bf65

14 files changed

+551
-383
lines changed

stock_return_request/README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ Contributors
9090
- Pedro M. Baeza
9191
- David Vidal
9292
- César A. Sánchez
93+
- Carlos Lopez
9394

9495
- `Pro Thai <http://prothaitechnology.com>`__:
9596

stock_return_request/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
33
{
44
"name": "Stock Return Request",
5-
"version": "15.0.1.0.2",
5+
"version": "18.0.1.0.0",
66
"category": "Stock",
77
"website": "https://github.com/OCA/stock-logistics-request",
88
"author": "Tecnativa, " "Odoo Community Association (OCA)",

stock_return_request/data/stock_return_request_data.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
<field name="padding">5</field>
88
<field name="number_next">1</field>
99
<field name="number_increment">1</field>
10+
<field name="company_id" eval="False" />
1011
</record>
1112
</odoo>

stock_return_request/models/stock_move.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,18 @@ class StockMove(models.Model):
1010
digits="Product Unit of Measure",
1111
string="Returnable Quantity",
1212
compute="_compute_qty_returnable",
13-
readonly=True,
1413
)
1514

1615
def _compute_qty_returnable(self):
1716
"""Looks for chained returned moves to compute how much quantity
1817
from the original can be returned"""
18+
self.qty_returnable = 0
1919
for move in self.filtered(lambda x: x.state not in ["draft", "cancel"]):
2020
if not move.returned_move_ids:
2121
if move.state == "done":
22-
move.qty_returnable = move.quantity_done
23-
else:
24-
# TODO: Review if this option has sense
25-
move.qty_returnable = move.reserved_availability
22+
move.qty_returnable = move.quantity
2623
continue
27-
move.qty_returnable = move.quantity_done - sum(
24+
move.qty_returnable = move.quantity - sum(
2825
move.returned_move_ids.mapped("qty_returnable")
2926
)
3027

@@ -33,15 +30,12 @@ def _get_lot_returnable_qty(self, lot_id, qty=0):
3330
from the original can be returned for a given lot"""
3431
for move in self.filtered(lambda x: x.state not in ["draft", "cancel"]):
3532
mls = move.move_line_ids.filtered(lambda x: x.lot_id == lot_id)
36-
if move.state == "done":
37-
qty += sum(mls.mapped("qty_done"))
38-
else:
39-
qty += sum(mls.mapped("product_uom_qty"))
33+
qty += sum(mls.mapped("quantity"))
4034
qty -= move.returned_move_ids._get_lot_returnable_qty(lot_id)
4135
return qty
4236

4337
def _action_assign(self):
4438
if self.env.context.get("skip_assign_move", False):
4539
# Avoid assign stock moves allowing create stock move lines manually
4640
return
47-
return super(StockMove, self)._action_assign()
41+
return super()._action_assign()

0 commit comments

Comments
 (0)