diff --git a/rma/wizards/rma_add_stock_move.py b/rma/wizards/rma_add_stock_move.py index 10c48b31..3ba80672 100644 --- a/rma/wizards/rma_add_stock_move.py +++ b/rma/wizards/rma_add_stock_move.py @@ -10,8 +10,8 @@ class RmaAddStockMove(models.TransientModel): _description = 'Wizard to add rma lines from pickings' @api.model - def default_get(self, fields): - res = super(RmaAddStockMove, self).default_get(fields) + def default_get(self, fields_list): + res = super(RmaAddStockMove, self).default_get(fields_list) rma_obj = self.env['rma.order'] rma_id = self.env.context['active_ids'] or [] active_model = self.env.context['active_model'] diff --git a/rma/wizards/rma_make_picking.py b/rma/wizards/rma_make_picking.py index 792a9b23..8e5170b5 100644 --- a/rma/wizards/rma_make_picking.py +++ b/rma/wizards/rma_make_picking.py @@ -26,13 +26,13 @@ class RmaMakePicking(models.TransientModel): return values @api.model - def default_get(self, fields): + def default_get(self, fields_list): """Default values for wizard, if there is more than one supplier on lines the supplier field is empty otherwise is the unique line supplier. """ context = self._context.copy() - res = super(RmaMakePicking, self).default_get(fields) + res = super(RmaMakePicking, self).default_get(fields_list) rma_line_obj = self.env['rma.order.line'] rma_line_ids = self.env.context['active_ids'] or [] active_model = self.env.context['active_model'] diff --git a/rma/wizards/rma_order_line_make_supplier_rma.py b/rma/wizards/rma_order_line_make_supplier_rma.py index 50b79267..e8d976c9 100644 --- a/rma/wizards/rma_order_line_make_supplier_rma.py +++ b/rma/wizards/rma_order_line_make_supplier_rma.py @@ -47,9 +47,9 @@ class RmaLineMakeSupplierRma(models.TransientModel): } @api.model - def default_get(self, fields): + def default_get(self, fields_list): res = super(RmaLineMakeSupplierRma, self).default_get( - fields) + fields_list) rma_line_obj = self.env['rma.order.line'] rma_line_ids = self.env.context['active_ids'] or [] active_model = self.env.context['active_model'] diff --git a/rma_account/wizards/rma_add_invoice.py b/rma_account/wizards/rma_add_invoice.py index 8c44205d..f766b6f6 100644 --- a/rma_account/wizards/rma_add_invoice.py +++ b/rma_account/wizards/rma_add_invoice.py @@ -10,8 +10,8 @@ class RmaAddInvoice(models.TransientModel): _description = 'Wizard to add rma lines' @api.model - def default_get(self, fields): - res = super(RmaAddInvoice, self).default_get(fields) + def default_get(self, fields_list): + res = super(RmaAddInvoice, self).default_get(fields_list) rma_obj = self.env['rma.order'] rma_id = self.env.context['active_ids'] or [] active_model = self.env.context['active_model'] diff --git a/rma_account/wizards/rma_refund.py b/rma_account/wizards/rma_refund.py index 553b5449..0e06ee16 100644 --- a/rma_account/wizards/rma_refund.py +++ b/rma_account/wizards/rma_refund.py @@ -32,13 +32,13 @@ class RmaRefund(models.TransientModel): return values @api.model - def default_get(self, fields): + def default_get(self, fields_list): """Default values for wizard, if there is more than one supplier on lines the supplier field is empty otherwise is the unique line supplier. """ context = self._context.copy() - res = super(RmaRefund, self).default_get(fields) + res = super(RmaRefund, self).default_get(fields_list) rma_line_obj = self.env['rma.order.line'] rma_line_ids = self.env.context['active_ids'] or [] active_model = self.env.context['active_model'] diff --git a/rma_internal_transfer/wizards/rma_internal_transfer.py b/rma_internal_transfer/wizards/rma_internal_transfer.py index 5a4ae09d..1083c20f 100644 --- a/rma_internal_transfer/wizards/rma_internal_transfer.py +++ b/rma_internal_transfer/wizards/rma_internal_transfer.py @@ -24,13 +24,13 @@ class RmaMakePicking(models.TransientModel): return values @api.model - def default_get(self, fields): + def default_get(self, fields_list): """Default values for wizard, if there is more than one supplier on lines the supplier field is empty otherwise is the unique line supplier. """ context = self._context.copy() - res = super(RmaMakePicking, self).default_get(fields) + res = super(RmaMakePicking, self).default_get(fields_list) rma_line_obj = self.env['rma.order.line'] rma_line_ids = self.env.context['active_ids'] or [] active_model = self.env.context['active_model'] @@ -51,8 +51,8 @@ class RmaMakePicking(models.TransientModel): types = self.env['stock.picking.type'].search( [('code', '=', 'internal'), - ('warehouse_id.company_id', '=', - line.in_warehouse_id.id)])[:1] + ('warehouse_id', 'in', + lines.mapped('in_warehouse_id').ids)])[:1] if not types: raise ValidationError(_('Please define an internal picking type ' 'for this warehouse')) diff --git a/rma_purchase/wizards/rma_add_purchase.py b/rma_purchase/wizards/rma_add_purchase.py index f84a81ef..e4a89e91 100644 --- a/rma_purchase/wizards/rma_add_purchase.py +++ b/rma_purchase/wizards/rma_add_purchase.py @@ -10,8 +10,8 @@ class RmaAddPurchase(models.TransientModel): _description = 'Wizard to add rma lines' @api.model - def default_get(self, fields): - res = super(RmaAddPurchase, self).default_get(fields) + def default_get(self, fields_list): + res = super(RmaAddPurchase, self).default_get(fields_list) rma_obj = self.env['rma.order'] rma_id = self.env.context['active_ids'] or [] active_model = self.env.context['active_model'] diff --git a/rma_purchase/wizards/rma_order_line_make_purchase_order.py b/rma_purchase/wizards/rma_order_line_make_purchase_order.py index cd34a4f1..17d13bf0 100644 --- a/rma_purchase/wizards/rma_order_line_make_purchase_order.py +++ b/rma_purchase/wizards/rma_order_line_make_purchase_order.py @@ -34,9 +34,9 @@ class RmaLineMakePurchaseOrder(models.TransientModel): } @api.model - def default_get(self, fields): + def default_get(self, fields_list): res = super(RmaLineMakePurchaseOrder, self).default_get( - fields) + fields_list) rma_line_obj = self.env['rma.order.line'] rma_line_ids = self.env.context['active_ids'] or [] active_model = self.env.context['active_model'] @@ -109,16 +109,10 @@ class RmaLineMakePurchaseOrder(models.TransientModel): po_line_obj.create(po_line_data) res.append(purchase.id) - return { - 'domain': "[('id','in', ["+','.join(map(str, res))+"])]", - 'name': _('Request for Quotation'), - 'view_type': 'form', - 'view_mode': 'tree,form', - 'res_model': 'purchase.order', - 'view_id': False, - 'context': False, - 'type': 'ir.actions.act_window' - } + action = self.env.ref('purchase.purchase_rfq') + result = action.read()[0] + result['domain'] = "[('id','in', ["+','.join(map(str, res))+"])]" + return result class RmaLineMakePurchaseOrderItem(models.TransientModel): diff --git a/rma_repair/wizards/rma_order_line_make_repair.py b/rma_repair/wizards/rma_order_line_make_repair.py index 7ecec20c..a65dd91a 100644 --- a/rma_repair/wizards/rma_order_line_make_repair.py +++ b/rma_repair/wizards/rma_order_line_make_repair.py @@ -37,9 +37,9 @@ class RmaLineMakeRepair(models.TransientModel): } @api.model - def default_get(self, fields): + def default_get(self, fields_list): res = super(RmaLineMakeRepair, self).default_get( - fields) + fields_list) rma_line_obj = self.env['rma.order.line'] rma_line_ids = self.env.context['active_ids'] or [] active_model = self.env.context['active_model'] diff --git a/rma_sale/wizards/rma_add_sale.py b/rma_sale/wizards/rma_add_sale.py index 0946b082..306d61f8 100644 --- a/rma_sale/wizards/rma_add_sale.py +++ b/rma_sale/wizards/rma_add_sale.py @@ -10,8 +10,8 @@ class RmaAddSale(models.TransientModel): _description = 'Wizard to add rma lines from SO lines' @api.model - def default_get(self, fields): - res = super(RmaAddSale, self).default_get(fields) + def default_get(self, fields_list): + res = super(RmaAddSale, self).default_get(fields_list) rma_obj = self.env['rma.order'] rma_id = self.env.context['active_ids'] or [] active_model = self.env.context['active_model'] diff --git a/rma_sale/wizards/rma_order_line_make_sale_order.py b/rma_sale/wizards/rma_order_line_make_sale_order.py index b5577c81..0cba6c9f 100644 --- a/rma_sale/wizards/rma_order_line_make_sale_order.py +++ b/rma_sale/wizards/rma_order_line_make_sale_order.py @@ -23,7 +23,6 @@ class RmaLineMakeSaleOrder(models.TransientModel): def _prepare_item(self, line): return { 'line_id': line.id, - 'rma_line_id': line.id, 'product_id': line.product_id.id, 'name': line.product_id.name, 'product_qty': line.qty_to_sell, @@ -33,9 +32,9 @@ class RmaLineMakeSaleOrder(models.TransientModel): } @api.model - def default_get(self, fields): + def default_get(self, fields_list): res = super(RmaLineMakeSaleOrder, self).default_get( - fields) + fields_list) rma_line_obj = self.env['rma.order.line'] rma_line_ids = self.env.context['active_ids'] or [] active_model = self.env.context['active_model'] @@ -59,13 +58,13 @@ class RmaLineMakeSaleOrder(models.TransientModel): return res @api.model - def _prepare_sale_order(self, out_warehouse, company): + def _prepare_sale_order(self, out_warehouse, company, item): if not self.partner_id: raise exceptions.Warning( _('Enter a customer.')) customer = self.partner_id data = { - 'origin': '', + 'origin': item.line_id.name, 'partner_id': customer.id, 'warehouse_id': out_warehouse.id, 'company_id': company.id, @@ -103,24 +102,20 @@ class RmaLineMakeSaleOrder(models.TransientModel): if self.sale_order_id: sale = self.sale_order_id if not sale: - po_data = self._prepare_sale_order(line.out_warehouse_id, - line.company_id) + po_data = self._prepare_sale_order( + line.out_warehouse_id, + line.company_id, + item) sale = sale_obj.create(po_data) so_line_data = self._prepare_sale_order_line(sale, item) so_line_obj.create(so_line_data) res.append(sale.id) - return { - 'domain': "[('id','in', ["+','.join(map(str, res))+"])]", - 'name': _('Quotations'), - 'view_type': 'form', - 'view_mode': 'tree,form', - 'res_model': 'sale.order', - 'view_id': False, - 'context': False, - 'type': 'ir.actions.act_window' - } + action = self.env.ref('sale.action_orders') + result = action.read()[0] + result['domain'] = "[('id','in', ["+','.join(map(str, res))+"])]" + return result class RmaLineMakeSaleOrderItem(models.TransientModel):