diff options
| author | Jinal Patel <jip@odoo.com> | 2019-05-31 06:29:25 +0000 |
|---|---|---|
| committer | Jinal Patel <jip@odoo.com> | 2019-06-25 04:48:43 +0000 |
| commit | faf67303b35e6b15dfe2fd4e51402db0458f7e43 (patch) | |
| tree | 5b0e84f6530d315035ddc2eead97f928fa27d951 | |
| parent | 35202202687f6292261ad01a3958df20bcf15264 (diff) | |
[REF] stock: default warehouse
In a bunch of places, a default warehouse is selected to make an operation:
- default warehouse on a sale order
- default location of an unbuild order
- default location of an inventory adjustment
Before this commit, the warehouse that was created first was always selected.
Now, we introduce a sequence field and a widget handle so that the user can
chose the default one as he wishes.
Task- 2001671
closes odoo/odoo#34085
Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
| -rw-r--r-- | addons/stock/models/stock_warehouse.py | 3 | ||||
| -rw-r--r-- | addons/stock/views/stock_warehouse_views.xml | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/addons/stock/models/stock_warehouse.py b/addons/stock/models/stock_warehouse.py index ded14cd2566..5ed2517477a 100644 --- a/addons/stock/models/stock_warehouse.py +++ b/addons/stock/models/stock_warehouse.py @@ -19,6 +19,7 @@ _logger = logging.getLogger(__name__) class Warehouse(models.Model): _name = "stock.warehouse" _description = "Warehouse" + _order = 'sequence,id' # namedtuple used in helper methods generating values for routes Routing = namedtuple('Routing', ['from_loc', 'dest_loc', 'picking_type', 'action']) @@ -69,6 +70,8 @@ class Warehouse(models.Model): 'stock.location.route', 'supplied_wh_id', 'Resupply Routes', help="Routes will be created for these resupply warehouses and you can select them on products and product categories") show_resupply = fields.Boolean(compute="_compute_show_resupply") + sequence = fields.Integer(default=10, + help="Gives the sequence of this line when displaying the warehouses.") _sql_constraints = [ ('warehouse_name_uniq', 'unique(name, company_id)', 'The name of the warehouse must be unique per company!'), ('warehouse_code_uniq', 'unique(code, company_id)', 'The code of the warehouse must be unique per company!'), diff --git a/addons/stock/views/stock_warehouse_views.xml b/addons/stock/views/stock_warehouse_views.xml index ba6df953d8a..e292d3de93e 100644 --- a/addons/stock/views/stock_warehouse_views.xml +++ b/addons/stock/views/stock_warehouse_views.xml @@ -82,6 +82,7 @@ <field name="model">stock.warehouse</field> <field name="arch" type="xml"> <tree string="Warehouse" create="false"> + <field name="sequence" widget="handle"/> <field name="name"/> <field name="active" invisible="1"/> <field name="lot_stock_id" groups="stock.group_stock_multi_locations"/> |
