[FIX]various fixes

This commit is contained in:
aheficent
2018-01-02 13:05:09 +01:00
committed by Chanakya Soni
parent 5a21c51677
commit 3b3a1d3fe8
3 changed files with 8 additions and 6 deletions

View File

@@ -2,7 +2,7 @@
# Copyright 2017 Eficent Business and IT Consulting Services S.L. # Copyright 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, models
class PurchaseOrderLine(models.Model): class PurchaseOrderLine(models.Model):

View File

@@ -375,6 +375,8 @@ class TestRma(common.TransactionCase):
proc.group_id]) proc.group_id])
domain = [('group_id', 'in', list(group_ids))] domain = [('group_id', 'in', list(group_ids))]
pickings = self.stockpicking.search(domain) pickings = self.stockpicking.search(domain)
procurements[0].purchase_id = self._create_purchase_order().id
wizard._get_action(pickings, procurements)
self.assertEquals(len(pickings), 2, self.assertEquals(len(pickings), 2,
"Incorrect number of pickings created") "Incorrect number of pickings created")
picking_out = pickings[1] picking_out = pickings[1]

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
@@ -50,19 +50,19 @@ class RmaAddPurchase(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 a rma route.") raise ValidationError(_("Please define a 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,
'purchase_order_line_id': line.id, 'purchase_order_line_id': line.id,