mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
24 lines
884 B
Python
24 lines
884 B
Python
# Copyright (c) 2019 Open Source Integrators
|
|
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class StockRequest(models.Model):
|
|
_inherit = "stock.request"
|
|
|
|
direction = fields.Selection([('outbound', 'Outbound'),
|
|
('inbound', 'Inbound')],
|
|
string='Direction',
|
|
states={'draft': [('readonly', False)]},
|
|
readonly=True)
|
|
|
|
@api.onchange('direction')
|
|
def _onchange_location_id(self):
|
|
if self.direction == 'outbound':
|
|
# Partner Locations/Customers
|
|
self.location_id = self.env.ref('stock.stock_location_customers')
|
|
else:
|
|
# Otherwise the Stock Location of the Warehouse
|
|
self.location_id = self.warehouse_id.lot_stock_id.id
|