mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[IMP] Improved Unit Test Case and Fixed Travis
This commit is contained in:
committed by
Carlos Vallés Fuster
parent
97cb9aff5e
commit
5ea392345a
@@ -171,7 +171,6 @@ class RmaOrder(models.Model):
|
||||
res = self.env.ref('rma.view_rma_line_form', False)
|
||||
else:
|
||||
res = self.env.ref('rma.view_rma_line_supplier_form', False)
|
||||
|
||||
result['views'] = [(res and res.id or False, 'form')]
|
||||
result['res_id'] = lines.id
|
||||
return result
|
||||
@@ -181,13 +180,14 @@ class RmaOrder(models.Model):
|
||||
action = self.env.ref('rma.action_rma_supplier_lines')
|
||||
result = action.read()[0]
|
||||
lines = self.rma_line_ids
|
||||
related_lines = [line.id for line in lines.supplier_rma_line_ids]
|
||||
# choose the view_mode accordingly
|
||||
if len(related_lines) != 1:
|
||||
result['domain'] = "[('id', 'in', " + \
|
||||
str(related_lines) + ")]"
|
||||
elif len(related_lines) == 1:
|
||||
res = self.env.ref('rma.view_rma_line_supplier_form', False)
|
||||
result['views'] = [(res and res.id or False, 'form')]
|
||||
result['res_id'] = related_lines[0]
|
||||
for line_id in lines:
|
||||
related_lines = [line.id for line in line_id.supplier_rma_line_ids]
|
||||
# choose the view_mode accordingly
|
||||
if len(related_lines) != 1:
|
||||
result['domain'] = "[('id', 'in', " + \
|
||||
str(related_lines) + ")]"
|
||||
elif len(related_lines) == 1:
|
||||
res = self.env.ref('rma.view_rma_line_supplier_form', False)
|
||||
result['views'] = [(res and res.id or False, 'form')]
|
||||
result['res_id'] = related_lines[0]
|
||||
return result
|
||||
|
||||
@@ -372,21 +372,21 @@ class RmaOrderLine(models.Model):
|
||||
operation = self.env['rma.operation'].search(
|
||||
[('type', '=', self.type)], limit=1)
|
||||
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:
|
||||
route = self.env['stock.location.route'].search(
|
||||
[('rma_selectable', '=', True)], limit=1)
|
||||
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:
|
||||
warehouse = self.env['stock.warehouse'].search(
|
||||
[('company_id', '=', self.company_id.id),
|
||||
('lot_rma_id', '!=', False)], limit=1)
|
||||
if not warehouse:
|
||||
raise ValidationError(
|
||||
"Please define a warehouse with a default RMA location.")
|
||||
raise ValidationError(_(
|
||||
"Please define a warehouse with a default RMA location."))
|
||||
|
||||
data = {
|
||||
'product_id': sm.product_id.id,
|
||||
|
||||
Reference in New Issue
Block a user