From c47f6f75219c82bfd22f857f592d80e50fb400e8 Mon Sep 17 00:00:00 2001 From: Bhavesh Odedra Date: Wed, 14 Feb 2018 19:22:41 +0530 Subject: [PATCH] [IMP] Various improvements --- rma/models/rma_order_line.py | 14 ++++---- rma/views/product_view.xml | 21 ++++++----- rma/wizards/rma_make_picking_view.xml | 4 +-- .../rma_order_line_make_supplier_rma_view.xml | 35 +++++++------------ 4 files changed, 36 insertions(+), 38 deletions(-) diff --git a/rma/models/rma_order_line.py b/rma/models/rma_order_line.py index 78e60dee..454af5cc 100644 --- a/rma/models/rma_order_line.py +++ b/rma/models/rma_order_line.py @@ -46,16 +46,18 @@ class RmaOrderLine(models.Model): @api.multi def _compute_in_shipment_count(self): for line in self: - line.in_shipment_count = len(self.env['stock.picking'].search( - [('origin', '=', line.name), - ('picking_type_code', '=', 'incoming')]).ids) + moves = self.env['stock.move'].search([ + ('rma_line_id', '=', line.id)]) + line.in_shipment_count = len(moves.mapped('picking_id').filtered( + lambda p: p.picking_type_code == 'incoming').ids) @api.multi def _compute_out_shipment_count(self): for line in self: - line.out_shipment_count = len(self.env['stock.picking'].search( - [('origin', '=', line.name), - ('picking_type_code', '=', 'outgoing')]).ids) + moves = self.env['stock.move'].search([ + ('rma_line_id', '=', line.id)]) + line.out_shipment_count = len(moves.mapped('picking_id').filtered( + lambda p: p.picking_type_code == 'outgoing').ids) @api.multi def _get_rma_move_qty(self, states, direction='in'): diff --git a/rma/views/product_view.xml b/rma/views/product_view.xml index aeb6da9d..a2810600 100755 --- a/rma/views/product_view.xml +++ b/rma/views/product_view.xml @@ -3,13 +3,16 @@ product.category.form product.category - + - + - - - + + + @@ -20,11 +23,13 @@ product.template - + - - + + diff --git a/rma/wizards/rma_make_picking_view.xml b/rma/wizards/rma_make_picking_view.xml index 126bf191..61bd41de 100755 --- a/rma/wizards/rma_make_picking_view.xml +++ b/rma/wizards/rma_make_picking_view.xml @@ -61,26 +61,26 @@ Create Incoming Shipment ir.actions.act_window rma_make_picking.wizard - rma.order.line form form new {'picking_type': 'incoming'} + Create Delivery ir.actions.act_window rma_make_picking.wizard - rma.order.line form form new {'picking_type': 'outgoing'} + diff --git a/rma/wizards/rma_order_line_make_supplier_rma_view.xml b/rma/wizards/rma_order_line_make_supplier_rma_view.xml index 1129702f..1ba47921 100755 --- a/rma/wizards/rma_order_line_make_supplier_rma_view.xml +++ b/rma/wizards/rma_order_line_make_supplier_rma_view.xml @@ -56,29 +56,20 @@ form new + - - - - rma.order.line.supplier.rma.form - rma.order.line - - -
-
-
+ + rma.order.line.supplier.rma.form + rma.order.line + + +
+
+