[MIG]rma v110.0.2.0.0

This commit is contained in:
aheficent
2018-07-26 18:41:44 +02:00
committed by Florian da Costa
parent b3cf59538c
commit 29e30d5ec9
14 changed files with 711 additions and 277 deletions

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2017 Eficent Business and IT Consulting Services S.L.
# Copyright 2017-18 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
from odoo import api, fields, models
@@ -23,6 +23,14 @@ class RmaOperation(models.Model):
def _default_supplier_location_id(self):
return self.env.ref('stock.stock_location_suppliers') or False
@api.model
def _default_routes(self):
op_type = self.env.context.get('default_type')
if op_type == 'customer':
return self.env.ref('rma.route_rma_customer')
elif op_type == 'supplier':
return self.env.ref('rma.route_rma_supplier')
name = fields.Char('Description', required=True)
code = fields.Char('Code', required=True)
active = fields.Boolean(string='Active', default=True)
@@ -35,15 +43,21 @@ class RmaOperation(models.Model):
('received', 'Based on Received Quantities')],
string="Delivery Policy", default='no')
in_route_id = fields.Many2one(
'stock.location.route', string='Inbound Route',
domain=[('rma_selectable', '=', True)])
comodel_name='stock.location.route', string='Inbound Route',
domain=[('rma_selectable', '=', True)],
default=_default_routes,
)
out_route_id = fields.Many2one(
'stock.location.route', string='Outbound Route',
domain=[('rma_selectable', '=', True)])
comodel_name='stock.location.route', string='Outbound Route',
domain=[('rma_selectable', '=', True)],
default=_default_routes,
)
customer_to_supplier = fields.Boolean(
'The customer will send to the supplier', default=False)
string='The customer will send to the supplier',
)
supplier_to_customer = fields.Boolean(
'The supplier will send to the customer', default=False)
string='The supplier will send to the customer',
)
in_warehouse_id = fields.Many2one(
comodel_name='stock.warehouse', string='Inbound Warehouse',
default=_default_warehouse_id)
@@ -55,5 +69,7 @@ class RmaOperation(models.Model):
type = fields.Selection([
('customer', 'Customer'), ('supplier', 'Supplier')],
string="Used in RMA of this type", required=True)
rma_line_ids = fields.One2many('rma.order.line', 'operation_id',
'RMA lines')
rma_line_ids = fields.One2many(
comodel_name='rma.order.line', inverse_name='operation_id',
string='RMA lines',
)