[FIX]various fixes

This commit is contained in:
aheficent
2018-01-02 13:05:09 +01:00
committed by ahenriquez
parent 2979c8ecc8
commit 5425e6c7d8

View File

@@ -2,7 +2,7 @@
# © 2017 Eficent Business and IT Consulting Services S.L. # © 2017 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html) # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
from odoo import api, fields, models from odoo import _, api, fields, models
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError
@@ -46,19 +46,19 @@ class RmaAddSale(models.TransientModel):
operation = self.env['rma.operation'].search( operation = self.env['rma.operation'].search(
[('type', '=', self.rma_id.type)], limit=1) [('type', '=', self.rma_id.type)], limit=1)
if not operation: if not operation:
raise ValidationError("Please define an operation first") raise ValidationError(_("Please define an operation first"))
if not operation.in_route_id or not operation.out_route_id: if not operation.in_route_id or not operation.out_route_id:
route = self.env['stock.location.route'].search( route = self.env['stock.location.route'].search(
[('rma_selectable', '=', True)], limit=1) [('rma_selectable', '=', True)], limit=1)
if not route: if not route:
raise ValidationError("Please define an rma route") raise ValidationError(_("Please define an rma route"))
if not operation.in_warehouse_id or not operation.out_warehouse_id: if not operation.in_warehouse_id or not operation.out_warehouse_id:
warehouse = self.env['stock.warehouse'].search( warehouse = self.env['stock.warehouse'].search(
[('company_id', '=', self.rma_id.company_id.id), [('company_id', '=', self.rma_id.company_id.id),
('lot_rma_id', '!=', False)], limit=1) ('lot_rma_id', '!=', False)], limit=1)
if not warehouse: if not warehouse:
raise ValidationError("Please define a warehouse with a " raise ValidationError(_("Please define a warehouse with a "
"default rma location.") "default rma location."))
data = { data = {
'partner_id': self.partner_id.id, 'partner_id': self.partner_id.id,
'sale_line_id': line.id, 'sale_line_id': line.id,