[IMP] stock: partial delivery usability enhanced

bzr revid: qdp-launchpad@openerp.com-20140204105231-4g4yxgkop955frwy
This commit is contained in:
Quentin (OpenERP) 2014-02-04 11:52:31 +01:00
parent 40ae95fd11
commit b124247642
2 changed files with 12 additions and 4 deletions

View File

@ -1303,14 +1303,22 @@ class stock_move(osv.osv):
return res
def _get_string_qty_information(self, cr, uid, ids, field_name, args, context=None):
settings_obj = self.pool.get('stock.config.settings')
res = dict.fromkeys(ids, '')
for move in self.browse(cr, uid, ids, context=context):
if move.state in ('draft', 'done', 'cancel'):
if move.state in ('draft', 'done', 'cancel') or move.location_id.usage != 'internal':
res[move.id] = _('n/a')
continue
info = str(move.reserved_availability + move.availability) + 'uom?'
total_available = min(move.product_qty, move.reserved_availability + move.availability)
info = str(total_available)
#look in the settings if we need to display the UoM name or not
config_ids = settings_obj.search(cr, uid, [], limit=1, order='id DESC', context=context)
if config_ids:
stock_settings = settings_obj.browse(cr, uid, config_ids[0], context=context)
if stock_settings.group_uom:
info += ' ' + move.product_id.uom_id.name
if move.reserved_availability:
if move.availability:
if move.reserved_availability != total_available:
#some of the available quantity is assigned and some are available but not reserved
info += _(' (%s reserved)') % str(move.reserved_availability)
else:

View File

@ -759,7 +759,7 @@
<button name="do_prepare_partial" string="Partial Transfer" groups="stock.group_stock_user" type="object" class="oe_highlight" attrs="{'invisible': ['|',('pack_operation_exist', '=', True),('state','not in',('assigned', 'partially_available'))]}"/>
<button name="%(act_stock_return_picking)d" string="Reverse Transfer" states="done" type="action" groups="base.group_user"/>
<button name="action_cancel" states="assigned,confirmed,partially_available,draft" string="Cancel Transfer" groups="base.group_user" type="object"/>
<button name="do_unreserve" string="Unreserve" groups="base.group_user" type="object" attrs="{'invisible': ['|',('quant_reserved_exist', '=', False), ('state','not in',('assigned', 'partially_available'))]}"/>
<button name="do_unreserve" string="Unreserve" groups="base.group_user" type="object" attrs="{'invisible': [('quant_reserved_exist', '=', False)]}"/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirmed,partially_available,assigned,done" statusbar_colors='{"shipping_except":"red","invoice_except":"red","waiting_date":"blue"}'/>
</header>
<sheet>