diff --git a/stock_request_direction/__manifest__.py b/stock_request_direction/__manifest__.py index 1dcb93d29..9731896e9 100644 --- a/stock_request_direction/__manifest__.py +++ b/stock_request_direction/__manifest__.py @@ -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", diff --git a/stock_request_direction/models/stock_request.py b/stock_request_direction/models/stock_request.py index 732621286..03a0611ed 100644 --- a/stock_request_direction/models/stock_request.py +++ b/stock_request_direction/models/stock_request.py @@ -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 diff --git a/stock_request_direction/models/stock_request_order.py b/stock_request_direction/models/stock_request_order.py index 309261ea0..29e719c76 100644 --- a/stock_request_direction/models/stock_request_order.py +++ b/stock_request_direction/models/stock_request_order.py @@ -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