← Back to team overview

openerp-dev-web team mailing list archive

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

 

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

Requested reviews:
  Rucha (Open ERP) (rpa-openerp)
Related bugs:
  Bug #776245 in OpenERP Addons: "stock: when splitting incoming shipments, system allows to split lots in more than the total quantity, without warning"
  https://bugs.launchpad.net/openobject-addons/+bug/776245

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-776245-ron/+merge/61725
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-776245-ron/+merge/61725
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-bug-776245-ron.
=== modified file 'stock/wizard/stock_move.py'
--- stock/wizard/stock_move.py	2011-05-02 18:46:43 +0000
+++ stock/wizard/stock_move.py	2011-05-20 09:49:26 +0000
@@ -20,6 +20,7 @@
 ##############################################################################
 
 from osv import fields, osv
+from tools.translate import _
 
 import decimal_precision as dp
 
@@ -323,4 +324,18 @@
         'quantity': 1.00,
         'action' : 'split',
     }
+
+    def onchange_qty(self, cr, uid, ids, product_id=False, 
+                        product_qty=False, uom_id=False, order_qty=False):
+        if not product_id or not uom_id:
+            return {}
+        uom = self.pool.get('product.uom').browse(cr, uid, uom_id, context=None).name
+        warning = {}
+        if product_qty > order_qty:
+            warning = {
+                        'title': _('Warning !'),
+                        'message': _('Your delivery quantity %.2f %s is more than ordered quantity of %.2f %s') % (product_qty, uom, order_qty, uom)
+                        }
+        return {'warning': warning}
+    
 stock_move_split_lines()

=== modified file 'stock/wizard/stock_move_view.xml'
--- stock/wizard/stock_move_view.xml	2011-03-14 10:27:42 +0000
+++ stock/wizard/stock_move_view.xml	2011-05-20 09:49:26 +0000
@@ -123,11 +123,11 @@
                         <field name="line_ids" colspan="4" nolabel="1">
                             <tree string="Production Lot Numbers" editable="bottom">
                                 <field name="name" string="Lots"/>
-                                <field name="quantity" />
+                                <field name="quantity" on_change="onchange_qty(parent.product_id, quantity, parent.product_uom, parent.qty)" />
                             </tree>
                             <form string="Production Lot Number">
                                 <field name="name" string="Lot number"/>
-                                <field name="quantity" />
+                                <field name="quantity" on_change="onchange_qty(parent.product_id, quantity, parent.product_uom, parent.qty) "/>
                             </form>
                         </field>
                     </group>