← Back to team overview

openerp-dev-web team mailing list archive

[Merge] lp:~openerp-dev/openobject-addons/trunk-bug-780354-ron into lp:openobject-addons

 

Rohan Nayani(Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-bug-780354-ron into lp:openobject-addons.

Requested reviews:
  Rucha (Open ERP) (rpa-openerp)
Related bugs:
  Bug #780354 in OpenERP Addons: "Stock: a view location is valid as destination warehouse"
  https://bugs.launchpad.net/openobject-addons/+bug/780354

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-780354-ron/+merge/60584
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-780354-ron/+merge/60584
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-780354-ron.
=== modified file 'stock/stock.py'
--- stock/stock.py	2011-05-05 05:46:31 +0000
+++ stock/stock.py	2011-05-11 07:01:19 +0000
@@ -658,6 +658,19 @@
         '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 _destination_location(self, cr, uid, ids, context=None):
+        if context is None: 
+            context = {}
+        for record in self.browse(cr, uid, ids, context=context)[0].move_lines:
+            if record.location_dest_id.usage == 'view':
+                return False
+        return True
+
+    _constraints = [
+        (_destination_location, 'You cannot put view type location as Destination location.', ['location_dest_id'])
+    ]
+
     def action_process(self, cr, uid, ids, context=None):
         if context is None: context = {}
         partial_id = self.pool.get("stock.partial.picking").create(