[IMP] stock: Task ID-575 (1) The scraped field on stock.move changed to related field. (2) Set a default location wich is the location having a scrap checkbox on. (3) Changed location field to selection field (widget=selection) (4) Added demo data for scraped locations. (5) When a move line is added in picking as scraped it should be converted to grey color. (6) Corrected tooltip on buttons for 'Scraped products' in outgoing picking-> move lines.
bzr revid: uco@tinyerp.com-20100504111419-6j6tla6zj5kqwtkp
This commit is contained in:
parent
b5f21a6274
commit
7650793dac
|
@ -1214,7 +1214,7 @@ class stock_move(osv.osv):
|
|||
'origin': fields.related('picking_id','origin',type='char', size=64, relation="stock.picking", string="Origin"),
|
||||
'move_stock_return_history': fields.many2many('stock.move', 'stock_move_return_history', 'move_id', 'return_move_id', 'Move Return History',readonly=True),
|
||||
'delivered_id': fields.many2one('stock.delivery', 'Product delivered'),
|
||||
'scraped': fields.boolean('Scraped'),
|
||||
'scraped': fields.related('location_dest_id','scraped',type='boolean',relation='stock.location',string='Scraped'),
|
||||
}
|
||||
_constraints = [
|
||||
(_check_tracking,
|
||||
|
|
|
@ -37,6 +37,11 @@
|
|||
<field name="usage">view</field>
|
||||
<field name="icon">terp-mrp</field>
|
||||
</record>
|
||||
<record id="stock_location_scraped" model="stock.location">
|
||||
<field name="name">Scraped</field>
|
||||
<field name="location_id" ref="stock_location_locations_virtual"/>
|
||||
<field name="scraped">True</field>
|
||||
</record>
|
||||
|
||||
<record id="location_inventory" model="stock.location">
|
||||
<field name="name">Inventory loss</field>
|
||||
|
|
|
@ -606,7 +606,7 @@
|
|||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
|
||||
<tree colors="grey:state in ('cancel');black:state not in ('cancel')" string="Stock Moves">
|
||||
<tree colors="grey:state in ('done','cancel');black:state not in ('cancel','done')" string="Stock Moves">
|
||||
<field name="name" string="Move Name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
|
@ -756,7 +756,7 @@
|
|||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
|
||||
<tree colors="grey:state in ('cancel');black:state not in ('cancel')" string="Stock Moves">
|
||||
<tree colors="grey:state in ('done','cancel');black:state not in ('cancel','done')" string="Stock Moves">
|
||||
<field name="name" string="Move Name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
|
@ -934,7 +934,7 @@
|
|||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
|
||||
<tree colors="grey:state in ('cancel');black:state not in ('cancel')" string="Stock Moves">
|
||||
<tree colors="grey:state in ('done','cancel');black:state not in ('cancel','done')" string="Stock Moves">
|
||||
<field name="name" string="Move Name"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
|
@ -952,7 +952,7 @@
|
|||
states="draft,waiting,confirmed,assigned" />
|
||||
<button
|
||||
name="%(stock.move_scrap)d"
|
||||
string="D" type="action"
|
||||
string="Scrap Products" type="action"
|
||||
icon="gtk-convert"
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
</tree>
|
||||
|
@ -1109,7 +1109,7 @@
|
|||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_in_id': address_id}">
|
||||
<tree colors="grey:state in ('cancel');black:state not in ('cancel')" string="Stock Moves">
|
||||
<tree colors="grey:state in ('done','cancel');black:state not in ('cancel','done')" string="Stock Moves">
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom"/>
|
||||
|
|
|
@ -86,7 +86,9 @@ class stock_move_consume(osv.osv_memory):
|
|||
if 'product_uom' in fields:
|
||||
res.update({'product_uom': move.product_uom.id})
|
||||
if 'product_qty' in fields:
|
||||
res.update({'product_qty': move.product_qty})
|
||||
res.update({'product_qty': move.product_qty})
|
||||
if 'location_id' in fields:
|
||||
res.update({'location_id': move.location_id.id})
|
||||
|
||||
return res
|
||||
|
||||
|
@ -120,9 +122,41 @@ class stock_move_scrap(osv.osv_memory):
|
|||
_inherit = "stock.move.consume"
|
||||
|
||||
_defaults = {
|
||||
'location_id': lambda *x: False
|
||||
'location_id': lambda *x: False
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
Get default values
|
||||
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param fields: List of fields for default value
|
||||
@param context: A standard dictionary
|
||||
|
||||
@return: default values of fields
|
||||
|
||||
"""
|
||||
res = super(stock_move_consume, self).default_get(cr, uid, fields, context=context)
|
||||
move = self.pool.get('stock.move').browse(cr, uid, context['active_id'], context=context)
|
||||
location_obj = self.pool.get('stock.location')
|
||||
scrpaed_location_ids = location_obj.search(cr, uid, [('scraped','=',True)])
|
||||
|
||||
if 'product_id' in fields:
|
||||
res.update({'product_id': move.product_id.id})
|
||||
if 'product_uom' in fields:
|
||||
res.update({'product_uom': move.product_uom.id})
|
||||
if 'product_qty' in fields:
|
||||
res.update({'product_qty': move.product_qty})
|
||||
if 'location_id' in fields:
|
||||
if scrpaed_location_ids:
|
||||
res.update({'location_id': scrpaed_location_ids[0]})
|
||||
else:
|
||||
res.update({'location_id': False})
|
||||
|
||||
return res
|
||||
|
||||
def move_scrap(self, cr, uid, ids, context={}):
|
||||
"""
|
||||
To move scraped products
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<form string="Consume Move">
|
||||
<separator string="Consume Products" colspan="4"/>
|
||||
<field name="product_id" colspan="4" readonly="1"/>
|
||||
<field name="location_id" colspan="4"/>
|
||||
<field name="location_id" colspan="4" widget="selection"/>
|
||||
<field name="product_qty" colspan="2"/>
|
||||
<field name="product_uom" nolabel="1" readonly="1"/>
|
||||
<newline/>
|
||||
|
@ -73,7 +73,7 @@
|
|||
<form string="Scrap Move">
|
||||
<separator string="Scrap Products" colspan="4"/>
|
||||
<field name="product_id" colspan="4" readonly="1"/>
|
||||
<field name="location_id" colspan="4" string="Dest. Location" domain="[('usage','<>','view'),('scraped','=',True)]"/>
|
||||
<field name="location_id" colspan="4" widget="selection" string="Dest. Location" domain="[('usage','<>','view'),('scraped','=',True)]"/>
|
||||
<field name="product_qty" colspan="2"/>
|
||||
<field name="product_uom" nolabel="1" readonly="1"/>
|
||||
<newline/>
|
||||
|
|
Loading…
Reference in New Issue