mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[IMP] stock_request_direction: black, isort
This commit is contained in:
@@ -4,15 +4,12 @@
|
|||||||
{
|
{
|
||||||
"name": "Stock Requests Direction",
|
"name": "Stock Requests Direction",
|
||||||
"summary": "From or to your warehouse?",
|
"summary": "From or to your warehouse?",
|
||||||
"version": "12.0.1.0.1",
|
"version": "13.0.1.0.0",
|
||||||
"license": "LGPL-3",
|
"license": "LGPL-3",
|
||||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||||
"author": "Open Source Integrators, "
|
"author": "Open Source Integrators, " "Odoo Community Association (OCA)",
|
||||||
"Odoo Community Association (OCA)",
|
|
||||||
"category": "Warehouse Management",
|
"category": "Warehouse Management",
|
||||||
"depends": [
|
"depends": ["stock_request"],
|
||||||
"stock_request",
|
|
||||||
],
|
|
||||||
"data": [
|
"data": [
|
||||||
"views/res_config_settings.xml",
|
"views/res_config_settings.xml",
|
||||||
"views/stock_request_views.xml",
|
"views/stock_request_views.xml",
|
||||||
|
|||||||
@@ -7,17 +7,18 @@ from odoo import api, fields, models
|
|||||||
class StockRequest(models.Model):
|
class StockRequest(models.Model):
|
||||||
_inherit = "stock.request"
|
_inherit = "stock.request"
|
||||||
|
|
||||||
direction = fields.Selection([('outbound', 'Outbound'),
|
direction = fields.Selection(
|
||||||
('inbound', 'Inbound')],
|
[("outbound", "Outbound"), ("inbound", "Inbound")],
|
||||||
string='Direction',
|
string="Direction",
|
||||||
states={'draft': [('readonly', False)]},
|
states={"draft": [("readonly", False)]},
|
||||||
readonly=True)
|
readonly=True,
|
||||||
|
)
|
||||||
|
|
||||||
@api.onchange('direction')
|
@api.onchange("direction")
|
||||||
def _onchange_location_id(self):
|
def _onchange_location_id(self):
|
||||||
if self.direction == 'outbound':
|
if self.direction == "outbound":
|
||||||
# Partner Locations/Customers
|
# Partner Locations/Customers
|
||||||
self.location_id = self.env.ref('stock.stock_location_customers')
|
self.location_id = self.env.ref("stock.stock_location_customers")
|
||||||
else:
|
else:
|
||||||
# Otherwise the Stock Location of the Warehouse
|
# Otherwise the Stock Location of the Warehouse
|
||||||
self.location_id = self.warehouse_id.lot_stock_id.id
|
self.location_id = self.warehouse_id.lot_stock_id.id
|
||||||
|
|||||||
@@ -5,27 +5,26 @@ from odoo import api, fields, models
|
|||||||
|
|
||||||
|
|
||||||
class StockRequestOrder(models.Model):
|
class StockRequestOrder(models.Model):
|
||||||
_inherit = 'stock.request.order'
|
_inherit = "stock.request.order"
|
||||||
|
|
||||||
direction = fields.Selection([('outbound', 'Outbound'),
|
direction = fields.Selection(
|
||||||
('inbound', 'Inbound')],
|
[("outbound", "Outbound"), ("inbound", "Inbound")],
|
||||||
string='Direction',
|
string="Direction",
|
||||||
states={'draft': [('readonly', False)]},
|
states={"draft": [("readonly", False)]},
|
||||||
readonly=True)
|
readonly=True,
|
||||||
|
)
|
||||||
|
|
||||||
@api.onchange('direction')
|
@api.onchange("direction")
|
||||||
def _onchange_location_id(self):
|
def _onchange_location_id(self):
|
||||||
if self.direction == 'outbound':
|
if self.direction == "outbound":
|
||||||
# Stock Location set to Partner Locations/Customers
|
# Stock Location set to Partner Locations/Customers
|
||||||
self.location_id = \
|
self.location_id = self.company_id.partner_id.property_stock_customer.id
|
||||||
self.company_id.partner_id.property_stock_customer.id
|
|
||||||
else:
|
else:
|
||||||
# Otherwise the Stock Location of the Warehouse
|
# Otherwise the Stock Location of the Warehouse
|
||||||
self.location_id = \
|
self.location_id = self.warehouse_id.lot_stock_id.id
|
||||||
self.warehouse_id.lot_stock_id.id
|
|
||||||
|
|
||||||
def change_childs(self):
|
def change_childs(self):
|
||||||
super().change_childs()
|
super().change_childs()
|
||||||
if not self._context.get('no_change_childs', False):
|
if not self._context.get("no_change_childs", False):
|
||||||
for line in self.stock_request_ids:
|
for line in self.stock_request_ids:
|
||||||
line.direction = self.direction
|
line.direction = self.direction
|
||||||
|
|||||||
Reference in New Issue
Block a user