[IMP] stock:Rename scraped field to scrapped
bzr revid: sbh@tinyerp.com-20100831065427-3hpd7kbvs34k0rf4
This commit is contained in:
parent
fdac7f3692
commit
5d2dae07b8
|
@ -690,25 +690,25 @@ class mrp_production(osv.osv):
|
|||
produced_qty = production_qty
|
||||
|
||||
for produced_product in production.move_created_ids2:
|
||||
if (produced_product.scraped) or (produced_product.product_id.id<>production.product_id.id):
|
||||
if (produced_product.scrapped) or (produced_product.product_id.id<>production.product_id.id):
|
||||
continue
|
||||
produced_qty += produced_product.product_qty
|
||||
|
||||
if production_mode in ['consume','consume_produce']:
|
||||
consumed_products = {}
|
||||
check = {}
|
||||
scraped = map(lambda x:x.scraped,production.move_lines2).count(True)
|
||||
scrapped = map(lambda x:x.scrapped,production.move_lines2).count(True)
|
||||
|
||||
for consumed_product in production.move_lines2:
|
||||
consumed = consumed_product.product_qty
|
||||
if consumed_product.scraped:
|
||||
if consumed_product.scrapped:
|
||||
continue
|
||||
if not consumed_products.get(consumed_product.product_id.id, False):
|
||||
consumed_products[consumed_product.product_id.id] = consumed_product.product_qty
|
||||
check[consumed_product.product_id.id] = 0
|
||||
for f in production.product_lines:
|
||||
if f.product_id.id == consumed_product.product_id.id:
|
||||
if (len(production.move_lines2) - scraped) > len(production.product_lines):
|
||||
if (len(production.move_lines2) - scrapped) > len(production.product_lines):
|
||||
check[consumed_product.product_id.id] += consumed_product.product_qty
|
||||
consumed = check[consumed_product.product_id.id]
|
||||
rest_consumed = produced_qty * f.product_qty / production.product_qty - consumed
|
||||
|
@ -730,7 +730,7 @@ class mrp_production(osv.osv):
|
|||
stock_mov_obj.write(cr, uid, final_product_todo, vals)
|
||||
produced_products = {}
|
||||
for produced_product in production.move_created_ids2:
|
||||
if produced_product.scraped:
|
||||
if produced_product.scrapped:
|
||||
continue
|
||||
if not produced_products.get(produced_product.product_id.id, False):
|
||||
produced_products[produced_product.product_id.id] = 0
|
||||
|
|
|
@ -607,14 +607,14 @@
|
|||
|
||||
<field colspan="2" name="move_lines2" nolabel="1" domain="[('state','in', ('done', 'cancel'))]"
|
||||
widget="one2many_list" mode="tree,form" height="275">
|
||||
<tree colors="red:scraped==True;blue:state in('draft');black:state in('picking_except','confirmed','ready','in_production');gray:state in('cancel','done') " string="Consumed Products" editable="bottom">
|
||||
<tree colors="red:scrapped==True;blue:state in('draft');black:state in('picking_except','confirmed','ready','in_production');gray:state in('cancel','done') " string="Consumed Products" editable="bottom">
|
||||
<field name="product_id" readonly="1"/>
|
||||
<field name="product_qty" readonly="1" string="Qty"/>
|
||||
<field name="product_uom" readonly="1" string="UOM"/>
|
||||
<field name="location_dest_id" readonly="1" string="Destination Loc."/>
|
||||
<field name="prodlot_id" />
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="scraped" invisible="1"/>
|
||||
<field name="scrapped" invisible="1"/>
|
||||
<button
|
||||
name="%(stock.track_line)d"
|
||||
string="Split in production lots"
|
||||
|
@ -657,14 +657,14 @@
|
|||
|
||||
<field colspan="2" name="move_created_ids2" nolabel="1" domain="[('state','in', ('done', 'cancel'))]"
|
||||
widget="one2many_list" mode="tree,form" height="275">
|
||||
<tree colors="red:scraped==True;blue:state in('draft');black:state in('picking_except','confirmed','ready','in_production');gray:state in('cancel','done') " string="Finished Products" editable="bottom">
|
||||
<tree colors="red:scrapped==True;blue:state in('draft');black:state in('picking_except','confirmed','ready','in_production');gray:state in('cancel','done') " string="Finished Products" editable="bottom">
|
||||
<field name="product_id" readonly="1"/>
|
||||
<field name="product_qty" readonly="1" string="Qty"/>
|
||||
<field name="product_uom" readonly="1" string="UOM"/>
|
||||
<field name="location_dest_id" readonly="1" string="Destination Loc."/>
|
||||
<field name="prodlot_id" />
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="scraped" invisible="1"/>
|
||||
<field name="scrapped" invisible="1"/>
|
||||
<button name="%(stock.track_line)d"
|
||||
string="Split in production lots" type="action" icon="gtk-justify-fill" states="done,cancel"/>
|
||||
<button name="%(stock.move_scrap)d"
|
||||
|
|
|
@ -46,7 +46,7 @@ class mrp_product_produce(osv.osv_memory):
|
|||
context['active_id'], context=context)
|
||||
done = 0.0
|
||||
for move in prod.move_created_ids2:
|
||||
if not move.scraped:
|
||||
if not move.scrapped:
|
||||
done += move.product_qty
|
||||
return (prod.product_qty - done) or prod.product_qty
|
||||
|
||||
|
|
|
@ -1391,7 +1391,7 @@ class stock_move(osv.osv):
|
|||
'partner_id': fields.related('picking_id','address_id','partner_id',type='many2one', relation="res.partner", string="Partner", store=True),
|
||||
'backorder_id': fields.related('picking_id','backorder_id',type='many2one', relation="stock.picking", string="Back Order"),
|
||||
'origin': fields.related('picking_id','origin',type='char', size=64, relation="stock.picking", string="Origin",store=True),
|
||||
'scraped': fields.related('location_dest_id','scrap_location',type='boolean',relation='stock.location',string='Scraped'),
|
||||
'scrapped': fields.related('location_dest_id','scrap_location',type='boolean',relation='stock.location',string='Scrapped'),
|
||||
'move_stock_return_history': fields.many2many('stock.move', 'stock_move_return_history', 'move_id', 'return_move_id', 'Move Return History',readonly=True),
|
||||
}
|
||||
_constraints = [
|
||||
|
@ -1437,7 +1437,7 @@ class stock_move(osv.osv):
|
|||
'state': 'draft',
|
||||
'priority': '1',
|
||||
'product_qty': 1.0,
|
||||
'scraped' : False,
|
||||
'scrapped' : False,
|
||||
'date_planned': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.move', context=c),
|
||||
|
@ -1935,7 +1935,7 @@ class stock_move(osv.osv):
|
|||
""" Move the scrap/damaged product into scrap location
|
||||
@param cr: the database cursor
|
||||
@param uid: the user id
|
||||
@param ids: ids of stock move object to be scraped
|
||||
@param ids: ids of stock move object to be scrapped
|
||||
@param quantity : specify scrap qty
|
||||
@param location_id : specify scrap location
|
||||
@param context: context arguments
|
||||
|
@ -1951,7 +1951,7 @@ class stock_move(osv.osv):
|
|||
'product_qty': quantity,
|
||||
'product_uos_qty': uos_qty,
|
||||
'state': move.state,
|
||||
'scraped' : True,
|
||||
'scrapped' : True,
|
||||
'location_dest_id': location_id,
|
||||
'tracking_id':False,
|
||||
'prodlot_id':False
|
||||
|
@ -1960,7 +1960,7 @@ class stock_move(osv.osv):
|
|||
res += [new_move]
|
||||
product_obj = self.pool.get('product.product')
|
||||
for (id, name) in product_obj.name_get(cr, uid, [move.product_id.id]):
|
||||
message = _('Product ') + " '" + name + "' "+ _("is scraped with") + " '" + str(move.product_qty) + "' "+ _("quantity.")
|
||||
message = _('Product ') + " '" + name + "' "+ _("is scrapped with") + " '" + str(move.product_qty) + "' "+ _("quantity.")
|
||||
self.log(cr, uid, move.id, message)
|
||||
|
||||
self.action_done(cr, uid, res)
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<field name="usage">view</field>
|
||||
<field name="icon">terp-mrp</field>
|
||||
</record>
|
||||
<record id="stock_location_scraped" model="stock.location">
|
||||
<record id="stock_location_scrapped" model="stock.location">
|
||||
<field name="name">Scrapped</field>
|
||||
<field name="location_id" ref="stock_location_locations_virtual"/>
|
||||
<field name="scrap_location">True</field>
|
||||
|
|
|
@ -579,7 +579,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}">
|
||||
<tree colors="grey:scraped == True" string="Stock Moves">
|
||||
<tree colors="grey:scrapped == True" 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)"/>
|
||||
|
@ -612,7 +612,7 @@
|
|||
string="Scrap Products" type="action"
|
||||
icon="gtk-convert" context="{'scrap': True}"
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
<field name="scraped" invisible="1"/>
|
||||
<field name="scrapped" invisible="1"/>
|
||||
</tree>
|
||||
<form string="Stock Moves">
|
||||
<notebook colspan="4">
|
||||
|
@ -754,7 +754,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:scraped == True" string="Stock Moves">
|
||||
<tree colors="grey:scrapped == True" 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)"/>
|
||||
|
@ -786,7 +786,7 @@
|
|||
string="Scrap Products" type="action"
|
||||
icon="gtk-convert" context="{'scrap': True}"
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
<field name="scraped" invisible="1"/>
|
||||
<field name="scrapped" invisible="1"/>
|
||||
</tree>
|
||||
<form string="Stock Moves">
|
||||
<notebook colspan="4">
|
||||
|
@ -960,7 +960,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:scraped==True" string="Stock Moves">
|
||||
<tree colors="grey:scrapped==True" string="Stock Moves">
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
<field name="product_uom" string="UOM"/>
|
||||
|
@ -988,7 +988,7 @@
|
|||
<field name="state"/>
|
||||
<button name="%(action_partial_move)d" string="Partial" type="action" states="confirmed,assigned" icon="gtk-justify-fill"/>
|
||||
<button name="action_done" states="confirmed,assigned" string="Done" type="object" icon="gtk-jump-to"/>
|
||||
<field name="scraped" invisible="1"/>
|
||||
<field name="scrapped" invisible="1"/>
|
||||
</tree>
|
||||
<form string="Stock Moves">
|
||||
<notebook colspan="4">
|
||||
|
@ -1159,7 +1159,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:scraped==True" string="Stock Moves">
|
||||
<tree colors="grey:scrapped==True" string="Stock Moves">
|
||||
<field name="product_id" readonly="1"/>
|
||||
<field name="product_qty" readonly="1"/>
|
||||
<field name="product_uom" string="UOM" readonly="1"/>
|
||||
|
@ -1185,7 +1185,7 @@
|
|||
string="Scrap Products" type="action"
|
||||
icon="gtk-convert" context="{'scrap': True}"
|
||||
states="draft,waiting,confirmed,assigned" />
|
||||
<field name="scraped" invisible="1"/>
|
||||
<field name="scrapped" invisible="1"/>
|
||||
</tree>
|
||||
<form string="Stock Moves">
|
||||
<notebook colspan="4">
|
||||
|
|
|
@ -142,7 +142,7 @@ class stock_move_scrap(osv.osv_memory):
|
|||
return res
|
||||
|
||||
def move_scrap(self, cr, uid, ids, context={}):
|
||||
""" To move scraped products
|
||||
""" To move scrapped products
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
|
|
Loading…
Reference in New Issue