From 4fb35d0aea09ead4201ecfccc22971b14b757d78 Mon Sep 17 00:00:00 2001 From: Bertrand Chenal Date: Tue, 11 Nov 2008 23:31:30 +0100 Subject: [PATCH] Added default_warehouse on packings --- packing.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packing.py b/packing.py index 0b01f32614..3c51642e1e 100644 --- a/packing.py +++ b/packing.py @@ -84,6 +84,15 @@ class PackingIn(OSV): def default_state(self, cursor, user, context=None): return 'draft' + def default_warehouse(self, cursor, user, context=None): + location_obj = self.pool.get('stock.location') + location_ids = location_obj.search(cursor, user, + self.warehouse._domain, context=context) + if len(location_ids) == 1: + return location_obj.name_get(cursor, user, location_ids, + context=context)[0] + return False + def on_change_supplier(self, cursor, user, ids, values, context=None): if not values.get('supplier'): return {} @@ -342,6 +351,15 @@ class PackingOut(OSV): def default_state(self, cursor, user, context=None): return 'draft' + def default_warehouse(self, cursor, user, context=None): + location_obj = self.pool.get('stock.location') + location_ids = location_obj.search(cursor, user, + self.warehouse._domain, context=context) + if len(location_ids) == 1: + return location_obj.name_get(cursor, user, location_ids, + context=context)[0] + return False + def on_change_customer(self, cursor, user, ids, values, context=None): if not values.get('customer'): return {}