mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[FIX]various fixes
This commit is contained in:
@@ -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,20 +46,20 @@ class RmaAddInvoice(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,
|
||||||
'invoice_line_id': line.id,
|
'invoice_line_id': line.id,
|
||||||
|
|||||||
@@ -165,7 +165,6 @@ class RmaRefund(models.TransientModel):
|
|||||||
return values
|
return values
|
||||||
|
|
||||||
@api.constrains('item_ids')
|
@api.constrains('item_ids')
|
||||||
@api.one
|
|
||||||
def check_unique_invoice_address_id(self):
|
def check_unique_invoice_address_id(self):
|
||||||
addresses = self.item_ids.mapped('invoice_address_id')
|
addresses = self.item_ids.mapped('invoice_address_id')
|
||||||
if len(addresses) > 1:
|
if len(addresses) > 1:
|
||||||
|
|||||||
Reference in New Issue
Block a user