[IMP] stock_request_direction: black, isort

This commit is contained in:
ps-tubtim
2020-03-13 14:19:14 +07:00
committed by Freni Patel
parent 9bfe3101c3
commit d6c008f8ad
3 changed files with 24 additions and 27 deletions

View File

@@ -4,15 +4,12 @@
{
"name": "Stock Requests Direction",
"summary": "From or to your warehouse?",
"version": "12.0.1.0.1",
"version": "13.0.1.0.0",
"license": "LGPL-3",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"author": "Open Source Integrators, "
"Odoo Community Association (OCA)",
"author": "Open Source Integrators, " "Odoo Community Association (OCA)",
"category": "Warehouse Management",
"depends": [
"stock_request",
],
"depends": ["stock_request"],
"data": [
"views/res_config_settings.xml",
"views/stock_request_views.xml",

View File

@@ -7,17 +7,18 @@ 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)
direction = fields.Selection(
[("outbound", "Outbound"), ("inbound", "Inbound")],
string="Direction",
states={"draft": [("readonly", False)]},
readonly=True,
)
@api.onchange('direction')
@api.onchange("direction")
def _onchange_location_id(self):
if self.direction == 'outbound':
if self.direction == "outbound":
# Partner Locations/Customers
self.location_id = self.env.ref('stock.stock_location_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

View File

@@ -5,27 +5,26 @@ from odoo import api, fields, models
class StockRequestOrder(models.Model):
_inherit = 'stock.request.order'
_inherit = "stock.request.order"
direction = fields.Selection([('outbound', 'Outbound'),
('inbound', 'Inbound')],
string='Direction',
states={'draft': [('readonly', False)]},
readonly=True)
direction = fields.Selection(
[("outbound", "Outbound"), ("inbound", "Inbound")],
string="Direction",
states={"draft": [("readonly", False)]},
readonly=True,
)
@api.onchange('direction')
@api.onchange("direction")
def _onchange_location_id(self):
if self.direction == 'outbound':
if self.direction == "outbound":
# Stock Location set to Partner Locations/Customers
self.location_id = \
self.company_id.partner_id.property_stock_customer.id
self.location_id = self.company_id.partner_id.property_stock_customer.id
else:
# 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
def change_childs(self):
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:
line.direction = self.direction