diff --git a/rma/models/procurement.py b/rma/models/procurement.py
index accbb27c..18b73f17 100644
--- a/rma/models/procurement.py
+++ b/rma/models/procurement.py
@@ -13,19 +13,20 @@ class ProcurementOrder(models.Model):
ondelete="set null",
)
- @api.model
+ @api.multi
def _get_stock_move_values(self):
res = super(ProcurementOrder, self)._get_stock_move_values()
- if self.rma_line_id:
- line = self.rma_line_id
- res['rma_line_id'] = line.id
- # Propagate partner_dest_id for proper drop-shipment reports.
- if procurement.partner_dest_id:
- res['partner_id'] = procurement.partner_dest_id.id
- dest_loc = self.env["stock.location"].browse([
- res["location_dest_id"]])[0]
- if dest_loc.usage == "internal":
- res["price_unit"] = line.price_unit
+ for procurement in self:
+ if self.rma_line_id:
+ line = self.rma_line_id
+ res['rma_line_id'] = line.id
+ # Propagate partner_dest_id for proper drop-shipment reports.
+ if procurement.partner_dest_id:
+ res['partner_id'] = procurement.partner_dest_id.id
+ dest_loc = self.env["stock.location"].browse([
+ res["location_dest_id"]])[0]
+ if dest_loc.usage == "internal":
+ res["price_unit"] = line.price_unit
return res
diff --git a/rma/models/rma_order_line.py b/rma/models/rma_order_line.py
index b0c93e4d..93aa7841 100644
--- a/rma/models/rma_order_line.py
+++ b/rma/models/rma_order_line.py
@@ -72,9 +72,8 @@ class RmaOrderLine(models.Model):
for move in rec.move_ids.filtered(
lambda m: m.state in states and op(m.location_id.usage,
rec.type)):
- qty += product_obj._compute_qty_obj(
- move.product_uom, move.product_uom_qty,
- rec.uom_id)
+ qty += product_obj._compute_quantity(
+ move.product_uom_qty, rec.uom_id)
return qty
@api.multi
@@ -636,7 +635,7 @@ class RmaOrderLine(models.Model):
res = self.env.ref('rma.view_rma_line_form', False)
result = action.read()[0]
# choose the view_mode accordingly
- if len(rma_lines) != 1:
+ if rma_lines and len(rma_lines) != 1:
result['domain'] = rma_lines.ids
elif len(rma_lines) == 1:
result['views'] = [(res and res.id or False, 'form')]
diff --git a/rma/views/rma_order_line_view.xml b/rma/views/rma_order_line_view.xml
index 7cbc254a..befac3b5 100644
--- a/rma/views/rma_order_line_view.xml
+++ b/rma/views/rma_order_line_view.xml
@@ -148,23 +148,21 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -317,48 +315,42 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+