Merge lp:~syleam/wms/5.0-christophe-chauvet into lp:wms

Proposed by Christophe CHAUVET
Status: Merged
Merged at revision: 227
Proposed branch: lp:~syleam/wms/5.0-christophe-chauvet
Merge into: lp:wms
Diff against target: 68 lines (+12/-4)
1 file modified
wms_inventory/object/inventory.py (+12/-4)
To merge this branch: bzr merge lp:~syleam/wms/5.0-christophe-chauvet
Reviewer Review Type Date Requested Status
Christophe CHAUVET Approve
Review via email: mp+60282@code.launchpad.net
To post a comment you must log in.
227. By Christophe CHAUVET

merge

Revision history for this message
Christophe CHAUVET (christophe-chauvet) wrote :

ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'wms_inventory/object/inventory.py'
2--- wms_inventory/object/inventory.py 2011-03-25 11:39:15 +0000
3+++ wms_inventory/object/inventory.py 2011-05-07 15:36:33 +0000
4@@ -32,6 +32,7 @@
5 import time
6 import tempfile
7 import base64
8+import time
9
10
11 class Inventory(osv.osv):
12@@ -42,11 +43,13 @@
13 help='If global, reset all quantity product not found in this inventory'),
14 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True,
15 help='Select the warehouse where the inventory is made'),
16+ 'state': fields.selection([('draft', 'Draft'), ('progress', 'Progress'), ('done', 'Done')], 'Status', readonly=True),
17 }
18
19 _defaults = {
20 'type': lambda *a: 'partial',
21 'warehouse_id': lambda obj, cr, uid, context: obj.pool.get('res.users')._default_warehouse(cr, uid, context),
22+ 'state': lambda *a: 'draft',
23 }
24
25 def copy(self, cr, uid, id, default=None, context=None):
26@@ -64,6 +67,9 @@
27 """
28 Validate the inventory, it take a lot of time and must be launch in multi thread
29 """
30+ if context is None:
31+ context = {}
32+
33 def threading_done(cr, uid, ids, context=None):
34 """
35 Treatment launch as a new thread
36@@ -242,7 +248,7 @@
37 vals = {
38 'datas': base64.encodestring(outfp.read()),
39 'datas_fname': 'inv_%s.log' % inv.name.replace(' ', '_'),
40- 'name': 'INV %s' % inv.name,
41+ 'name': 'INV %s' % inv.name + ' [' + time.strftime('%Y%m%d%H%M%S') + ']',
42 'res_model': 'stock.inventory',
43 'res_id': inv.id,
44 }
45@@ -254,6 +260,8 @@
46 logger.notifyChannel('wms_inventory', netsvc.LOG_INFO, '[%s] End compute the inventory ***********' % cr.dbname)
47 return True
48
49+ # change state fo progress
50+ self.write(cr, uid, ids, {'state': 'progress'}, context=context)
51 thread.start_new_thread(threading_done, (cr, uid, ids, context))
52 return True
53
54@@ -271,12 +279,12 @@
55 def on_change_product_id(self, cr, uid, ids, location_id, product, uom=False):
56 if not product:
57 return {}
58+
59 if not uom:
60 prod = self.pool.get('product.product').browse(cr, uid, [product], {'uom': uom})[0]
61 uom = prod.uom_id.id
62- #amount = self.pool.get('stock.location')._product_get(cr, uid, location_id, [product], {'uom': uom})[product]
63- result = {'product_uom': uom}
64- return {'value': result}
65+
66+ return {'value': {'product_uom': uom}}
67
68 InventoryLine()
69

Subscribers

People subscribed via source and target branches