[FIX] stock : Warning message during move split, if the lot quantity available is less than specified quantity (Case:6001)

lp bug: https://launchpad.net/bugs/771377 fixed

bzr revid: vro@tinyerp.com-20110602123826-ou2ndsaesi6viswz
This commit is contained in:
vro
2011-06-02 18:08:26 +05:30
parent 9786984685
commit 5eb316c881
2 changed files with 16 additions and 4 deletions
+11
View File
@@ -20,6 +20,7 @@
##############################################################################
from osv import fields, osv
from tools.translate import _
import decimal_precision as dp
@@ -197,6 +198,8 @@ class split_in_production_lot(osv.osv_memory):
res.update({'qty': move.product_qty})
if 'use_exist' in fields:
res.update({'use_exist': (move.picking_id and move.picking_id.type=='out' and True) or False})
if 'location_id' in fields:
res.update({'location_id': move.location_id.id})
return res
_columns = {
@@ -206,6 +209,7 @@ class split_in_production_lot(osv.osv_memory):
'line_ids': fields.one2many('stock.move.split.lines', 'lot_id', 'Production Lots'),
'line_exist_ids': fields.one2many('stock.move.split.lines.exist', 'lot_id', 'Production Lots'),
'use_exist' : fields.boolean('Existing Lots', help="Check this option to select existing lots in the list below, otherwise you should enter new ones line by line."),
'location_id': fields.many2one('stock.location', 'Source Location', required=True, select=True),
}
def split_lot(self, cr, uid, ids, context=None):
@@ -307,6 +311,13 @@ class stock_move_split_lines_exist(osv.osv_memory):
'quantity': lambda *x: 1.00,
}
def onchange_lot_id(self, cr, uid, ids, prodlot_id=False, product_qty=False,
loc_id=False, product_id=False, uom_id=False, context=None):
stock_move_obj = self.pool.get('stock.move')
res = stock_move_obj.onchange_lot_id(cr, uid, ids, prodlot_id, product_qty,
loc_id, product_id, uom_id, context=context)
return res
stock_move_split_lines_exist()
class stock_move_split_lines(osv.osv_memory):
+5 -4
View File
@@ -118,6 +118,7 @@
<field name="product_uom" readonly="1"/>
</group>
</group>
<field name="location_id" invisible="1"/>
<group colspan="4" attrs="{'invisible':[('use_exist','=',True)]}">
<field name="line_ids" colspan="4" nolabel="1">
@@ -134,12 +135,12 @@
<group colspan="4" attrs="{'invisible':[('use_exist','!=',True)]}">
<field name="line_exist_ids" colspan="4" nolabel="1">
<tree string="Production Lot Numbers" editable="bottom">
<field name="prodlot_id" string="Lot number" domain="[('product_id','=',parent.product_id)]"/>
<field name="quantity" />
<field name="prodlot_id" string="Lot number" domain="[('product_id','=',parent.product_id)]" on_change="onchange_lot_id(prodlot_id, quantity, parent.location_id, parent.product_id, parent.product_uom)"/>
<field name="quantity" on_change="onchange_lot_id(prodlot_id, quantity, parent.location_id, parent.product_id, parent.product_uom)" />
</tree>
<form string="Production Lot Number">
<field name="prodlot_id" string="Lot number" domain="[('product_id','=',parent.product_id)]"/>
<field name="quantity" />
<field name="prodlot_id" string="Lot number" domain="[('product_id','=',parent.product_id)]" on_change="onchange_lot_id(prodlot_id, quantity, parent.location_id, parent.product_id, parent.product_uom)"/>
<field name="quantity" on_change="onchange_lot_id(prodlot_id, quantity, parent.location_id, parent.product_id, parent.product_uom)" />
</form>
</field>
</group>