[IMP] stock_location_bin_name: black, isort

This commit is contained in:
Guewen Baconnier
2019-12-19 11:48:41 +01:00
committed by Hai Lang
parent 8af14c98a2
commit 1d2f33d966
2 changed files with 21 additions and 26 deletions

View File

@@ -3,20 +3,15 @@
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
{
'name': 'Stock Location Bin Name',
'version': '12.0.1.0.0',
'author': "BCIM, Okia, Camptocamp, Odoo Community Association (OCA)",
'website': "https://github.com/OCA/stock-logistics-warehouse",
'summary': "Compute bin stock location name automatically",
'category': 'Stock Management',
'depends': [
'stock_location_zone',
'stock_location_attribute',
],
'data': [
'views/stock_location.xml',
],
'installable': True,
'development_status': 'Alpha',
'license': 'AGPL-3',
"name": "Stock Location Bin Name",
"version": "12.0.1.0.0",
"author": "BCIM, Okia, Camptocamp, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"summary": "Compute bin stock location name automatically",
"category": "Stock Management",
"depends": ["stock_location_zone", "stock_location_attribute"],
"data": ["views/stock_location.xml"],
"installable": True,
"development_status": "Alpha",
"license": "AGPL-3",
}

View File

@@ -7,30 +7,30 @@ from odoo import api, fields, models
class StockLocation(models.Model):
_inherit = 'stock.location'
_inherit = "stock.location"
location_name_format = fields.Char(
'Location Name Format',
"Location Name Format",
help="Format string that will compute the name of the location. "
"Use location fields. Example: "
"'{area}-{corridor:0>2}.{rack:0>3}"
".{level:0>2}'")
".{level:0>2}'",
)
area = fields.Char(
string='Area',
string="Area",
# Field used for _onchange_attribute_compute_name, so we
# have the name in the record's cache. Does not need to be
# stored as we already have 'area_location_id'
related='area_location_id.name',
related="area_location_id.name",
readonly=True,
)
@api.multi
@api.onchange('corridor', 'row', 'rack', 'level',
'posx', 'posy', 'posz')
@api.onchange("corridor", "row", "rack", "level", "posx", "posy", "posz")
def _onchange_attribute_compute_name(self):
for location in self:
if not location.location_kind == 'bin':
if not location.location_kind == "bin":
continue
area = location
while area and not area.location_name_format: