[FIX]inventory adjustment: should not show negative qty at start and prevent user should not input negative qty
lp bug: https://launchpad.net/bugs/1271244 fixed bzr revid: csn@openerp.com-20140122130411-vab09j3bo5r7ks0f
This commit is contained in:
@@ -2018,6 +2018,7 @@ class stock_inventory(osv.osv):
|
||||
'date': fields.datetime('Inventory Date', required=True, readonly=True, states={'draft': [('readonly', False)]}, help="Inventory Create Date."),
|
||||
'date_done': fields.datetime('Date done', help="Inventory Validation Date."),
|
||||
'line_ids': fields.one2many('stock.inventory.line', 'inventory_id', 'Inventories', readonly=False, states={'done': [('readonly', True)]}, help="Inventory Lines."),
|
||||
'line_view_ids': fields.one2many('stock.inventory.line', 'inventory_id', 'Inventories', readonly=False, domain=['|',('th_qty', '>=', 0),('th_qty', '=', False)], states={'done': [('readonly', True)]}, help="Inventory Lines."),
|
||||
'move_ids': fields.one2many('stock.move', 'inventory_id', 'Created Moves', help="Inventory Moves."),
|
||||
'state': fields.selection([('draft', 'Draft'), ('cancel', 'Cancelled'), ('confirm', 'In Progress'), ('done', 'Validated')], 'Status', readonly=True, select=True),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True, select=True, readonly=True, states={'draft': [('readonly', False)]}),
|
||||
@@ -2073,6 +2074,10 @@ class stock_inventory(osv.osv):
|
||||
context = {}
|
||||
move_obj = self.pool.get('stock.move')
|
||||
for inv in self.browse(cr, uid, ids, context=context):
|
||||
if inv.line_ids:
|
||||
for inventory_line in inv.line_ids:
|
||||
if inventory_line.product_qty < 0 and inventory_line.th_qty >= 0:
|
||||
raise osv.except_osv(_('Warning'),_('You cannot have a negative product quantity in an inventory line'))
|
||||
if not inv.move_ids:
|
||||
self.action_check(cr, uid, [inv.id], context=context)
|
||||
inv.refresh()
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
<notebook attrs="{'invisible':[('state','=','draft')]}">
|
||||
<page string="Inventory Details" >
|
||||
<button name="set_checked_qty" states="confirm" string="⇒ Set quantities to 0" type="object" class="oe_link oe_right" groups="stock.group_stock_user"/>
|
||||
<field name="line_ids" string="Inventory Details" context="{'default_location_id': location_id, 'default_product_id': product_id, 'default_prod_lot_id': lot_id, 'default_package_id': package_id, 'default_partner_id': partner_id}">
|
||||
<field name="line_view_ids" string="Inventory Details" context="{'default_location_id': location_id, 'default_product_id': product_id, 'default_prod_lot_id': lot_id, 'default_package_id': package_id, 'default_partner_id': partner_id}">
|
||||
<tree string="Inventory Details" editable="bottom" colors="blue: product_qty != th_qty">
|
||||
<field context="{'location':location_id, 'uom':product_uom_id, 'to_date':parent.date}" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom_id,partner_id,prod_lot_id,package_id)" domain="[('type','=','product')]"/>
|
||||
<field name="product_uom_id" groups="product.group_uom" on_change="on_change_product_id(location_id,product_id,product_uom_id,partner_id,prod_lot_id,package_id)"/>
|
||||
|
||||
Reference in New Issue
Block a user