← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/6.0-bug-761460-rgo into lp:openobject-addons/6.0

 

Ravi Gohil (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/6.0-bug-761460-rgo into lp:openobject-addons/6.0.

Requested reviews:
  Anup(OpenERP) (ach-openerp)
Related bugs:
  Bug #761460 in OpenERP Addons: "Stock datetime fields"
  https://bugs.launchpad.net/openobject-addons/+bug/761460

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-bug-761460-rgo/+merge/61953

Hello,

There was an issue with stock module. All datetime field in _defaults were used without lambda function.

It has been fixed.

Thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-bug-761460-rgo/+merge/61953
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/6.0-bug-761460-rgo.
=== modified file 'stock/stock.py'
--- stock/stock.py	2011-05-18 15:40:44 +0000
+++ stock/stock.py	2011-05-23 11:11:08 +0000
@@ -440,7 +440,7 @@
 
             total = 0.0
             results2 = 0.0
-            
+
             for r in results:
                 amount = pool_uom._compute_qty(cr, uid, r['product_uom'], r['product_qty'], context.get('uom', False))
                 results2 += amount
@@ -494,7 +494,7 @@
     _defaults = {
         'active': 1,
         'name': make_sscc,
-        'date': time.strftime('%Y-%m-%d %H:%M:%S'),
+        'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
     }
 
     def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
@@ -657,7 +657,7 @@
         'move_type': 'direct',
         'type': 'in',
         'invoice_state': 'none',
-        'date': time.strftime('%Y-%m-%d %H:%M:%S'),
+        'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
         'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.picking', context=c)
     }
     def action_process(self, cr, uid, ids, context=None):
@@ -1413,7 +1413,7 @@
         'move_ids': fields.one2many('stock.move', 'prodlot_id', 'Moves for this production lot', readonly=True),
     }
     _defaults = {
-        'date':  time.strftime('%Y-%m-%d %H:%M:%S'),
+        'date':  lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
         'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'stock.lot.serial'),
         'product_id': lambda x, y, z, c: c.get('product_id', False),
     }
@@ -1449,7 +1449,7 @@
 
     _defaults = {
         'author_id': lambda x, y, z, c: z,
-        'date': time.strftime('%Y-%m-%d'),
+        'date': lambda *a: time.strftime('%Y-%m-%d'),
     }
 
 stock_production_lot_revision()
@@ -1614,9 +1614,9 @@
         'priority': '1',
         'product_qty': 1.0,
         'scrapped' :  False,
-        'date': time.strftime('%Y-%m-%d %H:%M:%S'),
+        'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
         'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.move', context=c),
-        'date_expected': time.strftime('%Y-%m-%d %H:%M:%S'),
+        'date_expected': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
     }
 
     def write(self, cr, uid, ids, vals, context=None):
@@ -2257,7 +2257,7 @@
             new_move = self.copy(cr, uid, move.id, default_val)
 
             res += [new_move]
-            
+
             for (id, name) in product_obj.name_get(cr, uid, [move.product_id.id]):
                 self.log(cr, uid, move.id, "%s x %s %s" % (move.product_qty, name, _("were scrapped")))
 
@@ -2527,7 +2527,7 @@
 
     }
     _defaults = {
-        'date': time.strftime('%Y-%m-%d %H:%M:%S'),
+        'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
         'state': 'draft',
         'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c)
     }


Follow ups