[FIX] stock_account: accept negative quantities on standard price
authorMartin Trigaux <mat@openerp.com>
Thu, 18 Sep 2014 09:57:36 +0000 (11:57 +0200)
committerMartin Trigaux <mat@openerp.com>
Thu, 18 Sep 2014 09:57:48 +0000 (11:57 +0200)
The qty_available available of a product can be negative (e.g. using the force availibility button on delivery order) and the generated account.move.line should be adapted (otherwise getting negative values in debit/credit entries).
Fixes #2475

addons/stock_account/product.py

index ba4083a..391a5e8 100644 (file)
@@ -124,7 +124,7 @@ class product_template(osv.osv):
                         }
                         move_id = move_obj.create(cr, uid, move_vals, context=context)
     
-                        if diff > 0:
+                        if diff*qty > 0:
                             amount_diff = qty * diff
                             debit_account_id = datas['stock_account_input']
                             credit_account_id = datas['property_stock_valuation_account_id']