Added default lost_found on inventory
This commit is contained in:
1 parent
4fb35d0aea
commit
992b854acb
1 file changed
+11
-2
+11
-2
@@ -17,13 +17,13 @@ class Inventory(OSV):
|
||||
|
||||
location = fields.Many2One(
|
||||
'stock.location', 'Location', required=True,
|
||||
domain="[('type', '=', 'storage')]", states={
|
||||
domain=[('type', '=', 'storage')], states={
|
||||
'readonly': "state != 'draft' or bool(lines)",
|
||||
})
|
||||
date = fields.Date('Date', states=STATES)
|
||||
lost_found = fields.Many2One(
|
||||
'stock.location', 'Lost and Found', required=True,
|
||||
domain="[('type', '=', 'lost_found')]", states=STATES)
|
||||
domain=[('type', '=', 'lost_found')], states=STATES)
|
||||
lines = fields.One2Many(
|
||||
'stock.inventory.line', 'inventory', 'Lines', states=STATES)
|
||||
company = fields.Many2One(
|
||||
@@ -56,6 +56,15 @@ class Inventory(OSV):
|
||||
context=context)[0]
|
||||
return False
|
||||
|
||||
def default_lost_found(self, cursor, user, context=None):
|
||||
location_obj = self.pool.get('stock.location')
|
||||
location_ids = location_obj.search(cursor, user,
|
||||
self.lost_found._domain, context=context)
|
||||
if len(location_ids) == 1:
|
||||
return location_obj.name_get(cursor, user, location_ids,
|
||||
context=context)[0]
|
||||
return False
|
||||
|
||||
def set_state_cancel(self, cursor, user, ids, context=None):
|
||||
self.write(cursor, user, ids, {
|
||||
'state': 'cancel',
|
||||
|
||||
Reference in new issue
Block a user